From: "Jędrzej Dudkiewicz" <jedrzej.dudkiewicz@gmail.com>
To: Xi Ruoyao <xry111@xry111.site>
Cc: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: Decreasing size of final executable
Date: Fri, 30 Jun 2023 10:02:15 +0200 [thread overview]
Message-ID: <CABJqhQPW_ft8MX3tXEmUL_Zpn365vthL5+MVwkKwCPiQgwzU0g@mail.gmail.com> (raw)
In-Reply-To: <89c3d9fb04a47cbf8dddd0b24dbe3254253fd5ed.camel@xry111.site>
[-- Attachment #1: Type: text/plain, Size: 1419 bytes --]
On Fri, Jun 30, 2023 at 9:34 AM Xi Ruoyao <xry111@xry111.site> 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.
--
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.
next prev parent reply other threads:[~2023-06-30 8:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-30 6:28 Jędrzej Dudkiewicz
2023-06-30 7:11 ` Xi Ruoyao
2023-06-30 7:29 ` Jędrzej Dudkiewicz
2023-06-30 7:34 ` Xi Ruoyao
2023-06-30 8:02 ` Jędrzej Dudkiewicz [this message]
2023-06-30 8:02 ` Jędrzej Dudkiewicz
2023-07-01 15:34 ` Andrew Haley
2023-07-03 13:48 ` Jędrzej Dudkiewicz
2023-07-06 6:52 ` Florian Weimer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CABJqhQPW_ft8MX3tXEmUL_Zpn365vthL5+MVwkKwCPiQgwzU0g@mail.gmail.com \
--to=jedrzej.dudkiewicz@gmail.com \
--cc=gcc-help@gcc.gnu.org \
--cc=xry111@xry111.site \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).