Bug 21090

Summary: gcc compiled with --enable-default-pie show errors in binutils testsuite
Product: binutils Reporter: Robert West <lksfbdij>
Component: goldAssignee: Cary Coutant <ccoutant>
Status: REOPENED ---    
Severity: minor CC: allan, dilfridge, hjl.tools, ian, nickc, oneup40.bugzilla, sam, sjc+binutils_bugzilla
Priority: P2    
Version: 2.28   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed: 2017-01-31 00:00:00
Attachments: Partial patch
checklog v2.27
checklog git with patch
checklog git without patch
buildlog v2.27
Test file
checklog v2.27 no-pie
checklog v2.27 pie
diff with Partial patch attached earlier by Nick
binutils-git no-pie
binutils-git pie
binutils 2.28 checklog no-pie_vs_pie.diff
binutils 2.28 checklog pie_vs_pie-patch.diff
checklog v2.29 (master) pie
reduced testcase for gold incremental link internal error
further reduced testcase for gold incremental link internal error

Description Robert West 2017-01-27 12:51:41 UTC
Hi!

Archlinux is planning to enable -PIE flag in gcc by default however after this change binutils compilation shows numerous errors in testsuite:

gcc 6.3.1, default settings ( https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/gcc ):

grep Error binutils-2.27-1-x86_64-check.log 
make[3]: [Makefile:140: site.exp] Error 2 (ignored)
make[3]: [Makefile:141: site.exp] Error 1 (ignored)

gcc 6.3.1, default settings with --enable-default-pie:

grep Error binutils-2.27-1.90-x86_64-check.log 
make[3]: [Makefile:140: site.exp] Error 2 (ignored)
make[3]: [Makefile:141: site.exp] Error 1 (ignored)
make[5]: *** [Makefile:7038: incremental_test_2] Error 1
make[5]: *** [Makefile:7062: incremental_test_5] Error 1
make[5]: *** [Makefile:7009: ehdr_start_test_4] Error 1
make[4]: *** [Makefile:5520: check-am] Error 2
make[3]: *** [Makefile:5524: check] Error 2
make[2]: *** [Makefile:940: check-recursive] Error 1
make[1]: *** [Makefile:6135: check-gold] Error 2
make[5]: *** [Makefile:3646: check-DEJAGNU] Error 1
make[4]: *** [Makefile:1940: check-am] Error 2
make[3]: *** [Makefile:1780: check-recursive] Error 1
make[2]: *** [Makefile:1942: check] Error 2
make[1]: *** [Makefile:7548: check-ld] Error 2
make: *** [Makefile:2207: do-check] Error 2

binutils default build settings ( https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/binutils )

Those errors are currently blocking developers from making the change. I'll be grateful if someone could help fixing them.

Discussion: https://bbs.archlinux.org/viewtopic.php?pid=1682854
Comment 1 Nick Clifton 2017-01-27 15:54:49 UTC
Created attachment 9777 [details]
Partial patch

Hi Robert,

  Could you provide a full list of the tests that are failing ?

  In the meantime here is a small patch that might fix a few of the failures.
  Please try it out and let me know how you get on.

Cheers
  Nick
Comment 2 Robert West 2017-01-28 00:40:26 UTC
Created attachment 9778 [details]
checklog v2.27

Hi Nick,

Thanks for answer. I added attachments with checklogs. I cannot apply your patch against 2.27 version which arch uses so I had to do against current git master. Unfortunately there seems no difference in testsuite with and without patch.
Comment 3 Robert West 2017-01-28 00:41:14 UTC
Created attachment 9779 [details]
checklog git with patch
Comment 4 Robert West 2017-01-28 00:41:46 UTC
Created attachment 9780 [details]
checklog git without patch
Comment 5 Robert West 2017-01-28 00:43:14 UTC
Created attachment 9781 [details]
buildlog v2.27
Comment 6 Nick Clifton 2017-01-31 12:26:58 UTC
Created attachment 9783 [details]
Test file

Link, using gold, with:

  ./ld-new --eh-frame-hdr -m elf_x86_64 -Ttext=0x100100 ehdr_start_test_4.o 

Result:

 ./ld-new: internal error in relocate, at gold/x86_64.cc:4246
Comment 7 Nick Clifton 2017-01-31 12:29:15 UTC
Hi Robert,

  Well given that the failures you report in the description are due to an internal error in the gold linker, I am resetting the component for this PR.

  I have also uploaded an extracted version of one of the failing gold tests that reproduces the internal error in gold.  I hope that this will allow the gold maintainers to track down the bug.

Cheers
  Nick
Comment 8 Robert West 2017-01-31 20:41:16 UTC
Created attachment 9785 [details]
checklog v2.27 no-pie

My previous checklogs were contaminated by my custom environment. These are as clean as I can get
Comment 9 Robert West 2017-01-31 20:42:29 UTC
Created attachment 9786 [details]
checklog v2.27 pie
Comment 10 Sourceware Commits 2017-02-01 00:36:25 UTC
The master branch has been updated by Cary Coutant <ccoutant@sourceware.org>:

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

commit ed35cc4a1cb76fd9ac53ad19efb97ee2caffbae9
Author: Cary Coutant <ccoutant@gmail.com>
Date:   Tue Jan 31 16:32:59 2017 -0800

    Don't allow mov-to-lea optimization for __ehdr_start.
    
    gold/
    	PR gold/21090
    	* x86_64.cc (Target_x86_64::can_convert_mov_to_lea): Add check
    	for predefined symbol.
    	(Target_x86_64::Relocate::relocate): Fix formatting.
Comment 11 Cary Coutant 2017-02-01 00:41:32 UTC
Fixed on master. OK to cherry-pick to older releases as needed.
Comment 12 Robert West 2017-02-01 15:41:50 UTC
Created attachment 9788 [details]
diff with Partial patch attached earlier by Nick

Current situation:

binutils-git/gcc 6.3.1/pie disabled default:

readelf: Error: the PHDR segment is not covered by a LOAD segment
make[5]: *** [Makefile:3653: check-DEJAGNU] Error 1
make[4]: *** [Makefile:1919: check-am] Error 2
make[3]: *** [Makefile:1759: check-recursive] Error 1
make[2]: *** [Makefile:1921: check] Error 2
make[1]: *** [Makefile:7513: check-ld] Error 2
make[3]: [Makefile:140: site.exp] Error 2 (ignored)
make[3]: [Makefile:141: site.exp] Error 1 (ignored)
make: *** [Makefile:2176: do-check] Error 2


binutils-git/gcc 6.3.1/pie enabled default:
make[5]: *** [Makefile:7239: incremental_test_2] Error 1
make[5]: *** [Makefile:7263: incremental_test_5] Error 1
make[5]: *** [Makefile:7278: incremental_copy_test] Error 1
make[5]: *** [Makefile:7284: incremental_common_test_1] Error 1
readelf: Error: the PHDR segment is not covered by a LOAD segment
make[4]: *** [Makefile:5675: check-am] Error 2
make[3]: *** [Makefile:5679: check] Error 2
make[2]: *** [Makefile:941: check-recursive] Error 1
make[1]: *** [Makefile:6100: check-gold] Error 2
make[5]: *** [Makefile:3653: check-DEJAGNU] Error 1
make[4]: *** [Makefile:1919: check-am] Error 2
make[3]: *** [Makefile:1759: check-recursive] Error 1
make[2]: *** [Makefile:1921: check] Error 2
make[1]: *** [Makefile:7513: check-ld] Error 2
make[3]: [Makefile:140: site.exp] Error 2 (ignored)
make[3]: [Makefile:141: site.exp] Error 1 (ignored)
make: *** [Makefile:2176: do-check] Error 2

Is it supposed to look like this? Should I treat those as false positives? I have to acknowledge that libiberty/testsuite/test-pexecute always crash on my system (in a clean chroot).

Also I retested Nick previous partial https://sourceware.org/bugzilla/attachment.cgi?id=9777 and found it fixes some additional fails in checklog so maybe it's worth to add it to master. I attached diff from checks with and without Nick's patch.
Comment 13 Robert West 2017-02-01 15:50:51 UTC
Created attachment 9789 [details]
binutils-git no-pie
Comment 14 Robert West 2017-02-01 15:51:20 UTC
Created attachment 9790 [details]
binutils-git pie
Comment 15 Cary Coutant 2017-02-01 16:22:05 UTC
Similar problem, but this time with incremental linking. If we've already done the mov-to-lea conversion during the initial link, an incremental update will not be able to apply the correct relocation.

