Re: Decreasing size of final executable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 30, 2023 at 10:02 AM Jędrzej Dudkiewicz <
jedrzej.dudkiewicz@xxxxxxxxx> wrote:

> On Fri, Jun 30, 2023 at 9:34 AM Xi Ruoyao <xry111@xxxxxxxxxxx> wrote:
>
>> On Fri, 2023-06-30 at 09:29 +0200, Jędrzej Dudkiewicz wrote:
>> > > > Currently I am compiling using the following compiler/linker
>> options:
>> > > > -fvisibility=hidden -fvisibility-inlines-hidden -flto
>> -Wl,--exclude-libs,ALL
>> > > > -Wl,-r,--discard-all -Wl,-flto
>> > >
>> > > Hmm, isn't "-r" for partial linking?  How can you use it to link an
>> > > executable?
>> >
>> > Well, final binary works so I suppose it simply makes no difference.
>> > Reason for it being here is simple: I've been trying basically all
>> > combinations of options that according to The Experts Of The Internet
>> > should somehow make my binary smaller. Since this is combination that
>> > ended with smallest binary.
>>
>> I've no idea why it even works in your case.  When I try them for a
>> Hello World program, the produced "a.out" file is an ELF relocatable and
>> I cannot run it at all.
>>
>
> You are right, thank you. I checked it twice and this option simply wasn't
> passed to the linker. I removed both -r and -Ur from linker options and it
> builds again - final binary is slightly slower, but main problem (symbols
> from boost::asio) still persist - if this is a problem at all, of course.
>

Not slower, smaller. Sorry for the confusion.

-- 
Jędrzej Dudkiewicz

I really hate this damn machine, I wish that they would sell it.
It never does just what I want, but only what I tell it.




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux