From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: Re: size of executable
Date: Mon, 12 Aug 2019 13:18:51 -0400 [thread overview]
Message-ID: <20190812171851.GS9017@brightrain.aerifal.cx> (raw)
In-Reply-To: <CAKpSnp+acwtTa8u7qLrx254Pms=qhA1gfXnM-x-9DAkHdVJktg@mail.gmail.com>
On Mon, Aug 12, 2019 at 05:55:28PM +0100, Jorge Almeida wrote:
> On Mon, Aug 12, 2019 at 5:48 PM Jorge Almeida <jjalmeida@gmail.com> wrote:
> >
>
> > with gcc-8.3.0 on x86_64. Could someone check the following hello.c
> > and see what size you get?
> > I get 16768 bytes (not stripped) and 12324 (stripped).
> > Note that I'm not even using printf.
> >
> > Thanks
> >
> > #include <unistd.h>
> > int main(int argc, char* argv[]){
> > write(1, "Hello, bloated world...\n", 24);
> > }
>
> Sorry, I forgot to add the compile options. In attachement, due to
> Gmail interface being what it is.
> gcc -static -Os -march=native -fomit-frame-pointer -pipe -Wall -Werror=pedantic -Werror=implicit-function-declaration -pedantic -pedantic-errors -mpreferred-stack-boundary=4 -falign-functions=1 -falign-jumps=1 -falign-loops=1 -fno-unwind-tables -fdata-sections -ffunction-sections -Wl,--gc-sections -fno-asynchronous-unwind-tables -fstrict-aliasing -Wstrict-aliasing=2 -Wno-unused-function -std=c11 hello.c
>
> Stripping:
>
> strip -s a.out
> strip -S --strip-unneeded --remove-section=.note.gnu.gold-version --remove-section=.comment --remove-section=.note --remove-section=.note.gnu.build-id --remove-section=.note.ABI-tag --remove-section=.eh_frame --remove-section=.eh_frame_ptr -R .note -R .comment -R .note.GNU-stack a.out
> sstrip a.out
This is a binutils regression from a dubious anti-ROP feature, -z
separate-code. Add -Wl,-z,noseparate-code and it will go away.
FYI musl-cross-make has been updated to change the default back in
toolchains it builds.
Rich
next prev parent reply other threads:[~2019-08-12 17:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-12 16:48 Jorge Almeida
2019-08-12 16:55 ` Jorge Almeida
2019-08-12 17:18 ` Rich Felker [this message]
2019-08-12 17:59 ` Jorge Almeida
2019-08-12 18:16 ` Khem Raj
2019-08-12 18:23 ` Rich Felker
2019-08-13 10:15 ` Micha Nelissen
2019-08-13 11:45 ` Fangrui Song
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=20190812171851.GS9017@brightrain.aerifal.cx \
--to=dalias@libc.org \
--cc=musl@lists.openwall.com \
/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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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 NNTP newsgroup(s).