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/15903] New: INITFIRST flag does not change fini order


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

            Bug ID: 15903
           Summary: INITFIRST flag does not change fini order
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: dynamic-link
          Assignee: unassigned at sourceware dot org
          Reporter: berardgui at gmail dot com

Created attachment 7169
  --> https://sourceware.org/bugzilla/attachment.cgi?id=7169&action=edit
git diff of an idea of a fix

It looks like the INITFIRST flag is read by ld.so only for the init order and
not during sorting the fini order.
For instance, if I build a first library (lib1) with -z initfirst and a second
one without, link an executable with these two libraries, and finally run it
with LD_DEBUG, I have:
     26457:    calling init: ../lib1/lib1.so
     26457:    calling init: /lib64/ld-linux-x86-64.so.2
     26457:    calling init: /lib64/libc.so.6
     26457:    calling init: ../lib2/lib2.so
     26457:    calling fini: ./test [0]
     26457:    calling fini: ../lib1/lib1.so [0]
     26457:    calling fini: ../lib2/lib2.so [0]

According to https://sourceware.org/binutils/docs/ld/Options.html the fini
order should be the reverse order of the init order...

Having a closer look to elf/dl-fini.c it seems that there is no check of the
initfirst flag.

Find attached an idea of a fix.

-- 
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]