aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-undefined/fundef.s
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2017-08-24 09:26:37 +0930
committerAlan Modra <amodra@gmail.com>2017-08-24 16:43:39 +0930
commit647d4de92e061a3a2be83740d7f1bf63e5669630 (patch)
treefc2892bec943cce85c21cced8453762af419a969 /ld/testsuite/ld-undefined/fundef.s
parentf8d31560e1f64ea35a4e6b67c2834c5f89ffef20 (diff)
downloadgdb-647d4de92e061a3a2be83740d7f1bf63e5669630.zip
gdb-647d4de92e061a3a2be83740d7f1bf63e5669630.tar.gz
gdb-647d4de92e061a3a2be83740d7f1bf63e5669630.tar.bz2
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.
Diffstat (limited to 'ld/testsuite/ld-undefined/fundef.s')
-rw-r--r--ld/testsuite/ld-undefined/fundef.s31
1 files changed, 31 insertions, 0 deletions
diff --git a/ld/testsuite/ld-undefined/fundef.s b/ld/testsuite/ld-undefined/fundef.s
new file mode 100644
index 0000000..96eb668
--- /dev/null
+++ b/ld/testsuite/ld-undefined/fundef.s
@@ -0,0 +1,31 @@
+ .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