diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2016-05-12 16:50:34 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2016-05-12 16:50:52 -0700 |
commit | 3355cb3b643bd50aafae768e7cf990d4bec40fe1 (patch) | |
tree | c16b986fd942a0b25ab494d5635d97d5fdd5de62 /ld/testsuite/ld-plugin/plugin.exp | |
parent | 8ddd5a6cd692ca8c4041d9fb64cbb4e0585d4aa1 (diff) | |
download | gdb-3355cb3b643bd50aafae768e7cf990d4bec40fe1.zip gdb-3355cb3b643bd50aafae768e7cf990d4bec40fe1.tar.gz gdb-3355cb3b643bd50aafae768e7cf990d4bec40fe1.tar.bz2 |
Handle symbols defined/referenced only within IR
The plugin is called to claim symbols in an archive element from
plugin_object_p. But those symbols aren't needed to create output.
They are defined and referenced only within IR. get_symbols should
return resolution based on IR symbol kinds.
PR ld/20070
* Makefile.am (noinst_LTLIBRARIES): Add libldtestplug4.la.
(libldtestplug4_la_SOURCES): New.
(libldtestplug4_la_CFLAGS): Likewise.
(libldtestplug4_la_LDFLAGS): Likewise.
* Makefile.in: Regenerated.
* plugin.c (get_symbols): Return resolution based on IR symbol
kinds for symbols defined/referenced only within IR.
* testplug4.c: New file.
* ld/testsuite/ld-plugin/pr20070.d: Likewise.
* ld/testsuite/ld-plugin/pr20070a.c: Likewise.
* ld/testsuite/ld-plugin/pr20070b.c: Likewise.
* testsuite/ld-plugin/plugin.exp (plugin4_name): New.
(plugin4_path): Likewise.
Add a test for ld/20070.
Diffstat (limited to 'ld/testsuite/ld-plugin/plugin.exp')
-rw-r--r-- | ld/testsuite/ld-plugin/plugin.exp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/ld/testsuite/ld-plugin/plugin.exp b/ld/testsuite/ld-plugin/plugin.exp index 5be5661..4c9116b 100644 --- a/ld/testsuite/ld-plugin/plugin.exp +++ b/ld/testsuite/ld-plugin/plugin.exp @@ -55,6 +55,10 @@ set plugin3_name [file_contents "$base_dir/libldtestplug3.la"] set plugin3_name [regsub "'.*" [regsub ".*dlname='" "$plugin3_name" ""] ""] verbose "plugin3 name is '$plugin3_name'" +set plugin4_name [file_contents "$base_dir/libldtestplug4.la"] +set plugin4_name [regsub "'.*" [regsub ".*dlname='" "$plugin4_name" ""] ""] +verbose "plugin4 name is '$plugin4_name'" + # Use libtool to find full path to plugin rather than worrying # about run paths or anything like that. catch "exec $base_dir/libtool --config" lt_config @@ -66,9 +70,11 @@ set lt_objdir [regsub "objdir=" "$lt_objdir" ""] set plugin_path "$base_dir/$lt_objdir/$plugin_name" set plugin2_path "$base_dir/$lt_objdir/$plugin2_name" set plugin3_path "$base_dir/$lt_objdir/$plugin3_name" +set plugin4_path "$base_dir/$lt_objdir/$plugin4_name" verbose "Full plugin path $plugin_path" 2 verbose "Full plugin2 path $plugin2_path" 2 verbose "Full plugin3 path $plugin3_path" 2 +verbose "Full plugin4 path $plugin4_path" 2 set regclm "-plugin-opt registerclaimfile" set regas "-plugin-opt registerallsymbolsread" @@ -93,6 +99,7 @@ if { $can_compile && \ (![ld_compile "$CC $CFLAGS" $srcdir/$subdir/main.c tmpdir/main.o] \ || ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/func.c tmpdir/func.o] \ || ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/text.c tmpdir/text.o] \ + || ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/pr20070a.c tmpdir/pr20070a.o] \ || ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/dummy.s tmpdir/dummy.o] \ || ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/pr17973.s tmpdir/pr17973.o]) } { # Defer fail until we have list of tests set. @@ -351,3 +358,22 @@ if [ar_simple_create $ar "--plugin $plugin2_path" "tmpdir/libfunc.a" \ unresolved [lindex $testitem 0] } } + +file delete tmpdir/libpr20070.a +if [ar_simple_create $ar "--plugin $plugin4_path" "tmpdir/libpr20070.a" \ + "$srcdir/$subdir/pr20070b.c"] { + run_ld_link_tests [list \ + [list \ + "PR ld/20070" \ + "-Bstatic -plugin $plugin4_path $regclm \ + $regas $regcln \ + -plugin-opt claim:$srcdir/$subdir/pr20070b.c \ + -plugin-opt claim:tmpdir/libpr20070.a \ + -plugin-opt dumpresolutions \ + tmpdir/pr20070a.o tmpdir/text.o tmpdir/libpr20070.a $libs" \ + "" "" "" {{ld pr20070.d}} "pr20070.x" \ + ] \ + ] +} else { + unresolved "PR ld/20070" +} |