]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Test undefined symbols in shared libraries
authorAlan Modra <amodra@gmail.com>
Wed, 23 Aug 2017 23:56:37 +0000 (09:26 +0930)
committerAlan Modra <amodra@gmail.com>
Thu, 24 Aug 2017 07:13:39 +0000 (16:43 +0930)
commit647d4de92e061a3a2be83740d7f1bf63e5669630
treefc2892bec943cce85c21cced8453762af419a969
parentf8d31560e1f64ea35a4e6b67c2834c5f89ffef20
Test undefined symbols in shared libraries

git commit 46434633f9 said
    Make undefined symbols in allocate_dynrelocs dynamic

    ..if they have dynamic relocs.  An undefined symbol in a PIC object
    that finds no definition ought to become dynamic in order to support
    --allow-shlib-undefined, but there is nothing in the generic ELF
    linker code to do this if the reference isn't via the GOT or PLT.  (An
    initialized function pointer is an example.)  So it falls to backend
    code to ensure the symbol is made dynamic.

The above isn't true.  Undefined symbols are indeed made dynamic for
shared libraries.  Undefined symbols are not automatically made
dynamic in executables, and it was the PIE case that triggered an
internal consistency assertion on powerpc64.  I guess I could have
jumped the other way when fixing PR21988, and not created a dynamic
reloc.  Either way, it doesn't matter a great deal.  We're going to
get an error on strong undefined symbols in an executable anyway, and
broken binaries if you try to use --unresolved-symbols=ignore-all to
disable the error.

* testsuite/ld-undefined/fundef.s: New test.
* testsuite/ld-undefined/undefined.exp: Test that undefined
symbols in shared libraries are made dynamic.
ld/ChangeLog
ld/testsuite/ld-undefined/fundef.s [new file with mode: 0644]
ld/testsuite/ld-undefined/undefined.exp