Boost logo

Boost-Build :

Subject: Re: [Boost-build] How to remove specific compiler/linker flags
From: Rene Rivera (grafikrobot_at_[hidden])
Date: 2010-05-07 10:23:35


On 5/7/2010 12:57 AM, Benjamin Prestele wrote:
>
>>> [...] In my case the "-Wl,-dead_strip
>>> -no_dead_strip_inits_and_terms" flags defined for<optimization>
>>> in darwin.jam remove necessary assembly code in some apps. So
>>> building<variant>release will create an incomplete binary,
>>> causing the app to crash. Switching<optimization>off will compile
>>> with -O0, which is also not desirable.
>>>
>>> Any suggestions?
>>
>> Sorry... I've been rather busy since you asked this.. And I wont be
>> able to really respond to the rest of the email in this thread.
>> But, since you are doing assembly, why don't you also use the
>> ".no_dead_strip<symbol>" Mac assembler directive? Note, I recently
>> add a<force-load>library.a feature to darwin.jam which might also
>> be of use.
>
> Actually I'm not an assembly programmer and therefore would like to
> not touch this code unless necessary. But I think I'll try this out,
> too. What does the<force-load> feature do?

It lets you add "-force_load something.a", or "-force_load something.o",
when linking which tells the Darwin linker to not dead-code eliminate
the symbols in that specific archive/object. I use it for dealing with
the weird static link but dynamic run-time of Objective C. But it's
generally useful :-)

You might also want to look into the GCC __attributes__ that are
designed to handle some of the dead-code strip cases. Specifically the
__attribute__((used)) function specifier
<http://gcc.gnu.org/onlinedocs/gcc-4.2.4/gcc/Function-Attributes.html>
which can also be used in variables.

The reason I keep avoiding the option of removing the "-dead_strip" is
that it for C++ which is susceptible to large symbol creep it can make
exes rather large if not cleaned up by the linker.

-- 
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org (msn) - grafik/redshift-software.com
-- 102708583/icq - grafikrobot/aim,yahoo,skype,efnet,gmail

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk