[Bug target/49833] [x32] PIC doesn't work

hjl.tools at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Jul 25 20:11:00 GMT 2011


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

--- Comment #18 from H.J. Lu <hjl.tools at gmail dot com> 2011-07-25 20:10:27 UTC ---
(In reply to comment #14)
> Another problem:
> 
> [hjl@gnu-6 gcc]$ cat /tmp/bar.c
> typedef unsigned int Elf32_Addr;
> extern void _start (void);
> int
> dl_main ( Elf32_Addr *user_entry)
> {
>   if (*user_entry == (Elf32_Addr) _start)
>     return 0;
>   else
>     return 1;
> }
> [hjl@gnu-6 gcc]$ ./xgcc -B./ -S -O2 -fPIC /tmp/bar.c   -mx32 -std=gnu99  -dp
> /tmp/bar.c: In function ‘dl_main’:
> /tmp/bar.c:10:1: error: unrecognizable insn:
> (insn 6 5 7 3 (set (reg:SI 67)
>         (symbol_ref:SI ("_start") [flags 0x41] <function_decl 0x7faad972ff00
> _start>)) /tmp/bar.c:6 -1
>      (nil))
> /tmp/bar.c:10:1: internal compiler error: in extract_insn, at recog.c:2115
> Please submit a full bug report,
> with preprocessed source if appropriate.
> See <http://gcc.gnu.org/bugs.html> for instructions.
> [hjl@gnu-6 gcc]$

On x32 branch, I got

    .file    "bar.c"
    .text
    .p2align 4,,15
    .globl    dl_main
    .type    dl_main, @function
dl_main:
.LFB0:
    .cfi_startproc
    movl    _start@GOTPCREL(%rip), %eax    # 22    *movsi_internal/1    [length
= 6]
    cmpl    %eax, (%rdi)    # 8    *cmpsi_1/1    [length = 2]
    setne    %al    # 23    *setcc_qi    [length = 3]
    movzbl    %al, %eax    # 24    *zero_extendqisi2_movzbl    [length = 3]
    ret    # 27    return_internal    [length = 1]
    .cfi_endproc
.LFE0:
    .size    dl_main, .-dl_main
    .ident    "GCC: (GNU) 4.7.0 20110723 (experimental)"
    .section    .note.GNU-stack,"",@progbits



More information about the Gcc-bugs mailing list