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

2021-03-01 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21562
Bug 21562 depends on bug 27495, which changed state.

Bug 27495 Summary: -z start_stop_gc isn't compatible with --gc-sections
https://sourceware.org/bugzilla/show_bug.cgi?id=27495

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|NOTABUG |---

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

2021-03-01 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21562
Bug 21562 depends on bug 27495, which changed state.

Bug 27495 Summary: -z start_stop_gc isn't compatible with --gc-sections
https://sourceware.org/bugzilla/show_bug.cgi?id=27495

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |NOTABUG

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

2021-03-01 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21562

H.J. Lu  changed:

   What|Removed |Added

 Depends on||27495


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=27495
[Bug 27495] -z start_stop_gc isn't compatible with --gc-sections
-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

2017-11-24 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=21562

--- Comment #13 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by H.J. Lu :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8b77421a20c22c9a66048e7d1484b149da060b67

commit 8b77421a20c22c9a66048e7d1484b149da060b67
Author: H.J. Lu 
Date:   Fri Nov 24 08:58:43 2017 -0800

Update PR ld/21562 tests for underscore targets

We also need to provide __start_scnfoo and __stop_scnfoo with the extra
leading underscore for underscore targets.

This patch fixed:

FAIL: ld-elf/pr21562k
FAIL: ld-elf/pr21562l
FAIL: ld-elf/pr21562m
FAIL: ld-elf/pr21562n

for metag-linux,

* testsuite/ld-elf/pr21562c.t: Also provide ___start_scnfoo and
___stop_scnfoo.
* testsuite/ld-elf/pr21562d.t: Likewise.

-- 
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-16 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=21562

--- Comment #12 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Alan Modra :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7dba9362c172f1073487536eb137feb2da30b0ff

commit 7dba9362c172f1073487536eb137feb2da30b0ff
Author: Alan Modra 
Date:   Fri Jun 16 19:41:41 2017 +0930

Rewrite __start and __stop symbol handling

This arranges for __start and __stop symbols to be defined before
garbage collection, for all target formats.  That should allow the
COFF and PE --gc-sections to keep a singleton orphan input section,
a feature lost by 2017-06-13 commit cbd0eecf26.  The fancier ELF
treatment of keeping all input sections associated with a __start or
__stop symbol, from 2015-10-23 commit 1cce69b9dc, is retained.

.startof. and .sizeof. symbols are deliberately not defined before
garbage collection, so these won't affect garbage collection of
sections.

The patch also ensures __start, __stop, .startof. and .sizeof. symbols
are defined before target size_dynamic_sections is called, albeit
with a preliminary value, so that target code doesn't need to cope
with a symbol changing from undefined at size_dynamic_sections to
defined at relocate_section.

Also, a number of problems with the testcases have been fixed.

