NOCROSSREF tests

Stephen Casner casner@acm.org
Tue Jun 23 07:18:30 GMT 2020


Moving on to the next FAIL in the ld testsuite for pdp11...

The NOCROSSREFS 2 test looks for an error message indicating that a
prohibited reference from .text to a local symbol in .data is
detected.  This test fails for pdp11-aout because the relocation for
local references (that is, not to an external symbol) is relative to
the section, not the symbol.

The code in ldcref.c (check_reloc_refs) requires that the name of the
symbol in the arelent matches the name of the current symbol in the
scan over all symbols in the hash.  That is, unless the current symbol
has no name, in which case the symbol in the arelent just needs to
have the BSF_SECTION_SYM flag set.

Is it really necessary to compare the symbol names at all?  The code
has determined the output section that the reference is coming from
is prohibited from referring to the section of the symbol in the
arelent, so it seems to me that it should not be necessary for the
name to match if the symbol in the arelent is a section symbol.

Perhaps the requirement to match the name is so the error message can
include the right name?

I note that the test passes for arm-none-eabi because there is a
symbol with no name in the hash.  The actual reference to the local
symbol 'i' is not identified.

I see that H.J. worked on this code back in 2005 for PR 1396.

                                                        -- Steve

p.s. I found a bug in bfd/pdp11.c that caused the symbol in the
arelent for all local references to be to the section symbol for *ABS*
rather than for .text, .data or .bss, but fixing that is only the
first step toward making this test work for pdp11-aout.  That bug
appears to be in the original import of the pdp11 code, but I have not
determined yet how it affects the results of the link.


More information about the Binutils mailing list