public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Carlos O'Donell <carlos@redhat.com>
To: Gary Benson <gbenson@redhat.com>, "H.J. Lu" <hjl.tools@gmail.com>
Cc: Adhemerval Zanella <adhemerval.zanella@linaro.org>,
	GNU C Library <libc-alpha@sourceware.org>
Subject: Re: Why GLIBC requires compiler optimizations to build
Date: Wed, 20 Jun 2018 12:51:00 -0000	[thread overview]
Message-ID: <d60b3fcf-7f12-1001-6af2-3826a6769001@redhat.com> (raw)
In-Reply-To: <CAHegJiJnmwqjBocN_caOxtn9-gBL3Aib6qS8vmE1bssUUDcubQ@mail.gmail.com>

On 06/20/2018 06:35 AM, Gary Benson wrote:
> On 11 June 2018 at 22:48, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Mon, Jun 11, 2018 at 2:38 PM, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:
>>> It has been some time since I tried to build glibc without optimization
>>> as an exercise and I can't really recall what exactly has prevented me
>>> to accomplish it.  So the question is if it is make sense to add such
>>> requirement and if it is the case whether it would be a useful options
>>> and what prevents us to do so?
>>
>> The main issue is to bootstrap ld.so to prevent dynamic relocations
>> before it is ready.
> 
> Is it only really elf/rtld.c that specifically requires optimization then?

No.

The dynamic loader has many functions it needs to execute the early startup.

So there are a lot of dependencies on other *.c files here and there, which
must be callable directly and not through the PLT.

The perfect solution is a refactored build system that can distinguish what
is going into rtld that needs optimizations and what is not. Then apply
optimizations only to rtld.

Even then, for debugging purposes, I have gotten away with using gcc's
function attributes to mark some function as -O0 to debug them more easily,
otherwise it's very hard to debug and _dl_debug_printf() is your highest
value tool.

Cheers,
Carlos.

  reply	other threads:[~2018-06-20 12:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-11 21:38 Adhemerval Zanella
2018-06-11 21:49 ` H.J. Lu
2018-06-20 10:35   ` Gary Benson
2018-06-20 12:51     ` Carlos O'Donell [this message]
2018-06-20 15:22       ` Gary Benson
2018-06-21 17:16         ` 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=d60b3fcf-7f12-1001-6af2-3826a6769001@redhat.com \
    --to=carlos@redhat.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=gbenson@redhat.com \
    --cc=hjl.tools@gmail.com \
    --cc=libc-alpha@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).