This is an archive of the discontinued LLVM Phabricator instance.

[Driver] Add support for -fembed-bitcode for assembly file
ClosedPublic

Authored by steven_wu on Dec 10 2018, 11:03 AM.

Details

Summary

Handle -fembed-bitcode for assembly inputs. When the input file is
assembly, write a marker as "LLVM,asm" section.

Fix llvm.org/pr39659

Diff Detail

Repository
rC Clang

Event Timeline

steven_wu created this revision.Dec 10 2018, 11:03 AM
compnerd added a comment.EditedDec 11 2018, 3:07 PM

This really feels odd. Why not expect that the developer will add the content themselves? I'm not sure I understand the motivation for this change.

This really feels odd. Why not expect that the developer will add the content themselves? I'm not sure I understand the motivation for this change.

The main motivation for upstreaming this is to make -fembed-bitcode behaves the same as Apple clang.
The section is just a marker for ld64 to tell the linker there is no bitcode available for this specific module because it is built from assembly. If ld64 sees this marker, it will pull the object file into the bitcode bundle, rather than error out and complaining about missing bitcode.

compnerd accepted this revision.Dec 11 2018, 10:02 PM

Please do clang-format this. If this is already in the wild, then, I suppose that we don't have the option, but, this seems like something that should be written by the author of the assembly file. This is really the same as the emission of the emission of the directive for the GNU noexecstack, although, there is --noexecstack.

This revision is now accepted and ready to land.Dec 11 2018, 10:02 PM
This revision was automatically updated to reflect the committed changes.