I'm working on a fix. I'm headed out of town, though, so it'll be a few days.
Comment 16 Robert West 2017-02-17 11:33:37 UTC
Hi!

Any news about this? Is it still being worked on? I'm very sorry to disrupt you but I'm hoping those fixes could be included before binutils 2.28 is released.
Comment 17 Robert West 2017-03-18 20:49:20 UTC
Created attachment 9904 [details]
binutils 2.28 checklog no-pie_vs_pie.diff

I retested this against binutils 2.28. Here are the results:

### binutils-2.28/gcc 6.3.1/no pie:

$ grep Error binutils-2.28-check.log    
                                     
readelf: Error: the PHDR segment is not covered by a LOAD segment
make[5]: *** [Makefile:3678: check-DEJAGNU] Error 1
make[4]: *** [Makefile:1953: check-am] Error 2
make[3]: *** [Makefile:1793: check-recursive] Error 1
make[2]: *** [Makefile:1955: check] Error 2
make[1]: *** [Makefile:7548: check-ld] Error 2
make[3]: [Makefile:140: site.exp] Error 2 (ignored)
make[3]: [Makefile:141: site.exp] Error 1 (ignored)
make: *** [Makefile:2207: do-check] Error 2

		=== ld Summary ===

# of expected passes		1778
# of unexpected failures	1
# of expected failures		57
# of untested testcases	1
# of unsupported tests		12
/build/binutils/src/binutils-build/ld/ld-new 2.28


### binutils-2.28/gcc 6.3.1 --enable-default-pie:

$ grep Error binutils-2.28-pie-check.log
make[5]: *** [Makefile:7239: incremental_test_2] Error 1
make[5]: *** [Makefile:7263: incremental_test_5] Error 1
make[5]: *** [Makefile:7278: incremental_copy_test] Error 1
make[5]: *** [Makefile:7284: incremental_common_test_1] Error 1
readelf: Error: the PHDR segment is not covered by a LOAD segment
make[5]: *** [Makefile:7206: ehdr_start_test_4] Error 1
make[4]: *** [Makefile:5675: check-am] Error 2
make[3]: *** [Makefile:5679: check] Error 2
make[2]: *** [Makefile:941: check-recursive] Error 1
make[1]: *** [Makefile:6135: check-gold] Error 2
make[5]: *** [Makefile:3678: check-DEJAGNU] Error 1
make[4]: *** [Makefile:1953: check-am] Error 2
make[3]: *** [Makefile:1793: check-recursive] Error 1
make[2]: *** [Makefile:1955: check] Error 2
make[1]: *** [Makefile:7548: check-ld] Error 2
make[3]: [Makefile:140: site.exp] Error 2 (ignored)
make[3]: [Makefile:141: site.exp] Error 1 (ignored)
make: *** [Makefile:2207: do-check] Error 2

		=== ld Summary ===

# of expected passes		1775
# of unexpected failures	4
# of expected failures		57
# of untested testcases	1
# of unsupported tests		12
/build/binutils/src/binutils-build/ld/ld-new 2.28


### binutils-2.28/gcc 6.3.1 --enable-default-pie/+ patch https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ed35cc4a1cb76fd9ac53ad19efb97ee2caffbae9 included:

$ grep Error binutils-2.28-pie-patch-check.log
make[5]: *** [Makefile:7239: incremental_test_2] Error 1
make[5]: *** [Makefile:7263: incremental_test_5] Error 1
make[5]: *** [Makefile:7278: incremental_copy_test] Error 1
make[5]: *** [Makefile:7284: incremental_common_test_1] Error 1
readelf: Error: the PHDR segment is not covered by a LOAD segment
make[4]: *** [Makefile:5675: check-am] Error 2
make[3]: *** [Makefile:5679: check] Error 2
make[2]: *** [Makefile:941: check-recursive] Error 1
make[1]: *** [Makefile:6135: check-gold] Error 2
make[5]: *** [Makefile:3678: check-DEJAGNU] Error 1
make[4]: *** [Makefile:1953: check-am] Error 2
make[3]: *** [Makefile:1793: check-recursive] Error 1
make[2]: *** [Makefile:1955: check] Error 2
make[1]: *** [Makefile:7548: check-ld] Error 2
make[3]: [Makefile:140: site.exp] Error 2 (ignored)
make[3]: [Makefile:141: site.exp] Error 1 (ignored)
make: *** [Makefile:2207: do-check] Error 2

		=== ld Summary ===

