From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20861 invoked by alias); 16 May 2006 15:28:48 -0000 Received: (qmail 20847 invoked by uid 22791); 16 May 2006 15:28:47 -0000 X-Spam-Check-By: sourceware.org Received: from web26907.mail.ukl.yahoo.com (HELO web26907.mail.ukl.yahoo.com) (217.146.176.96) by sourceware.org (qpsmtpd/0.31) with SMTP; Tue, 16 May 2006 15:28:43 +0000 Received: (qmail 79871 invoked by uid 60001); 16 May 2006 15:28:41 -0000 Message-ID: <20060516152841.79869.qmail@web26907.mail.ukl.yahoo.com> Received: from [80.168.43.100] by web26907.mail.ukl.yahoo.com via HTTP; Tue, 16 May 2006 17:28:41 CEST Date: Tue, 16 May 2006 22:47:00 -0000 From: Etienne Lorrain Subject: Re: `.sym' referenced in section `reloc_sym' of file.o: defined in discarded section `.text.sym' of file.o To: Alan Modra Cc: binutils@sourceware.org In-Reply-To: <20060516150145.GI19700@bubble.grove.modra.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2006-05/txt/msg00275.txt.bz2 --- Alan Modra wrote: > On Tue, May 16, 2006 at 01:34:25PM +0200, Etienne Lorrain wrote: > > My problem is when the function (for instance) linux_set_params is not used > > at all in the link process, and is discarded because I am using GCC > > -ffunction-sections and LD --gc-sections, it is still referenced in > > ".section reloc_paramcode_section" > > What is special about reloc_paramcode_section? ie. How are you managing > to confuse the linker into thinking the reference in that section is not > a normal use, which should result in linux_set_params being kept? > > Do you have a small self-contained testcase? I do not know what is special about reloc_paramcode_section, but I noticed the message do not appear if --no-check-sections is not a parameter of ld !!! No testcase from C, but from assembler, with two files: etienne@cygne:~/projet/gujin$ cat vmlinuz.s .code16gcc .psize 0 .section reloc_xcode_section .weak fptr_treat_gzip_name fptr_treat_gzip_name: .long treat_gzip_name .previous .section .xcode.treat_gzip_name,"ax",@progbits .p2align 1,,1 .globl treat_gzip_name .type treat_gzip_name, @function treat_gzip_name: pushl %edi # pushl %esi # pushl %edx # movl 16(%esp), %edx # ptr, ptr cmpl $LOADER+4, LOADER+76 #, LOADER.curfileload jne .L266 #, .L266: popl %eax # popl %esi # popl %edi # lretw $4 # .size treat_gzip_name, .-treat_gzip_name etienne@cygne:~/projet/gujin$ cat boot.lnk MEMORY { ram : ORIGIN = 0, LENGTH = 64K } EXTERN(__ERROR) SECTIONS { .text 0 : AT (0) { /* boot.o(SORT(.text_start*)) */ /* KEEP (boot.o(.text_start*)); */ *(.text*) __sizeof_gujin_code_in_text = . ; . = ALIGN (32) ; _etext = . ; } > ram = 0 .xcode 0 : AT(SIZEOF(.text)) { /* boot.o (.xcode_start) */ /* KEEP (boot.o(.xcode_start)); */ *(.xcode*) __sizeof_gujin_code_in_extra = . ; . = ALIGN (32) ; } > ram = 0 __sizeof_all_code = SIZEOF(.text) + SIZEOF(.xcode); .xdata 0 : AT(__sizeof_all_code) { /* gzlib.o(.xdata*) */ /* font.o(.xdata*) */ . = ALIGN (8); __paramcode_start = .; *(.paramcode*) __sizeof_paramcode = . - __paramcode_start; *(.xdata*) . = ALIGN (32); _exdata = . ; __sizeof_xdata = . ; } > ram = 0 .data 0 : AT(__sizeof_all_code + __sizeof_xdata) { *(.fourKsegment*) _srodata = . ; reloc_text_start = . ; *(reloc_text_section) reloc_text_end = . ; reloc_xcode_start = . ; *(reloc_xcode_section) reloc_xcode_end = . ; *(reloc_paramcode_section) *(.rodata.str1*) *(.rodata*) . = ALIGN (32) ; _erodata = . ; __sizeof_constants = _erodata - _srodata ; _end = . ; _sdata = . ; *(.data) . = ALIGN (32); _sbss = . ; __sizeof_inited_data = _sbss - _sdata ; } > ram = 0 .bss ALIGN(0x10) (NOLOAD) : { *(COMMON) *(.bss) . = ALIGN (4); _edata = . ; } > ram = 0 __sizeof_zeroed_data = SIZEOF (.bss) ; .note (NOLOAD) : { *(.note) } .comment (NOLOAD) : { *(.comment) } .stab (NOLOAD) : { *(.stab) } .stabstr (NOLOAD) : { *(.stabstr) } } NOCROSSREFS (.text .xcode); EXTERN (xcodeseg_never_call_address_zero); xcodeseg = SIZEOF(.text) >> 4 ; _extext = SIZEOF(.xcode); xdataseg = __sizeof_all_code >> 4; deltaseg = (__sizeof_all_code + SIZEOF(.xdata)) >> 4; etienne@cygne:~/projet/gujin$ as vmlinuz.s -o vmlinuz.o etienne@cygne:~/projet/gujin$ ld vmlinuz.o -Tboot.lnk --no-check-sections --gc-sections -o boot.elf ld: warning: no memory region specified for loadable section `.rel.dyn' ld: boot.elf: warning: allocated section `.data' not in segment `treat_gzip_name' referenced in section `reloc_xcode_section' of vmlinuz.o: defined in discarded section `.xcode.treat_gzip_name' of vmlinuz.o etienne@cygne:~/projet/gujin$ ld vmlinuz.o -Tboot.lnk --gc-sections -o boot.elf ld: error: no memory region specified for loadable section `.rel.dyn' etienne@cygne:~/projet/gujin$ I think I really need the --no-check-sections, because most of my segments start at 0 and have a max size of 64 Kbytes, so addresses in code and data overlap... > Alan Modra > IBM OzLabs - Linux Technology Centre Thanks, Etienne. ___________________________________________________________________________ Faites de Yahoo! votre page d'accueil sur le web pour retrouver directement vos services préférés : vérifiez vos nouveaux mails, lancez vos recherches et suivez l'actualité en temps réel. Rendez-vous sur http://fr.yahoo.com/set