[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/11006] New: A "relaxed" link order of libraries is requested for
From: |
geir at cray dot com |
Subject: |
[Bug ld/11006] New: A "relaxed" link order of libraries is requested for improved compatibilty |
Date: |
23 Nov 2009 19:45:55 -0000 |
The GNU ld linker requires the user to specify libraries after any object
files which use them. For example:
$ cat main.c
void sub();
main() {
sub();
}
$ gcc -c sub.c
$ ar rv libsub.a sub.o
ar: creating libsub.a
a - sub.o
$ gcc -L . -lsub main.c ### FAILS !!!
/tmp/cccN9Qxp.o: In function `main':
main.c:(.text+0xa): undefined reference to `sub'
collect2: ld returned 1 exit status
$ gcc main.c -L . -lsub ### WORKS !!!
$
The linking order requirement is not needed by AIX, so this has been an issue
for users migrating from an AIX system to Linux. This enhancement bug is being
submitted for the benefit of these users.
---------------------
I am aware of the following workaround:
$ gcc -Wl,--start -lsub -L. main.c -Wl,--end
$
--
Summary: A "relaxed" link order of libraries is requested for
improved compatibilty
Product: binutils
Version: 2.16
Status: NEW
Severity: enhancement
Priority: P2
Component: ld
AssignedTo: unassigned at sources dot redhat dot com
ReportedBy: geir at cray dot com
CC: bug-binutils at gnu dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=11006
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
- [Bug ld/11006] New: A "relaxed" link order of libraries is requested for improved compatibilty,
geir at cray dot com <=