# of expected passes		1774
# of unexpected failures	5
# of expected failures		57
# of untested testcases	1
# of unsupported tests		12
/build/binutils/src/binutils-build/ld/ld-new 2.28
Comment 18 Robert West 2017-03-18 20:51:09 UTC
Created attachment 9905 [details]
binutils 2.28 checklog pie_vs_pie-patch.diff
Comment 19 Sourceware Commits 2017-04-07 10:49:26 UTC
The master branch has been updated by Nick Clifton <nickc@sourceware.org>:

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

commit ae3f8c28134b52414a4c31df2e156615087c46e5
Author: Nick Clifton <nickc@redhat.com>
Date:   Fri Apr 7 11:48:08 2017 +0100

    Fix failure in x86_64 linker tests when compiling with a PIE enabled compiler.
    
    	PR 21090
    	* testsuite/ld-x86-64/x86-64.exp (undefined_weak): Explicitly
    	disable PIE for the non-pie version of the test.
Comment 20 Nick Clifton 2017-04-07 10:51:57 UTC
> The master branch has been updated by Nick Clifton <nickc@sourceware.org>:
> https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;
> h=ae3f8c28134b52414a4c31df2e156615087c46e5

This fixes a failure in the x86_64 linker tests.
Comment 21 Sourceware Commits 2017-04-07 15:58:54 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=a7eaf017f95932eb2d654bd61f4c4a873ba71f77

commit a7eaf017f95932eb2d654bd61f4c4a873ba71f77
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Apr 7 08:53:43 2017 -0700

    Use NOPIE_CFLAGS and NOPIE_LDFLAGS to disable PIE
    
    Since not all compilers support -no-pie, NOPIE_CFLAGS and NOPIE_LDFLAGS
    should be used to disable PIE.
    
    	PR ld/21090
    	* testsuite/ld-x86-64/x86-64.exp (undefined_weak): Use
    	NOPIE_CFLAGS and NOPIE_LDFLAGS to disable PIE for the non-pie
    	version of the test.
Comment 22 Robert West 2017-04-09 13:58:18 UTC
Thanks for the patches although I didn't saw difference in checklog after applying them to 2.28.0. I tested both Nick's and H.J. Lu versions. Is it only applicable to current master or it's just a minor fix? Am I missing something?

I think the main problem is still what Cary Coutant said:
> Similar problem, but this time with incremental linking. If we've already
> done the mov-to-lea conversion during the initial link, an incremental
> update will not be able to apply the correct relocation.
>
>I'm working on a fix. I'm headed out of town, though, so it'll be a few days.

I tried contact him to ask if he's still interested in fixing this be I didn't get answer. Anyway thank you for helping with this.
Comment 23 oneup40.bugzilla 2017-05-22 05:34:17 UTC
Created attachment 10060 [details]
checklog v2.29 (master) pie

There seems to be two different tracks going on in this bug thread.

When using gcc compiled with --enable-default-pie, there's still a failure in the gold linker testsuite in the master branch as of today (commit ca49a96781f723d43ec49471cbbb50aa511d063e).

`echo g++ -W -Wall    -Wstack-usage=262144 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fmerge-constants -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-use-linker-plugin   -o incremental_test_2 | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'` -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ two_file_test_tmp_2.o two_file_test_1b_ndebug.o two_file_test_2_ndebug.o two_file_test_main_ndebug.o

gcctestdir/ld: internal error in relocate, at ../../binutils-gdb/gold/x86_64.cc:4300


Second, there's also 18 unexpected failures in the ld testsuite:

Running /home/builder/src/binutils/src/binutils-gdb/ld/testsuite/ld-elf/shared.exp ...
FAIL: Run dl6a2 with -Bsymbolic-functions and dlopen on libdl6a.so
FAIL: Run dl6a5 with -Bsymbolic-functions --dynamic-list-cpp-new and dlopen on libdl6a.so
FAIL: Run dl6a6 with --dynamic-list-cpp-new -Bsymbolic-functions and dlopen on libdl6a.so
FAIL: Run dl6a7 with --dynamic-list-data -Bsymbolic and dlopen on libdl6a.so

Running /home/builder/src/binutils/src/binutils-gdb/ld/testsuite/ld-scripts/crossref.exp ...
FAIL: NOCROSSREFS 3

