On Thu, Oct 16, 2014 at 2:05 PM, Jakub Jelinek <ja...@redhat.com> wrote:

>> > Recent change caused bootstrap failure on CentOS 5.11:
>> >
>> > /usr/bin/ld: Dwarf Error: found dwarf version '4', this reader only
>> > handles version 2 information.
>> > unwind-dw2-fde-dip_s.o: In function `__pthread_cleanup_routine':
>> > unwind-dw2-fde-dip.c:(.text+0x1590): multiple definition of
>> > `__pthread_cleanup_routine'
>> > /usr/bin/ld: Dwarf Error: found dwarf version '4', this reader only
>> > handles version 2 information.
>> > unwind-dw2_s.o:unwind-dw2.c:(.text+0x270): first defined here
>> > /usr/bin/ld: Dwarf Error: found dwarf version '4', this reader only
>> > handles version 2 information.
>> > unwind-sjlj_s.o: In function `__pthread_cleanup_routine':
>> > unwind-sjlj.c:(.text+0x0): multiple definition of 
>> > `__pthread_cleanup_routine'
>> > unwind-dw2_s.o:unwind-dw2.c:(.text+0x270): first defined here
>> > /usr/bin/ld: Dwarf Error: found dwarf version '4', this reader only
>> > handles version 2 information.
>> > emutls_s.o: In function `__pthread_cleanup_routine':
>> > emutls.c:(.text+0x170): multiple definition of `__pthread_cleanup_routine'
>> > unwind-dw2_s.o:unwind-dw2.c:(.text+0x270): first defined here
>> > collect2: error: ld returned 1 exit status
>> > gmake[5]: *** [libgcc_s.so] Error 1
>> >
>> > $ ld --version
>> > GNU ld version 2.17.50.0.6-26.el5 20061020
>>
>> It looks like a switch-to-c11 fallout. Older glibc versions have
>> issues with c99 (and c11) conformance [1].
>>
>> Changing "extern __inline void __pthread_cleanup_routine (...)" in
>> system /usr/include/pthread.h to
>>
>> if __STDC_VERSION__ < 199901L
>> extern
>> #endif
>> __inline__ void __pthread_cleanup_routine (...)
>>
>> fixes this issue and allows bootstrap to proceed.
>>
>> However, fixincludes is not yet built in stage1 bootstrap. Is there a
>> way to fix this issue without changing system headers?
>>
>> [1] https://gcc.gnu.org/ml/gcc-patches/2006-11/msg01030.html
>
> Yeah, old glibcs are totally incompatible with -fno-gnu89-inline.
> Not sure if it is easily fixincludable, if yes, then -fgnu89-inline should
> be used for code like libgcc which is built with the newly built compiler
> before it is fixincluded.
> Or we need -fgnu89-inline by default for old glibcs (that is pretty
> much what we do e.g. in Developer Toolset for RHEL5).

At the end of the day, adding pthread.h to glibc_c99_inline_4 fix
fixes the bootstrap. The fix applies __attribute__((__gnu_inline__))
to the declaration:

extern __inline __attribute__ ((__gnu_inline__)) void
__pthread_cleanup_routine (struct __pthread_cleanup_frame *__frame)

2014-10-21  Uros Bizjak  <ubiz...@gmail.com>

    * inclhack.def (glibc_c99_inline_4): Add pthread.h to files.
    * fixincl.x: Regenerate.

Bootstrapped and regression tested on CentOS 5.11 x86_64-linux-gnu {,-m32}.

OK for mainline?

Uros.
Index: fixincl.x
===================================================================
--- fixincl.x   (revision 216501)
+++ fixincl.x   (working copy)
@@ -2,11 +2,11 @@
  * 
  * DO NOT EDIT THIS FILE   (fixincl.x)
  * 
- * It has been AutoGen-ed  August 12, 2014 at 02:09:58 PM by AutoGen 5.12
+ * It has been AutoGen-ed  October 21, 2014 at 10:18:16 AM by AutoGen 5.16.2
  * From the definitions    inclhack.def
  * and the template file   fixincl
  */
-/* DO NOT SVN-MERGE THIS FILE, EITHER Tue Aug 12 14:09:58 MSK 2014
+/* DO NOT SVN-MERGE THIS FILE, EITHER Tue Oct 21 10:18:17 CEST 2014
  *
  * You must regenerate it.  Use the ./genfixes script.
  *
@@ -3173,7 +3173,7 @@
  *  File name selection pattern
  */
 tSCC zGlibc_C99_Inline_4List[] =
-  "sys/sysmacros.h\0*/sys/sysmacros.h\0wchar.h\0*/wchar.h\0";
+  
"sys/sysmacros.h\0*/sys/sysmacros.h\0wchar.h\0*/wchar.h\0pthread.h\0*/pthread.h\0";
 /*
  *  Machine/OS name selection pattern
  */
Index: inclhack.def
===================================================================
--- inclhack.def        (revision 216501)
+++ inclhack.def        (working copy)
@@ -1687,7 +1687,8 @@
  */
 fix = {
     hackname  = glibc_c99_inline_4;
-    files     = sys/sysmacros.h, '*/sys/sysmacros.h', wchar.h, '*/wchar.h';
+    files     = sys/sysmacros.h, '*/sys/sysmacros.h', wchar.h, '*/wchar.h',
+    pthread.h, '*/pthread.h';
     bypass    = "__extern_inline|__gnu_inline__";
     select    = "(^| )extern __inline";
     c_fix     = format;

Reply via email to