From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16357 invoked by alias); 7 Aug 2003 09:15:41 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 16344 invoked from network); 7 Aug 2003 09:15:37 -0000 Received: from unknown (HELO sunsite.ms.mff.cuni.cz) (195.113.19.66) by sources.redhat.com with SMTP; 7 Aug 2003 09:15:37 -0000 Received: from sunsite.ms.mff.cuni.cz (sunsite.mff.cuni.cz [127.0.0.1]) by sunsite.ms.mff.cuni.cz (8.12.8/8.12.8) with ESMTP id h777FPlx001751; Thu, 7 Aug 2003 09:15:27 +0200 Received: (from jakub@localhost) by sunsite.ms.mff.cuni.cz (8.12.8/8.12.8/Submit) id h75CjxUb023049; Tue, 5 Aug 2003 14:45:59 +0200 Date: Thu, 07 Aug 2003 09:15:00 -0000 From: Jakub Jelinek To: Alan Modra Cc: binutils@sources.redhat.com Subject: [PATCH] Fix place_orphan; add .rela.opd to default ppc64 linker script Message-ID: <20030805124559.GS20507@sunsite.ms.mff.cuni.cz> Reply-To: Jakub Jelinek Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i X-SW-Source: 2003-08/txt/msg00105.txt.bz2 Hi! cat > test.c < * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): If secname is in the linker script but os->bfd_section is NULL, use output_prev_sec_find to place it on the right place in the section list. * emulparams/elf64ppc.sh (OTHER_GOT_RELOC_SECTIONS): Add .rela.opd. --- binutils/ld/emulparams/elf64ppc.sh.jj 2003-07-28 10:24:45.000000000 -0400 +++ binutils/ld/emulparams/elf64ppc.sh 2003-08-05 08:35:58.000000000 -0400 @@ -28,7 +28,8 @@ else .toc 0 : { *(.toc) }" fi OTHER_GOT_RELOC_SECTIONS=" - .rela.toc ${RELOCATING-0} : { *(.rela.toc) }" + .rela.toc ${RELOCATING-0} : { *(.rela.toc) } + .rela.opd ${RELOCATING-0} : { *(.rela.opd) }" OTHER_READWRITE_SECTIONS=" .toc1 ${RELOCATING-0}${RELOCATING+ALIGN(8)} : { *(.toc1) } .opd ${RELOCATING-0}${RELOCATING+ALIGN(8)} : { KEEP (*(.opd)) }" --- binutils/ld/emultempl/elf32.em.jj 2003-08-05 06:59:49.000000000 -0400 +++ binutils/ld/emultempl/elf32.em 2003-08-05 08:27:23.000000000 -0400 @@ -1138,7 +1138,27 @@ gld${EMULATION_NAME}_place_orphan (lang_ { /* We already have an output section statement with this name, and its bfd section, if any, has compatible flags. */ - lang_add_section (&os->children, s, os, file); + if (os->bfd_section != NULL) + lang_add_section (&os->children, s, os, file); + else + { + asection *prev_section = output_prev_sec_find (os); + lang_add_section (&os->children, s, os, file); + if (prev_section != NULL) + { + asection *snew = os->bfd_section, **pps; + + /* Unlink the section. */ + for (pps = &output_bfd->sections; *pps != snew; + pps = &(*pps)->next) + ; + bfd_section_list_remove (output_bfd, pps); + + /* Now tack it on to the "os" section list. */ + bfd_section_list_insert (output_bfd, &prev_section->next, + snew); + } + } return TRUE; } } Jakub