From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32430 invoked by alias); 26 Jul 2002 10:20:59 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 32400 invoked from network); 26 Jul 2002 10:20:56 -0000 Received: from unknown (HELO ngate.noida.hcltech.com) (202.54.110.230) by sources.redhat.com with SMTP; 26 Jul 2002 10:20:56 -0000 Received: from exch-01.noida.hcltech.com (exch-01 [204.160.254.29]) by ngate.noida.hcltech.com (8.9.3/8.9.3) with ESMTP id PAA11868; Fri, 26 Jul 2002 15:49:46 +0530 Received: by exch-01.noida.hcltech.com with Internet Mail Service (5.5.2653.19) id ; Fri, 26 Jul 2002 15:48:47 +0530 Message-ID: From: "Nitin Gupta, Noida" To: gcc@gcc.gnu.org Cc: aoliva@redhat.com Subject: .stack section in binary generated by sh-elf-gcc Date: Fri, 26 Jul 2002 14:57:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-SW-Source: 2002-07/txt/msg01274.txt.bz2 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