This is an archive of the discontinued LLVM Phabricator instance.

Rename embedded bitcode section in MachO
ClosedPublic

Authored by steven_wu on Feb 18 2016, 9:32 AM.

Details

Summary

Rename the section embeds bitcode from ".llvmbc,.llvmbc" to "LLVM,bitcode".
The new name matches MachO section naming convention.

Diff Detail

Repository
rL LLVM

Event Timeline

steven_wu updated this revision to Diff 48343.Feb 18 2016, 9:32 AM
steven_wu retitled this revision from to Rename embedded bitcode section in MachO.
steven_wu updated this object.
steven_wu added a reviewer: rafael.
steven_wu added a subscriber: llvm-commits.
rafael edited edge metadata.

Don't you also need to check the segment name on macho? Or it is just invalid to create a FOO, bitcode?

davide added a subscriber: davide.Feb 19 2016, 12:43 PM
davide added inline comments.
lib/Object/FunctionIndexObjectFile.cpp
42 ↗(On Diff #48343)

You can just inline the call here (also true in the other case), as there's only one use of this variable.

lib/Object/ObjectFile.cpp
119 ↗(On Diff #48343)

this can be spelled in a more compact form.
return (Obj.isMachO()) ? "__bitcode" : ".llvmbc";

steven_wu updated this revision to Diff 48556.Feb 19 2016, 4:23 PM
steven_wu edited edge metadata.

It will probably be better to check the segment name. I was hesitate to do
that because I couldn't figure out a way without adding more virtual method.
Here is a try to make it more robust. Note it does slightly change the
behavior because std::error not longer propagates through findBitcodeInObject.

I think this is fine given that it just mean that a section with a corrupted name is not bitcode. That is the same answer you would get if the corruption had changed the name to __bitcodx.

pcc, what do you think?

pcc accepted this revision.Feb 29 2016, 11:10 AM
pcc edited edge metadata.

LGTM

This revision is now accepted and ready to land.Feb 29 2016, 11:10 AM
This revision was automatically updated to reflect the committed changes.