qemu-i386 segfaults running "hello world".
Problem:
landley@triolith:~/firmware/firmware$ build/temp-i686/hello Hello world! landley@triolith:~/firmware/firmware$ qemu-i386 build/temp-i686/hello Segmentation fault (core dumped)
This is on a cvs snapshot from 15 minutes ago. The hello world is a statically linked executable built against uClibc 0.9.29. It runs fine from the command line, but qemu application emulation goes "boing".
The executable is attached.
Am I doing something wrong?
Rob
Signature · 2 lines
"One of my most productive days was throwing away 1000 lines of code." - Ken Thompson.
Ok, it's a more fundamental problem:
landley@triolith:/sys$ qemu-i386 Segmentation fault (core dumped)
Nothing to do with the program it's trying to run, it segfaults with no arguments.
Is anybody else seeing this?
Rob
Signature · 2 lines
"One of my most productive days was throwing away 1000 lines of code." - Ken Thompson.
Quoted 5 lines · Rob Landley
Ok, it's a more fundamental problem:
landley@triolith:/sys$ qemu-i386 Segmentation fault (core dumped)
Quoted 7 lines
Nothing to do with the program it's trying to run, it segfaults with no arguments.
Is anybody else seeing this?
Rob
agraf@mac:/vm/qemu-devel/patches/qemu> qemu-i386 ~/hello Hello world!
Well it works for me. I usually see this segfault when trying to compile qemu with a gcc4. Try gcc3 and everything should be fine.
Alex
Quoted 11 lines · Alexander Graf
Quoted 10 lines · Rob Landley
Ok, it's a more fundamental problem:
landley@triolith:/sys$ qemu-i386 Segmentation fault (core dumped)Nothing to do with the program it's trying to run, it segfaults with no arguments.
Is anybody else seeing this?
Quoted 7 lines
Quoted 2 lines
Rob
agraf@mac:/vm/qemu-devel/patches/qemu> qemu-i386 ~/hello Hello world!
Well it works for me. I usually see this segfault when trying to compile qemu with a gcc4. Try gcc3 and everything should be fine.
I usually see this when I forget to rebuild all files affected by a recent change (because the Makefile doesn't make the .depend before you tell it to).
Regards
Quoted 11 lines · On Friday 22 June 2007 19:13:19 Alexander Graf wrote:
Quoted 10 lines · Rob Landley
Ok, it's a more fundamental problem:
landley@triolith:/sys$ qemu-i386 Segmentation fault (core dumped)Nothing to do with the program it's trying to run, it segfaults with no arguments.
Is anybody else seeing this?
Quoted 7 lines
Quoted 1 line
Rob
agraf@mac:/vm/qemu-devel/patches/qemu> qemu-i386 ~/hello Hello world!
Well it works for me. I usually see this segfault when trying to compile qemu with a gcc4. Try gcc3 and everything should be fine.
It's using gcc-3.4. The one that comes with Ubuntu 7.04. (Or at least ./configure said it had found gcc-3.4 during configuration, anyway.)
I ran the sucker under strace and it seems to be segfaulting right before it calls main(). I stuck an exit(1) at the start of main and it doesn't get to it, but it's after all the shared libraries are loaded:
Quoted 17 lines
mprotect(0xb7f3f000, 4096, PROT_READ)= 0mprotect(0x80000000, 548864, PROT_READ|PROT_WRITE)= 0mprotect(0x80000000, 548864, PROT_READ|PROT_EXEC)= 0munmap(0xb7f76000, 57255)= 0set_tid_address(0xb7deca88)= 4338
sendto(-1210135920, umovestr: Input/output error0xc, 3084914676, MSG_DONTWAIT|MSG_CONFIRM|MSG_FIN|MSG_NOSIGNAL|MSG_MORE|0xb7de0000, {sa_family=AF_DECnet, sa_data="\0\0\320=\0\0\r\0\0\0p\362\0\0"}, 3217384328) = 0 rt_sigaction(SIGRTMIN, {0xb7df13f0, [],SA_SIGINFO}, NULL,
8) = 0rt_sigaction(SIGRT_1, {0xb7df1300, [], SA_RESTART|SA_SIGINFO}, NULL, 8)= 0rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8)= 0getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY})= 0uname({sys="Linux", node="triolith", ...})= 0killed by SIGSEGV (core dumped) +++ renamed from SIGSEGV (Segmentation fault) @ 0 (0) --- +0
-0
Quoted 1 line
Process 4338 detached
If I link "int main() {}" against -lm and -lrt I get the same set of calls up through the first mprotect. (The next two mprotects are probably setting up other segments like bss that an empty program doesn't have.) Then everything up through the uname() is the same... And then it would call "main".
Right now I'm commenting out various global variable initializations because that's what comes to mind as "stuff that runs right before main()".
By the way, by commenting out this bit:
//const char interp[] __attribute__((section(".interp"))) = "/lib/ld-linux.so.2";
I made it go from "segmentation fault" to "illegal instruction" as the reason it dies. Which is weird because there's no non-x86 toolchain the path, this is all stock Ubuntu stuff. But oh well...
Quoted 1 line
Alex
Rob
Signature · 2 lines
"One of my most productive days was throwing away 1000 lines of code." - Ken Thompson.
Quoted 6 lines · On Friday 22 June 2007 19:27:18 andrzej zaborowski wrote:
Quoted 2 lines
Well it works for me. I usually see this segfault when trying to compile qemu with a gcc4. Try gcc3 and everything should be fine.
I usually see this when I forget to rebuild all files affected by a recent change (because the
Makefiledoesn't make the .depend before you tell it to).
I did an rm -rf of the directory and re-downloaded it out from CVS when I first encountered this. Didn't fix it. I just did a "make distclean" and rebuilt again: same problem.
Quoted 1 line
Regards
Rob
Signature · 2 lines
"One of my most productive days was throwing away 1000 lines of code." - Ken Thompson.
Quoted 59 lines · Rob Landley
Quoted 11 lines · On Friday 22 June 2007 19:13:19 Alexander Graf wrote:
Quoted 10 lines · Rob Landley
Ok, it's a more fundamental problem:
landley@triolith:/sys$ qemu-i386 Segmentation fault (core dumped)Nothing to do with the program it's trying to run, it segfaults with no arguments.
Is anybody else seeing this?
Quoted 7 lines
Quoted 1 line
Rob
agraf@mac:/vm/qemu-devel/patches/qemu> qemu-i386 ~/hello Hello world!
Well it works for me. I usually see this segfault when trying to compile qemu with a gcc4. Try gcc3 and everything should be fine.
It's using gcc-3.4. The one that comes with Ubuntu 7.04. (Or at least ./configure said it had found gcc-3.4 during configuration, anyway.)
I ran the sucker under strace and it seems to be segfaulting right before it calls
main(). I stuck an exit(1) at the start of main and it doesn't get to it, but it's after all the shared libraries are loaded:Quoted 17 lines
mprotect(0xb7f3f000, 4096, PROT_READ)= 0mprotect(0x80000000, 548864, PROT_READ|PROT_WRITE)= 0mprotect(0x80000000, 548864, PROT_READ|PROT_EXEC)= 0munmap(0xb7f76000, 57255)= 0set_tid_address(0xb7deca88)= 4338
sendto(-1210135920, umovestr: Input/output error0xc, 3084914676, MSG_DONTWAIT|MSG_CONFIRM|MSG_FIN|MSG_NOSIGNAL|MSG_MORE|0xb7de0000, {sa_family=AF_DECnet, sa_data="\0\0\320=\0\0\r\0\0\0p\362\0\0"}, 3217384328) = 0 rt_sigaction(SIGRTMIN, {0xb7df13f0, [],SA_SIGINFO}, NULL,
8) = 0rt_sigaction(SIGRT_1, {0xb7df1300, [], SA_RESTART|SA_SIGINFO}, NULL, 8)= 0rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8)= 0getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY})= 0uname({sys="Linux", node="triolith", ...})= 0killed by SIGSEGV (core dumped) +++ renamed from SIGSEGV (Segmentation fault) @ 0 (0) --- +0
-0Quoted 1 line
Process 4338 detached
If I link "int
main(){}" against -lm and -lrt I get the same set of calls up through the first mprotect. (The next two mprotects are probably setting up other segments like bss that an empty program doesn't have.) Then everything up through theuname()is the same... And then it would call "main".Right now I'm commenting out various global variable initializations because that's what comes to mind as "stuff that runs right before
main()".By the way, by commenting out this bit:
//const char interp[] __attribute__((section(".interp"))) = "
/lib/ld-linux.so.2";
Quoted 12 lines
I made it go from "segmentation fault" to "illegal instruction" as the reason it dies. Which is weird because there's no non-x86 toolchain the path, this is all stock Ubuntu stuff. But oh well...
Quoted 1 line
Alex
Rob
Signature · 2 lines
"One of my most productive days was throwing away 1000 lines of code." - Ken Thompson.
I guess you're running on i586 then? I only tried this on ppc.
Last time I checked the code-copy stuff was broken, so maybe it helps to disable that?
If that doesn't work either - would you mind to gdb it and run a "bt" when it segfaulted so we can see if the segfault is in the generated code?
Alex
Quoted 11 lines · On Friday 22 June 2007 18:31:20 Rob Landley wrote:
Ok, it's a more fundamental problem:
landley@triolith:/sys$ qemu-i386 Segmentation fault (core dumped)Nothing to do with the program it's trying to run, it segfaults with no arguments.
Is anybody else seeing this?
Rob
So I'm vaguely suspecting that some of the dynamic linker magic this thing's doing is contributing to the screw up (or at least the complexity of debugging it), so I thought I'd statically link.
If I ./configure --static the result doesn't build, it dies during linking. Is this expected? (Do I need to install .a versions of all the alsa and x11 libraries to make that work?)
I realize releases are a bit out of fashion, but is there any way to go through cvs to track down which checkin broke this stuff? I can do it in git, mercurial, or subversion. But cvs isn't really set up for this sort of thing...
Rob
Signature · 2 lines
"One of my most productive days was throwing away 1000 lines of code." - Ken Thompson.
Quoted 9 lines · Rob Landley
Ok, it's a more fundamental problem:
landley@triolith:/sys$ qemu-i386 Segmentation fault (core dumped)Nothing to do with the program it's trying to run, it segfaults with no arguments.
Is anybody else seeing this?
Yes, I get it.
Quoted 2 lines
Rob
-Nigel
Quoted 17 lines · Rob Landley
Quoted 11 lines · On Friday 22 June 2007 18:31:20 Rob Landley wrote:
Ok, it's a more fundamental problem:
landley@triolith:/sys$ qemu-i386 Segmentation fault (core dumped)Nothing to do with the program it's trying to run, it segfaults with no arguments.
Is anybody else seeing this?
Rob
So I'm vaguely suspecting that some of the dynamic linker magic this thing's doing is contributing to the screw up (or at least the complexity of debugging it), so I thought I'd statically link.
Quoted 8 lines
If I ./configure --static the result doesn't build, it dies during linking. Is this expected? (Do I need to install .a versions of all the alsa and x11 libraries to make that work?)
I realize releases are a bit out of fashion, but is there any way to go through cvs to track down which checkin broke this stuff? I can do it in git, mercurial, or subversion. But cvs isn't really set up for this sort of thing...
git clone git://git.kernel.dk/data/git/qemu.git
and bisect on that then. It's a continued git import of the cvs repo, gets updated every night.
Signature · 1 line
Jens Axboe
Quoted 11 lines · Rob Landley
Ok, it's a more fundamental problem:
landley@triolith:/sys$ qemu-i386 Segmentation fault (core dumped)Nothing to do with the program it's trying to run, it segfaults with no arguments.
Is anybody else seeing this?
Rob
Yes, I see this on Debian Linux since several months (libc update?).
The crash is caused by libc startup code which calls a null pointer. QEMU provides this null pointer with the __init_array_start workaround in linux-user/main.c.
This can be fixed with some kind of code hack - see my patch (which is not really a solution, but one more workaround).
Nevertheless user mode emulations remains unusable even with this patch because of TLS problems.
Regards,
Stefan
Index: linux-user/main.c
===================================================================
RCS file: /sources/qemu/qemu/linux-user/main.c,v
retrieving revision 1.116
main.c +10 -6
@@ -45,12 +45,16 @@/* for recent libc, we add these dummy symbols which are not declared when generating a linked object (bug in ld ?) */ #if (__GLIBC__ >2 || (__GLIBC__ ==2 && __GLIBC_MINOR__ >=3 )) && !defined(CONFIG_STATIC ) -long __preinit_array_start[0 ]; -long __preinit_array_end[0 ]; -long __init_array_start[0 ]; -long __init_array_end[0 ]; -long __fini_array_start[0 ]; -long __fini_array_end[0 ]; +typedef void (*dummy_function_t )(void ); +static void dummy_function (void ) +{ +} +dummy_function_t __preinit_array_start = dummy_function; +dummy_function_t __preinit_array_end = dummy_function; +dummy_function_t __init_array_start = dummy_function; +dummy_function_t __init_array_end = dummy_function; +dummy_function_t __fini_array_start = dummy_function; +dummy_function_t __fini_array_end = dummy_function;#endif /* XXX: on x86 MAP_GROWSDOWN only works if ESP <= address + 32, so
Quoted 1 line · On Saturday 23 June 2007 03:27:03 Alexander Graf wrote:
I guess you're running on i586 then?
Athlon. (/proc/cpuinfo says "AMD Sempron(tm) 2200+")
Quoted 3 lines
I only tried this on ppc.
Last time I checked the code-copy stuff was broken, so maybe it helps to disable that?
What code-copy stuff? (How do I disable that?)
Quoted 3 lines
If that doesn't work either - would you mind to gdb it and run a "bt" when it segfaulted so we can see if the segfault is in the generated code?
Sure... except it has no debugging symbols so the backtrace is just numbers and an occasional library name. How about... Huh, ./configure --help doesn't show any sort of --enable-debug... Trying "./configure --extra-cflags=-g"... Nope, that stripped it too. Ok, grep for "strip" and it shows up in multiple places. It's in ./configure but I can't seem to tell configure not to do it. Maybe "make STRIP=echo" would work? Nope...
Grrr:
make clean
mkdir sub
ln /bin/echo sub/strip
PATH=pwd/sub:$PATH make
Ok, that didn't do it either.
Would somebody like to clue me in on how to get this darn thing to build a version with debugging symbols, please?
In the meantime:
Program received signal SIGSEGV, Segmentation fault. 0x00000000 in ?? ()
(gdb) bt
#0 0x00000000 in ?? () #1 0x800773a9 in ?? () #2 0x00000001 in ?? () #3 0xbff09304 in ?? () #4 0xbff0930c in ?? () #5 0xb7f75ff4 in ?? () #6 0xb7fc77b0 in ?? () from /lib/ld-linux.so.2 #7 0x80077350 in ?? () #8 0xffffffee in ?? () #9 0xb7f75ff4 in ?? ()
#10 0xb7fd3ce0 in ?? () from /lib/ld-linux.so.2
#11 0x80077350 in ?? ()
#12 0xbff092d8 in ?? ()
#13 0xb7e4ee61 in ?? ()
#14 0x00000001 in ?? ()
#15 0xbff09304 in ?? ()
#16 0xbff0930c in ?? ()
#17 0xb7fbbdcb in ?? () from /lib/ld-linux.so.2
#18 0x00000000 in ?? ()
Kind of useless...
Quoted 1 line
Alex
Rob
Signature · 2 lines
"One of my most productive days was throwing away 1000 lines of code." - Ken Thompson.
Quoted 9 lines · On Saturday 23 June 2007 07:00:03 Jens Axboe wrote:
Quoted 4 lines
I realize releases are a bit out of fashion, but is there any way to go through cvs to track down which checkin broke this stuff? I can do it in git, mercurial, or subversion. But cvs isn't really set up for this sort of thing...
git clone
git://git.kernel.dk/data/git/qemu.gitand bisect on that then. It's a continued git import of the cvs repo, gets updated every night.
Oh _cool_. Any way to get a mention of that on the qemu web page?
Thanks,
Rob
Signature · 2 lines
"One of my most productive days was throwing away 1000 lines of code." - Ken Thompson.
Quoted 6 lines · On Saturday 23 June 2007 07:12:39 Stefan Weil wrote:
Quoted 5 lines · Rob Landley
Ok, it's a more fundamental problem:
landley@triolith:/sys$ qemu-i386 Segmentation fault (core dumped)
Quoted 8 lines
Quoted 6 lines
Nothing to do with the program it's trying to run, it segfaults with no arguments.
Is anybody else seeing this?
Rob
Yes, I see this on Debian Linux since several months (libc update?).
Ubuntu 7.04 is using glibc-2.5.
Quoted 3 lines
The crash is caused by libc startup code which calls a null pointer. QEMU provides this null pointer with the
__init_array_startworkaround inlinux-user/main.c.
What exactly is this working around, anyway? There are comments in the code that it's doing something fancy (being both a shared library and an executable, I think) but I'm not sure why...
Quoted 2 lines
This can be fixed with some kind of code hack - see my patch (which is not really a solution, but one more workaround).
I applied your patch and still got the segfault.
Quoted 2 lines
Nevertheless user mode emulations remains unusable even with this patch because of TLS problems.
That I know how to work around. Set the environment variable LD_ASSUME_KERNEL=2.4.1 and glibc won't try to use TLS.
Quoted 2 lines
Regards,
Stefan
Rob
Signature · 2 lines
"One of my most productive days was throwing away 1000 lines of code." - Ken Thompson.
Quoted 6 lines · Rob Landley
Quoted 5 lines · On Saturday 23 June 2007 07:00:03 Jens Axboe wrote:
Quoted 4 lines
I realize releases are a bit out of fashion, but is there any way to go through cvs to track down which checkin broke this stuff? I can do it in git, mercurial, or subversion. But cvs isn't really set up for this sort of thing...
Quoted 6 lines
Quoted 4 lines
git clone
git://git.kernel.dk/data/git/qemu.gitand bisect on that then. It's a continued git import of the cvs repo, gets updated every night.
Oh _cool_. Any way to get a mention of that on the qemu web page?
I don't mind, it's already mentioned on some japanese qemu-win page for quite some time.
Signature · 1 line
Jens Axboe
Hi,
this is the patch we are currently using to build qemu-0.9.0. Does this work for you?
Alex
i386.ld +143 -95
@@ -1,116 +1,164 @@ -/* ld script to make i386 Linux kernel - * Written by Martin Mares <[email protected]>; - */ -OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") +/* Default linker script, for normal executables */ +OUTPUT_FORMAT("elf32-i386", "elf32-i386", + "elf32-i386") OUTPUT_ARCH(i386) -SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/alpha-unknown-linux-gnu/lib); ENTRY(_start) +SEARCH_DIR("/usr/i586-suse-linux/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib"); SECTIONS { /* Read-only sections, merged into text segment: */ - . = 0x60000000 + SIZEOF_HEADERS; - .interp : { *(.interp) } - .hash : { *(.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .gnu.version : { *(.gnu.version) } - .gnu.version_d : { *(.gnu.version_d) } - .gnu.version_r : { *(.gnu.version_r) } - .rel.text : - { *(.rel.text) *(.rel.gnu.linkonce.t*) } - .rela.text : - { *(.rela.text) *(.rela.gnu.linkonce.t*) } - .rel.data : - { *(.rel.data) *(.rel.gnu.linkonce.d*) } - .rela.data : - { *(.rela.data) *(.rela.gnu.linkonce.d*) } - .rel.rodata : - { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } - .rela.rodata : - { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } - .rel.got : { *(.rel.got) } - .rela.got : { *(.rela.got) } - .rel.ctors : { *(.rel.ctors) } - .rela.ctors : { *(.rela.ctors) } - .rel.dtors : { *(.rel.dtors) } - .rela.dtors : { *(.rela.dtors) } - .rel.init : { *(.rel.init) } - .rela.init : { *(.rela.init) } - .rel.fini : { *(.rel.fini) } - .rela.fini : { *(.rela.fini) } - .rel.bss : { *(.rel.bss) } - .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .init : { *(.init) } =0x47ff041f - .text : + PROVIDE (__executable_start = 0x60000000); . = 0x60000000 + SIZEOF_HEADERS; + .interp : { *(.interp) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .gnu.version : { *(.gnu.version) } + .gnu.version_d : { *(.gnu.version_d) } + .gnu.version_r : { *(.gnu.version_r) } + .rel.init : { *(.rel.init) } + .rela.init : { *(.rela.init) } + .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } + .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } + .rel.fini : { *(.rel.fini) } + .rela.fini : { *(.rela.fini) } + .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } + .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } + .rel.data.rel.ro : { *(.rel.data.rel.ro*) } + .rela.data.rel.ro : { *(.rel.data.rel.ro*) } + .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } + .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } + .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } + .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } + .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } + .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } + .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + .init : { - *(.text) + KEEP (*(.init)) + } =0x90909090 + .plt : { *(.plt) } + .text : + { + *(.text .stub .text.* .gnu.linkonce.t.*) + KEEP (*(.text.*personality*)) /* .gnu.warning sections are handled specially by elf32.em. */ *(.gnu.warning) - *(.gnu.linkonce.t*) - } =0x47ff041f - _etext = .; + } =0x90909090 + .fini : + { + KEEP (*(.fini)) + } =0x90909090 + PROVIDE (__etext = .); + PROVIDE (_etext = .); PROVIDE (etext = .); - .fini : { *(.fini) } =0x47ff041f - . = ALIGN(32 / 8); - PROVIDE (__preinit_array_start = .); - .preinit_array : { *(.preinit_array) } - PROVIDE (__preinit_array_end = .); - PROVIDE (__init_array_start = .); - .init_array : { *(.init_array) } - PROVIDE (__init_array_end = .); - PROVIDE (__fini_array_start = .); - .fini_array : { *(.fini_array) } - PROVIDE (__fini_array_end = .); - .rodata : { *(.rodata) *(.gnu.linkonce.r*) } - .rodata1 : { *(.rodata1) } - .reginfo : { *(.reginfo) } + .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } + .rodata1 : { *(.rodata1) } + .eh_frame_hdr : { *(.eh_frame_hdr) } + .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } + .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) } /* Adjust the address for the data segment. We want to adjust up to the same address within the page on the next page up. */ - . = ALIGN(0x100000) + (. & (0x100000 - 1)); - .data : + . = ALIGN (0x1000) - ((0x1000 - .) & (0x1000 - 1)); . = DATA_SEGMENT_ALIGN (0x1000, 0x1000); + /* Exception handling */ + .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } + .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } + /* Thread Local Storage sections */ + .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } + .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } + .preinit_array : + { + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + } + .init_array : + { + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + } + .fini_array : + { + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + } + .ctors : + { + /* gcc uses crtbegin.o to find the start of + the constructors, so we make sure it is + first. Because this is a wildcard, it + doesn't matter if the user does not + actually link against crtbegin.o; the + linker won't look for a file to match a + wildcard. The wildcard also means that it + doesn't matter which directory crtbegin.o + is in. */ + KEEP (*crtbegin*.o(.ctors)) + /* We don't want to include the .ctor section from + from the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + } + .dtors : + { + KEEP (*crtbegin*.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + } + .jcr : { KEEP (*(.jcr)) } + .data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro*) } + .dynamic : { *(.dynamic) } + .got : { *(.got) } + . = DATA_SEGMENT_RELRO_END (12, .); + .got.plt : { *(.got.plt) } + .data : { - *(.data) - *(.gnu.linkonce.d*) - CONSTRUCTORS - } - .data1 : { *(.data1) } - .ctors : - { - *(.ctors) - } - .dtors : - { - *(.dtors) - } - .plt : { *(.plt) } - .got : { *(.got.plt) *(.got) } - .dynamic : { *(.dynamic) } - /* We want the small data sections together, so single-instruction offsets - can access them all, and initialized data all before uninitialized, so - we can shorten the on-disk segment size. */ - .sdata : { *(.sdata) } - _edata = .; - PROVIDE (edata = .); + *(.data .data.* .gnu.linkonce.d.*) + KEEP (*(.gnu.linkonce.d.*personality*)) + SORT(CONSTRUCTORS) + } + .data1 : { *(.data1) } + _edata = .; PROVIDE (edata = .); __bss_start = .; - .sbss : { *(.sbss) *(.scommon) } - .bss : + .bss : { *(.dynbss) - *(.bss) + *(.bss .bss.* .gnu.linkonce.b.*) *(COMMON) + /* Align here to ensure that the .bss section occupies space up to + _end. Align after .bss to ensure correct alignment even if the + .bss section disappears because there are no input sections. + FIXME: Why do we need it? When there is no .bss section, we don't + pad the .data section. */ + . = ALIGN(. != 0 ? 32 / 8 : 1); } - _end = . ; + . = ALIGN(32 / 8); + . = ALIGN(32 / 8); + _end = .; PROVIDE (end = .); + . = DATA_SEGMENT_END (.); /* Stabs debugging sections. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } + .comment 0 : { *(.comment) } /* DWARF debug sections. Symbols in the DWARF debugging sections are relative to the beginning of the section so we begin them at 0. */
@@ -124,7 +172,7 @@ .debug_aranges 0 : { *(.debug_aranges) } .debug_pubnames 0 : { *(.debug_pubnames) } /* DWARF 2 */ - .debug_info 0 : { *(.debug_info) } + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } .debug_abbrev 0 : { *(.debug_abbrev) } .debug_line 0 : { *(.debug_line) } .debug_frame 0 : { *(.debug_frame) }
@@ -136,5 +184,5 @@ .debug_funcnames 0 : { *(.debug_funcnames) } .debug_typenames 0 : { *(.debug_typenames) } .debug_varnames 0 : { *(.debug_varnames) } - /* These must appear regardless of . */ + /DISCARD/ : { *(.note.GNU-stack) } }
ppc.ld +173 -88
301 lines not on this page · raw message
Quoted 6 lines · On Monday 02 July 2007 11:02:49 Alexander Graf wrote:
Hi,
this is the patch we are currently using to build qemu-0.9.0. Does this work for you?
Alex
Let's see...
i386.ld line 3
Quoted 7 lines
i386.ld +3
-4-/* ld script to make i386 Linux kernel - * Written by Martin Mares <[email protected]>; - */ -OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") +/* Default linker script, for normal executables */ +OUTPUT_FORMAT("elf32-i386", "elf32-i386", + "elf32-i386")
That's just a whitespace change and removal of credit.
Quoted 1 line
+SEARCH_DIR("/usr/i586-suse-linux/lib");
SEARCH_DIR("/usr/local/lib");
I haven't got SuSE.
The next hunk is another huge multi-page whitespace change with code changes sprinkled in it.
I have no idea what this patch does, but the second hunk is suse-specific and the second half of it is for qemu-ppc which builds runs for me. (Dunno if it _works_, but it's not segfaulting immediately when I run it...)
Rob
Signature · 2 lines
"One of my most productive days was throwing away 1000 lines of code." - Ken Thompson.
Am 10.07.2007 um 17:47 schrieb Rob Landley:
Quoted 3 lines
I have no idea what this patch does, but the second hunk is suse-specific and the second half of it is for qemu-ppc which builds runs for me. (Dunno if it _works_, but it's not segfaulting immediately when I run it...)
ppc-softmmu does not build on OS X for me, there are two undefined symbol references, caused in some way by function aliasing. Would be nice if someone could fix that in CVS.
I got a number of error messages and an (emulated) crash when booting a Debian CD on both ppc and ppc64 so am unsure whether it's my quickfix (attached) or normal behavior. :-)
Andreas
? .DS_Store
? ia64-softmmu
Index: hw/ppc.c
===================================================================
RCS file: /sources/qemu/qemu/hw/ppc.c,v retrieving revision 1.22
diff -r1.22 ppc.c
599c599,602
< __attribute__ (( alias ("cpu_ppc_store_tbu") ));
---
Quoted 4 lines
//__attribute__ (( alias ("
cpu_ppc_store_tbu") ));{ cpu_ppc_store_tbu(env, value); }
602c605,608
< __attribute__ (( alias ("cpu_ppc_load_tbu") ));
---
Quoted 4 lines
//__attribute__ (( alias ("
cpu_ppc_load_tbu") ));{ return cpu_ppc_load_tbu(env); }