Page MenuHomePhabricator

[llvm-objcopy] Add elf32-sparc and elf32-sparcel target
ClosedPublic

Authored by seiya on Jun 12 2019, 5:10 PM.

Details

Summary

The "sparc"/"sparcel" architectures appears in ArchMap (used by -B option) but not in OutputFormatMap (used by -I/-O option). Add their targets into OutputFormatMap for consistency.

Note that AFAIK there're no targets for 32-bit little-endian SPARC ("elf32-sparcel") in GNU binutils.

Diff Detail

Repository
rL LLVM

Event Timeline

seiya created this revision.Jun 12 2019, 5:10 PM
compnerd accepted this revision.Jun 12 2019, 7:23 PM
This revision is now accepted and ready to land.Jun 12 2019, 7:23 PM

Looks good, I think, but does GNU objcopy have sparc as -I/-O type? Is the syntax the same as you have used?

seiya marked an inline comment as done.Jun 13 2019, 3:12 AM

Looks good, I think, but does GNU objcopy have sparc as -I/-O type? Is the syntax the same as you have used?

Yes, it has the same target name. I'm not familiar with SPARC at all, but now I noticed that 32-bit SPARC is big endian and gnu-objcopy -Oelf32-sparc certainly emits a big endian ELF file. I think I should fix the SPARC entry in ArchMap before committing this patch. What do you think on this?

llvm/tools/llvm-objcopy/CopyConfig.cpp
266 ↗(On Diff #204393)

I mean this 32-bit SPARC entry should be big endian.

seiya added a comment.Jun 13 2019, 3:17 AM

In LLVM, there's a target named SPARCV8el, the 32-bit little-endian SPARC target so adding sparc/ sparcel into ArchMap and elf32-sparc/elf32-sparcel into OutputFormatMap would be better I think.

Looks good, I think, but does GNU objcopy have sparc as -I/-O type? Is the syntax the same as you have used?

Yes, it has the same target name. I'm not familiar with SPARC at all, but now I noticed that 32-bit SPARC is big endian and gnu-objcopy -Oelf32-sparc certainly emits a big endian ELF file. I think I should fix the SPARC entry in ArchMap before committing this patch. What do you think on this?

I'm not familiar with SPARC either. Are you confident about it being big endian? If so, fixing the map seems fine and relevant. I have no problem with you adding the sparcel target if you want.

seiya added a comment.Jun 13 2019, 4:05 AM

Looks good, I think, but does GNU objcopy have sparc as -I/-O type? Is the syntax the same as you have used?

Yes, it has the same target name. I'm not familiar with SPARC at all, but now I noticed that 32-bit SPARC is big endian and gnu-objcopy -Oelf32-sparc certainly emits a big endian ELF file. I think I should fix the SPARC entry in ArchMap before committing this patch. What do you think on this?

I'm not familiar with SPARC either. Are you confident about it being big endian? If so, fixing the map seems fine and relevant. I have no problem with you adding the sparcel target if you want.

According to bfd/elf32-sparc.c in GNU binutils and clang/lib/Basic/Targets/Sparc.h, it seems to be big endian. I'll submit another patch for this.

seiya updated this revision to Diff 204658.Jun 13 2019, 4:32 PM
seiya retitled this revision from [llvm-objcopy] Add elf32-sparc target to [llvm-objcopy] Add elf32-sparc and elf32-sparcel target.Jun 13 2019, 4:33 PM
seiya edited the summary of this revision. (Show Details)
seiya edited the summary of this revision. (Show Details)Jun 13 2019, 4:38 PM
jakehehrlich accepted this revision.Jun 13 2019, 5:22 PM
This revision was automatically updated to reflect the committed changes.