From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 103161 invoked by alias); 20 Apr 2017 19:41:52 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 103105 invoked by uid 89); 20 Apr 2017 19:41:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-23.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,NO_DNS_FOR_FROM,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=mixing, 1296 X-HELO: mga11.intel.com Received: from mga11.intel.com (HELO mga11.intel.com) (192.55.52.93) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 20 Apr 2017 19:41:45 +0000 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2017 12:41:45 -0700 X-ExtLoop1: 1 Received: from gnu-6.sc.intel.com ([172.25.70.218]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2017 12:41:45 -0700 Received: by gnu-6.sc.intel.com (Postfix, from userid 1000) id 86D4E2004C6; Thu, 20 Apr 2017 12:41:45 -0700 (PDT) Date: Thu, 20 Apr 2017 19:41:00 -0000 From: "H.J. Lu" To: binutils@sourceware.org Subject: [PATCH] PR ld/21402: Skip PIE indirect5 and indirect6 tests on i386 Message-ID: <20170420194144.GA12307@intel.com> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.8.0 (2017-02-23) X-SW-Source: 2017-04/txt/msg00181.txt.bz2 On i386, since GOT reference is needed to access global symbols in PIE, those symbols are made dynamic. Crash happens when there is a reference to the same global symbol with a different symbol type in a shared object. Since mixing different types of the same symbol doesn't work in general, this patch skips those tests on i386 as well as compiles non-PIE indirect5 and indirect6 tests with $NOPIE_LDFLAGS and $NOPIE_CFLAGS. I am checking in this patch. H.J. --- PR ld/21402 * testsuite/ld-elf/indirect.exp: Pass $NOPIE_LDFLAGS and $NOPIE_CFLAGS to non-PIE indirect5 and indirect6 tests. Skip PIE indirect5 and indirect6 tests on i386. --- ld/ChangeLog | 7 +++++++ ld/testsuite/ld-elf/indirect.exp | 23 +++++++++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 7f5e389..fb88dc7 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,10 @@ +2017-04-20 H.J. Lu + + PR ld/21402 + * testsuite/ld-elf/indirect.exp: Pass $NOPIE_LDFLAGS and + $NOPIE_CFLAGS to non-PIE indirect5 and indirect6 tests. Skip + PIE indirect5 and indirect6 tests on i386. + 2017-04-20 Maciej W. Rozycki * testsuite/ld-mips-elf/mips-elf.exp: Join `__ehdr_start' tests. diff --git a/ld/testsuite/ld-elf/indirect.exp b/ld/testsuite/ld-elf/indirect.exp index 128d4a7..2fa374b 100644 --- a/ld/testsuite/ld-elf/indirect.exp +++ b/ld/testsuite/ld-elf/indirect.exp @@ -129,6 +129,8 @@ set testname "Indirect symbol 2" set cmd "$ld -shared -o tmpdir/indirect2.so tmpdir/indirect2.o" check_link_message "$cmd" [list $string2 $string] "$testname" +global NOPIE_CFLAGS NOPIE_LDFLAGS + set run_tests { {"Run with libindirect3c.so 1" "-Wl,--no-as-needed tmpdir/indirect3a.o tmpdir/indirect3b.o tmpdir/libindirect3c.so" "" @@ -155,17 +157,17 @@ set run_tests { "-Wl,--no-as-needed tmpdir/libindirect4c.so tmpdir/indirect4b.o tmpdir/indirect4a.o" "" {dummy.c} "indirect4d" "indirect4.out"} {"Run indirect5 1" - "-Wl,--no-as-needed tmpdir/libindirect5.so" "" - {indirect5a.c} "indirect5a" "indirect5.out"} + "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libindirect5.so" "" + {indirect5a.c} "indirect5a" "indirect5.out" "$NOPIE_CFLAGS"} {"Run indirect5 2" - "-Wl,--no-as-needed tmpdir/indirect5a.o tmpdir/libindirect5.so" "" - {dummy.c} "indirect5b" "indirect5.out"} + "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/indirect5a.o tmpdir/libindirect5.so" "" + {dummy.c} "indirect5b" "indirect5.out" "$NOPIE_CFLAGS"} {"Run indirect6 1" - "-Wl,--no-as-needed tmpdir/libindirect5.so" "" - {indirect6a.c} "indirect6a" "indirect5.out"} + "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libindirect5.so" "" + {indirect6a.c} "indirect6a" "indirect5.out" "$NOPIE_CFLAGS"} {"Run indirect6 2" - "-Wl,--no-as-needed tmpdir/indirect6a.o tmpdir/libindirect5.so" "" - {dummy.c} "indirect6b" "indirect5.out"} + "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/indirect6a.o tmpdir/libindirect5.so" "" + {dummy.c} "indirect6b" "indirect5.out" "$NOPIE_CFLAGS"} {"Run with libpr18720c.so 1" "-Wl,--no-as-needed tmpdir/pr18720a.o tmpdir/pr18720b.o tmpdir/libpr18720c.so" "" {check-ptr-eq.c} "pr18720a" "pr18720.out"} @@ -220,6 +222,11 @@ foreach t [list indirect5a indirect5b indirect6a indirect6b] { } } +# PR ld/21402: i386 doesn't support mixing different symbol types in PIE. +if {[istarget "i?86-*-*"]} { + return +} + send_log "$CC -fPIE -pie $srcdir/$subdir/main.c -o tmpdir/pie" catch "exec $CC -fPIE -pie $srcdir/$subdir/main.c -o tmpdir/pie" exec_output send_log "$exec_output" -- 2.9.3