public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Leif Lindholm <leif.lindholm@linaro.org>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: steven.shi@intel.com, yonghong.zhu@intel.com,
	liming.gao@intel.com, jordan.l.justen@intel.com,
	edk2-devel@lists.01.org, lersek@redhat.com
Subject: Re: [PATCH v5 5/8] ArmPkg: add prebuilt glue binaries for GCC5 LTO support
Date: Tue, 2 Aug 2016 09:50:55 +0100	[thread overview]
Message-ID: <20160802085055.GU31760@bivouac.eciton.net> (raw)
In-Reply-To: <1470038497-2536-6-git-send-email-ard.biesheuvel@linaro.org>

On Mon, Aug 01, 2016 at 10:01:34AM +0200, Ard Biesheuvel wrote:
> 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 <ard.biesheuvel@linaro.org>
> Acked-by: Jordan Justen <jordan.l.justen@intel.com>

If everyone else is happy about this binary file inclusion, I
certainly don't object (given that the source is included).

Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

> ---
>  ArmPkg/Library/GccLto/liblto-aarch64.a | Bin 0 -> 1016 bytes
>  ArmPkg/Library/GccLto/liblto-aarch64.s |  27 +++++++++
>  ArmPkg/Library/GccLto/liblto-arm.a     | Bin 0 -> 2096 bytes
>  ArmPkg/Library/GccLto/liblto-arm.s     |  61 ++++++++++++++++++++
>  4 files changed, 88 insertions(+)
> 
> diff --git a/ArmPkg/Library/GccLto/liblto-aarch64.a b/ArmPkg/Library/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<j^57EYNXKak(^fcXvc@Z~)5d^m*lCr*Hz|6PAkvlcbK
> oxX>*EVPSp5Eivz1-~TrQyaBwMaQ{8W!rrlD%!Td{2n*}~0;u;a`v3p{
> 
> literal 0
> HcmV?d00001
> 
> diff --git a/ArmPkg/Library/GccLto/liblto-aarch64.s b/ArmPkg/Library/GccLto/liblto-aarch64.s
> new file mode 100644
> index 000000000000..45000d327758
> --- /dev/null
> +++ b/ArmPkg/Library/GccLto/liblto-aarch64.s
> @@ -0,0 +1,27 @@
> +//
> +// Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
> +//
> +// This program and the accompanying materials are licensed and made available under
> +// the terms and conditions of the BSD License that accompanies this distribution.
> +// The full text of the license may be found at
> +// http://opensource.org/licenses/bsd-license.php.
> +//
> +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
> +//
> +
> +//
> +// 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/Library/GccLto/liblto-arm.a b/ArmPkg/Library/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<Fp}Ouq9w_nvbfNlqSKoxD~mm5{X(
> zhR`D5^G4ItF=}K8T}U0-`2R^Kc5yYX=T>}_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<eVx#1jh0yHv
> z<B{-Nm!6|^Pj~Rl*~wdJ;>*-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/Library/GccLto/liblto-arm.s b/ArmPkg/Library/GccLto/liblto-arm.s
> new file mode 100644
> index 000000000000..bc16320a46c0
> --- /dev/null
> +++ b/ArmPkg/Library/GccLto/liblto-arm.s
> @@ -0,0 +1,61 @@
> +//
> +// Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
> +//
> +// This program and the accompanying materials are licensed and made available under
> +// the terms and conditions of the BSD License that accompanies this distribution.
> +// The full text of the license may be found at
> +// http://opensource.org/licenses/bsd-license.php.
> +//
> +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
> +//
> +
> +//
> +// 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 - .
> -- 
> 2.7.4
> 


  reply	other threads:[~2016-08-02  8:51 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-01  8:01 [PATCH v5 0/8] BaseTools: add support for GCC5 in LTO mode Ard Biesheuvel
2016-08-01  8:01 ` [PATCH v5 1/8] BaseTools CLANG35: drop problematic use-movt and save-temps options Ard Biesheuvel
2016-08-01  8:01 ` [PATCH v5 2/8] ArmVirtPkg/ArmVirtPrePiUniCoreRelocatable: ignore .hash and .note sections Ard Biesheuvel
2016-08-01  8:01 ` [PATCH v5 3/8] BaseTools UNIXGCC ELFGCC CYGGCC: clone GCC build rule family into GCCLD Ard Biesheuvel
2016-08-01  8:01 ` [PATCH v5 4/8] BaseTools GCC: use 'gcc' as the linker command for GCC44 and later Ard Biesheuvel
2016-08-01  8:01 ` [PATCH v5 5/8] ArmPkg: add prebuilt glue binaries for GCC5 LTO support Ard Biesheuvel
2016-08-02  8:50   ` Leif Lindholm [this message]
2016-08-01  8:01 ` [PATCH v5 6/8] BaseTools GCC: drop GNU notes section from EFI image Ard Biesheuvel
2016-08-01  8:01 ` [PATCH v5 7/8] MdePkg GCC/X64: avoid 'hidden' visibility for module entry points Ard Biesheuvel
2016-08-01 14:18   ` Gao, Liming
2016-08-01 14:49     ` Ard Biesheuvel
2016-08-01 14:56       ` Ard Biesheuvel
2016-08-01 15:51         ` Ard Biesheuvel
2016-08-01 16:11           ` Ard Biesheuvel
2016-08-02  2:39             ` Gao, Liming
2016-08-02  5:26               ` Gao, Liming
2016-08-01  8:01 ` [PATCH v5 8/8] BaseTools GCC: introduce GCC5 toolchain to support GCC v5.x in LTO mode Ard Biesheuvel
2016-08-01 14:01 ` [PATCH v5 0/8] BaseTools: add support for GCC5 " Shi, Steven
2016-08-01 14:04   ` Ard Biesheuvel
2016-08-02  9:03 ` Ard Biesheuvel
2016-08-02 10:57   ` Laszlo Ersek
2016-08-02 11:13     ` Ard Biesheuvel
2016-08-02 11:41   ` Shi, Steven
2016-08-02 11:42     ` Ard Biesheuvel
2016-08-02 13:55       ` Michael Zimmermann
2016-08-02 13:56         ` Ard Biesheuvel
2016-08-02 14:39           ` Michael Zimmermann
2016-08-02 14:46             ` Michael Zimmermann
2016-08-02 14:51               ` Michael Zimmermann
2016-08-02 14:47             ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160802085055.GU31760@bivouac.eciton.net \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox