[llvm] r200138 - Implement the missing bits corresponding to .mips_hack_elf_flags.

Matheus Almeida Matheus.Almeida at imgtec.com
Tue Jan 28 03:37:16 PST 2014


Hi Rafael,

" Can't you use llvm-mc's mattr option to set it? For example, -mattr=n32 seems to correctly select the n32 abi."
Yes, it appears to work. 

There's another issue related to the ELF header that I didn't mention on my previous e-mail but it can now be fixed/tested.
EF_MIPS_32BITMODE should be set when the O32 ABI is used when targeting a Mips64 arch. 

The attached patch fixes the mentioned issues plus it adds more tests related to the different ABIs supported by Mips.

Regards,
Matheus

-----Original Message-----
From: Rafael EspĂ­ndola [mailto:rafael.espindola at gmail.com] 
Sent: 27 January 2014 18:18
To: Matheus Almeida
Cc: llvm-commits at cs.uiuc.edu
Subject: Re: [llvm] r200138 - Implement the missing bits corresponding to .mips_hack_elf_flags.

....
On 27 January 2014 12:17, Matheus Almeida <Matheus.Almeida at imgtec.com> wrote:
> Hi Rafael,
>
> We found one issue with this commit.
> EF_MIPS_ABI2 should only be set if the n32 ABI is used as opposed to set if targeting any 64-bit Mips architecture. Note that at the moment n64 is the default ABI for Mips64 (not n32). This will probably be updated in the future for compatibility reasons with GCC based toolchains but I believe it's not a change we can perform silently.
>
> I've attached a patch that fixes this issue.
>
> Are you OK if we add an option to llvm-mc that allows the ABI to be manipulated on the command line (-mabi=...) ? That would allow us to add more tests that check if the correct bits were written to the ELF header without relying on the default values for the ABI.

I see. I noticed the default cpu was different from gas, but missed that the ABI was intended to be different. Can't you use llvm-mc's mattr option to set it? For example, -mattr=n32 seems to correctly select the n32 abi. If so, please change the test to include at least the equivalent of

mips64el-as -mabi=n32 -mips64r2 (what we have now, but with the explicit abi option) mips64el-as -mabi=n32 -mips64 (similar)

mips64el-as -mabi=64 -mips64r2 (what you were changing the test to, but with the explicit abi option) mips64el-as -mabi=64 -mips64 (similar)

Using explicit command line options keeps the invariant stated at the top of the test that it matches the output of gas when compiled with the same triple and corresponding options.

Feel free to add another test explicitly showing that we have a different default from gas.

Cheers,
Rafael

To report this email as SPAM, please forward it to spam at websense.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_r200138_v2.patch
Type: application/octet-stream
Size: 3076 bytes
Desc: fix_r200138_v2.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140128/ee2e304f/attachment.obj>


More information about the llvm-commits mailing list