/usr/src/gcc-4.8/debian/patches/gcc-default-relro.diff is in gcc-4.8-source 4.8.2-19ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | # DP: Turn on -Wl,-z,relro by default.
---
gcc/doc/invoke.texi | 3 +++
gcc/gcc.c | 1 +
2 files changed, 4 insertions(+), 0 deletions(-)
Index: b/src/gcc/doc/invoke.texi
===================================================================
--- a/src/gcc/doc/invoke.texi
+++ b/src/gcc/doc/invoke.texi
@@ -10049,6 +10049,9 @@
linker. When using the GNU linker, you can also get the same effect with
@option{-Wl,-Map=output.map}.
+NOTE: In Ubuntu 8.10 and later versions, for LDFLAGS, the option
+@option{-Wl,-z,relro} is used. To disable, use @option{-Wl,-z,norelro}.
+
@item -u @var{symbol}
@opindex u
Pretend the symbol @var{symbol} is undefined, to force linking of
Index: b/src/gcc/gcc.c
===================================================================
--- a/src/gcc/gcc.c
+++ b/src/gcc/gcc.c
@@ -741,6 +741,7 @@
"%{flto|flto=*:%<fcompare-debug*} \
%{flto} %{flto=*} %l " LINK_PIE_SPEC \
"%{fuse-ld=*:-fuse-ld=%*}\
+ -z relro\
%X %{o*} %{e*} %{N} %{n} %{r}\
%{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}}\
%{static:} %{L*} %(mfwrap) %(link_libgcc) " SANITIZER_EARLY_SPEC " %o\
|