Boost logo

Boost :

From: Rene Rivera (grafik.list_at_[hidden])
Date: 2003-10-09 15:41:56

[2003-10-02] Ben Young wrote:

>On Wed, 1 Oct 2003, Dave Gomboc wrote:
>> > > Maybe we should add -fwritable-strings for GCC in Boost.Build unless
>> > > <optimization>size is set?
>> >
>> > In my experience the links are slow only if -g is used. I
>> > think it should be sufficient to add -fwritable-strings only
>> > for debug builds. Ralf
>> I have a (non-boost) source file that I need to use -fwritable-strings
>> even without -g. Mind you, it has about 6.5x10^5 string literals in it.
>> ;-)
>> I'd still like to get confirmation from the original poster
>> (ben.young_at_[hidden]) that using the -fwritable-strings switch will
>> actually solve his lengthy compile times, but if it does, sure, Dave's
>> proposed change to the Boost.Build setting works for me. If it doesn't,
>> hopefully Ben's company will contribute their patch to GCC.
>I'm afraid -fwritable-strings doesn't work. The problem is not in the code
>string literals (which for non-optimized builds are conpiled with
>-fno-merge-constants by default), but the debug_str sections, whose flags
>are set as a compile time constants (well, a macro :) ). I will get onto
>posting the patch to gcc, but I imagine it will be a while before it comes
>out (if it is accepted at all)
>Thanks for the feedback!

No thank you!!!! You just saved me a few hours a day wasted on link times
:-) Thank you!!!

And to repay my gratitude I have a variation of your solution which doesn't
require patching GCC. Thanks to your discovery of the debug strings merge
problem, and to Dave G.'s mention of -fwritable-strings, the problem can be
fixed by turning off the "readonly" flag for the debug strings section. That
prevents the linker from running the n^2 merge algorithm. To do that one can

    objcopy --set-section-flags .debug_str=contents,debug some_file.o

On each compiled file. Normally the flags are contents,readonly,debug - so
the above removes the readonly flag and voila, no merging of debug symbols
:-) [I have Boost.Build changes to do this if there's interest.]

And again... thanks^2 !!

-- grafik - Don't Assume Anything
-- rrivera (at) - grafik (at)
-- 102708583 (at) icq

Boost list run by bdawes at, gregod at, cpdaniel at, john at