[cfe-dev] Patch: Make ccc generate native object files

Shantonu Sen ssen at apple.com
Sat Feb 9 13:22:01 PST 2008

I'm not suggesting they do.

I'm suggesting that llvm/lib/Bitcode/BitcodeReader.cpp know that if  
the first few bytes don't look like a bitcode file, it should try to  
analyze it as a Mach-O file and read enough of the load commands to  
find a __LLVM,__llvm section, and then create a view into the memory  
buffer of just that data. Same for ELF.

All llvm tools layered on top of BitcodeReader would look at the LLVM  
data for these hybrid objects. Native tools would look at the native  
parts. The native linker would aggregate the __LLVM,__llvm section  
into some useless blob, probably, but that's OK for these purposes.


Sent from my MacBook

On Feb 9, 2008, at 1:18 PM, Chris Lattner wrote:

> On Feb 9, 2008, at 12:49 PM, Shantonu Sen wrote:
>> One approach that would probably make everyone happy is to teach  
>> "llc"
>> how to output the original bitcode stream in its own section/segment
>> in the native assembly stream, and teach the LLVM libraries how to
>> extract this encapsulated bitcode data for Mach-O, ELF, etc., in the
>> event that the input file is not a bitcode file directly.
> It's pretty easy to get the .bc file encoded into the .s file in  
> some magic section, however, it would be harder to teach all the  
> llvm tools about native .o files etc,
> -Chris

More information about the cfe-dev mailing list