mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-19 22:20:08 +08:00
re PR c/2347 (gcc does not accept "-l m" as POSIX permits (wants -lm))
* gcc.c (process_command): Allow -l lib in addition to -llib for POSIX compliance. This fixes PR c/2347. * invoke.texi: Update section on Link Options accordingly. From-SVN: r41655
This commit is contained in:
parent
86b8ab9e48
commit
4275c4c400
@ -1,3 +1,10 @@
|
||||
2001-04-28 Jens Schweikhardt <schweikh@schweikhardt.net>
|
||||
|
||||
* gcc.c (process_command): Allow -l lib in addition to -llib
|
||||
for POSIX compliance. This fixes PR c/2347.
|
||||
|
||||
* invoke.texi: Update section on Link Options accordingly.
|
||||
|
||||
2001-04-27 Zack Weinberg <zackw@stanford.edu>
|
||||
|
||||
* function.c (purge_addressof_1): Remove the duplicate
|
||||
|
14
gcc/gcc.c
14
gcc/gcc.c
@ -3284,6 +3284,14 @@ process_command (argc, argv)
|
||||
if (i + 1 == argc)
|
||||
fatal ("argument to `-Xlinker' is missing");
|
||||
|
||||
n_infiles++;
|
||||
i++;
|
||||
}
|
||||
else if (strcmp (argv[i], "-l") == 0)
|
||||
{
|
||||
if (i + 1 == argc)
|
||||
fatal ("argument to `-l' is missing");
|
||||
|
||||
n_infiles++;
|
||||
i++;
|
||||
}
|
||||
@ -3728,6 +3736,12 @@ process_command (argc, argv)
|
||||
infiles[n_infiles].language = "*";
|
||||
infiles[n_infiles++].name = argv[++i];
|
||||
}
|
||||
else if (strcmp (argv[i], "-l") == 0)
|
||||
{ /* POSIX allows separation of -l and the lib arg;
|
||||
canonicalize by concatenating -l with its arg */
|
||||
infiles[n_infiles].language = "*";
|
||||
infiles[n_infiles++].name = concat ("-l", argv[++i], NULL_PTR);
|
||||
}
|
||||
else if (strncmp (argv[i], "-l", 2) == 0)
|
||||
{
|
||||
infiles[n_infiles].language = "*";
|
||||
|
@ -3721,10 +3721,13 @@ Options}.
|
||||
|
||||
@cindex Libraries
|
||||
@item -l@var{library}
|
||||
Search the library named @var{library} when linking.
|
||||
@itemx -l @var{library}
|
||||
Search the library named @var{library} when linking. (The second
|
||||
alternative with the library as a separate argument is only for
|
||||
POSIX compliance and is not recommended.)
|
||||
|
||||
It makes a difference where in the command you write this option; the
|
||||
linker searches processes libraries and object files in the order they
|
||||
linker searches and processes libraries and object files in the order they
|
||||
are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
|
||||
after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
|
||||
to functions in @samp{z}, those functions may not be loaded.
|
||||
|
Loading…
Reference in New Issue
Block a user