Allow new just-symbols test to run on XCOFF and PE
Maciej W. Rozycki
macro@wdc.com
Thu Jul 30 15:44:01 GMT 2020
On Tue, 28 Jul 2020, Alan Modra wrote:
> > > Would you be able to update your change to keep that purpose? What's
> > > there with the affected targets that causes extra data to be present
> > > ahead?
> >
> > It's not extra data but rather that some aout formats don't even have
> > a .data section.
> >
> > ~/build/gas/i386-msdos/ld$ ../binutils/objdump -s tmpdir/just-symbols-1obj
> >
> > tmpdir/just-symbols-1obj: file format msdos
> >
> > Contents of section .text:
> > 0000 12000000 00000000 00000000 00000000 ................
Good point, yeah! I reckon the run-time-relocatable .exe (MZ) format
this target uses doesn't have a notion of sections at all and all the
memory is RWX, so presenting the contents of a program as `.text' is as
good a way as there could be (and then the more limited .com format is an
entirely raw byte stream, so I guess we only support it with the `binary'
BFD).
NB somehow I missed `i386-msdos' when looking through bfd/config.bfd
previously, so I have now added it to my list of targets to verify.
> > I'll reinstate the "file format" and "Contents of section" lines but
> > match any named section.
>
> That failed on another aout target, ns32k, where the linker always
> gives a a non-empty .text section. So I'm reverting the
Indeed I'd expect at least some a.out targets to be inflexible enough to
hardwire the presence of all the three of `.text'/`.data'/`.bss' even.
> just-symbols-1.dd change and applying the following. The lang_check
> change fixes msp430-elf bfd_merge_private_bfd_data errors.
Great, thank you for taking care of it!
> diff --git a/ld/testsuite/ld-misc/just-symbols.exp b/ld/testsuite/ld-misc/just-symbols.exp
> index 59c725d0d2..e3c012f0f6 100644
> --- a/ld/testsuite/ld-misc/just-symbols.exp
> +++ b/ld/testsuite/ld-misc/just-symbols.exp
> @@ -20,7 +20,13 @@
> #
>
> # SH/PE targets complain about zero VMA.
> -if { [istarget sh-*-pe] } {
> +# i386-msdos doesn't have .data
> +# tic30-coff has a weird 32-bit reloc that divides sym value by four
> +# alpha-dec-vms wants a bunch of libs to link
> +if { [istarget sh-*-pe]
> + || [istarget *-*-msdos]
> + || [istarget *c30-*-*]
> + || [istarget alpha-*-vms] } {
I think there's no need to exclude `alpha-dec-vms' specifically for this
test case, as the target wants to link in those libraries throughout and
all the LD tests fail, e.g.:
./ld-new: cannot find -limagelib
./ld-new: cannot find -lstarlet
./ld-new: cannot find -lsys$public_vectors
FAIL: script
(which I discovered many years ago but never bothered to look into).
It looks like those are hardcoded in the emulation itself rather than in
a linker script:
static void
gld${EMULATION_NAME}_create_output_section_statements (void)
{
lang_add_input_file ("imagelib", lang_input_file_is_l_enum, NULL);
lang_add_input_file ("starlet", lang_input_file_is_l_enum, NULL);
lang_add_input_file ("sys\$public_vectors", lang_input_file_is_l_enum, NULL);
}
so I think the right way to sort it might be by having the test framework
prebuild stub versions of those, except for the native configuration;
perhaps by making them empty-ish linker scripts so as to avoid a
chicken-and-egg problem here.
Maciej
More information about the Binutils
mailing list