bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gold/16945] New: [Gold] Executable with -fpie and -mcmodel=large gi


From: aivchenk at gmail dot com
Subject: [Bug gold/16945] New: [Gold] Executable with -fpie and -mcmodel=large gives segfault on start
Date: Wed, 14 May 2014 20:47:09 +0000

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

            Bug ID: 16945
           Summary: [Gold] Executable with -fpie and -mcmodel=large gives
                    segfault on start
           Product: binutils
           Version: 2.25 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gold
          Assignee: ian at airs dot com
          Reporter: aivchenk at gmail dot com
                CC: ccoutant at google dot com

> cat mcmodel_large.c
#include <stdlib.h>
#include <stdio.h>

int main()
{
  fprintf(stdout, "Hello\n");
  return 0;
}


> g++ -g -O0 -B/gold/.. mcmodel_large.c -fpic -mcmodel=large -o gold.out
> ./gold.out
Segmentation fault


The disassembler:
int main()
{
4005da:       55                      push   %rbp
4005db:       48 89 e5                mov    %rsp,%rbp
4005de:       53                      push   %rbx                              
                                                                               
             4005df:       48 83 ec 08             sub    $0x8,%rsp
4005e3:       48 8d 1d f9 ff ff ff    lea    -0x7(%rip),%rbx  #
4005e3<main+0x9>
4005ea:       49 bb fd 13 00 00 00    movabs $0x13fd,%r11
4005f1:       00 00 00
4005f4:       4c 01 db                add    %r11,%rbx
  fprintf(stdout, "Hello\n");                                                  
                                                                               
          4005f7:       48 b8 f8 ff ff ff 00    movabs $0xfffffff8,%rax
4005fe:       00 00 00                                                         
                                                                               
        400601:       48 8b 04 03             mov    (%rbx,%rax,1),%rax <<<
SEGFAULT
400605:       48 8b 00                mov    (%rax),%rax
400608:       48 89 c1                mov    %rax,%rcx
40060b:       ba 06 00 00 00          mov    $0x6,%edx                         
                                                                               
        400610:       be 01 00 00 00          mov    $0x1,%esi
400615:       48 b8 10 ed ff ff ff    movabs $0xffffffffffffed10,%rax          
                                                                               
        40061c:       ff ff ff
40061f:       48 8d 3c 03             lea    (%rbx,%rax,1),%rdi
400623:       48 b8 f0 ea ff ff ff    movabs $0xffffffffffffeaf0,%rax
40062a:       ff ff ff
40062d:       48 01 d8                add    %rbx,%rax
400630:       ff d0                   callq  *%rax
  return 0;
400632:       b8 00 00 00 00          mov    $0x0,%eax
}


Addendum in instruction at 4005f7 is wrong..

-- 
You are receiving this mail because:
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]