From patchwork Mon Jul 18 12:09:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 72198 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp72908qga; Mon, 18 Jul 2016 05:09:27 -0700 (PDT) X-Received: by 10.66.227.101 with SMTP id rz5mr27587978pac.81.1468843767171; Mon, 18 Jul 2016 05:09:27 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id cr4si26652963pad.76.2016.07.18.05.09.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Jul 2016 05:09:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 624DC1A1E0F; Mon, 18 Jul 2016 05:10:15 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-wm0-x233.google.com (mail-wm0-x233.google.com [IPv6:2a00:1450:400c:c09::233]) (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 9E7641A1E05 for ; Mon, 18 Jul 2016 05:10:14 -0700 (PDT) Received: by mail-wm0-x233.google.com with SMTP id i5so113557282wmg.0 for ; Mon, 18 Jul 2016 05:09:25 -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=Sv54+PwhQY/9vW0aiOcbilTbdn92vncmV1jLP2EXqyM=; b=jTbL3kaduHNgat9jywKlpfcaqTSHBjN9KPU/dteayC89rlSerONE7RnuVY99A1nKQ6 ZL9LsTMR9vCkGQalUOXIu84+bRqCmAD0cbwlFsvoGZMcaeJOLRdvbwf7mRGwloDo9g0V acNTgRzCYIkhsRCu3EhiH5UD5iZ9bCfvF3dvQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Sv54+PwhQY/9vW0aiOcbilTbdn92vncmV1jLP2EXqyM=; b=HtbUUO49RE9YdkmHN2KWIupjFj3PMD//ty2p6350GqdWUmRe1nTQS3CSiMf5xU9f7O jd8zL5jDNanBmNbueRHzvJLRgCpnceHQDzv3O8S4aY9hmEBjG1xT+8OOK2z0Lq1BG9Nr 2nGr6SktzLx58AxNRX5XAk2NX0WzvCvH+jFPSxEDB/DZrIZVKlqWj8+ynUN6FBNB1mi9 dGNu30EoTWZONRSY4LqpC2Z/xQkq61tfC84arCx5fW+21Cc9jM+Su+VffIpNL5vxa9+U z8s1GQ1bSgenRYOv6+e219azLYO3RLrlGzEFlf/NC0qdndALF/la7OAOCz4XJpdhUKP6 rfEw== X-Gm-Message-State: ALyK8tLeUwJ41pzlDfMmAg21Gleh6jQqJ8WbT824TZkWtgKolQhqQmFTroIXSzMZUFhLsl28 X-Received: by 10.194.57.137 with SMTP id i9mr994748wjq.173.1468843763291; Mon, 18 Jul 2016 05:09:23 -0700 (PDT) Received: from localhost.localdomain (ip16-2-212-87.adsl2.static.versatel.nl. [87.212.2.16]) by smtp.gmail.com with ESMTPSA id b186sm6645343wmg.23.2016.07.18.05.09.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Jul 2016 05:09:22 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com, liming.gao@intel.com, steven.shi@intel.com, yonghong.zhu@intel.com, michael.d.kinney@intel.com, jordan.l.justen@intel.com Date: Mon, 18 Jul 2016 14:09:14 +0200 Message-Id: <1468843755-6248-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [edk2] [PATCH v2 1/2] ArmPkg: add prebuilt glue binaries for GCC5 LTO support X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" GCC in LTO mode interoperates poorly with non-standard libraries that provide implementations of compiler intrinsics such as memcpy/memset or the stack protector entry points. Such libraries need to be built in non-LTO mode, and then referenced explicitly on the linker command line using a -plugin-opt=-pass-through=-lxxx linker option. However, if these intrinsics are also referenced directly, the LTO version of the code will be pulled in, and will happily satisfy all other references to the same symbol. So add a pair of glue libraries, for ARM and AARCH64, that reference the known intrinsics. Since the binaries live under ArmPkg directly, we can reference them in tools_def.txt. Under LD garbage collection, the object itself will be pruned, and so will the intrinsics that end up unused by the module. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- ArmPkg/GccLto/liblto-aarch64.a | Bin 0 -> 1016 bytes ArmPkg/GccLto/liblto-aarch64.s | 15 ++++++ ArmPkg/GccLto/liblto-arm.a | Bin 0 -> 2096 bytes ArmPkg/GccLto/liblto-arm.s | 49 ++++++++++++++++++++ 4 files changed, 64 insertions(+) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/ArmPkg/GccLto/liblto-aarch64.a b/ArmPkg/GccLto/liblto-aarch64.a new file mode 100644 index 0000000000000000000000000000000000000000..2ab00238f0dad882abf08a1fb9623c9cdea9f17b GIT binary patch literal 1016 zcmbu7&rZTX5XPqz6oLo!M8btcV>pmaJb3R#Pab@Ovb0qUG$GwJk&}<*)yMErJh~su zhGA(FBh#ci^V@G{X8(NLKR&dgh`dGgNxR5Xq8|a14Nj;_ot@whUR;}*D0W|+#ne8) z+crcqtbp?TKuy$d;Fk^js)5sWPGwPMt2G8wSV~i4b+$;e`67MRugg8~@}{d?w$pJf z%hU2Z13wYMF8ko8f}aWQH5;VNy0m&m%Ghc<&b?O^ORa42Zb{|ZYEm;}M9QPwkz0*h zki8>ef}gYSE})e*bOFvFk*EVPSp5Eivz1-~TrQyaBwMaQ{8W!rrlD%!Td{2n*}~0;u;a`v3p{ literal 0 HcmV?d00001 diff --git a/ArmPkg/GccLto/liblto-aarch64.s b/ArmPkg/GccLto/liblto-aarch64.s new file mode 100644 index 000000000000..1215858edd43 --- /dev/null +++ b/ArmPkg/GccLto/liblto-aarch64.s @@ -0,0 +1,15 @@ +// +// GCC in LTO mode interoperates poorly with non-standard libraries that +// provide implementations of compiler intrinsics such as memcpy/memset +// or the stack protector entry points. +// +// By referencing these functions from a non-LTO object that can be passed +// to the linker via the -plugin-opt=-pass-through=-lxxx options, the +// intrinsics are included in the link in a way that allows them to be +// pruned again if no other references to them exist. +// + + .long memcpy - . + .long memset - . + .long __stack_chk_fail - . + .long __stack_chk_guard - . diff --git a/ArmPkg/GccLto/liblto-arm.a b/ArmPkg/GccLto/liblto-arm.a new file mode 100644 index 0000000000000000000000000000000000000000..d811c09573a35ea87a8002ecf01be18e1c6e7fd3 GIT binary patch literal 2096 zcmd6o%WKq76vn?XQ*C|Js#WW|YOD1@u(oJH7cHm=wjd(Xg%C3{sS}#eGD-SEunQLz zT?o1mx)E36&V>ti;!4n^e}Mi6u3h<^n@J{fT}_x@dNmx{6!*W2si#P63O*VzW?IBihqh z=)ig*pojKb#bw326`xc*toV}R>x!op&nRA0ysG%I;^&HAD}JZ=gW^w$zbO8u_=n=3 zihn6C7jA)^cemm`#e<4%#TOM%D88Zij$&7Fpm;^`6UFO_-zdgF4UQAVZgtkF)@Pj= z*ALnp_Y=1vL)@s|sQDwQ6*Mh*7aYIlFNiybaLxo6PTG16rQHlllhBAv-k>#u2@Sol zI=`G}CPrQiN;tRR(ak(*AdNItn6xb{AamTrttlr6972!~lYGJ?&mg`uh4`8leFjDu zR1H=l|GXG+(@3h}e9gF`ML(|A$Jm)#Ny{9*kb6fYIz6K#U~GZXiE;<`AQQJZh#Ex* zvPafpsg(EM+QeEU%F9+!7AJXjt<6BM=oX+)l${4fw*md4-N1n8cCac_8FW^32XIbw zCm?m%V%-}PWwOhnEHdMwdw?sVdjY8%7AKh$-3Qzh-4EOrJpf1@u{il%(L=yJ(ZfJZ z^axNF?FRzUqrklAF(4K_4lIdsu@6KCfmP8Hz#~x>xiwL4;;HB<;F;)Y;DzWJUhHT& zjNJ+~ZlqeztcDlZv9}b%uDP)byAnmP`PA5M95?(*5_=I7{9EHzOij*-d{<&4d*_Y!hx!AINvPBvHw{hmarpIg2NWNZUrI#!p wAAvlV^sI41<6<;hHcoUy=A?e-|05l;7C8giM-Tt9*KBPx@rv+1OG3`f-+dwCzyJUM literal 0 HcmV?d00001 diff --git a/ArmPkg/GccLto/liblto-arm.s b/ArmPkg/GccLto/liblto-arm.s new file mode 100644 index 000000000000..48c682f92e08 --- /dev/null +++ b/ArmPkg/GccLto/liblto-arm.s @@ -0,0 +1,49 @@ +// +// GCC in LTO mode interoperates poorly with non-standard libraries that +// provide implementations of compiler intrinsics such as memcpy/memset +// or the stack protector entry points. +// +// By referencing these functions from a non-LTO object that can be passed +// to the linker via the -plugin-opt=-pass-through=-lxxx options, the +// intrinsics are included in the link in a way that allows them to be +// pruned again if no other references to them exist. +// + + .long memcpy - . + .long memset - . + .long __stack_chk_fail - . + .long __stack_chk_guard - . + .long __ashrdi3 - . + .long __ashldi3 - . + .long __aeabi_idiv - . + .long __aeabi_idivmod - . + .long __aeabi_uidiv - . + .long __aeabi_uidivmod - . + .long __divdi3 - . + .long __divsi3 - . + .long __lshrdi3 - . + .long __aeabi_memcpy - . + .long __aeabi_memset - . + .long memmove - . + .long __modsi3 - . + .long __moddi3 - . + .long __muldi3 - . + .long __aeabi_lmul - . + .long __ARM_ll_mullu - . + .long __udivsi3 - . + .long __umodsi3 - . + .long __udivdi3 - . + .long __umoddi3 - . + .long __udivmoddi4 - . + .long __clzsi2 - . + .long __ctzsi2 - . + .long __ucmpdi2 - . + .long __switch8 - . + .long __switchu8 - . + .long __switch16 - . + .long __switch32 - . + .long __aeabi_ulcmp - . + .long __aeabi_uldivmod - . + .long __aeabi_ldivmod - . + .long __aeabi_llsr - . + .long __aeabi_llsl - .