bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/17287] New: --as-needed unresolved symbols with dummy shared lib


From: amodra at gmail dot com
Subject: [Bug ld/17287] New: --as-needed unresolved symbols with dummy shared library in command line
Date: Mon, 18 Aug 2014 04:34:54 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=17287

            Bug ID: 17287
           Summary: --as-needed unresolved symbols with dummy shared
                    library in command line
           Product: binutils
           Version: 2.25 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: amodra at gmail dot com

Documented --as-needed behaviour says one condition a library is needed is
"..if the library is not found in the DT_NEEDED lists of other libraries, a
non-weak undefined symbol reference from another dynamic library."  I think the
documentation should say "..DT_NEEDED lists of other *needed* libraries".
Otherwise we have the following odd behaviour.

cat > foo.c <<\EOF
void foo() {}
EOF
cat > bar.c <<\EOF
extern void foo();
void bar() { foo (); }
EOF
echo -n > dummy.c
cat > app.c <<\EOF
extern void bar();
int main() { bar(); return 0; }
EOF
gcc -fPIC -shared -o libfoo.so foo.c
gcc -fPIC -shared -o libbar.so bar.c
gcc -fPIC -shared -o libdummy.so -Wl,--no-as-needed -L. -lfoo
gcc -fPIC -o app app.c -Wl,--as-needed -L. -lbar -lfoo
gcc -fPIC -o app app.c -Wl,--as-needed -L. -lbar -ldummy -lfoo
./libbar.so: undefined reference to `foo'
collect2: ld returned 1 exit status

-- 
You are receiving this mail because:
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]