PR ld/20022
PR ld/21557
PR ld/21562
PR ld/21571
include/
* bfdlink.h (struct bfd_link_hash_entry): Delete undef.section.
bfd/
* targets.c (struct bfd_target): Add _bfd_define_start_stop.
(BFD_JUMP_TABLE_LINK): Likewise.
* elf-bfd.h (bfd_elf_define_start_stop): Declare.
* elflink.c (_bfd_elf_gc_mark_rsec): Update comment.
(bfd_elf_define_start_stop): New function.
* linker.c (bfd_generic_define_start_stop): New function.
* coff64-rs6000.c (rs6000_xcoff64_vec, rs6000_xcoff64_aix_vec): Init
new field.
* aout-adobe.c (aout_32_bfd_define_start_stop): Define.
* aout-target.h (MY_bfd_define_start_stop): Define.
* aout-tic30.c (MY_bfd_define_start_stop): Define.
* binary.c (binary_bfd_define_start_stop): Define.
* bout.c (b_out_bfd_define_start_stop): Define.
* coff-alpha.c (_bfd_ecoff_bfd_define_start_stop): Define.
* coff-mips.c (_bfd_ecoff_bfd_define_start_stop): Define.
* coff-rs6000.c (_bfd_xcoff_bfd_define_start_stop): Define.
* coffcode.h (coff_bfd_define_start_stop): Define.
* elfxx-target.h (bfd_elfNN_bfd_define_start_stop): Define.
* i386msdos.c (msdos_bfd_define_start_stop): Define.
* i386os9k.c (os9k_bfd_define_start_stop): Define.
* ieee.c (ieee_bfd_define_start_stop): Define.
* ihex.c (ihex_bfd_define_start_stop): Define.
* libbfd-in.h (_bfd_nolink_bfd_define_start_stop): Define.
* mach-o-target.c (bfd_mach_o_bfd_define_start_stop): Define.
* mmo.c (mmo_bfd_define_start_stop): Define.
* nlm-target.h (nlm_bfd_define_start_stop): Define.
* oasys.c (oasys_bfd_define_start_stop): Define.
* pef.c (bfd_pef_bfd_define_start_stop): Define.
* plugin.c (bfd_plugin_bfd_define_start_stop): Define.
* ppcboot.c (ppcboot_bfd_define_start_stop): Define.
* som.c (som_bfd_define_start_stop): Define.
* srec.c (srec_bfd_define_start_stop): Define.
* tekhex.c (tekhex_bfd_define_start_stop): Define.
* versados.c (versados_bfd_define_start_stop): Define.
* vms-alpha.c (vms_bfd_define_start_stop): Define.
(alpha_vms_bfd_define_start_stop): Define.
* xsym.c (bfd_sym_bfd_define_start_stop): Define.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
ld/
* emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Don't set
__start/__stop syms here.
* ldlang.c (lang_set_startof): Delete.
(start_stop_syms, start_stop_count, start_stop_alloc): New vars.
(lang_define_start_stop, lang_init_start_stop, foreach_start_stop,
undef_start_stop, lang_undef_start_stop, lang_init_startof_sizeof,
set_start_stop, lang_finalize_start_stop): New functions.
(lang_process): Call _start_stop functions.
* testsuite/ld-elf/pr21562a.d: Use xfail rather than notarget.
Correct typos and list of xfail targets.
* testsuite/ld-elf/pr21562b.d: Likewise.
* testsuite/ld-elf/pr21562c.d: Likewise.
* testsuite/ld-elf/pr21562d.d: Likewise.
* testsuite/ld-elf/pr21562e.d: Likewise.
* testsuite/ld-elf/pr21562f.d: Likewise.
* testsuite/ld-elf/pr21562g.d: Likewise.
* testsuite/ld-elf/pr21562h.d: Likewise.
* testsuite/ld-elf/pr21562i.d: Likewise.
* testsuite/ld-elf/pr21562j.d: Likewise.
* testsuite/ld-elf/pr21562k.d: Likewise.
* 

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

2017-06-14 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=21562

--- Comment #11 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by H.J. Lu :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8eca1095d96c215409371c5687573aac89a0a980

commit 8eca1095d96c215409371c5687573aac89a0a980
Author: H.J. Lu 
Date:   Wed Jun 14 04:36:17 2017 -0700

Skip PR ld/21562 tests on targets with leading char or without
--gc-sections

Symbol lookup in linker will always fail on targets with leading char
in symbol name since __start_SECNAME and __stop_SECNAME in C may be
___start_SECNAME and ___stop_SECNAME in assembly.  Also tests with
--gc-sections always fails on targets without --gc-sections support.

* testsuite/ld-elf/pr21562a.d: Skip on targets with leading char
in in symbol name or without --gc-sections.
* testsuite/ld-elf/pr21562b.d: Likewise.
* testsuite/ld-elf/pr21562c.d: Likewise.
* testsuite/ld-elf/pr21562d.d: Likewise.
* testsuite/ld-elf/pr21562i.d: Likewise.
* testsuite/ld-elf/pr21562j.d: Likewise.
* testsuite/ld-elf/pr21562k.d: Likewise.
* testsuite/ld-elf/pr21562l.d: Likewise.
* testsuite/ld-elf/pr21562m.d: Likewise.
* testsuite/ld-elf/pr21562n.d: Likewise.
* testsuite/ld-elf/pr21562e.d: Skip on targets with leading char
in symbol name.
* testsuite/ld-elf/pr21562f.d: Likewise.
* testsuite/ld-elf/pr21562g.d: Likewise.
* testsuite/ld-elf/pr21562h.d: Likewise.

