[Kos-dev] [Fwd: Bug when generating Program Header in elf files]
Thomas Petazzoni
kos-dev@enix.org
Tue, 12 Jun 2001 17:09:14 +0200
This is a multi-part message in MIME format.
--------------F4ED63FF5B0FEF0A93139EFE
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
salut,
voici pour information la conclusion du probleme des binutils 2.11 avec
les anciens script de linkage de KOS. deux solutions :
- avoir le script que j'ai fait qui dit explicitement ou placer la
section .rodata
- appliquer le patch joint sur les binutils 2.11
enfin, plus d'infos dans le mail.
thomas
--
PETAZZONI Thomas
thomas.petazzoni@meridon.com
ICQ : 34937744
Projet KOS : http://kos.enix.org
--------------F4ED63FF5B0FEF0A93139EFE
Content-Type: message/rfc822
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Return-Path: <nickc@cambridge.redhat.com>
Received: from gateway.utbm.fr (localhost [127.0.0.1])
by hera.utbm.fr (8.9.1a/jtpda-5.3.1) with ESMTP id QAA28700
for <tpetazzo@sune250-cri-s01.utbm.fr>; Tue, 12 Jun 2001 16:05:41 +0200 (MEST)
Received: from cassis.host-web.net (maurel-vedeau.com [213.11.172.42])
by gateway.utbm.fr (8.9.3/jtpda-5.3.2) with ESMTP id QAA08832
for <thomas.petazzoni@utbm.fr>; Tue, 12 Jun 2001 16:05:43 +0200
Received: from rhenium [194.73.73.93] by cassis.host-web.net with ESMTP
(SMTPD32-5.05) id A1B3910238; Tue, 12 Jun 2001 16:05:39 +0200
Received: from [213.122.184.230] (helo=north-pole.nickc.cambridge.redhat.com)
by rhenium with esmtp (Exim 3.03 #83)
id 159onQ-0002No-00; Tue, 12 Jun 2001 15:05:28 +0100
Received: from north-pole.nickc.cambridge.redhat.com.nickc.cambridge.redhat.com (localhost [127.0.0.1])
by north-pole.nickc.cambridge.redhat.com (Postfix) with ESMTP
id 6D518112CBE; Tue, 12 Jun 2001 15:06:38 +0100 (BST)
Sender: nickc@north-pole.nickc.cambridge.redhat.com
To: thomas.petazzoni@meridon.com
Cc: binutils@sourceware.cygnus.com
Subject: Re: Bug when generating Program Header in elf files
References: <3B13C9C9.AA9D6A2B@meridon.com>
From: Nick Clifton <nickc@cambridge.redhat.com>
Date: 12 Jun 2001 15:06:36 +0100
In-Reply-To: <3B13C9C9.AA9D6A2B@meridon.com>
Message-ID: <m3ae3dlrmb.fsf@north-pole.nickc.cambridge.redhat.com>
User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Mozilla-Status2: 00000000
Hi Thomas,
As you have discovered this problem happens because your linker
script did not explicitly assign .rodata sections in the input files
to a section in the output file.
The algorithm used to decide where to place these unallocated
sections (called 'orphan sections') changed with binutils 2.11, so
that were being placed at the start of file rather than the end of
the file, and this meant a second (correctly specified) program
header was needed.
Although you have already solved the problem by fixing your linker
script, you may also want to try the patch below, which changes the
orphan placement algorithm slitghtly so that unallocates .rodata
sections will now be attached to the .data section.
Cheers
Nick
Index: ld/emultempl/elf32.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/elf32.em,v
retrieving revision 1.48
diff -p -r1.48 elf32.em
*** elf32.em 2001/05/25 05:39:22 1.48
--- elf32.em 2001/06/12 14:04:20
*************** gld${EMULATION_NAME}_place_orphan (file,
*** 1097,1105 ****
&& (hold_rel.os != NULL
|| (hold_rel.os = output_rel_find ()) != NULL))
place = &hold_rel;
! else if ((s->flags & (SEC_CODE | SEC_READONLY)) == SEC_READONLY
! && HAVE_SECTION (hold_rodata, ".rodata"))
! place = &hold_rodata;
else if ((s->flags & (SEC_CODE | SEC_READONLY)) == (SEC_CODE | SEC_READONLY)
&& hold_text.os != NULL)
place = &hold_text;
--- 1097,1111 ----
&& (hold_rel.os != NULL
|| (hold_rel.os = output_rel_find ()) != NULL))
place = &hold_rel;
! else if ((s->flags & (SEC_CODE | SEC_READONLY)) == SEC_READONLY)
! {
! if (HAVE_SECTION (hold_rodata, ".rodata"))
! place = &hold_rodata;
! /* If the script does not provide a .rodata
! section try using the .data section instead. */
! else if (HAVE_SECTION (hold_data, ".data"))
! place = &hold_data;
! }
else if ((s->flags & (SEC_CODE | SEC_READONLY)) == (SEC_CODE | SEC_READONLY)
&& hold_text.os != NULL)
place = &hold_text;
--------------F4ED63FF5B0FEF0A93139EFE--