[Bug ld/21532] AArch64: Symbol address inconsistency across compilation units

2017-06-09 Thread jiwang at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=21532

Jiong Wang  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

--- Comment #8 from Jiong Wang  ---
Temporarily reopen this bug as the fix was reverted because it will leak some
PC-relative relocations in while PC-relative support on copy relocation
elimination is going on as explained at the email.  So this fix itself is
incomplete.

I will commit the fix later together PC-relative support after which is done
and reviewed.

Sorry for the trouble.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/21557] __start_SCN not provided if SCN used in linker script

2017-06-09 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21557

H.J. Lu  changed:

   What|Removed |Added

 Status|UNCONFIRMED |WAITING
   Last reconfirmed||2017-06-09
 CC||hjl.tools at gmail dot com
 Ever confirmed|0   |1

--- Comment #1 from H.J. Lu  ---
>From ld manual:

   If an orphaned section's name is representable as a C identifier then
the linker will automatically *note PROVIDE:: two symbols:
__start_SECNAME and __stop_SECNAME, where SECNAME is the name of the
section.  These indicate the start address and end address of the
orphaned section respectively.  Note: most section names are not
representable as C identifiers because they contain a '.' character.

When scnfoo is used in the linker script, it is no longer an orphan section.
I think this should be closed as WONTFIX.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/21557] __start_SCN not provided if SCN used in linker script

2017-06-09 Thread amonakov at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21557

--- Comment #2 from Alexander Monakov  ---
Thanks for the reference, I was missing that this handling is explicitly
limited to orphan sections. This makes my testcase invalid, but please consider
that current linker behavior appears inconsistent, for two separate reasons.

First, gc-sections considers these non-orphan sections reachable; taking the
testcase and linking it without '-z defs', with --gc-sections, you get:

$ ld.bfd -shared -o test.so test.o --gc-sections --print-gc-sections -T lds


But eliminating the reference from 'bar' allows it to be collected:

$ sed -i -e s/__start_scnfoo/undef/ test.s
$ gcc -c test.s
$ ld.bfd -shared -o test.so test.o --gc-sections --print-gc-sections -T lds
ld.bfd: Removing unused section 'scnfoo' in file 'test.o'

To the user this means that __start_scnfoo was virtually present when sections
were marked for garbage-collection, but not present for actual symbol
resolution.


Second, it implies there's no good way to use linker-scripts, --gc-sections and
__start_SCN together, even if one's use of linker scripts is limited to
rearranging sections. If one tries to manually provide __start_SCN:

SECTIONS {
.dynamic : { *(.dynamic) }
.data : { *(.data) }
PROVIDE(__start_scnfoo = .);
scnfoo : { *(scnfoo) }
}

... then it leads to scnfoo eliminated with --gc-sections because
__start_scnfoo no longer ties it to public symbol 'bar':

ld.bfd -shared -o test.so test.o --gc-sections --print-gc-sections -T lds
ld.bfd: Removing unused section 'scnfoo' in file 'test.o'

(with linker scripts it's possible to have output sections have different names
than input sections, this may cause ambiguity in what SCN __start_SCN should be
referring to; is that the reason why handling is limited to orphans?)

(it's not clear to me why bug status was set to WAITING, please clarify if
you'd like to see further clarifications, new bugreports for above issues, or
something else)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/21557] __start_SCN not provided if SCN used in linker script

2017-06-09 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21557

H.J. Lu  changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |WONTFIX

--- Comment #3 from H.J. Lu  ---
(In reply to Alexander Monakov from comment #2)
> Thanks for the reference, I was missing that this handling is explicitly
> limited to orphan sections. This makes my testcase invalid, but please
> consider that current linker behavior appears inconsistent, for two separate
> reasons.
> 
> First, gc-sections considers these non-orphan sections reachable; taking the
> testcase and linking it without '-z defs', with --gc-sections, you get:
> 

Please open a new bug report.  BTW, foo in your testcase isn't reachable
outside of test.so.

> (it's not clear to me why bug status was set to WAITING, please clarify if
> you'd like to see further clarifications, new bugreports for above issues,
> or something else)

I wanted to see more info.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/21562] New: Refs to __start_SCN of non-orphan sections affect --gc-sections

