[Bug ld/12762] LTO on Windows is broken (C++)

2020-10-13 Thread lvella at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=12762

--- Comment #34 from lvella  ---
(In reply to lvella from comment #33)
> I also managed to workaround the problem by using
> -Wl,-allow-multiple-definition.

This turned out to be incorrect. Code generated this way is wrong, and in my
case, a cross procedure floating point computation was replaced with the wrong
result.

I don't know any workaround for this bug.

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


[Bug ld/12291] "ld -r" doesn't work with mixed IR/non-IR objects

2020-10-13 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=12291

--- Comment #6 from H.J. Lu  ---
(In reply to H.J. Lu from comment #2)
> The proposal is at
> 
> http://www.kernel.org/pub/linux/devel/gcc/lto/mixed-IR/mixed-IR.pdf

Here is the proposal:

Link with mixed IR/non-IR objects

* 2 kinds of object files
  o non-IR object file has
* non-IR sections
  o IR object file has
* IR sections
* non-IR sections
* The output of "ld -r" with mixed IR/non-IR objects should work with:
o Compilers/linkers with IR support.
o Compilers/linkers without IR support.
* Add the mixed object file which has
  o IR sections
  o non-IR sections:
* Object codes from IR sections.
* Object codes from non-IR object files.
  o Object-only section:
* With section name ".gnu_object_only" and SHT_GNU_OBJECT_ONLY type
on ELF:
#define SHT_GNU_OBJECT_ONLY 0x6ff8  /* Object only */
* Contain non-IR object file.
* Input is discarded after link.
* Linker action:
  o Classify each input object file:
* If there is a ".gnu_object_only" section, it is a mixed object file.
* If there is a IR section, it is an IR object file.
* Otherwise, it is a non-IR object file.
  o Relocatable non-IR link:
* Prepare for an object-only output.
* Prepare for a regular output.
* For each mixed object file:
  * Add IR and non-IR sections to the regular output.
  * For object-only section:
* Extract object only file.
* Add it to the object-only output.
* Discard object-only section.
* For each IR object file:
  * Add IR and non-IR sections to the regular output.
* For each non-IR object file:
  * Add non-IR sections to the regular output.
  * Add non-IR sections to the object-only output.
* Final output:
  * If there are IR objects, non-IR objects and the object-only
  output isn't empty:
* Put the object-only output into the object-only section.
* Add the object-only section to the regular output.
* Remove the object-only output.
  o Normal link and relocatable IR link:
* Prepare for output.
* IR link:
  * For each mixed object file:
* Compile and add IR sections to the output.
* Discard non-IR sections.
* Object-only section:
  * Extract object only file.
  * Add it to the output.
  * Discard object-only section.
  * For each IR object file:
* Compile and add IR sections to the output.
* Discard non-IR sections.
  * For each non-IR object file:
* Add non-IR sections to the output.
* Non-IR link:
  * For each mixed object file:
* Add non-IR sections to the output.
* Discard IR sections and object-only section.
  * For each IR object file:
* Add non-IR sections to the output.
* Discard IR sections.
  * For each non-IR object file:
* Add non-IR sections to the output.

> 
> It is implemented on hjl/lto-mixed branch at
> 
> http://git.kernel.org/?p=devel/binutils/hjl/x86.git;a=summary

It has been moved at:

https://gitlab.com/x86-binutils/binutils-gdb/-/tree/users/hjl/lto-mixed/master

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


[Bug gold/23503] -Ttext= doesn't work right with GNU property

2020-10-13 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=23503

H.J. Lu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
   Target Milestone|--- |2.36
 Resolution|--- |FIXED

--- Comment #3 from H.J. Lu  ---
Fixed for 2.36.

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


[Bug gold/22914] Gold doesn't support .note.gnu.property section (NT_GNU_PROPERTY_TYPE_0)

2020-10-13 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22914

H.J. Lu  changed:

   What|Removed |Added

   Target Milestone|2.31|2.36
 Resolution|--- |FIXED
 Status|REOPENED|RESOLVED

--- Comment #9 from H.J. Lu  ---
Fixed for 2.36.

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


[Bug gold/23539] --incremental-update doesn't work with GNU properties

2020-10-13 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=23539

--- Comment #1 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=6c0005b8f4a8bf5f239be761deee6e5ee4faa25e

commit 6c0005b8f4a8bf5f239be761deee6e5ee4faa25e
Author: H.J. Lu 
Date:   Tue Oct 13 05:22:55 2020 -0700

gold: Skip some incremental tests

Skip incremental_test_2, incremental_test_3, incremental_test_4,
incremental_test_5, incremental_copy_test, incremental_common_test_1
and incremental_comdat_test_1 when -fcf-protection is used to compile
gold since gold doesn't properly support -fcf-protection on Intel CET
enabled OS.

Also skip incremental_copy_test and incremental_comdat_test_1 for GCC 9
or later since they failed with GCC 9 or later.

PR gold/23539
* configure.ac: Check for GCC 9 or later and for -fcf-protection.
* configure: Regenerated.
* testsuite/Makefile.am (check_PROGRAMS): Skip incremental_test_2,
incremental_test_3, incremental_test_4, incremental_test_5,
incremental_copy_test, incremental_common_test_1 and
incremental_comdat_test_1 for -fcf-protection.  Also Skip
incremental_copy_test and incremental_comdat_test_1 for GCC 9 or
later.
* testsuite/Makefile.in: Regenerated.

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


[Bug gold/23503] -Ttext= doesn't work right with GNU property

2020-10-13 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=23503

--- Comment #2 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=29700bfff45955f1323573a8270625d38e9bdbb6

commit 29700bfff45955f1323573a8270625d38e9bdbb6
Author: H.J. Lu 
Date:   Tue Oct 13 05:21:53 2020 -0700

gold: Discard .note.gnu.property section

Discard .note.gnu.property section since it changes the expected section
order.

PR gold/23503
* testsuite/Makefile.am (justsyms_lib): Pass
-T $(srcdir)/justsyms_lib.t to gold.
* testsuite/Makefile.in: Regenerated.
* testsuite/justsyms_lib.t: New file.
* testsuite/script_test_10.t: Discard .note.gnu.property section.

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


[Bug gold/22914] Gold doesn't support .note.gnu.property section (NT_GNU_PROPERTY_TYPE_0)

2020-10-13 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22914

--- Comment #8 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=6bf4a34047452f882c5cc66bd85812ee1bb5a41c

commit 6bf4a34047452f882c5cc66bd85812ee1bb5a41c
Author: H.J. Lu 
Date:   Tue Oct 13 05:18:13 2020 -0700

gold: Properly align the NT_GNU_PROPERTY_TYPE_0 note

The NT_GNU_PROPERTY_TYPE_0 note should be aligned to 8 bytes for 64-bit
ELF as specified by gABI.  A note section can be only placed in a PT_NOTE
segment with the same alignment.

PR gold/22914
PR gold/23535
* layout.cc (Layout::attach_allocated_section_to_segment): Place
a note section in a PT_NOTE segment with the same alignment.  Set
the alignment of the PT_NOTE segment from the alignment of the
note section.
(Layout::create_note): Align the NT_GNU_PROPERTY_TYPE_0 note to 8
bytes for 64-bit ELF.
(Layout::segment_precedes): Place segments with larger alignments
first.
* output.cc (Output_segment::Output_segment): Initialize align_.
* output.h (Output_segment): Add align, set_align and align_.
* testsuite/Makefile.am (gnu_property_test.stdout): Pass -lhSWn
to $(TEST_READELF).
(gnu_property_test): Pass --build-id to ld.
* testsuite/Makefile.in: Regenerated.
* testsuite/gnu_property_test.sh (check_alignment): New.
Use check_alignment to check the NT_GNU_PROPERTY_TYPE_0 note
alignment.  Verify that there are 2 PT_NOTE segments.

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


[Bug gold/23535] gold needs to produce two PT_NOTE segments with ELFCLASS64

2020-10-13 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=23535

--- Comment #2 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=6bf4a34047452f882c5cc66bd85812ee1bb5a41c

commit 6bf4a34047452f882c5cc66bd85812ee1bb5a41c
Author: H.J. Lu 
Date:   Tue Oct 13 05:18:13 2020 -0700

gold: Properly align the NT_GNU_PROPERTY_TYPE_0 note

The NT_GNU_PROPERTY_TYPE_0 note should be aligned to 8 bytes for 64-bit
ELF as specified by gABI.  A note section can be only placed in a PT_NOTE
segment with the same alignment.

PR gold/22914
PR gold/23535
* layout.cc (Layout::attach_allocated_section_to_segment): Place
a note section in a PT_NOTE segment with the same alignment.  Set
the alignment of the PT_NOTE segment from the alignment of the
note section.
(Layout::create_note): Align the NT_GNU_PROPERTY_TYPE_0 note to 8
bytes for 64-bit ELF.
(Layout::segment_precedes): Place segments with larger alignments
first.
* output.cc (Output_segment::Output_segment): Initialize align_.
* output.h (Output_segment): Add align, set_align and align_.
* testsuite/Makefile.am (gnu_property_test.stdout): Pass -lhSWn
to $(TEST_READELF).
(gnu_property_test): Pass --build-id to ld.
* testsuite/Makefile.in: Regenerated.
* testsuite/gnu_property_test.sh (check_alignment): New.
Use check_alignment to check the NT_GNU_PROPERTY_TYPE_0 note
alignment.  Verify that there are 2 PT_NOTE segments.

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


[Bug gold/21452] Enable safe ICF for shared object

2020-10-13 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21452

H.J. Lu  changed:

   What|Removed |Added

 Resolution|--- |FIXED
   Target Milestone|--- |2.36
 Status|NEW |RESOLVED

--- Comment #2 from H.J. Lu  ---
Fixed for 2.36.

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


[Bug gold/21452] Enable safe ICF for shared object

2020-10-13 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=21452

--- Comment #1 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=aac1d94f19492fb6bea7193497bce599952c429d

commit aac1d94f19492fb6bea7193497bce599952c429d
Author: H.J. Lu 
Date:   Tue Oct 13 05:10:24 2020 -0700

Gold: Enable safe ICF for shared object on x86-64

With

commit 4aebb6312eb5dcd12f2f8420028547584b708907
Author: Rahul Chaudhry 
Date:   Wed Feb 15 00:37:10 2017 -0800

Improved support for --icf=safe when used with -pie.

we now check opcode with R_X86_64_PC32 relocation, which tell branches
from other instructions.  We can enable safe ICF for shared object on
x86-64.  Also, global symbols with non-default visibility should be
folded like local symbols.

PR gold/21452
* x86_64.cc (Scan::local_reloc_may_be_function_pointer): Remove
check for shared library.
(Scan::global_reloc_may_be_function_pointer): Remove check for
shared library and symbol visibility.
* testsuite/icf_safe_so_test.cc (bar_static): New function.
(main): Take function address of bar_static and use it.
* testsuite/icf_safe_so_test.sh (arch_specific_safe_fold): Also
check fold on x86-64.  Check bar_static isn't folded.

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