This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Specify architecture for SPARC gas tests
- From: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>
- To: jose dot marchesi at oracle dot com (Jose E. Marchesi)
- Cc: binutils at sourceware dot org
- Date: Sat, 10 Feb 2018 18:10:25 +0100
- Subject: Re: Specify architecture for SPARC gas tests
- Authentication-results: sourceware.org; auth=none
- References: <yddsha8vnmy.fsf@CeBiTec.Uni-Bielefeld.DE> <87mv0gwzir.fsf@oracle.com>
Hi Jose,
> In GNU/Linux GAS annotates the hardware capabilities when it assembles
> an ELF object. From gas/config/tc-sparc.c:sparc_md_end:
>
> #if defined(OBJ_ELF) && !defined(TE_SOLARIS)
> hwcaps = hwcap_seen & U0xffffffff;
> hwcaps2 = hwcap_seen >> 32;
>
> if (hwcaps)
> bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_GNU, Tag_GNU_Sparc_HWCAPS, hwcaps);
> if (hwcaps2)
> bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_GNU, Tag_GNU_Sparc_HWCAPS2, hwcaps2);
> #endif
>
> Then when BFD opens the file, it looks at the GNU object attributes
> HWCAPS and HWCAPS2 and determines the opcodes architecture that is
> subsequently used by the disassembler. See
> bfd/elfxx-spac.c:_bfd_sparc_elf_object_p.
ah, that's the missing piece: I'd already wondered how those failures
could have escaped you.
> The hwcaps tags are not created in Solaris though, so that's why the
> tests are failing... I wonder if it is possible to change the tests so
> they use -msparc:MACH only when testing in solaris targets?
I've no idea, but there's already tcl code that modifies/rewrites tags
in the *.?d files. That could certainly be extended...
> Alternatively, I guess we could just change the assembler to add the GNU
> object attributes also in solaris...
TBH, I'd rather not, given that Solaris has a native format for this
feature:
https://docs.oracle.com/cd/E37838_01/html/E36783/chapter7-28.html#scrolltoc
I'd long meant to implement this in binutils.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University