public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* --gc-sections and -r
@ 2016-09-01 12:34 Tristan Gingold
  2016-09-01 23:14 ` Alan Modra
  0 siblings, 1 reply; 4+ messages in thread
From: Tristan Gingold @ 2016-09-01 12:34 UTC (permalink / raw)
  To: binutils; +Cc: Alan Modra

Alan,

on Thursday, 28 October 2010 you committed this patch:

v850-elf fails "--gc-sections -r without -e" because the v850 linker
script contains EXTERN().  We don't distinguish these from symbols
given with -u on the command line, but the intention was to require a
command line -u or -e with --gc-sections -r.  Like so.

However, the doc still contains:

This option can be set when doing a partial link (enabled with option
@samp{-r}).  In this case the root of symbols kept must be explicitly
specified either by an @samp{--entry} or @samp{--undefined} option or by
a @code{ENTRY} command in the linker script.

So there is a mismatch.
Is there any reason not to accept anymore ENTRY from linker script ?
(in particular from an explicit linker script).

Tristan.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: --gc-sections and -r
  2016-09-01 12:34 --gc-sections and -r Tristan Gingold
@ 2016-09-01 23:14 ` Alan Modra
  2016-09-05  7:24   ` Tristan Gingold
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Modra @ 2016-09-01 23:14 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: binutils

On Thu, Sep 01, 2016 at 02:34:46PM +0200, Tristan Gingold wrote:
> Alan,
> 
> on Thursday, 28 October 2010 you committed this patch:
> 
> v850-elf fails "--gc-sections -r without -e" because the v850 linker
> script contains EXTERN().  We don't distinguish these from symbols
> given with -u on the command line, but the intention was to require a
> command line -u or -e with --gc-sections -r.  Like so.
> 
> However, the doc still contains:
> 
> This option can be set when doing a partial link (enabled with option
> @samp{-r}).  In this case the root of symbols kept must be explicitly
> specified either by an @samp{--entry} or @samp{--undefined} option or by
> a @code{ENTRY} command in the linker script.
> 
> So there is a mismatch.
> Is there any reason not to accept anymore ENTRY from linker script ?
> (in particular from an explicit linker script).

Hi Tristan.  Most likely I was on a mission to reduce testsuite fails
and decided that the people who wrote the testcase really did intend
that --gc-sections -r require -e.  Since you had a hand in writing
that testcase, I guess you're telling me that assumption was wrong. :)
If you want to revert the patch, I have no objection.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: --gc-sections and -r
  2016-09-01 23:14 ` Alan Modra
@ 2016-09-05  7:24   ` Tristan Gingold
  2016-09-30  8:54     ` Alan Modra
  0 siblings, 1 reply; 4+ messages in thread
From: Tristan Gingold @ 2016-09-05  7:24 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils


> On 02 Sep 2016, at 01:14, Alan Modra <amodra@gmail.com> wrote:
> 
> On Thu, Sep 01, 2016 at 02:34:46PM +0200, Tristan Gingold wrote:
>> Alan,
>> 
>> on Thursday, 28 October 2010 you committed this patch:
>> 
>> v850-elf fails "--gc-sections -r without -e" because the v850 linker
>> script contains EXTERN().  We don't distinguish these from symbols
>> given with -u on the command line, but the intention was to require a
>> command line -u or -e with --gc-sections -r.  Like so.
>> 
>> However, the doc still contains:
>> 
>> This option can be set when doing a partial link (enabled with option
>> @samp{-r}).  In this case the root of symbols kept must be explicitly
>> specified either by an @samp{--entry} or @samp{--undefined} option or by
>> a @code{ENTRY} command in the linker script.
>> 
>> So there is a mismatch.
>> Is there any reason not to accept anymore ENTRY from linker script ?
>> (in particular from an explicit linker script).
> 
> Hi Tristan.  Most likely I was on a mission to reduce testsuite fails
> and decided that the people who wrote the testcase really did intend
> that --gc-sections -r require -e.  Since you had a hand in writing
> that testcase, I guess you're telling me that assumption was wrong. :)
> If you want to revert the patch, I have no objection.

Thank you for the comment and the background.  I plan to propose a patch.

Tristan.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: --gc-sections and -r
  2016-09-05  7:24   ` Tristan Gingold
@ 2016-09-30  8:54     ` Alan Modra
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Modra @ 2016-09-30  8:54 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: binutils

This should avoid the need for the 2010-10-28 change.

	* scripttempl/v850.sc: Don't reference __ctbp, __ep, __gp when
	not relocating.
	* scripttempl/v850_rh850.sc: Likewise.

diff --git a/ld/scripttempl/v850.sc b/ld/scripttempl/v850.sc
index cf7cd20..9ff5e9a 100644
--- a/ld/scripttempl/v850.sc
+++ b/ld/scripttempl/v850.sc
@@ -16,7 +16,7 @@ OUTPUT_FORMAT("elf32-v850", "elf32-v850",
 OUTPUT_ARCH(v850:old-gcc-abi)
 ${RELOCATING+ENTRY(_start)}
 SEARCH_DIR(.);
-EXTERN(__ctbp __ep __gp);
+${RELOCATING+EXTERN(__ctbp __ep __gp)};
 SECTIONS
 {
   /* This saves a little space in the ELF file, since the zda starts
diff --git a/ld/scripttempl/v850_rh850.sc b/ld/scripttempl/v850_rh850.sc
index a44b9b5..b54e956 100644
--- a/ld/scripttempl/v850_rh850.sc
+++ b/ld/scripttempl/v850_rh850.sc
@@ -16,7 +16,7 @@ OUTPUT_FORMAT("elf32-v850-rh850", "elf32-v850-rh850",
 OUTPUT_ARCH(v850:rh850)
 ${RELOCATING+ENTRY(_start)}
 SEARCH_DIR(.);
-EXTERN(__ctbp __ep __gp);
+${RELOCATING+EXTERN(__ctbp __ep __gp)};
 SECTIONS
 {
   /* This saves a little space in the ELF file, since the zda starts

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-09-30  8:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-01 12:34 --gc-sections and -r Tristan Gingold
2016-09-01 23:14 ` Alan Modra
2016-09-05  7:24   ` Tristan Gingold
2016-09-30  8:54     ` Alan Modra

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).