This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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 c/14952] New: libgcc_eh.a broken with respect to pthreads & static linking


same as #4372?
libgcc_eh contains a file unwind-dw2-fde-glibc.o that seems to be linked with an executable when
a program is compiled with -static. In that is the function __register_frame_info_bases, which makes
a very suspicious use of weak symbols to change its behaviour depending on the usage of threads
in the program. The program below crashes in __register_frame_info_bases(), because some of
the weak symbols are not defined while others are. It seems that __register_frame_info_bases relies
on the assumption, that if one pthread_* function is defined another will also be defined, which is not
the case depending on the libc-version (works with glibc/linuxthreads, not with glibc/nptl). Note
that this bug is strongly related to #4372, i entered a new one since this is addressing inconsistencies
within gcc itself (represented by libgcc_eh) and #4372 addresses the affection of gcc-headers to the
application program. Additionally i see no workaround except giving lots of -u options to the linker
or use some other way to pull in all used pthread_* functions by hand. Simply removing the
`#pragma weak' declarations from the headers does not work cause then one has to include the
pthread_* functions always. At least not as far as i tried.

Greetings - Rasmus

System information: gcc-3.3.3, binutils-2.14.90, glibc-2.3.3/nptl

int zero = 0;
int main () { /* compile with -static -lpthread */
    if (zero) { /* dont optimize away */
       pthread_key_create (0, 0); /* not called, but linked */
    }
}

-- 
           Summary: libgcc_eh.a broken with respect to pthreads & static
                    linking
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rassahah at neofonie dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14952


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