glibc 2.7 fails to build with gcc 4.3.1 (error messages given below). 
Investigating the error, I stumbled upon PR 36111. Applying the patch from 

http://gcc.gnu.org/viewcvs/trunk/gcc/ChangeLog?view=markup&pathrev=135221

makes gcc 4.3.1 build glibc OK (and everything else that I tried).

Maybe someone could comment on whether this is the correct way of fixing it.



---------------------------------------------------------------------------

[...]
malloc.c: In function 'mALLOPt':
malloc.c:5731: error: invalid rtl sharing found in the insn
(insn 131 128 136 24 malloc.c:5729 (parallel [
            (set (mem/s/c:SI (plus:SI (reg:SI 3 bx)
                        (const:SI (unspec:SI [
                                    (symbol_ref:SI ("main_arena") [flags 0x2] 
<var_decl 0x406e14d0 main_arena>)
                                ] 1))) [3 main_arena.mutex+0 S4 A256])
                (asm_operands/v:SI ("cmpl $0, %%gs:%P3
        je 0f
        lock
0:      subl $1,%0
        jne _L_unlock_%=
        .subsection 1
        .type _L_unlock_%=,@function
_L_unlock_%=:
1:      leal %0, %%eax
2:      call __lll_unlock_wake_private
3:      jmp 18f
4:      .size _L_unlock_%=, 4b-1b
        .previous
.section        .eh_frame,"a",@progbits
5:      .long   7f-6f   # Length of Common Information Entry
6:      .long   0x0     # CIE Identifier Tag
        .byte   0x1     # CIE Version
        .ascii "zR\0"   # CIE Augmentation
        .uleb128 0x1    # CIE Code Alignment Factor
        .sleb128 -4     # CIE Data Alignment Factor
        .byte   0x8     # CIE RA Column
        .uleb128 0x1    # Augmentation size
        .byte   0x1b    # FDE Encoding (pcrel sdata4)
        .byte   0xc     # DW_CFA_def_cfa
        .uleb128 0x4
        .uleb128 0x0
        .align 4
7:      .long   17f-8f  # FDE Length
8:      .long   8b-5b   # FDE CIE offset
        .long   1b-.    # FDE initial location
        .long   4b-1b   # FDE address range
        .uleb128 0x0    # Augmentation size
        .byte   0x16    # DW_CFA_val_expression
        .uleb128 0x8
        .uleb128 10f-9f
9:      .byte   0x78    # DW_OP_breg8
        .sleb128 3b-1b
10:     .byte   0x40 + (2b-1b) # DW_CFA_advance_loc
        .byte   0x16    # DW_CFA_val_expression
        .uleb128 0x8
        .uleb128 12f-11f
11:     .byte   0x78    # DW_OP_breg8
        .sleb128 3b-2b
12:     .byte   0x40 + (3b-2b-1) # DW_CFA_advance_loc
        .byte   0x16    # DW_CFA_val_expression
        .uleb128 0x8
        .uleb128 16f-13f
13:     .byte   0x78    # DW_OP_breg8
        .sleb128 15f-14f
        .byte   0x0d    # DW_OP_const4s
14:     .4byte  3b-.
        .byte   0x1c    # DW_OP_minus
        .byte   0x0d    # DW_OP_const4s
15:     .4byte  18f-.
        .byte   0x22    # DW_OP_plus
16:     .align 4
17:     .previous
18:") ("=m") 0 [
                        (mem/s/c:SI (plus:SI (reg:SI 3 bx)
                                (const:SI (unspec:SI [
                                            (symbol_ref:SI ("main_arena") 
[flags 0x2] <var_decl 0x406e14d0 main_arena>)
                                        ] 1))) [3 main_arena.mutex+0 S4 A256])
                        (const_int 12 [0xc])
                    ]
                     [
                        (asm_input:SI ("m") 0)
                        (asm_input:SI ("i") 0)
                    ] 7217092))
            (set (reg/v:SI 59 [ ignore ])
                (asm_operands/v:SI ("cmpl $0, %%gs:%P3
        je 0f
        lock
0:      subl $1,%0
        jne _L_unlock_%=
        .subsection 1
        .type _L_unlock_%=,@function
_L_unlock_%=:
1:      leal %0, %%eax
2:      call __lll_unlock_wake_private
3:      jmp 18f
4:      .size _L_unlock_%=, 4b-1b
        .previous
.section        .eh_frame,"a",@progbits
5:      .long   7f-6f   # Length of Common Information Entry
6:      .long   0x0     # CIE Identifier Tag
        .byte   0x1     # CIE Version
        .ascii "zR\0"   # CIE Augmentation
        .uleb128 0x1    # CIE Code Alignment Factor
        .sleb128 -4     # CIE Data Alignment Factor
        .byte   0x8     # CIE RA Column
        .uleb128 0x1    # Augmentation size
        .byte   0x1b    # FDE Encoding (pcrel sdata4)
        .byte   0xc     # DW_CFA_def_cfa
        .uleb128 0x4
        .uleb128 0x0
        .align 4
7:      .long   17f-8f  # FDE Length
8:      .long   8b-5b   # FDE CIE offset
        .long   1b-.    # FDE initial location
        .long   4b-1b   # FDE address range
        .uleb128 0x0    # Augmentation size
        .byte   0x16    # DW_CFA_val_expression
        .uleb128 0x8
        .uleb128 10f-9f
9:      .byte   0x78    # DW_OP_breg8
        .sleb128 3b-1b
10:     .byte   0x40 + (2b-1b) # DW_CFA_advance_loc
        .byte   0x16    # DW_CFA_val_expression
        .uleb128 0x8
        .uleb128 12f-11f
11:     .byte   0x78    # DW_OP_breg8
        .sleb128 3b-2b
12:     .byte   0x40 + (3b-2b-1) # DW_CFA_advance_loc
        .byte   0x16    # DW_CFA_val_expression
        .uleb128 0x8
        .uleb128 16f-13f
13:     .byte   0x78    # DW_OP_breg8
        .sleb128 15f-14f
        .byte   0x0d    # DW_OP_const4s
14:     .4byte  3b-.
        .byte   0x1c    # DW_OP_minus
        .byte   0x0d    # DW_OP_const4s
15:     .4byte  18f-.
        .byte   0x22    # DW_OP_plus
16:     .align 4
17:     .previous
18:") ("=&a") 1 [
                        (mem/s/c:SI (plus:SI (reg:SI 3 bx)
                                (const:SI (unspec:SI [
                                            (symbol_ref:SI ("main_arena") 
[flags 0x2] <var_decl 0x406e14d0 main_arena>)
                                        ] 1))) [3 main_arena.mutex+0 S4 A256])
                        (const_int 12 [0xc])
                    ]
                     [
                        (asm_input:SI ("m") 0)
                        (asm_input:SI ("i") 0)
                    ] 7217092))
            (clobber (reg:QI 18 fpsr))
            (clobber (reg:QI 17 flags))
            (clobber (mem:BLK (scratch) [0 A8]))
        ]) -1 (expr_list:REG_UNUSED (reg/v:SI 59 [ ignore ])
        (expr_list:REG_UNUSED (reg:QI 18 fpsr)
            (expr_list:REG_UNUSED (reg:QI 17 flags)
                (nil)))))
malloc.c:5731: error: shared rtx
(const:SI (unspec:SI [
            (symbol_ref:SI ("main_arena") [flags 0x2] <var_decl 0x406e14d0 
main_arena>)
        ] 1))
malloc.c:5731: internal compiler error: internal consistency failure
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[2]: *** [/fromscratch-toolbase/src/glibc/build/malloc/malloc.os] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory 
`/fs/tmp/mount/chroot/gcc43/fromscratch-toolbase/src/glibc/unpack/glibc-2.7/malloc'
make[1]: *** [malloc/subdir_lib] Error 2
make[1]: Leaving directory 
`/fs/tmp/mount/chroot/gcc43/fromscratch-toolbase/src/glibc/unpack/glibc-2.7'
make: *** [all] Error 2

Attachment: pgpOpPUWU0I0N.pgp
Description: PGP signature

Reply via email to