This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi Andreas, > Symbol table '.dynsym' contains 11 entries: > Num: Value Size Type Bind Vis Ndx Name > 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND > 1: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterTMCloneTable > 2: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __libc_start_main@GLIBC_2.2.5 (2) > 3: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__ > 4: 00000000000007b0 4 FUNC GLOBAL DEFAULT 13 func_attr_used_disabled > 5: 0000000000201030 4 OBJECT GLOBAL DEFAULT 23 var_attr_used_enabled > 6: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __printf_chk@GLIBC_2.3.4 (3) > 7: 00000000000007a0 4 FUNC GLOBAL DEFAULT 13 func_attr_used_enabled > 8: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMCloneTable > 9: 0000000000201034 4 OBJECT GLOBAL DEFAULT 23 var_attr_used_disabled > 10: 0000000000000000 0 FUNC WEAK DEFAULT UND __cxa_finalize@GLIBC_2.2.5 (2) > do I interpret this correctly that the test fails because of the additional lines > in between / the non-sorting of the table? (And if yes, is that relevant?) Not the additional lines, those should be ignored. But you are spot on with the non-sorting of the table. This is indeed the cause of the problem. The test script is expecting to see the symbols in this order: var_attr_used_enabled var_attr_used_disabled first func_attr_used_enabled func_attr_used_disabled This is the same order as the symbols are specified in the pr22983.t file. That file is part of the --dynamic-list command line option that is used when the test invokes the linker, and I guess most targets preserve the symbol ordering in their output. There is no documentation stating that the order has to be preserved however, so the test is incorrect. Fixing the test is going to be hard however. It is important to make sure that all four symbols are in the dynamic symbol table, so just shortening the pattern match rules in pr22983.d will not work. The readelf program that is used to dump the dynamic symbol table does not have a sorting option, and the linker testsuite harness does not have a way of invoking an external sorting program on the output, so the ordering cannot be guaranteed. So ... please could you try out the attached patch, which uses a rather hackish method to work around the problem - it runs the check four times, once for each symbol, each time ignoring any other symbol. I think that should work for you, but I would like to be sure. Cheers Nick
diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp index c0b7b1c764..70274b3712 100644 --- a/ld/testsuite/ld-plugin/lto.exp +++ b/ld/testsuite/ld-plugin/lto.exp @@ -572,13 +572,29 @@ run_ld_link_exec_tests $lto_run_tests if { [is_elf_format] } { run_ld_link_exec_tests $lto_run_elf_tests + + # Note - it is not guaranteed that the ordering of symbols in the dynamic + # symbol table will match the ordering of the symbols specified by the + # --dynamic-list command line option. + # + # For PR22983 we want to make sure that all four symbols specified in + # pr222983.t are present in the output, but a simple sequences of regexps + # will not work as we do not know the order of the symbols. (Readelf + # does not have a symbol sorting option and the run_cc_list_tests proc + # does not allow for the output of the dump program to piped into `sort`). + # + # So instead we run readelf four times, each time checking for the + # presence of a specific symbol from the pr22983.t file. run_cc_link_tests [list \ [list \ "Build pr22983" \ "-Wl,--dynamic-list,pr22983.t" \ "-flto" \ - {pr22983a.c pr22983b.c} \ - {{readelf {--dyn-syms --wide} pr22983.d}} \ + {pr22983a.c pr22983b.c} \ + {{readelf {--dyn-syms --wide} pr22983.1.d} \ + {readelf {--dyn-syms --wide} pr22983.2.d} \ + {readelf {--dyn-syms --wide} pr22983.3.d} \ + {readelf {--dyn-syms --wide} pr22983.4.d}} \ "pr22983" \ ] \ ] --- /dev/null 2018-06-11 08:13:30.371999906 +0100 +++ ld/testsuite/ld-plugin/pr22983.1.d 2018-06-11 12:51:50.207785000 +0100 @@ -0,0 +1,6 @@ +Symbol table '\.dynsym' contains [0-9]+ entries: + +Num: +Value +Size Type +Bind +Vis +Ndx Name +#... + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +OBJECT +GLOBAL +DEFAULT +[0-9]+ +_?var_attr_used_enabled +#pass + --- /dev/null 2018-06-11 08:13:30.371999906 +0100 +++ ld/testsuite/ld-plugin/pr22983.2.d 2018-06-11 12:49:10.228521413 +0100 @@ -0,0 +1,6 @@ +Symbol table '\.dynsym' contains [0-9]+ entries: + +Num: +Value +Size Type +Bind +Vis +Ndx Name +#... + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +OBJECT +GLOBAL +DEFAULT +[0-9]+ +_?var_attr_used_disabled +#pass + --- /dev/null 2018-06-11 08:13:30.371999906 +0100 +++ ld/testsuite/ld-plugin/pr22983.3.d 2018-06-11 12:49:24.133370490 +0100 @@ -0,0 +1,6 @@ +Symbol table '\.dynsym' contains [0-9]+ entries: + +Num: +Value +Size Type +Bind +Vis +Ndx Name +#... + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +FUNC +GLOBAL +DEFAULT +[0-9]+ +_?func_attr_used_enabled +#pass + --- /dev/null 2018-06-11 08:13:30.371999906 +0100 +++ ld/testsuite/ld-plugin/pr22983.4.d 2018-06-11 12:49:38.246217309 +0100 @@ -0,0 +1,5 @@ +Symbol table '\.dynsym' contains [0-9]+ entries: + +Num: +Value +Size Type +Bind +Vis +Ndx Name +#... + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +FUNC +GLOBAL +DEFAULT +[0-9]+ +_?func_attr_used_disabled +#pass
Attachment:
signature.asc
Description: OpenPGP digital signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |