Simplify PPC64::calcEFlags().
AcceptedPublic

Authored by ruiu on Tue, Jun 12, 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.

ruiu created this revision.Tue, Jun 12, 6:20 PM
ruiu updated this revision to Diff 151084.Tue, Jun 12, 6:48 PM
  • simplify
ruiu updated this revision to Diff 151085.Tue, Jun 12, 6:50 PM
  • simplify
sfertile accepted this revision.Wed, Jun 13, 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.Wed, Jun 13, 9:46 AM
ruiu added inline comments.Wed, Jun 13, 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.Wed, Jun 13, 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.Wed, Jun 13, 12:02 PM
lld/ELF/Arch/PPC64.cpp
121

Sorry, I meant Unrecognized e_flags above

ruiu updated this revision to Diff 151274.Wed, Jun 13, 5:21 PM
  • separated error message for v1 and unknown eflags
  • added a test
ruiu updated this revision to Diff 151275.Wed, Jun 13, 5:23 PM
  • clarified the error message