2017-06-09 Thread amonakov at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21562

Bug ID: 21562
   Summary: Refs to __start_SCN of non-orphan sections affect
--gc-sections
   Product: binutils
   Version: 2.29 (HEAD)
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: amonakov at gmail dot com
  Target Milestone: ---

(originally mentioned in bug 21557)

Linker manual explicitly states that __start_SCN symbols are automatically
provided only for orphan sections. However, the following testcase shows that
such symbols appear virtually present when marking reachable sections for
--gc-sections:

cat 

[Bug ld/21557] __start_SCN not provided if SCN used in linker script

2017-06-09 Thread amonakov at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21557

--- Comment #4 from Alexander Monakov  ---
> Please open a new bug report.

Done, bug 21562.

Now I see that to use __start_SCN together with linker scripts and
--gc-sections, one should put the PROVIDE statement inside of the output
section declaration:

SECTIONS {
scnfoo : {
PROVIDE_HIDDEN(__start_scnfoo = .);
*(scnfoo)
}
}

This looks logical and seems to work with -gc-sections, with both ld.bfd and
Gold. I think the Glibc approach quoted in comment #0 with PROVIDE statements
outside of output groups sets a bad example (and breaks build with
--gc-sections).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/21562] Refs to __start_SCN of non-orphan sections affect --gc-sections

2017-06-09 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21562

H.J. Lu  changed:

   What|Removed |Added

 CC||hjl.tools at gmail dot com

--- Comment #1 from H.J. Lu  ---
_bfd_elf_gc_mark_rsec has

  if (start_stop != NULL) 
{
  /* To work around a glibc bug, mark all XXX input sections
 when there is an as yet undefined reference to __start_XXX
 or __stop_XXX symbols.  The linker will later define such
 symbols for orphan input sections that have a name
 representable as a C identifier.  */
  asection *s = _bfd_elf_is_start_stop (info, h);

  if (s != NULL) 
{
  *start_stop = !s->gc_mark;
  return s;
}
}

The question is if ELF linker automatically creates a definition when
there is a reference, regardless if the input section is orphan or not.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/21562] Refs to __start_SCN of non-orphan sections affect --gc-sections

2017-06-09 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21562

H.J. Lu  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-06-09
   Target Milestone|--- |2.29
 Ever confirmed|0   |1

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/21562] Refs to __start_SCN of non-orphan sections affect --gc-sections

2017-06-09 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21562

--- Comment #2 from H.J. Lu  ---
Created attachment 10084
  --> https://sourceware.org/bugzilla/attachment.cgi?id=10084&action=edit
Try this

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/21562] Refs to __start_SCN of non-orphan sections affect --gc-sections

2017-06-09 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21562

H.J. Lu  changed:

   What|Removed |Added

  Attachment #10084|0   |1
is obsolete||

--- Comment #3 from H.J. Lu  ---
Created attachment 10085
  --> https://sourceware.org/bugzilla/attachment.cgi?id=10085&action=edit
A better patch

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/21562] Refs to __start_SCN of non-orphan sections affect --gc-sections

2017-06-09 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21562

H.J. Lu  changed:

   What|Removed |Added

 Status|NEW |UNCONFIRMED
   Last reconfirmed|2017-06-09 00:00:00 |
 Depends on||20022, 19167
   Target Milestone|2.29|---
 Ever confirmed|1   |0


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=19167
[Bug 19167] --gc-sections is broken with __start_
https://sourceware.org/bugzilla/show_bug.cgi?id=20022
[Bug 20022] --gc-sections is broken with __start_ and shared library
-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/20022] --gc-sections is broken with __start_ and shared library

2017-06-09 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=20022

H.J. Lu  changed:

   What|Removed |Added

 Blocks||21562


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=21562
[Bug 21562] Refs to __start_SCN of non-orphan sections affect --gc-sections
-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/19167] --gc-sections is broken with __start_

2017-06-09 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=19167

H.J. Lu  changed:

   What|Removed |Added

 Blocks||21562


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=21562
[Bug 21562] Refs to __start_SCN of non-orphan sections affect --gc-sections
-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils