From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Fangrui Song <i@maskray.me>, libc-help@sourceware.org
Subject: Re: Lightning talk notes on glibc
Date: Wed, 20 Jan 2021 13:17:37 -0300 [thread overview]
Message-ID: <89f7840b-e607-316e-9b4a-1ecab1f8cf41@linaro.org> (raw)
In-Reply-To: <20210120074815.k6km6cmhrt4aknpo@gmail.com>
On 20/01/2021 04:48, Fangrui Song wrote:
> Greetings, I will give a lightning talk in a small meetup on some GNU
> toolchain projects and I am writing notes:)
>
> Here is that I have now for glibc. Happy to see more points from you experts:)
>
>
> ## glibc
>
> Repository: <https://sourceware.org/git/gitweb.cgi?p=glibc.git>
> Wiki: <https://sourceware.org/glibc/wiki/>
> Bugzilla: <https://sourceware.org/bugzilla/>
> Mailing lists: `{libc-announce,libc-alpha,libc-locale,libc-stable,libc-help}@sourceware.org`
>
> A very unfortunate fact: glibc can only be built with `-O2`, not `-O0` or `-O1`.
> If you want to have an un-optimized debug build, deleting an object file and recompiling it with `-g` usually works.
> Another workaround is `#pragma GCC optimize ("O0")`.
Unfortunately this trick might still fail depending whether the routine
is also used on loader, although for library code it does help.
>
> The `-O2` issue is probably related to (1) expected inlining and (2) avoiding dynamic relocations.
Yes and I started to take a look if it would be possible. I could build
a un-optimized libc.so, but it still fails at runtime for some reason.
I think a better way would be to try to simplify the bootstrap and document
the requirements of the function call and arch-specific code. The idea is
to move all the required bootstrap code to maybe a single file and just
build it in an optimized manner.
As static-pie and ifunc has show, the bootstrap code is still somewhat
complex.
>
> Run the following commands to populate `/tmp/glibc-many` with toolchains.
> Caution: please make sure the target file system has tens of gigabytes.
>
> Preparation:
> ```sh
> scripts/build-many-glibcs.py /tmp/glibc-many checkout
> scripts/build-many-glibcs.py /tmp/glibc-many host-libraries
>
> scripts/build-many-glibcs.py /tmp/glibc-many compilers aarch64-linux-gnu
> scripts/build-many-glibcs.py /tmp/glibc-many compilers powerpc64le-linux-gnu
> scripts/build-many-glibcs.py /tmp/glibc-many compilers sparc64-linux-gnu
> ```
>
You might want to use the '--shallow' option on checkout to minimize both
the disk and network usage (since at principle you won't need to full git
history) and the --strip on compiler option.
> The `glibcs` command will delete the glibc build directory, build glibc, and run `make check`.
If you want all the build directories to further inspection you might use
'--keep all' option on either compilers or glibcs command.
>
> ```sh
> scripts/build-many-glibcs.py /tmp/glibc-many glibcs aarch64-linux-gnu
> # Find the logs and test results under /tmp/glibc-many/logs/glibcs/aarch64-linux-gnu/
>
> scripts/build-many-glibcs.py /tmp/glibc-many glibcs powerpc64le-linux-gnu
>
> scripts/build-many-glibcs.py /tmp/glibc-many glibcs sparc64-linux-gnu
> ```
>
> During development, some interesting targets:
>
> ((((((It'd be nice to list more targets here))))))))
> ```sh
> make -C Debug lib # meaning?
> make -C Debug objs # meaning?
> make -C Debug others # meaning?
> make -C Debug check-abi
> ```
next prev parent reply other threads:[~2021-01-20 16:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-20 7:48 Fangrui Song
2021-01-20 16:17 ` Adhemerval Zanella [this message]
2021-01-20 16:20 ` Carlos O'Donell
2021-01-20 16:25 ` Carlos O'Donell
2021-01-20 16:25 ` Carlos O'Donell
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=89f7840b-e607-316e-9b4a-1ecab1f8cf41@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=i@maskray.me \
--cc=libc-help@sourceware.org \
/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).