public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* .stack section in binary generated by sh-elf-gcc
@ 2002-07-26 14:57 Nitin  Gupta, Noida
  0 siblings, 0 replies; only message in thread
From: Nitin  Gupta, Noida @ 2002-07-26 14:57 UTC (permalink / raw)
  To: gcc; +Cc: aoliva

Hi,
	The flag of .stack section of elf generated by sh-elf-gcc 3.1.1-pre 
	is set to "WA" while in the elf binary gnereted by sh-elf-gcc
3.2-pre
	it is set to "W". I have attached the readelf output in the end of
this 
	mail for your reference.
	
	Since sh-elf-gcc links statically, the extent of .text in C++
binaries crosses 
	address 0x30000 which happens to be the starting address of .stack
sections 
	in SH.  Due to this  the ld exits giving .text and .stack section
overlap error 
	when using  sh-elf-gcc 3.1.1-pre. However when using sh-elf-gcc
3.2-pre the ld 
	does not report an overlap error.

	The linking of C++ binary works well when I modified
gcc-3_1_1-pre/gcc/config/sh/crt1.asm
	to remove the description of .stack section (as it is done in
gcc-3_2-pre). Please
	let me know is it safe for gcc 3.1.1? 
	However newlib-1.10.0/newlib/libc/sys/sh/crt0.S still retains the
	old description of .stack section for __ELF__. I found the follwoing
message 
	about the two startup files
http://gcc.gnu.org/ml/gcc-help/2001-06/msg00005.html. 
	Does it mean that newlib/libc/sys/sh/crt0.S is obselete?
	
	Besides newlib-1.10.0,  I'm using binutils-1.12 with both compiler
build.

Thanks in advance for your help.
Best Regards
Nitin.

PS: 	Readef output:

	$ sh-elf-gcc -v
		Reading specs from
/home/niting/gcc_release/sh-elf/tools/bin/../lib/gcc-lib/sh-elf/3.1.1/specs
		Configured with: ../../gcc/configure
--prefix=/home/niting/gcc_release/sh-elf/tools/ --target=sh-elf
--with-newlib --enable-languages=c,c++ --with-gnu-ld --with-gnu-as
--with-ld=/home/niting/gcc_release/sh-elf/tools/sh-elf/bin/ld
--with-as=/home/niting/gcc_release/sh-elf/tools/sh-elf/bin/as
--with-headers=/home/niting/gcc_release/newlib-1.10.0/newlib/libc/include/
		Thread model: single
		gcc version 3.1.1 20020723 (prerelease)

		$sh-elf-gcc hello.c

		$readelf -S a.out
		Section Headers:
		  [Nr] Name              Type               Addr
Off     Size     ES  Flg  Lk Inf Al
		  [ 2] .text             PROGBITS        00001038 0000b8
006728  00  AX   0   0  4
		...
		  [20] .stack            PROGBITS        00030000 0338ca
000000 00 WA  0   0  1


		$ sh-elf-gcc -v
		Reading specs from
/home/niting/gcc_release/sh-elf/tools/bin/../lib/gcc-lib/sh-elf/3.2/specs
		Configured with: /home/niting/gcc_release/gcc_3_x/configure
--prefix=/home/niting/gcc_release/sh-elf/tools/ --target=sh-elf
--with-newlib --enable-languages=c,c++ --with-gnu-ld --with-gnu-as
--with-ld=/home/niting/gcc_release/sh-elf/tools/sh-elf/bin/ld
--with-as=/home/niting/gcc_release/sh-elf/tools/sh-elf/bin/as
--with-headers=/home/niting/gcc_release/newlib-1.10.0/newlib/libc/include/
		Thread model: single
		gcc version 3.2 20020703 (experimental)

		$sh-elf-gcc hello.c


		Section Headers:
		  [Nr] Name              Type              Addr          Off
Size     ES  Flg  Lk Inf Al
		  [ 2] .text             PROGBITS        00001038 0000b8
00668c 00  AX  0   0  4
		...
		  [21] .stack            PROGBITS        00030000 034aca
000000 00 W  0   0  1

		Please note that both Write and Alloc flag is set for .stack
section in binary generated by gcc 3.1.1 pre however only Write flag
		is set in the one genrated by gcc 3.2

	
	

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-07-26 10:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-26 14:57 .stack section in binary generated by sh-elf-gcc Nitin  Gupta, Noida

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).