www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2016/03/02/09:03:26

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
Date: Wed, 2 Mar 2016 14:47:25 +0100
From: Leon Winter <winter-djgpp AT bfw-online DOT de>
To: djgpp-workers AT delorie DOT com
Subject: Re: [winter-gcc AT bfw-online DOT de: DJGPP COFF relocation in
absolute sections]
Message-ID: <20160302134725.GA21050@bfw-online.de>
References: <56D62004 DOT 9040101 AT gmx DOT de>
<201603020114 DOT u221EWsu015460 AT envy DOT delorie DOT com>
MIME-Version: 1.0
In-Reply-To: <201603020114.u221EWsu015460@envy.delorie.com>
User-Agent: Mutt/1.5.24 (2015-08-30)
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

--IS0zKkzwUGydFO0o
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi,

> > In the end the question is does the DJGPP port also need that symbols in absolute
> > sections shall not be relocated or not?

> I couldn't think of a good reason why we'd use absolute symbols
> anyway, as they're usually used for hardware or OS hooks, and that
> won't work for DJGPP as we relocate address "0" anyway.  ABS sections
> would only be useful for constants but we don't use them for that I
> think.

> > Is DJGPP/COFF in this sense different to
> > SCO/COFF?

The outcome of the changes in binutils suggest that.

Looking at the code at hand in binutils and my debugging session it appears to
be that in my SCO scenario an absolute section also has
   sec->output_section->vma == 0
which might not be true in DJGPP.

Attached patch works for me on SCO. Does it work for you, too?

Best regards,
Leon

--IS0zKkzwUGydFO0o
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="coff_abs_section_relocation.patch"

diff --git a/bfd/cofflink.c b/bfd/cofflink.c
index 8d98fec..ac6ed7b 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
@@ -2977,6 +2977,7 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
 	  else
 	    {
 	      sec = sections[symndx];
+              if (bfd_is_abs_section (sec)) continue;
               val = (sec->output_section->vma
 		     + sec->output_offset
 		     + sym->n_value);

--IS0zKkzwUGydFO0o--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019