public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Alan Modra <amodra@gmail.com>
Cc: Binutils <binutils@sourceware.org>
Subject: Re: [PATCH 1/6] ld: don't generate base relocations in PE output for absolute symbols
Date: Thu, 4 Mar 2021 09:52:06 +0100	[thread overview]
Message-ID: <aeba49fb-086c-a58e-1b22-1f014544ab77@suse.com> (raw)
In-Reply-To: <20210304044659.GP6042@bubble.grove.modra.org>

On 04.03.2021 05:46, Alan Modra wrote:
> On Tue, Mar 02, 2021 at 10:47:03AM +0100, Jan Beulich via Binutils wrote:
>> It is the very nature of absolute symbols that they don't change even
>> if the loader decides to put the image at other than its link-time base
>> address. Of the linker-defined (and PE-specific) symbols __image_base__
>> (and its alias) needs special casing, as it'll still appear to be
>> absolute at this point.
>>
>> A new inquiry function in ldexp.c is needed because PE base relocations
>> get generated before ldexp_finalize_syms() runs, yet whether a
>> relocation is needed depends on the ultimate property of a symbol.
>>
>> ld/
>> 2021-02-XX  Jan Beulich  <jbeulich@suse.com>
>>
>> 	* ldexp.c (ldexp_is_final_sym_absolute): New.
>> 	* ldexp.h (ldexp_is_final_sym_absolute): Declare.
>> 	* pe-dll.c (generate_reloc): Skip absolute symbols.
> 
> OK.

Just to confirm - subsequently I did send a test case to be added
here, for which I have these additional entries:

	* testsuite/ld-pe/reloc.s, testsuite/ld-pe/reloc.d: New.
	* testsuite/ld-pe/pe.exp: Run new test.

Is that okay to commit as a whole, or should I re-submit (or
submit the test case addition as a separate change)?

>> +		  /* Nor for absolute symbols.  */
>> +		  else if (blhe && ldexp_is_final_sym_absolute (blhe)
>> +			   && (!blhe->linker_def
>> +			       || (strcmp(sym->name, "__image_base__")
>> +				   && strcmp(sym->name, U ("__ImageBase")))))
> 
> Space after strcmp.

Oh, yes, sorry.

Jan

  reply	other threads:[~2021-03-04  8:52 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-02  9:46 [PATCH 0/6] PE/COFF linking adjustments Jan Beulich
2021-03-02  9:47 ` [PATCH 1/6] ld: don't generate base relocations in PE output for absolute symbols Jan Beulich
2021-03-02 13:30   ` Jan Beulich
2021-03-04  4:46   ` Alan Modra
2021-03-04  8:52     ` Jan Beulich [this message]
2021-03-04 13:16       ` Alan Modra
2021-03-05 12:49         ` Alan Modra
2021-03-05 13:38           ` Jan Beulich
2021-03-05 13:59             ` Alan Modra
2021-03-02  9:47 ` [PATCH 2/6] bfd: prune COFF/PE section flags setting Jan Beulich
2021-03-04  4:47   ` Alan Modra
2021-03-02  9:48 ` [PATCH 3/6] bfd: refine handling of relocations between debugging sections Jan Beulich
2021-03-04  6:10   ` Alan Modra
2021-03-04  9:00     ` Jan Beulich
2021-03-05 12:00       ` Alan Modra
2021-03-08 14:17         ` Jan Beulich
2021-03-09  2:24           ` Alan Modra
2021-03-09  7:46             ` Jan Beulich
2021-03-09 11:23               ` Alan Modra
2021-03-09 12:49             ` Jan Beulich
2021-03-02  9:49 ` [PATCH 4/6] ld: adjust ld-scripts/map-address.* Jan Beulich
2021-03-04  6:10   ` Alan Modra
2021-03-02  9:49 ` [PATCH 5/6] bfd: don't silently wrap or truncate PE image section RVAs Jan Beulich
2021-03-04  6:13   ` Alan Modra
2021-03-02  9:50 ` [PATCH 6/6] bfd: strip symbols not representable in COFF/PE symbol table Jan Beulich
2021-03-04  6:15   ` Alan Modra
2021-03-04  9:06     ` Jan Beulich
2021-03-04 13:27       ` Alan Modra
2021-03-08 15:05       ` Jan Beulich
2021-03-08 16:11         ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aeba49fb-086c-a58e-1b22-1f014544ab77@suse.com \
    --to=jbeulich@suse.com \
    --cc=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).