This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Why GLIBC requires compiler optimizations to build


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]