From patchwork Mon Feb 29 16:13:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Renlin Li X-Patchwork-Id: 590022 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 14E80140557 for ; Tue, 1 Mar 2016 03:14:30 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=HLuggcQT; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:cc:message-id:date:mime-version:content-type; q=dns; s=default; b=nmf7PRSFmINbhtcL7+9/GjeFHhtp+jpPDiHRflqB/faUYZiziq ZTitN4Bkp9mqVRIT02sIO+vKv0tdSJASN5Aoi6VU1dwYNC2+Xb7nZ6aOCujheMq+ qD5L8DT6kvqTVGjOtpDqJieqJlPnAK/87yJgdkpTJKs1i6c5ppURitkkk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:cc:message-id:date:mime-version:content-type; s= default; bh=tsLZL+jn8CxsKALkCv5w3UvFmJI=; b=HLuggcQTGeXzNh9dRu6F ny/w9RWWodiqPi3fW9p0AaUJHUlWq8ckSnKCJkhYD6MkBXniQqnWftkIuKLpBJLC QVOjfZDZQQqFATQiMYQO0T0ftiXpy6j6d5L14TY+45r0XMREfjlpVX4SI5qXz2Ih yxIB9nWvitaqTEPUEXXGEHs= Received: (qmail 75478 invoked by alias); 29 Feb 2016 16:14:01 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 75412 invoked by uid 89); 29 Feb 2016 16:14:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=statically, baremetal, UD:crtbegin.o, sk:dgrequ X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 29 Feb 2016 16:13:58 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 122CA49; Mon, 29 Feb 2016 08:13:01 -0800 (PST) Received: from [10.2.207.43] (e104453-lin.cambridge.arm.com [10.2.207.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3C61C3F25E; Mon, 29 Feb 2016 08:13:55 -0800 (PST) From: Renlin Li Subject: [PATCH]Replace -shared with -r -nostdlib in gcc.dg/lto/pr61526 pr54709 pr64415 test cases. To: "gcc-patches@gcc.gnu.org" Cc: Marcus Shawcroft , Ramana Radhakrishnan Message-ID: <56D46E41.7090708@foss.arm.com> Date: Mon, 29 Feb 2016 16:13:53 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 X-IsSubscribed: yes Hi all, The gcc.dg/lto/pr54709, pr61526, pr64415 linking testcases keep failing on arm/aarch64 bare-metal target. It's because statically built newlib library is used to link with shared object. And the linker complains about relocations which cannot be used in shared object. For example, the following errors are produced: crtbegin.o: relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC crtbegin.o: relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC librdimon.a(rdimon-syscalls.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against external symbol `_impure_ptr' can not be used when making a shared object; recompile with -fPIC Presumably, bare-metal toolchain for other architecture have those test case failures as well? In this patch, -shared option is replace by -r -nostdlib. So that the standard system startup files or libraries are not used when linking. arm-none-eabi, aarch64-none-elf regression test OK, OK for trunk? Regards, Renlin Li gcc/testsuite/ChangeLog: 2016-02-29 Renlin Li * gcc.dg/lto/pr54709_0.c: Replace -shard with -r -nostdlib. * gcc.dg/lto/pr61526_0.c: Ditto. * gcc.dg/lto/pr64415_0.c: Ditto. diff --git a/gcc/testsuite/gcc.dg/lto/pr54709_0.c b/gcc/testsuite/gcc.dg/lto/pr54709_0.c index f3db5dc..12a10e0 100644 --- a/gcc/testsuite/gcc.dg/lto/pr54709_0.c +++ b/gcc/testsuite/gcc.dg/lto/pr54709_0.c @@ -1,7 +1,7 @@ /* { dg-lto-do link } */ /* { dg-require-visibility "hidden" } */ /* { dg-require-effective-target fpic } */ -/* { dg-extra-ld-options { -shared } } */ +/* { dg-extra-ld-options { -r -nostdlib } } */ /* { dg-lto-options { { -fPIC -fvisibility=hidden -flto } } } */ void foo (void *p, void *q, unsigned s) diff --git a/gcc/testsuite/gcc.dg/lto/pr61526_0.c b/gcc/testsuite/gcc.dg/lto/pr61526_0.c index 8a631f0..5e2f7acf 100644 --- a/gcc/testsuite/gcc.dg/lto/pr61526_0.c +++ b/gcc/testsuite/gcc.dg/lto/pr61526_0.c @@ -1,7 +1,7 @@ /* { dg-require-effective-target fpic } */ /* { dg-lto-do link } */ /* { dg-lto-options { { -fPIC -flto -flto-partition=1to1 } } } */ -/* { dg-extra-ld-options { -shared } } */ +/* { dg-extra-ld-options { -r -nostdlib } } */ static void *master; void *foo () { return master; } diff --git a/gcc/testsuite/gcc.dg/lto/pr64415_0.c b/gcc/testsuite/gcc.dg/lto/pr64415_0.c index 4faab2b..0f583a5 100644 --- a/gcc/testsuite/gcc.dg/lto/pr64415_0.c +++ b/gcc/testsuite/gcc.dg/lto/pr64415_0.c @@ -1,7 +1,7 @@ /* { dg-lto-do link } */ /* { dg-require-effective-target fpic } */ /* { dg-lto-options { { -O -flto -fpic } } } */ -/* { dg-extra-ld-options { -shared } } */ +/* { dg-extra-ld-options { -r -nostdlib } } */ /* { dg-extra-ld-options "-Wl,-undefined,dynamic_lookup" { target *-*-darwin* } } */ extern void bar(char *, int);