[cfe-dev] [PATCH] options -ffunction-sections and -fdata-sections

Chris Lattner clattner at apple.com
Wed Apr 7 15:32:15 PDT 2010


On Apr 7, 2010, at 3:25 PM, Sylvere Teissier wrote:

> Anton Korobeynikov wrote:
>> Hello, Sylvere
>> 
>>  
>>> Currently it works only for elf format backend, for other object formats
>>> these options are ignored.
>>>    
>> First of all, please honor the LLVM coding style (or, at least, the
>> code style of the source files you're modifying).
>>  
> Ok, I have checked this point, I hope it's ok now
>> Second, I belive the approach used is wrong - there is already way to
>> emit objects into separate sections, which
>> is used for linkonce objects, you just need to hook in there. No need
>> to reinvent the wheel :)
>>  
> Thanks for the tip, I've changed my patch using the existing code. But I use different section names than gnu.linkonce when It's not "WeakForLinker"
> because gnu.linkonce.* are special sections. (I try to follow GCC section naming for -ffunction-sections/-fdata-sections)

Hi Sylvere,

I agree that they can't be happen with linkonce linkage... but this should be handled in the backend, not in the frontend.  TargetLoweringObjectFileELF::SelectSectionForGlobal is in charge of picking the section to use of a global, can you put this logic there?

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100407/9bf8a7f7/attachment.html>


More information about the cfe-dev mailing list