From patchwork Tue Feb 4 22:06:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 1233582 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-109178-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aurel32.net Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha1 header.s=default header.b=fOlySDJh; dkim-atps=neutral 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 48BzM90LlRz9sRY for ; Wed, 5 Feb 2020 09:07:16 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; q=dns; s=default; b=Z9X H0/cMkC1I8BsBEJCDzdQSJUvcq8QC7hdUdxtOQRFq1Z3pVbT8pXSn7zjdQmdgP9u EHj03JvnwqnJaNMa+Y+sbStUU5WCuah8UxlHNAWfQzWXVmdlxMKJltQAtryPyrCo zSQb63KXtTWxbIIKZXqN8q+IYjGBoVd2MjfUQDpE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; s=default; bh=VskTCLpXE Jorrxvpa7P5zq3y74E=; b=fOlySDJhY3ejz8YDVI6lmbD8gwdN6xlJm61aVmsiT CuzH720CWIswG9JluA2RqXokzWa/XvPJV+irdL+/cuWf+mJGMUmVa7olGEnwuxcm MlH737xA7VAA7jV6czJsL+Xg83Or8GYAXYqjW8l3QBbZJlJOe/0YJxhf5KOX5TAv fw= Received: (qmail 24364 invoked by alias); 4 Feb 2020 22:07:10 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 23919 invoked by uid 89); 4 Feb 2020 22:07:10 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy=H*r:sk:ECDHE_R, HX-Languages-Length:1912, HContent-Transfer-Encoding:8bit X-HELO: hall.aurel32.net From: Aurelien Jarno To: libc-alpha@sourceware.org Cc: Andreas Schwab , Aurelien Jarno Subject: [PATCH] configure: fix STT_GNU_IFUNC support detection with PIE toolchains [BZ #25506] Date: Tue, 4 Feb 2020 23:06:51 +0100 Message-Id: <20200204220651.4006526-1-aurelien@aurel32.net> MIME-Version: 1.0 When GCC defaults to PIE, compiling the conftest.S that is used to detect for assembler and linker STT_GNU_IFUNC support emits a relocation. This causes a false positive in the detection. Example on riscv64 with a toolchain defaulting to PIE: | configure:4009: checking for assembler and linker STT_GNU_IFUNC support | | Relocation section '.rela.dyn' at offset 0x268 contains 1 entry: | Offset Info Type Sym. Value Sym. Name + Addend | 000000002000 000000000003 R_RISCV_RELATIVE 280 | configure:4040: result: yes This is also reproducible on MIPS. Fix that by compiling conftest.S with -no-pie. After that change: | configure:4009: checking for assembler and linker STT_GNU_IFUNC support | | There are no relocations in this file. | configure:4040: result: no Thanks to Andreas Schwab for the help debugging the issue. --- configure | 2 +- configure.ac | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index b959d2d9885..b31b56567ab 100755 --- a/configure +++ b/configure @@ -4031,7 +4031,7 @@ __start: EOF libc_cv_ld_gnu_indirect_function=no if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \ - -nostartfiles -nostdlib $no_ssp \ + -nostartfiles -nostdlib $no_ssp -no-pie \ -o conftest conftest.S 1>&5 2>&5; then # Do a link to see if the backend supports IFUNC relocs. $READELF -r conftest 1>&5 diff --git a/configure.ac b/configure.ac index 49b900c1ed6..8e19341f595 100644 --- a/configure.ac +++ b/configure.ac @@ -645,7 +645,7 @@ __start: EOF libc_cv_ld_gnu_indirect_function=no if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \ - -nostartfiles -nostdlib $no_ssp \ + -nostartfiles -nostdlib $no_ssp -no-pie \ -o conftest conftest.S 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then # Do a link to see if the backend supports IFUNC relocs. $READELF -r conftest 1>&AS_MESSAGE_LOG_FD