This is an archive of the discontinued LLVM Phabricator instance.

Simplify PPC64::calcEFlags().
ClosedPublic

Authored by ruiu on Jun 12 2018, 6:20 PM.

Details

Summary

In this file we only have to handle the v2 ABI, so what we need to do
is to just make sure that all object files have v2 or unspecified version
number.

Event Timeline

ruiu created this revision.Jun 12 2018, 6:20 PM
ruiu updated this revision to Diff 151084.Jun 12 2018, 6:48 PM
  • simplify
ruiu updated this revision to Diff 151085.Jun 12 2018, 6:50 PM
  • simplify
sfertile accepted this revision.Jun 13 2018, 9:46 AM

Other then the 1 comment this LGTM.

lld/ELF/Arch/PPC64.cpp
121

I think we should still emit 2 separate error messages:

  1. if flags & 1 is set then emit an error message that reflects we don't support the V1 abi.
  2. if any flags bits other then bits 1 or 2 are set then we emit a message for unrecognized e_flags.
This revision is now accepted and ready to land.Jun 13 2018, 9:46 AM
ruiu added inline comments.Jun 13 2018, 10:25 AM
lld/ELF/Arch/PPC64.cpp
121

What do you suggest for the second message? I thought it would be something like "unsupported ABI version: 3" which is basically the same error message for v1.

sfertile added inline comments.Jun 13 2018, 11:05 AM
lld/ELF/Arch/PPC64.cpp
121

Maybe I am misunderstanding exactly what the eflags can be used for but I thought they can specify features/extensions as well as the abi versions. Right now only bits 0 and 1 are used to specify the abi, so if bit 1 is set we recognize that the user is giving us abi 1 input which isn't supported and let the user know exactly what the problem is.

If any bits above 1 are set we don't know if they are supposed to represent a new abi flag, a new feature flag or if the input is corrupted, and in that case a message like "Unrecognized feature flags: " + Twine (Flags & ~3) is likely to be more helpful.

sfertile added inline comments.Jun 13 2018, 12:02 PM
lld/ELF/Arch/PPC64.cpp
121

Sorry, I meant Unrecognized e_flags above

ruiu updated this revision to Diff 151274.Jun 13 2018, 5:21 PM
  • separated error message for v1 and unknown eflags
  • added a test
ruiu updated this revision to Diff 151275.Jun 13 2018, 5:23 PM
  • clarified the error message
This revision was automatically updated to reflect the committed changes.