about summary refs log tree commit diff
path: root/csu
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2018-07-05 22:57:45 +0200
committerFlorian Weimer <fweimer@redhat.com>2018-07-05 22:57:45 +0200
commit3a885c1f51b18852869a91cf59a1b39da1595c7a (patch)
treec6c2fd735a84b57ffe7d3496e7d7d03d946694d7 /csu
parent38cade0c461e58770749d7e8973f85c79532838a (diff)
downloadglibc-3a885c1f51b18852869a91cf59a1b39da1595c7a.tar.gz
glibc-3a885c1f51b18852869a91cf59a1b39da1595c7a.tar.xz
glibc-3a885c1f51b18852869a91cf59a1b39da1595c7a.zip
Build csu/elf-init.c and csu/static-reloc.c with stack protector
This does not change generated code (with -fstack-protector-strong), but
is important for formal compiler flags compliance.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'csu')
-rw-r--r--csu/Makefile16
1 files changed, 16 insertions, 0 deletions
diff --git a/csu/Makefile b/csu/Makefile
index f3498960f8..88fc77662e 100644
--- a/csu/Makefile
+++ b/csu/Makefile
@@ -50,6 +50,22 @@ CFLAGS-.o += $(no-stack-protector)
 CFLAGS-.op += $(no-stack-protector)
 CFLAGS-.os += $(no-stack-protector)
 
+# Dummy object not actually used for anything.  It is linked into
+# crt1.o nevertheless, which in turn is statically linked into
+# applications, so that build flags matter.
+# See <https://sourceware.org/ml/libc-alpha/2018-07/msg00101.html>.
+# NB: Using $(stack-protector) in this way causes a wrong definition
+# STACK_PROTECTOR_LEVEL due to the preceding $(no-stack-protector),
+# but it does not matter for this source file.
+CFLAGS-static-reloc.os += $(stack-protector)
+
+# This file is not actually part of the startup code in the nonshared
+# case and statically linked into applications.  See
+# <https://sourceware.org/bugzilla/show_bug.cgi?id=23323>,
+# <https://sourceware.org/ml/libc-alpha/2018-06/msg00717.html>.
+# Also see the note above regarding STACK_PROTECTOR_LEVEL.
+CFLAGS-elf-init.oS += $(stack-protector)
+
 ifeq (yes,$(build-shared))
 extra-objs += S$(start-installed-name) gmon-start.os
 ifneq ($(start-installed-name),$(static-start-installed-name))