Bug 23539 - --incremental-update doesn't work with GNU properties
Summary: --incremental-update doesn't work with GNU properties
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: 2.32
: P2 normal
Target Milestone: ---
Assignee: Cary Coutant
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-08-16 23:01 UTC by H.J. Lu
Modified: 2020-12-14 01:56 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2018-08-16 23:01:14 UTC
[hjl@gnu-cfl-1 gold-2]$ cat x.s
	.section ".note.gnu.property", "a"
.ifdef __64_bit__
	.p2align 3
.else
	.p2align 2
.endif
	.long 1f - 0f		/* name length.  */
	.long 3f - 1f		/* data length.  */
	/* NT_GNU_PROPERTY_TYPE_0 */
	.long 5			/* note type.  */
0:
	.asciz "GNU"		/* vendor name.  */
1:
.ifdef __64_bit__
	.p2align 3
.else
	.p2align 2
.endif
	/* GNU_PROPERTY_X86_ISA_1_USED */
	.long 0xc0000000	/* pr_type.  */
	.long 5f - 4f		/* pr_datasz.  */
4:
	.long 0xa
5:
.ifdef __64_bit__
	.p2align 3
.else
	.p2align 2
.endif
3:
[hjl@gnu-cfl-1 gold-2]$ cat a.s
	.text
	.globl	_start
	.type	_start, @function
_start:
	ret
	.size	_start, .-_start
[hjl@gnu-cfl-1 gold-2]$ make
as -defsym __64_bit__=1   -o x.o x.s
as -defsym __64_bit__=1   -o a.o a.s
cp x.o x1.o
./ld --incremental-full --incremental-patch=10 -z norelro -no-pie  -o x1 x1.o a.o
cp x.o x1.o
cp x1 x1.saved
./ld -z norelro -no-pie  --incremental-update -o x1 x1.o a.o
./ld: internal error in set_section_addresses, at /export/gnu/import/git/sources/binutils-gdb/gold/output.cc:4443
make: *** [Makefile:39: x2] Error 1
[hjl@gnu-cfl-1 gold-2]$ 

merge_gnu_properties doesn't take --incremental-update into account.
Comment 1 Sourceware Commits 2020-10-13 12:30:31 UTC
The master branch has been updated by H.J. Lu <hjl@sourceware.org>:

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

commit 6c0005b8f4a8bf5f239be761deee6e5ee4faa25e
Author: H.J. Lu <hjl.tools@gmail.com>
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.
Comment 2 Sourceware Commits 2020-12-13 23:29:42 UTC
The master branch has been updated by Cary Coutant <ccoutant@sourceware.org>:

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

commit 387a56a5435500ba2d2eac3fe76de1f400381cbe
Author: Cary Coutant <ccoutant@gmail.com>
Date:   Sun Dec 13 15:20:10 2020 -0800

    Fix incremental tests using gcc 9, which adds Gnu properties sections.
    
    During an incremental link, we should simply ignore the Gnu properties
    sections. We were not handling them properly -- failing to process the
    properties from the base file. While that could be fixed, the property
    sections are meant for deployed binaries, and incremental linking is
    for development, so keeping the properties sections just adds to the
    likelihood of forcing a full link sooner.
    
    gold/
            PR gold/23539
            * object.cc (Sized_relobj_file::layout_gnu_property_section): Ignore
            Gnu properties during incremental links.
Comment 3 Sourceware Commits 2020-12-14 00:51:02 UTC
The master branch has been updated by Cary Coutant <ccoutant@sourceware.org>:

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

commit f22318ef0db86d623e11efbd8936430f38484f69
Author: Cary Coutant <ccoutant@gmail.com>
Date:   Sun Dec 13 16:50:13 2020 -0800

    Re-enable incremental tests that were failing with GCC 9+.
    
    gold/
            PR gold/23539
            PR gold/24123
            * testsuite/Makefile.am (incremental_copy_test): Re-enable for GCC 9+.
            (incremental_comdat_test_1): Likewise.
            * testsuite/Makefile.in: Regenerate.
Comment 4 Cary Coutant 2020-12-14 01:56:12 UTC
Fixed on trunk.