[Bug target/38988] Cannot build crtstuff.c with -mcmodel=large -fPIC -O2

hjl dot tools at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Jan 27 18:07:00 GMT 2009



------- Comment #4 from hjl dot tools at gmail dot com  2009-01-27 18:07 -------
Assuming you have solved crtstuff.c issue, will /usr/lib64/crt1.o
work with -Wl,--section-start,.text=0x110000000? Can you try
the latest binutils from CVS with

[hjl@gnu-6 pr38988]$ cat f.c
#include <stdio.h>

int
main ()
{
  printf ("hello\n");
  return 0;
}
[hjl@gnu-6 pr38988]$ gcc f.c -Wl,-Ttext-segment,0x110000000 -fpie -pie -g
[hjl@gnu-6 pr38988]$ gdb a.out 
GNU gdb (GDB) 6.8.50.20081208-cvs (AVX revision 4683)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
(gdb) b main
Breakpoint 1 at 0x110000708: file f.c, line 6.
(gdb) r
Starting program: /export/home/hjl/bugs/gcc/pr38988/a.out 

Breakpoint 1, main () at f.c:6
6         printf ("hello\n");
(gdb) p $rip
$1 = (void (*)()) 0x110000708 <main+4>
(gdb) c
Continuing.
hello

Program exited normally.
(gdb) 

I added a new linker switch:

-Ttext-segment ADDRESS      Set address of text segment

It may work for you.


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


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



More information about the Gcc-bugs mailing list