From patchwork Mon Jun 11 07:42:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 138204 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp3736612lji; Mon, 11 Jun 2018 00:42:35 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ6VIWHTQb1Hde81mq4e4T6ScJZnJq4W6hR0agjjiaRZc74sQNETyOOKJ1cP4B/Mo/vA+P5 X-Received: by 2002:a17:902:1101:: with SMTP id d1-v6mr6278583pla.147.1528702955166; Mon, 11 Jun 2018 00:42:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528702955; cv=none; d=google.com; s=arc-20160816; b=W2nE+ttgZfFdGtV+Yv8C2KxVcQOYOTlXKP5NWMWlbwvw65og1ZxqtuoY7/wO9fLqAI iV+sTGA3ryxsRnVOGbEl70M0ZQwahtCWzYcZ+rwdCvlURDS2szEDeAw5BstD1zDFdEr1 uDaX0Dk7cd3R/evHGZEjd7NsYk1sqdq/SAmbN8vatFue8IwltFisZ3SDlCYu2eHTk3da sqyhS2MzbLY4nOdbx8xfEeNJOilBE1yThv/c2tAd5kho5Ad4xi6HgVcFvKIuGJIymfwW yT1hU+MoV4GTKRqxU3pYPQV6UxlLItkUgXzPaBdo8cjgUZori8VlMs8b2nJo/s4r60iv jp6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=K7OXgYzdHLE1O7LR6CJ7o4qo20G70uU2WJ878gTzHpw=; b=kCN+gA/V+NCTVaXzLz6r6Q8cvfCwCBTGLwaqm1iGx47s2VVV6tD/dmBzJAPug0gAPR CKQcH8X85dBRNX4sMEaEhbfaJuH2/G9Cock8M1BBTlfeOor6RngC93Ri8JMg9H6QxfY3 OeORYiMEc9LX2NSLEOq/lBFhXb+zodQkEgKBLOmKAVgW1XxQemWG+BS2Yo3kgr69BLyl qKyQWAHgQRNPRm9YUj4zXw+hAIC7huq96E8ZYtMqPu0WCDCXRw+dZefDSzWbVnD7zNFG NE9ww8c22hwX2UeSmiozj2gb6r1RfysM65h/yNweo7P4sMtiPtNxaNkFcqbZBXpWOKuI okHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VR5uZ6S8; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id p91-v6si62469421plb.457.2018.06.11.00.42.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Jun 2018 00:42:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VR5uZ6S8; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9C43D2119A875; Mon, 11 Jun 2018 00:42:34 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::241; helo=mail-wm0-x241.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 695BC21194899 for ; Mon, 11 Jun 2018 00:42:33 -0700 (PDT) Received: by mail-wm0-x241.google.com with SMTP id e16-v6so12849131wmd.0 for ; Mon, 11 Jun 2018 00:42:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=A1UO0sgBr4yMU3KgKWd6d8b8NpMbtT/xuXUlXnyCrfQ=; b=VR5uZ6S88+CigLQa5wlvzOpSESMo75qc3HElHhE9m2hPFg8rYvstVowMpHyCMmMUFK /1t7cVLX+ecjRqEoF4YBy2EE45+mm7jDejUcTPCrYysbONMRgIsf25Q1bh5/uP28iTOe dOwFDWfZVL7YkSwUJ/OrC9KWpsclh9P5mgahc= 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; bh=A1UO0sgBr4yMU3KgKWd6d8b8NpMbtT/xuXUlXnyCrfQ=; b=qqZA3OzHHhkzRx4sKYF5Uty+jcmPdPfygh5YdLKgTAQOGopQ2gvbPrnntQ5OG/2eq5 zBzAnebhyYix53pjDkZFnQkqmV1jikbI7YyCdcKNDrWSy7jQvQShLAuQGWIil2EmIjUa Mz+JfLKjgBqREkKBNZqKcwp1R+uPKd5Ib+pXlxsfF3fdEkTESoctUinhecEoW1R/mK6U XOq5vTLdg/rBbYvulPtkv8lJye3mrmXF9MqtzmP9ErTn7tcBqTADppcxv7IxjoGMJDSi PN2CaN7f9CLC5WsMHxJi+Gu3XQm8NgbcaTKHJuEEnk7S3wIbEF4chlI5SMr9RvGKD+1H rBog== X-Gm-Message-State: APt69E0DR2kYVIZfxdx2UXinruwZt4hgx885YirUegIMdt/htCcjj2aN jm00r32v68QdQe4ro43r2nXF1qb8K5g= X-Received: by 2002:a1c:454f:: with SMTP id s76-v6mr7091108wma.16.1528702951677; Mon, 11 Jun 2018 00:42:31 -0700 (PDT) Received: from dogfood.home ([2a01:cb1d:112:6f00:49dd:727b:5dc6:612d]) by smtp.gmail.com with ESMTPSA id n7-v6sm45702756wri.27.2018.06.11.00.42.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Jun 2018 00:42:30 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Mon, 11 Jun 2018 09:42:27 +0200 Message-Id: <20180611074227.30625-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 Subject: [edk2] [PATCH] BaseTools/tools_def IA32: disable PIE code generation explicitly X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel , zenith432@users.sourceforge.net, liming.gao@intel.com, lersek@redhat.com MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" As a security measure, some distros now build their GCC toolchains with PIE code generation enabled by default, because it is a prerequisite for ASLR to be enabled when running the executable. This typically results in slightly larger code, but it also generates ELF relocations that our tooling cannot deal with, so let's disable it explicitly when using GCC5 for IA32. (Note that this does not apply to X64: it uses PIE code deliberately in some cases, and our tooling does deal with the resuling relocations) Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- BaseTools/Conf/tools_def.template | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.17.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Acked-by: Laszlo Ersek diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template index 7e9c915755ed..ab57f9c706e3 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -4670,7 +4670,7 @@ DEFINE GCC49_AARCH64_DLINK2_FLAGS = DEF(GCC48_AARCH64_DLINK2_FLAGS) DEFINE GCC49_ARM_ASLDLINK_FLAGS = DEF(GCC48_ARM_ASLDLINK_FLAGS) DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS) -DEFINE GCC5_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) +DEFINE GCC5_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -fno-pic -fno-pie DEFINE GCC5_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) DEFINE GCC5_IA32_X64_DLINK_COMMON = DEF(GCC49_IA32_X64_DLINK_COMMON) DEFINE GCC5_IA32_X64_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_ASLDLINK_FLAGS) @@ -5502,9 +5502,9 @@ RELEASE_GCC49_AARCH64_DLINK_FLAGS = DEF(GCC49_AARCH64_DLINK_FLAGS) *_GCC5_IA32_RC_PATH = DEF(GCC5_IA32_PREFIX)objcopy *_GCC5_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32 -fno-lto -*_GCC5_IA32_ASLDLINK_FLAGS = DEF(GCC5_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386 +*_GCC5_IA32_ASLDLINK_FLAGS = DEF(GCC5_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386 -no-pie *_GCC5_IA32_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m32 -march=i386 -*_GCC5_IA32_DLINK2_FLAGS = DEF(GCC5_IA32_DLINK2_FLAGS) +*_GCC5_IA32_DLINK2_FLAGS = DEF(GCC5_IA32_DLINK2_FLAGS) -no-pie *_GCC5_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS) *_GCC5_IA32_OBJCOPY_FLAGS = *_GCC5_IA32_NASM_FLAGS = -f elf32