-- 
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-13 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 |RESOLVED
 Resolution|--- |FIXED

--- Comment #10 from H.J. Lu  ---
Fixed.

-- 
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-13 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21562
Bug 21562 depends on bug 20022, which changed state.

Bug 20022 Summary: --gc-sections is broken with __start_ and shared library
https://sourceware.org/bugzilla/show_bug.cgi?id=20022

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

-- 
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-13 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=21562

--- Comment #9 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by H.J. Lu :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=cbd0eecf261c2447781f8c89b0d955ee66fae7e9

commit cbd0eecf261c2447781f8c89b0d955ee66fae7e9
Author: H.J. Lu 
Date:   Tue Jun 13 08:53:22 2017 -0700

Always define referenced __start_SECNAME/__stop_SECNAME

Currently, linker will define __start_SECNAME and __stop_SECNAME symbols
only for orphaned sections.

However, during garbage collection, ELF linker marks all sections with
references to __start_SECNAME and __stop_SECNAME symbols as used even
when section SECNAME isn't an orphaned section and linker won't define
__start_SECNAME nor __stop_SECNAME.  And ELF linker stores the first
input section whose name matches __start_SECNAME or __stop_SECNAME in
u.undef.section for garbage collection.  If these symbols are provided
in linker script, u.undef.section is set to the section where they will
defined by linker script, which leads to the incorrect output.

This patch changes linker to always define referenced __start_SECNAME and
__stop_SECNAME if the input section name is the same as the output section
name, which is always true for orphaned sections, and SECNAME is a C
identifier.  Also __start_SECNAME and __stop_SECNAME symbols are marked
as hidden by ELF linker so that __start_SECNAME and __stop_SECNAME symbols
for section SECNAME in different modules are unique.  For garbage
collection, ELF linker stores the first matched input section in the
unused vtable field.

bfd/

PR ld/20022
PR ld/21557
PR ld/21562
PR ld/21571
* elf-bfd.h (elf_link_hash_entry): Add start_stop.  Change the
vtable field to a union.
(_bfd_elf_is_start_stop): Removed.
* elf32-i386.c (elf_i386_convert_load_reloc): Also check for
__start_SECNAME and __stop_SECNAME symbols.
* elf64-x86-64.c (elf_x86_64_convert_load_reloc): Likewise.
* elflink.c (_bfd_elf_is_start_stop): Removed.
(_bfd_elf_gc_mark_rsec): Check start_stop instead of calling
_bfd_elf_is_start_stop.
(elf_gc_propagate_vtable_entries_used): Skip __start_SECNAME and
__stop_SECNAME symbols.  Updated.
(elf_gc_smash_unused_vtentry_relocs): Likewise.
(bfd_elf_gc_record_vtinherit): Likewise.
(bfd_elf_gc_record_vtentry): Likewise.

ld/

