This is the mail archive of the glibc-bugs@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]

[Bug dynamic-link/18402] New: FPU use in strlen() before main()


https://sourceware.org/bugzilla/show_bug.cgi?id=18402

            Bug ID: 18402
           Summary: FPU use in strlen() before main()
           Product: glibc
           Version: 2.21
            Status: NEW
          Severity: normal
          Priority: P2
         Component: dynamic-link
          Assignee: unassigned at sourceware dot org
          Reporter: dave at sr71 dot net
  Target Milestone: ---

I was working on some kernel FPU bugs and noticed that virtually all of the
processes in the system were using the FPU at some point in their execution. 
That means that the kernel's "lazy" FPU mode was not being put to good use.

I took a hello world app and compiled it both statically and dynamically.  I
have some kernel instrumentation to see the instructions which first use the
FPU.  In both the static and dynamic cases, it was the first instruction in
strlen().  I ran under gdb, set a breakpoint at strlen ("set break strlen") and
started the app.

Neither the dynamic or static versions reached main() before hitting the
breakpoint.  The gdb output from the dynamically linked one is below.

I think it would be advantageous to avoid using the FPU before the user code
even starts in an application so that the FPU can remain disabled.

(gdb) break strlen
Function "strlen" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (strlen) pending.
(gdb) c
The program is not being run.
(gdb) run
Starting program: /root/hellodave 

Breakpoint 1, strlen () at ../sysdeps/x86_64/multiarch/../rtld-strlen.S:26
26      ../sysdeps/x86_64/multiarch/../rtld-strlen.S: No such file or
directory.
(gdb) bt
#0  strlen () at ../sysdeps/x86_64/multiarch/../rtld-strlen.S:26
#1  0x00007ffff7df1635 in _dl_sysdep_start
(start_argptr=start_argptr@entry=0x7fffffffe590,
dl_main=dl_main@entry=0x7ffff7ddb910 <dl_main>) at ../elf/dl-sysdep.c:232
#2  0x00007ffff7ddecf8 in _dl_start_final (arg=0x7fffffffe590) at rtld.c:332
#3  _dl_start (arg=0x7fffffffe590) at rtld.c:558
#4  0x00007ffff7ddb2d8 in _start () from /lib64/ld-linux-x86-64.so.2
#5  0x0000000000000001 in ?? ()
#6  0x00007fffffffe7ff in ?? ()
#7  0x0000000000000000 in ?? ()
(gdb) q

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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