Running /home/builder/src/binutils/src/binutils-gdb/ld/testsuite/ld-size/size.exp ...
FAIL: Run size-4a
FAIL: Run size-4b
FAIL: Run size-5a
FAIL: Run size-5b
FAIL: Run size-6
FAIL: Run size-8

Running /home/builder/src/binutils/src/binutils-gdb/ld/testsuite/ld-srec/srec.exp ...
FAIL: S-records
FAIL: S-records with constructors

Running /home/builder/src/binutils/src/binutils-gdb/ld/testsuite/ld-x86-64/no-plt.exp ...
FAIL: No PLT (dynamic 1a)
FAIL: No PLT (dynamic 1c)
FAIL: Run pr20253-2f

Running /home/builder/src/binutils/src/binutils-gdb/ld/testsuite/ld-x86-64/x86-64.exp ...
FAIL: Build gotpcrel1
FAIL: Run pr19031
Comment 24 oneup40.bugzilla 2017-05-23 02:23:05 UTC
Created attachment 10062 [details]
reduced testcase for gold incremental link internal error

$ make 1.o 2.o main.o
g++    -c -o 1.o 1.cc
g++    -c -o 2.o 2.cc
g++    -c -o main.o main.cc
$ g++ -Bbinutils-build/gold/testsuite/gcctestdir -fno-use-linker-plugin -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro 2.o main.o 1.o
$ g++ -Bbinutils-build/gold/testsuite/gcctestdir -fno-use-linker-plugin -Wl,--incremental-update -Wl,-z,norelro 2.o main.o -Wl,--incremental-changed 1.o -Wl,--incremental-unknown
binutils-build/gold/testsuite/gcctestdir/ld: internal error in relocate, at ../../gold/x86_64.cc:4300
collect2: error: ld returned 1 exit status
Comment 25 oneup40.bugzilla 2017-05-24 03:18:04 UTC
Created attachment 10066 [details]
further reduced testcase for gold incremental link internal error

$ make 1.o 2.o main.o
g++    -c -o 1.o 1.cc
g++    -c -o 2.o 2.cc
g++    -c -o main.o main.cc
$ ./gold/ld-new -pie --incremental-full --incremental-patch=100 -z norelro crtbeginS.o 1.o 2.o main.o -lc crtendS.o
$ ./gold/ld-new -pie --incremental-update -z norelro crtbeginS.o --incremental-changed 1.o --incremental-unknown 2.o main.o -lc crtendS.o
./gold/ld-new: internal error in relocate, at ../../gold/x86_64.cc:4300
Comment 26 Sourceware Commits 2017-06-21 21:46:50 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=68193357e8d0fb53a229114713db9f0385f60ed8

commit 68193357e8d0fb53a229114713db9f0385f60ed8
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Jun 21 14:45:16 2017 -0700

    Pass $NOPIE_LDFLAGS size tests
    
    	PR ld/21090
    	* testsuite/ld-size/size.exp: Pass $NOPIE_LDFLAGS to size-4a,
    	size-4b, size-5a, size-5b, size-6 and size-8 tests.
Comment 27 Sourceware Commits 2017-06-21 21:59:45 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=e5c89b096d9cb9e5956e98cd5863519c87c6890b

commit e5c89b096d9cb9e5956e98cd5863519c87c6890b
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Jun 21 14:57:53 2017 -0700

    Pass $NOPIE_CFLAGS to NOCROSSREFS tests
    
    	PR ld/21090
    	* testsuite/ld-scripts/crossref.exp: Also pass $NOPIE_CFLAGS
    	to CC.
Comment 28 Sourceware Commits 2017-06-21 22:24:22 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=6b7373708821500a7388a8248b6c19fa1826c514

commit 6b7373708821500a7388a8248b6c19fa1826c514
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Jun 21 15:22:05 2017 -0700

    Pass $NOPIE_CFLAGS and $NOPIE_LDFLAGS to some ELF tests
    
    Some ELF tests will fail when PIE is used.
    
    	PR ld/21090
    	* testsuite/ld-elf/shared.exp: Pass $NOPIE_CFLAGS and
    	$NOPIE_LDFLAGS if non-PIE is required.
Comment 29 Sourceware Commits 2017-06-22 16:55:02 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=9d1c54ed7f3a4a70f35f85658c311697c17a95f5

