This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[committed] MIPS/LD/testsuite: Correct PR ld/22649 test case failures
Fix commit d664fd41e15f ("Ignore dynamic references on forced local
symbols") and use alternative test actions and match patterns to
correctly handle messages like:
.../ld/ld-new: Removing unused section '.reginfo' in file 'tmpdir/pr22649-2b.o'
or:
.../ld/ld-new: Removing unused section '.MIPS.options' in file 'tmpdir/pr22649-2b.o'
produced by LD on MIPS targets, removing:
FAIL: Build pr22649-2c.so
FAIL: Build pr22649-2d.so
test suite failures and tightening checks made with `pr22649-2a.so' and
`pr22649-2b.so' test cases.
Keep the original empty action with `pr22649-2c.so' and `pr22649-2d.so'
links and MIPS/ELF targets though, because for them the linker does not
garbage-collect the `.reginfo' section. This is because the section has
its flags set differently by code in GAS in `md_begin':
if (strncmp (TARGET_OS, "elf", 3) != 0)
flags |= SEC_ALLOC | SEC_LOAD;
and consequently BFD linker code in `_bfd_elf_gc_mark_extra_sections':
else if (((isec->flags & SEC_DEBUGGING) != 0
|| (isec->flags & (SEC_ALLOC | SEC_LOAD | SEC_RELOC)) == 0)
&& elf_next_in_group (isec) == NULL)
isec->gc_mark = 1;
marks these sections to be kept due to their SEC_ALLOC, SEC_LOAD and
SEC_RELOC flags all being zero (`.reginfo' sections never have
relocations attached).
ld/
PR ld/22649
* testsuite/ld-elf/pr22649-2ab-mips.msg: New stderr output.
* testsuite/ld-elf/pr22649-2cd-mips.msg: New stderr output.
* testsuite/ld-elf/shared.exp: Use the new outputs with
`mips*-*-*' targets.
---
On Mon, 22 Jan 2018, Maciej W. Rozycki wrote:
> > > >> PR ld/22649
> > > >> * testsuite/ld-elf/pr22649-1.s: New file.
> > > >> * testsuite/ld-elf/pr22649-2a.s: Likewise.
> > > >> * testsuite/ld-elf/pr22649-2b.s: Likewise.
> > > >> * testsuite/ld-elf/pr22649.msg: Likewise.
> > > >> * testsuite/ld-elf/shared.exp: Run ld/22649 tests.
> > > >
> > > > OK.
> > > >
> > >
> > > I've noticed that 2 of the new tests fail:
> > > FAIL: ld:Build pr22649-2a.so
> > > FAIL: ld:Build pr22649-2b.so
> > >
> > > on arm*linux* and arm-none-nacl targets
> > >
> > > Can you check?
> >
> > I have a patch to fix this under test at the moment.
>
> This is still broken for several MIPS targets:
>
> .../ld/ld-new: Removing unused section '.reginfo' in file 'tmpdir/pr22649-2b.o'
> .../ld/ld-new: Removing unused section '.reginfo' in file 'tmpdir/pr22649-2b.o'
> FAIL: Build pr22649-2c.so
>
> and:
>
> .../ld/ld-new: Removing unused section '.reginfo' in file 'tmpdir/pr22649-2b.o'
> .../ld/ld-new: Removing unused section '.reginfo' in file 'tmpdir/pr22649-2b.o'
> FAIL: Build pr22649-2d.so
Nobody bothered to respond, so I have committed this update, as obvious,
correcting all `mips*-*-*' target failures caused by the original commit,
with the exception of:
mips-sgi-irix5 +FAIL: Build pr22649-2a.so
which is legitimate, due to:
.../ld/ld-new: tmpdir/pr22649-2a.so: protected symbol `_procedure_table_size' isn't defined
.../ld/ld-new: final link failed: Bad value
(and was previously masked by the wildcard match in the generic expected
pattern), which I'll investigate later (the same problem triggers across
other test cases and MIPS targets as well, so it's not specific to this
single link or target; probably a linker script issue).
Maciej
---
ld/testsuite/ld-elf/pr22649-2ab-mips.msg | 2 ++
ld/testsuite/ld-elf/pr22649-2cd-mips.msg | 1 +
ld/testsuite/ld-elf/shared.exp | 20 ++++++++++++++++----
3 files changed, 19 insertions(+), 4 deletions(-)
binutils-mips-ld-test-pr22649.diff
Index: binutils/ld/testsuite/ld-elf/pr22649-2ab-mips.msg
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ binutils/ld/testsuite/ld-elf/pr22649-2ab-mips.msg 2018-01-26 03:09:44.936458908 +0000
@@ -0,0 +1,2 @@
+.*: Removing unused section '\.data' in file 'tmpdir/pr22649-2.\.o'
+.*: Removing unused section '\.(?:reginfo|MIPS\.options)' in file 'tmpdir/pr22649-2.\.o'
Index: binutils/ld/testsuite/ld-elf/pr22649-2cd-mips.msg
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ binutils/ld/testsuite/ld-elf/pr22649-2cd-mips.msg 2018-01-26 03:09:44.955674155 +0000
@@ -0,0 +1 @@
+.*: Removing unused section '\.(?:reginfo|MIPS\.options)' in file 'tmpdir/pr22649-2.\.o'
Index: binutils/ld/testsuite/ld-elf/shared.exp
===================================================================
--- binutils.orig/ld/testsuite/ld-elf/shared.exp 2018-01-26 01:37:17.041655734 +0000
+++ binutils/ld/testsuite/ld-elf/shared.exp 2018-01-26 15:29:07.070336783 +0000
@@ -93,6 +93,11 @@ run_ld_link_tests [list \
]
if { [check_gc_sections_available] } {
+ if [istarget mips*-*-*] {
+ set actions {{ld pr22649-2ab-mips.msg}}
+ } else {
+ set actions {{ld pr22649.msg}}
+ }
run_ld_link_tests [list \
[list \
"Build pr22649-2a.so" \
@@ -100,7 +105,7 @@ if { [check_gc_sections_available] } {
"" \
"$AFLAGS_PIC" \
{pr22649-2a.s} \
- {{ld pr22649.msg}} \
+ $actions \
"pr22649-2a.so" \
] \
[list \
@@ -109,16 +114,23 @@ if { [check_gc_sections_available] } {
"tmpdir/pr22649-1.so" \
"$AFLAGS_PIC" \
{pr22649-2a.s} \
- {{ld pr22649.msg}} \
+ $actions \
"pr22649-2b.so" \
] \
+ ]
+ if { [istarget mips*-*-*] && ![istarget *-*-elf*] } {
+ set actions {{ld pr22649-2cd-mips.msg}}
+ } else {
+ set actions {}
+ }
+ run_ld_link_tests [list \
[list \
"Build pr22649-2c.so" \
"$LFLAGS -shared -gc-sections -print-gc-sections" \
"" \
"$AFLAGS_PIC" \
{pr22649-2b.s} \
- {} \
+ $actions \
"pr22649-2b.so" \
] \
[list \
@@ -127,7 +139,7 @@ if { [check_gc_sections_available] } {
"tmpdir/pr22649-1.so" \
"$AFLAGS_PIC" \
{pr22649-2b.s} \
- {} \
+ $actions \
"pr22649-2b.so" \
] \
]