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: [PATCHv4 0/2] tunables for glibc


On Mon, Aug 15, 2016 at 1:04 PM, Siddhesh Poyarekar
<siddhesh@sourceware.org> wrote:
> Hi,
>
> After another episode of disappearance, here is an updated iteration of the
> tunables patch with suggestions from Florian, Carlos and H. J. incorporated.
> Changes since the last version:
>
>  - Fixed mallopt behaviour using a set of intermediate functions that the
>    callback and __libc_mallopt use.  I did not make them into direct callbacks
>    because the callbacks are built only when tunables is enabled.
>
>  - Loads of comment and documentation fixes based on Carlos' and Florian's
>    suggestions
>
>  - Call __init_tunables even earlier to ensure that tunables are initialized
>    before get_cpu_features is called.
>

__tunables_init is called too late for static executables:

Breakpoint 2, __libc_start_main (main=0x400400 <main>, argc=1,
    argv=0x7fffffffde18, init=0x401d10 <__libc_csu_init>,
    fini=0x401da0 <__libc_csu_fini>, rtld_fini=0x0, stack_end=0x7fffffffde08)
    at ../sysdeps/x86/libc-start.c:37
37  init_cpu_features (&_dl_x86_cpu_features);
(gdb) bt
#0  __libc_start_main (main=0x400400 <main>, argc=1, argv=0x7fffffffde18,
    init=0x401d10 <__libc_csu_init>, fini=0x401da0 <__libc_csu_fini>,
    rtld_fini=0x0, stack_end=0x7fffffffde08) at ../sysdeps/x86/libc-start.c:37
#1  0x0000000000400aea in _start () at ../sysdeps/x86_64/start.S:120
(gdb) c
Continuing.

Breakpoint 3, __tunables_init (envp=envp@entry=0x7fffffffde28)
    at dl-tunables.c:208
208 {
(gdb) bt
#0  __tunables_init (envp=envp@entry=0x7fffffffde28) at dl-tunables.c:208
#1  0x0000000000447ceb in __libc_init_first (argc=argc@entry=1,
    argv=argv@entry=0x7fffffffde18, envp=0x7fffffffde28)
    at ../csu/init-first.c:81
#2  0x00000000004013f8 in generic_start_main (main=main@entry=0x400400 <main>,
    argc=argc@entry=1, argv=argv@entry=0x7fffffffde18,
    init=init@entry=0x401d10 <__libc_csu_init>,
    fini=fini@entry=0x401da0 <__libc_csu_fini>, rtld_fini=rtld_fini@entry=0x0,
    stack_end=0x7fffffffde08) at ../csu/libc-start.c:225
#3  0x0000000000401702 in __libc_start_main (main=0x400400 <main>, argc=1,
    argv=0x7fffffffde18, init=0x401d10 <__libc_csu_init>,
    fini=0x401da0 <__libc_csu_fini>, rtld_fini=0x0, stack_end=0x7fffffffde08)
    at ../sysdeps/x86/libc-start.c:38
#4  0x0000000000400aea in _start () at ../sysdeps/x86_64/start.S:120
(gdb)

It needs to be called before init_cpu_features on x86.

-- 
H.J.


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