binutils-gdb/ld/testsuite/ld-undefined/fundef.s
Alan Modra 647d4de92e 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.
2017-08-24 16:43:39 +09:30

32 lines
466 B
ArmAsm

.text
.type undef_fun_typed %function
.ifdef BL
bl undef_fun_typed
nop
bl undef_fun_notype
nop
.endif
.ifdef BLPLT
bl undef_fun_typed@plt
nop
bl undef_fun_notype@plt
nop
.endif
.ifdef CALLPLT
call undef_fun_typed@plt
call undef_fun_notype@plt
.endif
.ifdef HPPA
bl undef_fun_typed,%r2
nop
bl undef_fun_notype,%r2
nop
.endif
.data
.type undef_data %object
.dc.a undef_data
.type undef_pfun %function
.dc.a undef_pfun
.dc.a undef_notype