commit 9d1c54ed7f3a4a70f35f85658c311697c17a95f5
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Jun 22 09:53:33 2017 -0700

    Pass $NOPIE_CFLAGS and $NOPIE_LDFLAGS to more ELF tests
    
    	PR ld/21090
    	* testsuite/ld-gc/gc.ex: Compile tmpdir/pr14265.o with
    	$NOPIE_CFLAGS.
    	* testsuite/ld-i386/i386.exp: Pass $NOPIE_CFLAGS and
    	$NOPIE_LDFLAGS if non-PIE is required.
    	* testsuite/ld-i386/no-plt.exp (NOPIE_CFLAGS): New.
    	(NOPIE_LDFLAGS): Likewise.
    	Pass $NOPIE_LDFLAGS if non-PIE is required.
    	* testsuite/ld-shared/shared.exp: Compile tmpdir/sh1np.o with
    	$NOPIE_CFLAGS.
Comment 30 Sourceware Commits 2017-06-22 17:09:04 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=329b5ba137687c4cf00413534a08ec33c8acb556

commit 329b5ba137687c4cf00413534a08ec33c8acb556
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Jun 22 10:07:53 2017 -0700

    Pass $NOPIE_CFLAGS/$NOPIE_LDFLAGS to "Run pr19031"
    
    	PR ld/21090
    	* testsuite/ld-i386/i386.exp: Pass $NOPIE_CFLAGS and
    	$NOPIE_LDFLAGS to "Run pr19031".
Comment 31 Sourceware Commits 2017-06-22 19:55:08 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=922109c7182858b005f55f6ac69bb6af145fc710

commit 922109c7182858b005f55f6ac69bb6af145fc710
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Jun 22 12:53:39 2017 -0700

    Pass $NOPIE_CFLAGS to ELF visibility tests
    
    	PR ld/21090
    	* testsuite/ld-elfvsb/elfvsb.exp (visibility_run): Pass
    	$NOPIE_CFLAGS if non-PIE is required.
Comment 32 Andreas K. Huettel 2017-10-20 23:09:45 UTC
The ld failures seem to be all fixed in 2.29.1. 

However I do as well see several occurrences of the gold error, 
gcctestdir/ld: internal error in relocate, at /var/tmp/portage/sys-devel/binutils-2.29.1-r1/work/binutils-2.29.1/gold/x86_64.cc:4300

(gcc-6.4.0 with default pie)
Comment 33 Sourceware Commits 2017-12-02 07:47:22 UTC
The master branch has been updated by Cary Coutant <ccoutant@sourceware.org>:

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

commit 158600eb989bcbc364c6d18259f1cb32ea9dc478
Author: Cary Coutant <ccoutant@gmail.com>
Date:   Wed Feb 15 00:25:29 2017 -0800

    Disallow --incremental with -pie and force -no-pie for incremental tests.
    
    This is a partial fix for the gold testsuite failures documented in
    PR 21090. The use of -fpie triggers some mov-to-lea optimizations that
    are not compatible with incremental linking, so those optimizations need
    to be disabled. We also diagnose the attempt to use -pie with incremental
    linking, and force -no-pie for the incremental tests in case the build has
    been configured to have GCC pass -pie all the time.
    
    We still have a problem where compiling with -fpie results in some GOT
    entries even when linking with -no-pie. This combination still causes test
    failures because we are not updating the GOT entries in an incremental update
    link.
    
    gold/
    	PR gold/21090
    	* incremental.cc (Sized_relobj_incr::do_relocate): Fix comment.
    	* options.cc (General_options::finalize): Disallow -pie with
    	incremental linking.
    	* x86_64.cc (Target_x86_64::Scan::local): Don't do mov-to-lea
    	or callq-to-direct optimizations for incremental links.
    	(Target_x86_64::Scan::global): Likewise.
    	(Target_x86_64::Relocate::relocate): Likewise.
    	* testsuite/Makefile.am (incremental_test): Force -no-pie.
    	(incremental_test_2): Likewise.
    	(incremental_test_3): Likewise.
    	(incremental_test_4): Likewise.
    	(incremental_test_5): Likewise.
    	(incremental_test_6): Likewise.
    	(incremental_copy_test): Likewise.
    	(incremental_common_test_1): Likewise.
    	(incremental_comdat_test_1):  Likewise.
    	* testsuite/Makefile.in: Regenerate.