0003-specs-turn-on-Wl-z-now-by-default.patch (1632B)
1 From 40e45739e7d3787acd13b5b9a4c27d843de0ffe2 Mon Sep 17 00:00:00 2001 2 From: Ariadne Conill <ariadne@dereferenced.org> 3 Date: Fri, 21 Aug 2020 06:45:49 +0000 4 Subject: [PATCH] specs: turn on -Wl,-z,now by default 5 6 Previously, we also used to turn on -z relro here, but we now build 7 binutils with --enable-relro, which is functionally equivalent. 8 9 Binutils does not appear to have a similar option for enabling -z 10 now by default. 11 --- 12 gcc/doc/invoke.texi | 3 +++ 13 gcc/gcc.cc | 1 + 14 2 files changed, 4 insertions(+) 15 16 diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi 17 index b2de464798a..83bd1bde433 100644 18 --- a/gcc/doc/invoke.texi 19 +++ b/gcc/doc/invoke.texi 20 @@ -16872,6 +16872,9 @@ For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the 21 linker. When using the GNU linker, you can also get the same effect with 22 @option{-Wl,-Map=output.map}. 23 24 +NOTE: In Alpine Linux, for LDFLAGS, the option 25 +@option{-Wl,-z,now} is used. To disable, use @option{-Wl,-z,nonow}. 26 + 27 @item -u @var{symbol} 28 @opindex u 29 Pretend the symbol @var{symbol} is undefined, to force linking of 30 diff --git a/gcc/gcc.cc b/gcc/gcc.cc 31 index 47fb5802194..d18b5d7b59a 100644 32 --- a/gcc/gcc.cc 33 +++ b/gcc/gcc.cc 34 @@ -1157,6 +1157,7 @@ proper position among the other output files. */ 35 "%{flto|flto=*:%<fcompare-debug*} \ 36 %{flto} %{fno-lto} %{flto=*} %l " LINK_PIE_SPEC \ 37 "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \ 38 + "-z now " \ 39 "%X %{o*} %{e*} %{N} %{n} %{r}\ 40 %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \ 41 %{Wno-poison-system-directories:--no-poison-system-directories} \