PR ld/20022
PR ld/21557
PR ld/21562
PR ld/21571
* ld.texinfo: Update __start_SECNAME/__stop_SECNAME symbols.
* ldlang.c (lang_insert_orphan): Move handling of __start_SECNAME
and __stop_SECNAME symbols to ...
(lang_set_startof): Here.  Also define __start_SECNAME and
__stop_SECNAME for -Ur.
* emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Mark
referenced __start_SECNAME and __stop_SECNAME symbols as hidden
and set start_stop for garbage collection.
* testsuite/ld-elf/pr21562a.d: New file.
* testsuite/ld-elf/pr21562a.s: Likewise.
* testsuite/ld-elf/pr21562a.t: Likewise.
* testsuite/ld-elf/pr21562b.d: Likewise.
* testsuite/ld-elf/pr21562b.s: Likewise.
* testsuite/ld-elf/pr21562b.t: Likewise.
* testsuite/ld-elf/pr21562c.d: Likewise.
* testsuite/ld-elf/pr21562c.t: Likewise.
* testsuite/ld-elf/pr21562d.d: Likewise.
* testsuite/ld-elf/pr21562d.t: Likewise.
* testsuite/ld-elf/pr21562e.d: Likewise.
* testsuite/ld-elf/pr21562f.d: Likewise.
* testsuite/ld-elf/pr21562g.d: Likewise.
* testsuite/ld-elf/pr21562h.d: Likewise.
* testsuite/ld-elf/pr21562i.d: Likewise.
* testsuite/ld-elf/pr21562j.d: Likewise.
* testsuite/ld-elf/pr21562k.d: Likewise.
* testsuite/ld-elf/pr21562l.d: Likewise.
* testsuite/ld-elf/pr21562m.d: Likewise.
* testsuite/ld-elf/pr21562n.d: Likewise.
* testsuite/ld-gc/pr20022.d: Likewise.
* testsuite/ld-gc/pr20022a.s: Likewise.
* testsuite/ld-gc/pr20022b.s: Likewise.
* testsuite/ld-gc/gc.exp: Run PR ld/20022 tests.
* testsuite/ld-gc/pr19161.d: Also accept local __start_SECNAME
symbol.
* testsuite/ld-gc/start.d: Likewise.
* testsuite/ld-x86-64/lea1a.d: Updated.
* testsuite/ld-x86-64/lea1b.d: Updated.
* testsuite/ld-x86-64/lea1d.d: Updated.
* testsuite/ld-x86-64/lea1e.d: Likewise.

-- 
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-11 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21562

--- Comment #8 from H.J. Lu  ---
(In reply to Alexander Monakov from comment #7)
> (In reply to H.J. Lu from comment #6)
> > I posted a patch to always define referenced __start_SECNAME/__stop_SECNAME:
> 
> That's quite confusing, because originally bug 21557 (wrongly) complained
> about those symbols not being defined, and you closed that bug as WONTFIX.
> If you changed your mind, can you please update that bug?

I will update it after my patch has been checked in.

> I don't see the reason to extend __start_SECNAME auto-provisioning, it seems
> it would be simpler to avoid extraneous gc-marking shown in this bug.

The new approach is faster and happens to support non-orphaned 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-11 Thread amonakov at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21562

--- Comment #7 from Alexander Monakov  ---
(In reply to H.J. Lu from comment #6)
> I posted a patch to always define referenced __start_SECNAME/__stop_SECNAME:

That's quite confusing, because originally bug 21557 (wrongly) complained about
those symbols not being defined, and you closed that bug as WONTFIX. If you
changed your mind, can you please update that bug?

I don't see the reason to extend __start_SECNAME auto-provisioning, it seems it
would be simpler to avoid extraneous gc-marking shown in this bug.

-- 
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-10 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21562

--- Comment #6 from H.J. Lu  ---
(In reply to Alexander Monakov from comment #5)
> The patch looks wrong, it appears to ensure that __start_scnfoo is defined.
> The linker manual says it shouldn't get defined (scnfoo is not orphan), and
> therefore scnfoo should be eliminated due to --gc-sections.
> 

I posted a patch to always define referenced __start_SECNAME/__stop_SECNAME:

https://sourceware.org/ml/binutils/2017-06/msg00105.html

-- 
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-10 Thread amonakov at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21562

--- Comment #5 from Alexander Monakov  ---
The patch looks wrong, it appears to ensure that __start_scnfoo is defined. The
linker manual says it shouldn't get defined (scnfoo is not orphan), and
therefore scnfoo should be eliminated due to --gc-sections.

(note that bug 20022 and bug 19167 are both for orphan sections, linker scripts
are not involved there)

-- 
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-10 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21562

H.J. Lu  changed:

   What|Removed |Added

  Attachment #10085|0   |1
is obsolete||

--- Comment #4 from H.J. Lu  ---
Created attachment 10088
  --> https://sourceware.org/bugzilla/attachment.cgi?id=10088=edit
A new 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-10 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-10
   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-10 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21562
Bug 21562 depends on bug 19167, which changed state.

Bug 19167 Summary: --gc-sections is broken with __start_
https://sourceware.org/bugzilla/show_bug.cgi?id=19167

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

-- 
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/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=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

--- Comment #2 from H.J. Lu  ---
Created attachment 10084
  --> https://sourceware.org/bugzilla/attachment.cgi?id=10084=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

 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

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