From patchwork Sun Oct 27 22:03:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrice Fontaine X-Patchwork-Id: 1185144 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="fgQuoY2b"; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 471X0Y2yBVz9sCJ for ; Mon, 28 Oct 2019 09:03:08 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 88B6485161; Sun, 27 Oct 2019 22:03:06 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dakLVn_Hoa_w; Sun, 27 Oct 2019 22:03:06 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id D544A85116; Sun, 27 Oct 2019 22:03:05 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 900B81BF3D5 for ; Sun, 27 Oct 2019 22:03:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 7DE07846BF for ; Sun, 27 Oct 2019 22:03:04 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Oa0eGFULo4UY for ; Sun, 27 Oct 2019 22:03:03 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by whitealder.osuosl.org (Postfix) with ESMTPS id C866084320 for ; Sun, 27 Oct 2019 22:03:02 +0000 (UTC) Received: by mail-wr1-f68.google.com with SMTP id s1so7903942wro.0 for ; Sun, 27 Oct 2019 15:03:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SgqwRzcusdG+Tm0on2JPYsSNQ6YbcG74EAbPtAraYMI=; b=fgQuoY2bxOR4DSH/vv78VgxFn74NUoKrReYecR80jmNUtgo1JMaCa3ijmqpRZSw05R W3xlnnSUJxFY4nC1gEWOt0qtyc+5PLDAtj2Ka+add5bS7hs5vNKRp/SOA92rxmgqN4qa 68WxK3AuJm4eLOjRL6NrJXBAnPbxGLbdpB1wP0lcZ+IXt5FEmnGpcNiRFSNLoEY4c8MP tKCpzOzQWM+LvtCxgqq24jxFh+PekZMU9l09QTBFRqnQsqhAtDCLt2HOlV2FJlwdEGX1 NDB1HjqVHZeIYa5Eu408uVKV2UqbaJIJrzW55scF8VqLDoUlRV47IwOQyJb2i3KhFMo7 RdLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SgqwRzcusdG+Tm0on2JPYsSNQ6YbcG74EAbPtAraYMI=; b=p8jLjBtz7qaqNDrjGT7P9dtxtjjgIBAX4U9ZopadrzwBVTqG9jA4sYqqKMSAn71TeR 76Rmeoyxi2BmBvTf3OFu4h6PiUYSLDXkTnFTH2hrI1nxX/vHrdOywHQnbJ5xtVY2J9xZ wAYVVD8PUIYoWS1gh9klIIvzt7V20QKMOSnNdkaSLpCczcrAWcT/qK2pZR9RkEM2OaS/ wjgtrSB9y28/NvR1BUjaF9p5wmMbZBoQUInj+sc3utXugeKK017Eg9WJrc1Ar76Z+wSr qZXIopwJKOhSty1LWvFuFLfb8hIQ61E5qwVAFTQQAM/9fNddLdgjIt9hX2IxVL3N5kiU bR8A== X-Gm-Message-State: APjAAAVvmFWOH6cxFcV7MmUn6FP+5974/hCzN5DrLAtBu/wnSOJB+CIS EmdKvGNyko6nGZqRE+2qXIP3zIoG X-Google-Smtp-Source: APXvYqy37tfjkPMv9LLQEdWMy3yBK8aGL5QZECYoRRfv6rdETVsKmCa6owSNPfwBoAMXsFqBnBNcOw== X-Received: by 2002:adf:f90f:: with SMTP id b15mr12470781wrr.76.1572213780657; Sun, 27 Oct 2019 15:03:00 -0700 (PDT) Received: from kali.home (lfbn-1-3732-187.w86-229.abo.wanadoo.fr. [86.229.230.187]) by smtp.gmail.com with ESMTPSA id x12sm4200025wmc.4.2019.10.27.15.02.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Oct 2019 15:02:59 -0700 (PDT) From: Fabrice Fontaine To: buildroot@buildroot.org Date: Sun, 27 Oct 2019 23:03:34 +0100 Message-Id: <20191027220334.23505-1-fontaine.fabrice@gmail.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Subject: [Buildroot] [PATCH 1/1] Config.in: disable PIC/PIE if the toolchain does not support PIE X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fabrice Fontaine Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" m68k does not seem to really support PIE as it raises the following build failure with aer-inject: /usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-1/output/host/opt/ext-toolchain/bin/../lib/gcc/m68k-buildroot-linux-uclibc/7.4.0/../../../../m68k-buildroot-linux-uclibc/bin/ld: /usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-1/output/host/m68k-buildroot-linux-uclibc/sysroot/usr/lib/Scrt1.o: in function `lib_main': (.text+0x4): undefined reference to `__shared_flat_add_library' /usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-1/output/host/opt/ext-toolchain/bin/../lib/gcc/m68k-buildroot-linux-uclibc/7.4.0/../../../../m68k-buildroot-linux-uclibc/bin/ld: final link failed: bad value We also have another build failure with uclibc on microblazeel: /home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/microblazeel-buildroot-linux-uclibc/8.3.0/../../../../microblazeel-buildroot-linux-uclibc/bin/ld: final link failed: bad value collect2: error: ld returned 1 exit status Makefile.in:114: recipe for target '../utils/getconf' failed So add a BR2_TOOLCHAIN_SUPPORTS_PIE dependency on BR2_PIC_PIE Fixes: - http://autobuild.buildroot.net/results/4cdd6f0368cc9d3c6e88f01b1a8929eb0839b638 - http://autobuild.buildroot.net/results/a82a484409149d7f9aff6140ddcb89f627f508c7 Signed-off-by: Fabrice Fontaine Reviewed-by: Yann E. MORIN --- Config.in | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Config.in b/Config.in index ebbb6b41f4..010b0774e3 100644 --- a/Config.in +++ b/Config.in @@ -697,10 +697,15 @@ comment "Security Hardening Options" config BR2_PIC_PIE bool "Build code with PIC/PIE" depends on BR2_SHARED_LIBS + depends on BR2_TOOLCHAIN_SUPPORTS_PIE help Generate Position-Independent Code (PIC) and link Position-Independent Executables (PIE). +comment "PIC/PIE needs a toolchain w/ PIE" + depends on BR2_SHARED_LIBS + depends on !BR2_TOOLCHAIN_SUPPORTS_PIE + choice bool "Stack Smashing Protection" default BR2_SSP_ALL if BR2_ENABLE_SSP # legacy @@ -783,12 +788,16 @@ config BR2_RELRO_PARTIAL config BR2_RELRO_FULL bool "Full" + depends on BR2_TOOLCHAIN_SUPPORTS_PIE select BR2_PIC_PIE help This option includes the partial configuration, but also marks the GOT as read-only at the cost of initialization time during program loading, i.e every time an executable is started. +comment "RELRO Full needs a toolchain w/ PIE" + depends on !BR2_TOOLCHAIN_SUPPORTS_PIE + endchoice comment "RELocation Read Only (RELRO) needs shared libraries"