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]

glibc only with optimization?


Carlos O'Donell <carlos@systemhalted.org> explained:
>>>>>error: #error "glibc cannot be compiled without optimization"

> In the early startup of the dynamic loader (_dl_start), before
> relocation of the PLT, you cannot make function calls. You must inline
> the functions you will use during early startup, or call compiler
> builtins (__builtin_*).
> 
> Without optimizations enabled gcc will not inline functions. The early
> startup of the dynamic loader will make function calls via an
> unrelocated PLT and crash.

Today's gcc can call a file-scope 'static' function without using the
Program Linkage Table (PLT) on most architectures, including x86, x86_64,
powerpc, hppa, ia64, m68k, sparc, alpha.  Mips may have trouble because
the displacement of a program-counter-relative call is limited to 128KB
(32K instructions) which is somewhat small.  There isn't any particular
reason why a function than can be inlined could not be defined as static.

So, it seems to be overly coarse to blame the requirement for optimization
on an unrelocated PLT during early startup.  Most architectures can avoid
that problem.  What else requires that glibc be compiled with optimization?

-- 
John Reiser, jreiser@BitWagon.com


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