diff options
Diffstat (limited to 'binutils-2.21/ld/testsuite/ld-plugin')
17 files changed, 545 insertions, 0 deletions
diff --git a/binutils-2.21/ld/testsuite/ld-plugin/func.c b/binutils-2.21/ld/testsuite/ld-plugin/func.c new file mode 100644 index 0000000..8c668db --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-plugin/func.c @@ -0,0 +1,7 @@ + +extern int retval; + +int func (void) +{ + return retval; +} diff --git a/binutils-2.21/ld/testsuite/ld-plugin/main.c b/binutils-2.21/ld/testsuite/ld-plugin/main.c new file mode 100644 index 0000000..2d64617 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-plugin/main.c @@ -0,0 +1,13 @@ + +extern int printf (const char *fmt, ...); + +extern const char *text; +extern int func (void); + +int retval = 0; + +int main (int argc, const char **argv) +{ + printf ("%s\n", text); + return func (); +} diff --git a/binutils-2.21/ld/testsuite/ld-plugin/plugin-1.d b/binutils-2.21/ld/testsuite/ld-plugin/plugin-1.d new file mode 100644 index 0000000..0ce0794 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-plugin/plugin-1.d @@ -0,0 +1,18 @@ +Hello from testplugin. +tv\[0\]: LDPT_MESSAGE func@0x.* +tv\[1\]: LDPT_API_VERSION value 0x1 \(1\) +tv\[2\]: LDPT_GNU_LD_VERSION value 0x.* +tv\[3\]: LDPT_LINKER_OUTPUT value 0x1 \(1\) +tv\[4\]: LDPT_OUTPUT_NAME 'tmpdir/main.x' +tv\[5\]: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.* +tv\[6\]: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.* +tv\[7\]: LDPT_REGISTER_CLEANUP_HOOK func@0x.* +tv\[8\]: LDPT_ADD_SYMBOLS func@0x.* +tv\[9\]: LDPT_GET_INPUT_FILE func@0x.* +tv\[10\]: LDPT_RELEASE_INPUT_FILE func@0x.* +tv\[11\]: LDPT_GET_SYMBOLS func@0x.* +tv\[12\]: LDPT_ADD_INPUT_FILE func@0x.* +tv\[13\]: LDPT_ADD_INPUT_LIBRARY func@0x.* +tv\[14\]: LDPT_SET_EXTRA_LIBRARY_PATH func@0x.* +tv\[15\]: LDPT_NULL value 0x0 \(0\) +#... diff --git a/binutils-2.21/ld/testsuite/ld-plugin/plugin-10.d b/binutils-2.21/ld/testsuite/ld-plugin/plugin-10.d new file mode 100644 index 0000000..7e3c3bb --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-plugin/plugin-10.d @@ -0,0 +1,36 @@ +Hello from testplugin. +tv\[0\]: LDPT_MESSAGE func@0x.* +tv\[1\]: LDPT_API_VERSION value 0x1 \(1\) +tv\[2\]: LDPT_GNU_LD_VERSION value 0x.* +tv\[3\]: LDPT_LINKER_OUTPUT value 0x1 \(1\) +tv\[4\]: LDPT_OUTPUT_NAME 'tmpdir/main.x' +tv\[5\]: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.* +tv\[6\]: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.* +tv\[7\]: LDPT_REGISTER_CLEANUP_HOOK func@0x.* +tv\[8\]: LDPT_ADD_SYMBOLS func@0x.* +tv\[9\]: LDPT_GET_INPUT_FILE func@0x.* +tv\[10\]: LDPT_RELEASE_INPUT_FILE func@0x.* +tv\[11\]: LDPT_GET_SYMBOLS func@0x.* +tv\[12\]: LDPT_ADD_INPUT_FILE func@0x.* +tv\[13\]: LDPT_ADD_INPUT_LIBRARY func@0x.* +tv\[14\]: LDPT_SET_EXTRA_LIBRARY_PATH func@0x.* +tv\[15\]: LDPT_OPTION 'registerclaimfile' +tv\[16\]: LDPT_OPTION 'registerallsymbolsread' +tv\[17\]: LDPT_OPTION 'registercleanup' +tv\[18\]: LDPT_OPTION 'claim:tmpdir/func.o' +tv\[19\]: LDPT_OPTION 'sym:_?func::0:0:0' +tv\[20\]: LDPT_OPTION 'sym:_?func2::0:0:0' +tv\[21\]: LDPT_OPTION 'dumpresolutions' +tv\[22\]: LDPT_OPTION 'add:tmpdir/func.o' +tv\[23\]: LDPT_NULL value 0x0 \(0\) +#... +hook called: claim_file tmpdir/main.o \[@0/.* not claimed +hook called: claim_file tmpdir/func.o \[@0/.* CLAIMED +#... +hook called: claim_file tmpdir/libtext.a \[@.* not claimed +#... +hook called: all symbols read. +Sym: '_?func' Resolution: LDPR_PREVAILING_DEF +Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY +hook called: cleanup. +#... diff --git a/binutils-2.21/ld/testsuite/ld-plugin/plugin-11.d b/binutils-2.21/ld/testsuite/ld-plugin/plugin-11.d new file mode 100644 index 0000000..927cffd --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-plugin/plugin-11.d @@ -0,0 +1,40 @@ +Hello from testplugin. +tv\[0\]: LDPT_MESSAGE func@0x.* +tv\[1\]: LDPT_API_VERSION value 0x1 \(1\) +tv\[2\]: LDPT_GNU_LD_VERSION value 0x.* +tv\[3\]: LDPT_LINKER_OUTPUT value 0x1 \(1\) +tv\[4\]: LDPT_OUTPUT_NAME 'tmpdir/main.x' +tv\[5\]: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.* +tv\[6\]: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.* +tv\[7\]: LDPT_REGISTER_CLEANUP_HOOK func@0x.* +tv\[8\]: LDPT_ADD_SYMBOLS func@0x.* +tv\[9\]: LDPT_GET_INPUT_FILE func@0x.* +tv\[10\]: LDPT_RELEASE_INPUT_FILE func@0x.* +tv\[11\]: LDPT_GET_SYMBOLS func@0x.* +tv\[12\]: LDPT_ADD_INPUT_FILE func@0x.* +tv\[13\]: LDPT_ADD_INPUT_LIBRARY func@0x.* +tv\[14\]: LDPT_SET_EXTRA_LIBRARY_PATH func@0x.* +tv\[15\]: LDPT_OPTION 'registerclaimfile' +tv\[16\]: LDPT_OPTION 'registerallsymbolsread' +tv\[17\]: LDPT_OPTION 'registercleanup' +tv\[18\]: LDPT_OPTION 'claim:tmpdir/func.o' +tv\[19\]: LDPT_OPTION 'sym:_?func::0:0:0' +tv\[20\]: LDPT_OPTION 'sym:_?func2::0:0:0' +tv\[21\]: LDPT_OPTION 'dumpresolutions' +tv\[22\]: LDPT_OPTION 'add:tmpdir/func.o' +tv\[23\]: LDPT_OPTION 'claim:tmpdir/libtext.a' +tv\[24\]: LDPT_OPTION 'sym:_?text::0:0:0' +tv\[25\]: LDPT_OPTION 'add:tmpdir/text.o' +tv\[26\]: LDPT_NULL value 0x0 \(0\) +#... +hook called: claim_file tmpdir/main.o \[@0/.* not claimed +hook called: claim_file tmpdir/func.o \[@0/.* CLAIMED +#... +hook called: claim_file tmpdir/libtext.a \[@.* CLAIMED +#... +hook called: all symbols read. +Sym: '_?func' Resolution: LDPR_PREVAILING_DEF +Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY +Sym: '_?text' Resolution: LDPR_PREVAILING_DEF +hook called: cleanup. +#... diff --git a/binutils-2.21/ld/testsuite/ld-plugin/plugin-2.d b/binutils-2.21/ld/testsuite/ld-plugin/plugin-2.d new file mode 100644 index 0000000..677f8fb --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-plugin/plugin-2.d @@ -0,0 +1,21 @@ +Hello from testplugin. +tv\[0\]: LDPT_MESSAGE func@0x.* +tv\[1\]: LDPT_API_VERSION value 0x1 \(1\) +tv\[2\]: LDPT_GNU_LD_VERSION value 0x.* +tv\[3\]: LDPT_LINKER_OUTPUT value 0x1 \(1\) +tv\[4\]: LDPT_OUTPUT_NAME 'tmpdir/main.x' +tv\[5\]: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.* +tv\[6\]: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.* +tv\[7\]: LDPT_REGISTER_CLEANUP_HOOK func@0x.* +tv\[8\]: LDPT_ADD_SYMBOLS func@0x.* +tv\[9\]: LDPT_GET_INPUT_FILE func@0x.* +tv\[10\]: LDPT_RELEASE_INPUT_FILE func@0x.* +tv\[11\]: LDPT_GET_SYMBOLS func@0x.* +tv\[12\]: LDPT_ADD_INPUT_FILE func@0x.* +tv\[13\]: LDPT_ADD_INPUT_LIBRARY func@0x.* +tv\[14\]: LDPT_SET_EXTRA_LIBRARY_PATH func@0x.* +tv\[15\]: LDPT_OPTION 'failonload' +tv\[16\]: LDPT_NULL value 0x0 \(0\) +#... +.*ld.*:.*ldtestplug.*: error loading plugin +#... diff --git a/binutils-2.21/ld/testsuite/ld-plugin/plugin-3.d b/binutils-2.21/ld/testsuite/ld-plugin/plugin-3.d new file mode 100644 index 0000000..73aba1b --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-plugin/plugin-3.d @@ -0,0 +1,22 @@ +Hello from testplugin. +tv\[0\]: LDPT_MESSAGE func@0x.* +tv\[1\]: LDPT_API_VERSION value 0x1 \(1\) +tv\[2\]: LDPT_GNU_LD_VERSION value 0x.* +tv\[3\]: LDPT_LINKER_OUTPUT value 0x1 \(1\) +tv\[4\]: LDPT_OUTPUT_NAME 'tmpdir/main.x' +tv\[5\]: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.* +tv\[6\]: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.* +tv\[7\]: LDPT_REGISTER_CLEANUP_HOOK func@0x.* +tv\[8\]: LDPT_ADD_SYMBOLS func@0x.* +tv\[9\]: LDPT_GET_INPUT_FILE func@0x.* +tv\[10\]: LDPT_RELEASE_INPUT_FILE func@0x.* +tv\[11\]: LDPT_GET_SYMBOLS func@0x.* +tv\[12\]: LDPT_ADD_INPUT_FILE func@0x.* +tv\[13\]: LDPT_ADD_INPUT_LIBRARY func@0x.* +tv\[14\]: LDPT_SET_EXTRA_LIBRARY_PATH func@0x.* +tv\[15\]: LDPT_OPTION 'registerallsymbolsread' +tv\[16\]: LDPT_OPTION 'failallsymbolsread' +tv\[17\]: LDPT_NULL value 0x0 \(0\) +#... +.*ld.*:.*ldtestplug.*: plugin reported error after all symbols read +#... diff --git a/binutils-2.21/ld/testsuite/ld-plugin/plugin-4.d b/binutils-2.21/ld/testsuite/ld-plugin/plugin-4.d new file mode 100644 index 0000000..580cbac --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-plugin/plugin-4.d @@ -0,0 +1,23 @@ +Hello from testplugin. +tv\[0\]: LDPT_MESSAGE func@0x.* +tv\[1\]: LDPT_API_VERSION value 0x1 \(1\) +tv\[2\]: LDPT_GNU_LD_VERSION value 0x.* +tv\[3\]: LDPT_LINKER_OUTPUT value 0x1 \(1\) +tv\[4\]: LDPT_OUTPUT_NAME 'tmpdir/main.x' +tv\[5\]: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.* +tv\[6\]: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.* +tv\[7\]: LDPT_REGISTER_CLEANUP_HOOK func@0x.* +tv\[8\]: LDPT_ADD_SYMBOLS func@0x.* +tv\[9\]: LDPT_GET_INPUT_FILE func@0x.* +tv\[10\]: LDPT_RELEASE_INPUT_FILE func@0x.* +tv\[11\]: LDPT_GET_SYMBOLS func@0x.* +tv\[12\]: LDPT_ADD_INPUT_FILE func@0x.* +tv\[13\]: LDPT_ADD_INPUT_LIBRARY func@0x.* +tv\[14\]: LDPT_SET_EXTRA_LIBRARY_PATH func@0x.* +tv\[15\]: LDPT_OPTION 'failcleanup' +tv\[16\]: LDPT_OPTION 'registercleanup' +tv\[17\]: LDPT_NULL value 0x0 \(0\) +#... +hook called: cleanup. +.*ld.*:.*ldtestplug.*: error in plugin cleanup \(ignored\) +#... diff --git a/binutils-2.21/ld/testsuite/ld-plugin/plugin-5.d b/binutils-2.21/ld/testsuite/ld-plugin/plugin-5.d new file mode 100644 index 0000000..c0ffa66 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-plugin/plugin-5.d @@ -0,0 +1,29 @@ +Hello from testplugin. +tv\[0\]: LDPT_MESSAGE func@0x.* +tv\[1\]: LDPT_API_VERSION value 0x1 \(1\) +tv\[2\]: LDPT_GNU_LD_VERSION value 0x.* +tv\[3\]: LDPT_LINKER_OUTPUT value 0x1 \(1\) +tv\[4\]: LDPT_OUTPUT_NAME 'tmpdir/main.x' +tv\[5\]: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.* +tv\[6\]: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.* +tv\[7\]: LDPT_REGISTER_CLEANUP_HOOK func@0x.* +tv\[8\]: LDPT_ADD_SYMBOLS func@0x.* +tv\[9\]: LDPT_GET_INPUT_FILE func@0x.* +tv\[10\]: LDPT_RELEASE_INPUT_FILE func@0x.* +tv\[11\]: LDPT_GET_SYMBOLS func@0x.* +tv\[12\]: LDPT_ADD_INPUT_FILE func@0x.* +tv\[13\]: LDPT_ADD_INPUT_LIBRARY func@0x.* +tv\[14\]: LDPT_SET_EXTRA_LIBRARY_PATH func@0x.* +tv\[15\]: LDPT_OPTION 'registerclaimfile' +tv\[16\]: LDPT_OPTION 'registerallsymbolsread' +tv\[17\]: LDPT_OPTION 'registercleanup' +tv\[18\]: LDPT_NULL value 0x0 \(0\) +#... +hook called: claim_file tmpdir/main.o \[@0/.* +hook called: claim_file tmpdir/func.o \[@0/.* +hook called: claim_file tmpdir/text.o \[@0/.* +#... +hook called: all symbols read. +#... +hook called: cleanup. +#... diff --git a/binutils-2.21/ld/testsuite/ld-plugin/plugin-6.d b/binutils-2.21/ld/testsuite/ld-plugin/plugin-6.d new file mode 100644 index 0000000..cb9257d --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-plugin/plugin-6.d @@ -0,0 +1,31 @@ +Hello from testplugin. +tv\[0\]: LDPT_MESSAGE func@0x.* +tv\[1\]: LDPT_API_VERSION value 0x1 \(1\) +tv\[2\]: LDPT_GNU_LD_VERSION value 0x.* +tv\[3\]: LDPT_LINKER_OUTPUT value 0x1 \(1\) +tv\[4\]: LDPT_OUTPUT_NAME 'tmpdir/main.x' +tv\[5\]: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.* +tv\[6\]: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.* +tv\[7\]: LDPT_REGISTER_CLEANUP_HOOK func@0x.* +tv\[8\]: LDPT_ADD_SYMBOLS func@0x.* +tv\[9\]: LDPT_GET_INPUT_FILE func@0x.* +tv\[10\]: LDPT_RELEASE_INPUT_FILE func@0x.* +tv\[11\]: LDPT_GET_SYMBOLS func@0x.* +tv\[12\]: LDPT_ADD_INPUT_FILE func@0x.* +tv\[13\]: LDPT_ADD_INPUT_LIBRARY func@0x.* +tv\[14\]: LDPT_SET_EXTRA_LIBRARY_PATH func@0x.* +tv\[15\]: LDPT_OPTION 'registerclaimfile' +tv\[16\]: LDPT_OPTION 'registerallsymbolsread' +tv\[17\]: LDPT_OPTION 'registercleanup' +tv\[18\]: LDPT_OPTION 'claim:tmpdir/func.o' +tv\[19\]: LDPT_NULL value 0x0 \(0\) +#... +hook called: claim_file tmpdir/main.o \[@0/.* not claimed +hook called: claim_file tmpdir/func.o \[@0/.* CLAIMED +hook called: claim_file tmpdir/text.o \[@0/.* not claimed +#... +hook called: all symbols read. +tmpdir/main.o: In function `main': +.*ld/testsuite/ld-plugin/main.c:12: undefined reference to `func' +hook called: cleanup. +#... diff --git a/binutils-2.21/ld/testsuite/ld-plugin/plugin-7.d b/binutils-2.21/ld/testsuite/ld-plugin/plugin-7.d new file mode 100644 index 0000000..75f25e0 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-plugin/plugin-7.d @@ -0,0 +1,30 @@ +Hello from testplugin. +tv\[0\]: LDPT_MESSAGE func@0x.* +tv\[1\]: LDPT_API_VERSION value 0x1 \(1\) +tv\[2\]: LDPT_GNU_LD_VERSION value 0x.* +tv\[3\]: LDPT_LINKER_OUTPUT value 0x1 \(1\) +tv\[4\]: LDPT_OUTPUT_NAME 'tmpdir/main.x' +tv\[5\]: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.* +tv\[6\]: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.* +tv\[7\]: LDPT_REGISTER_CLEANUP_HOOK func@0x.* +tv\[8\]: LDPT_ADD_SYMBOLS func@0x.* +tv\[9\]: LDPT_GET_INPUT_FILE func@0x.* +tv\[10\]: LDPT_RELEASE_INPUT_FILE func@0x.* +tv\[11\]: LDPT_GET_SYMBOLS func@0x.* +tv\[12\]: LDPT_ADD_INPUT_FILE func@0x.* +tv\[13\]: LDPT_ADD_INPUT_LIBRARY func@0x.* +tv\[14\]: LDPT_SET_EXTRA_LIBRARY_PATH func@0x.* +tv\[15\]: LDPT_OPTION 'registerclaimfile' +tv\[16\]: LDPT_OPTION 'registerallsymbolsread' +tv\[17\]: LDPT_OPTION 'registercleanup' +tv\[18\]: LDPT_OPTION 'claim:tmpdir/func.o' +tv\[19\]: LDPT_OPTION 'sym:_?func::0:0:0' +tv\[20\]: LDPT_NULL value 0x0 \(0\) +#... +hook called: claim_file tmpdir/main.o \[@0/.* not claimed +hook called: claim_file tmpdir/func.o \[@0/.* CLAIMED +hook called: claim_file tmpdir/text.o \[@0/.* not claimed +#... +hook called: all symbols read. +hook called: cleanup. +#... diff --git a/binutils-2.21/ld/testsuite/ld-plugin/plugin-8.d b/binutils-2.21/ld/testsuite/ld-plugin/plugin-8.d new file mode 100644 index 0000000..e72b039 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-plugin/plugin-8.d @@ -0,0 +1,34 @@ +Hello from testplugin. +tv\[0\]: LDPT_MESSAGE func@0x.* +tv\[1\]: LDPT_API_VERSION value 0x1 \(1\) +tv\[2\]: LDPT_GNU_LD_VERSION value 0x.* +tv\[3\]: LDPT_LINKER_OUTPUT value 0x1 \(1\) +tv\[4\]: LDPT_OUTPUT_NAME 'tmpdir/main.x' +tv\[5\]: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.* +tv\[6\]: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.* +tv\[7\]: LDPT_REGISTER_CLEANUP_HOOK func@0x.* +tv\[8\]: LDPT_ADD_SYMBOLS func@0x.* +tv\[9\]: LDPT_GET_INPUT_FILE func@0x.* +tv\[10\]: LDPT_RELEASE_INPUT_FILE func@0x.* +tv\[11\]: LDPT_GET_SYMBOLS func@0x.* +tv\[12\]: LDPT_ADD_INPUT_FILE func@0x.* +tv\[13\]: LDPT_ADD_INPUT_LIBRARY func@0x.* +tv\[14\]: LDPT_SET_EXTRA_LIBRARY_PATH func@0x.* +tv\[15\]: LDPT_OPTION 'registerclaimfile' +tv\[16\]: LDPT_OPTION 'registerallsymbolsread' +tv\[17\]: LDPT_OPTION 'registercleanup' +tv\[18\]: LDPT_OPTION 'claim:tmpdir/func.o' +tv\[19\]: LDPT_OPTION 'sym:_?func::0:0:0' +tv\[20\]: LDPT_OPTION 'sym:_?func2::0:0:0' +tv\[21\]: LDPT_OPTION 'dumpresolutions' +tv\[22\]: LDPT_NULL value 0x0 \(0\) +#... +hook called: claim_file tmpdir/main.o \[@0/.* not claimed +hook called: claim_file tmpdir/func.o \[@0/.* CLAIMED +hook called: claim_file tmpdir/text.o \[@0/.* not claimed +#... +hook called: all symbols read. +Sym: '_?func' Resolution: LDPR_PREVAILING_DEF +Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY +hook called: cleanup. +#... diff --git a/binutils-2.21/ld/testsuite/ld-plugin/plugin-9.d b/binutils-2.21/ld/testsuite/ld-plugin/plugin-9.d new file mode 100644 index 0000000..b74f4a6 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-plugin/plugin-9.d @@ -0,0 +1,35 @@ +Hello from testplugin. +tv\[0\]: LDPT_MESSAGE func@0x.* +tv\[1\]: LDPT_API_VERSION value 0x1 \(1\) +tv\[2\]: LDPT_GNU_LD_VERSION value 0x.* +tv\[3\]: LDPT_LINKER_OUTPUT value 0x1 \(1\) +tv\[4\]: LDPT_OUTPUT_NAME 'tmpdir/main.x' +tv\[5\]: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.* +tv\[6\]: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.* +tv\[7\]: LDPT_REGISTER_CLEANUP_HOOK func@0x.* +tv\[8\]: LDPT_ADD_SYMBOLS func@0x.* +tv\[9\]: LDPT_GET_INPUT_FILE func@0x.* +tv\[10\]: LDPT_RELEASE_INPUT_FILE func@0x.* +tv\[11\]: LDPT_GET_SYMBOLS func@0x.* +tv\[12\]: LDPT_ADD_INPUT_FILE func@0x.* +tv\[13\]: LDPT_ADD_INPUT_LIBRARY func@0x.* +tv\[14\]: LDPT_SET_EXTRA_LIBRARY_PATH func@0x.* +tv\[15\]: LDPT_OPTION 'registerclaimfile' +tv\[16\]: LDPT_OPTION 'registerallsymbolsread' +tv\[17\]: LDPT_OPTION 'registercleanup' +tv\[18\]: LDPT_OPTION 'claim:tmpdir/func.o' +tv\[19\]: LDPT_OPTION 'sym:_?func::0:0:0' +tv\[20\]: LDPT_OPTION 'sym:_?func2::0:0:0' +tv\[21\]: LDPT_OPTION 'dumpresolutions' +tv\[22\]: LDPT_OPTION 'add:tmpdir/func.o' +tv\[23\]: LDPT_NULL value 0x0 \(0\) +#... +hook called: claim_file tmpdir/main.o \[@0/.* not claimed +hook called: claim_file tmpdir/func.o \[@0/.* CLAIMED +hook called: claim_file tmpdir/text.o \[@0/.* not claimed +#... +hook called: all symbols read. +Sym: '_?func' Resolution: LDPR_PREVAILING_DEF +Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY +hook called: cleanup. +#... diff --git a/binutils-2.21/ld/testsuite/ld-plugin/plugin-ignore.d b/binutils-2.21/ld/testsuite/ld-plugin/plugin-ignore.d new file mode 100644 index 0000000..875ac51 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-plugin/plugin-ignore.d @@ -0,0 +1 @@ +#pass diff --git a/binutils-2.21/ld/testsuite/ld-plugin/plugin-vis-1.d b/binutils-2.21/ld/testsuite/ld-plugin/plugin-vis-1.d new file mode 100644 index 0000000..41f4971 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-plugin/plugin-vis-1.d @@ -0,0 +1,9 @@ +#... +.*(PROTECTED.*func3|DEFAULT.*func|HIDDEN.*func2|INTERNAL.*func1) +#... +.*(PROTECTED.*func3|DEFAULT.*func|HIDDEN.*func2|INTERNAL.*func1) +#... +.*(PROTECTED.*func3|DEFAULT.*func|HIDDEN.*func2|INTERNAL.*func1) +#... +.*(PROTECTED.*func3|DEFAULT.*func|HIDDEN.*func2|INTERNAL.*func1) +#... diff --git a/binutils-2.21/ld/testsuite/ld-plugin/plugin.exp b/binutils-2.21/ld/testsuite/ld-plugin/plugin.exp new file mode 100644 index 0000000..710e991 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-plugin/plugin.exp @@ -0,0 +1,193 @@ +# Expect script for ld-plugin tests +# Copyright 2010 +# Free Software Foundation, Inc. +# +# This file is part of the GNU Binutils. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. + +# These tests require the plugin API to be configured in. +if ![check_plugin_api_available] { + return +} + +# And a compiler to be available. +set can_compile 1 +set failure_kind "unresolved" +if { [which $CC] == 0 } { + # Don't fail immediately, + set can_compile 0 + set failure_kind "unsupported" +} + +pass "plugin API enabled" + +global base_dir + +# Look for the name we can dlopen in the test plugin's libtool control script. +set plugin_name [file_contents "$base_dir/libldtestplug.la"] +set plugin_name [regsub "'.*" [regsub ".*dlname='" "$plugin_name" ""] ""] +verbose "plugin name is '$plugin_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 +verbose "Full lt config: $lt_config" 3 +# Look for "objdir=.libs" +regexp -line "^objdir=.*$" "$lt_config" lt_objdir +verbose "lt_objdir line is '$lt_objdir'" 3 +set lt_objdir [regsub "objdir=" "$lt_objdir" ""] +set plugin_path "$base_dir/$lt_objdir/$plugin_name" +verbose "Full plugin path $plugin_path" 2 + +set regclm "-plugin-opt registerclaimfile" +set regas "-plugin-opt registerallsymbolsread" +set regcln "-plugin-opt registercleanup" + +# In order to define symbols in plugin options in the list of tests below, +# we need to know if the platform prepends an underscore to C symbols, +# which we find out by compiling the test objects now. If there is any +# error compiling, we defer reporting it until after the list of tests has +# been initialised, so that we can use the names in the list to report; +# otherwise, we scan one of the files with 'nm' and look for a known symbol +# in the output to see if it is prefixed or not. +set failed_compile 0 +set _ "" +set plugin_nm_output "" +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]) } { + # Defer fail until we have list of tests set. + set failed_compile 1 +} + +if { $can_compile && !$failed_compile } { + # Find out if symbols have prefix on this platform before setting tests. + catch "exec $NM tmpdir/func.o" plugin_nm_output + if { [regexp "_func" "$plugin_nm_output"] } { + set _ "_" + } +} + +set testobjfiles "tmpdir/main.o tmpdir/func.o tmpdir/text.o" +set testobjfiles_notext "tmpdir/main.o tmpdir/func.o" +# Rather than having libs we just define dummy values for anything +# we may need to link a target exe; we aren't going to run it anyway. +set libs "[ld_simple_link_defsyms] --defsym ${_}printf=0 --defsym ${_}puts=0" + +set plugin_tests [list \ + [list "load plugin" "-plugin $plugin_path \ + $testobjfiles $libs" "" "" {{ld plugin-1.d}} "main.x" ] \ + [list "fail plugin onload" "-plugin $plugin_path -plugin-opt failonload \ + $testobjfiles $libs" "" "" {{ld plugin-2.d}} "main.x" ] \ + [list "fail plugin allsymbolsread" "-plugin $plugin_path $regas \ + -plugin-opt failallsymbolsread \ + $testobjfiles $libs" "" "" {{ld plugin-3.d}} "main.x" ] \ + [list "fail plugin cleanup" "-plugin $plugin_path -plugin-opt failcleanup \ + $regcln \ + $testobjfiles $libs" "" "" {{ld plugin-4.d}} "main.x" ] \ + [list "plugin all hooks" "-plugin $plugin_path $regclm $regas $regcln \ + $testobjfiles $libs" "" "" {{ld plugin-5.d}} "main.x" ] \ + [list "plugin claimfile lost symbol" "-plugin $plugin_path $regclm \ + $regas $regcln -plugin-opt claim:tmpdir/func.o \ + $testobjfiles $libs" "" "" {{ld plugin-6.d}} "main.x" ] \ + [list "plugin claimfile replace symbol" "-plugin $plugin_path $regclm \ + $regas $regcln -plugin-opt claim:tmpdir/func.o \ + -plugin-opt sym:${_}func::0:0:0 \ + $testobjfiles $libs" "" "" {{ld plugin-7.d}} "main.x" ] \ + [list "plugin claimfile resolve symbol" "-plugin $plugin_path $regclm \ + $regas $regcln -plugin-opt claim:tmpdir/func.o \ + -plugin-opt sym:${_}func::0:0:0 \ + -plugin-opt sym:${_}func2::0:0:0 \ + -plugin-opt dumpresolutions \ + $testobjfiles $libs" "" "" {{ld plugin-8.d}} "main.x" ] \ + [list "plugin claimfile replace file" "-plugin $plugin_path $regclm \ + $regas $regcln -plugin-opt claim:tmpdir/func.o \ + -plugin-opt sym:${_}func::0:0:0 \ + -plugin-opt sym:${_}func2::0:0:0 \ + -plugin-opt dumpresolutions \ + -plugin-opt add:tmpdir/func.o \ + $testobjfiles $libs" "" "" {{ld plugin-9.d}} "main.x" ] \ +] + +set plugin_lib_tests [list \ + [list "plugin ignore lib" "-plugin $plugin_path $regclm \ + $regas $regcln -plugin-opt claim:tmpdir/func.o \ + -plugin-opt sym:${_}func::0:0:0 \ + -plugin-opt sym:${_}func2::0:0:0 \ + -plugin-opt dumpresolutions \ + -plugin-opt add:tmpdir/func.o \ + $testobjfiles_notext -Ltmpdir -ltext $libs" "" "" {{ld plugin-10.d}} "main.x" ] \ + [list "plugin claimfile replace lib" "-plugin $plugin_path $regclm \ + $regas $regcln -plugin-opt claim:tmpdir/func.o \ + -plugin-opt sym:${_}func::0:0:0 \ + -plugin-opt sym:${_}func2::0:0:0 \ + -plugin-opt dumpresolutions \ + -plugin-opt add:tmpdir/func.o \ + -plugin-opt claim:tmpdir/libtext.a \ + -plugin-opt sym:${_}text::0:0:0 \ + -plugin-opt add:tmpdir/text.o \ + $testobjfiles_notext -Ltmpdir -ltext $libs" "" "" {{ld plugin-11.d}} "main.x" ] \ +] + +set plugin_extra_elf_tests [list \ + [list "plugin set symbol visibility" "-plugin $plugin_path $regclm \ + $regas $regcln -plugin-opt claim:tmpdir/func.o \ + -plugin-opt sym:${_}func::0:0:0 \ + -plugin-opt sym:${_}func1::0:1:0 \ + -plugin-opt sym:${_}func2::0:2:0 \ + -plugin-opt sym:${_}func3::0:3:0 \ + -plugin-opt dumpresolutions \ + $testobjfiles $libs" "" "" {{ld plugin-ignore.d} \ + {readelf -s plugin-vis-1.d}} "main.x" ] \ +] + +# TODO(simonb): Plugin tests attempt to use ld-new to link a test program, +# but on powerpc platforms the link command these tests generate results +# in spurious errors and warnings from ld-new that cause the tests to fail. +# For the moment, XFAIL these tests on powerpc by unsetting can_compile so +# that we enter the error handling loop below. +if { [istarget "powerpc*-*-*"] } { + set can_compile 0 + set failure_kind "xfail" +} + +if { !$can_compile || $failed_compile } { + foreach testitem $plugin_tests { + $failure_kind [lindex $testitem 0] + } + if { [is_elf_format] } { + foreach testitem $plugin_extra_elf_tests { + $failure_kind [lindex $testitem 0] + } + } + return +} + +run_ld_link_tests $plugin_tests + +if { [is_elf_format] } { + run_ld_link_tests $plugin_extra_elf_tests +} + +if ![ar_simple_create $ar "" "tmpdir/libtext.a" "tmpdir/text.o"] { + foreach testitem $plugin_lib_tests { + unresolved [lindex $testitem 0] + } +} else { + run_ld_link_tests $plugin_lib_tests +} diff --git a/binutils-2.21/ld/testsuite/ld-plugin/text.c b/binutils-2.21/ld/testsuite/ld-plugin/text.c new file mode 100644 index 0000000..6d02114 --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-plugin/text.c @@ -0,0 +1,3 @@ + +const char *text = "Hello world!\n"; + |