]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - elf/rtld-Rules
install.texi: Build was tested with binutils 2.41 (just released)
[thirdparty/glibc.git] / elf / rtld-Rules
index 1e03332ca1894b678da230b9abc8c9db10877c2a..365a3408f3c0e3bf261963aa2f8478dca458ff5d 100644 (file)
@@ -1,6 +1,6 @@
 # Subroutine makefile for compiling libc modules linked into dynamic linker.
 
-# Copyright (C) 2002-2012 Free Software Foundation, Inc.
+# Copyright (C) 2002-2023 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -15,7 +15,7 @@
 
 # You should have received a copy of the GNU Lesser General Public
 # License along with the GNU C Library; if not, see
-# <http://www.gnu.org/licenses/>.
+# <https://www.gnu.org/licenses/>.
 
 # This makefile is never used by itself, but only from the rtld-libc.a
 # rule in Makefile, which does make -f librtld.mk -f rtld-Rules.
@@ -29,7 +29,7 @@ rtld-all:
 # When run from the elf/Makefile to build rtld-libc.a, $(subdir) is elf.
 ifneq ($(subdir),elf)
 ifndef rtld-modules
-error rtld-modules not set
+$(error rtld-modules not set)
 endif
 endif
 
@@ -37,7 +37,7 @@ ifndef rtld-modules
 # Running to build rtld-libc.a, driving runs of $(rtld-subdir-make), below.
 
 ifndef rtld-subdirs
-error This makefile is a subroutine of elf/Makefile not to be used directly
+$(error This makefile is a subroutine of elf/Makefile not to be used directly)
 endif
 
 include ../Makeconfig
@@ -52,7 +52,7 @@ $(objpfx)rtld-libc.a: $(foreach dir,$(rtld-subdirs),\
        mv -f $@T $@
 
 # Use the verbose option of ar and tar when not running silently.
-ifeq   "$(findstring s,$(MAKEFLAGS))" ""       # if not -s
+ifeq ($(silent-make),no)                       # if not -s
 verbose := v
 else                                           # -s
 verbose        :=
@@ -88,29 +88,39 @@ else
 # Some other subdir's Makefile has provided all its normal rules,
 # and we just provide some additional definitions.
 
+rtld-compile-command.S = $(compile-command.S) $(rtld-CPPFLAGS)
+rtld-compile-command.s = $(compile-command.s) $(rtld-CPPFLAGS)
+rtld-compile-command.c = $(compile-command.c) $(rtld-CPPFLAGS) $(rtld-CFLAGS)
+
 # These are the basic compilation rules corresponding to the Makerules ones.
 # The sysd-rules generated makefile already defines pattern rules for rtld-%
 # targets built from sysdeps source files.
 $(objpfx)rtld-%.os: rtld-%.S $(before-compile)
-       $(compile-command.S) $(rtld-CPPFLAGS)
+       $(rtld-compile-command.S)
 $(objpfx)rtld-%.os: rtld-%.s $(before-compile)
-       $(compile-command.s) $(rtld-CPPFLAGS)
+       $(rtld-compile-command.s)
 $(objpfx)rtld-%.os: rtld-%.c $(before-compile)
-       $(compile-command.c) $(rtld-CPPFLAGS)
+       $(rtld-compile-command.c)
 $(objpfx)rtld-%.os: %.S $(before-compile)
-       $(compile-command.S) $(rtld-CPPFLAGS)
+       $(rtld-compile-command.S)
 $(objpfx)rtld-%.os: %.s $(before-compile)
-       $(compile-command.s) $(rtld-CPPFLAGS)
+       $(rtld-compile-command.s)
 $(objpfx)rtld-%.os: %.c $(before-compile)
-       $(compile-command.c) $(rtld-CPPFLAGS)
+       $(rtld-compile-command.c)
 
 # The rules for generated source files.
-$(objpfx)rtld-%.os: $(objpfx)rtld-%.S $(before-compile); $(compile-command.S)
-$(objpfx)rtld-%.os: $(objpfx)rtld-%.s $(before-compile); $(compile-command.s)
-$(objpfx)rtld-%.os: $(objpfx)rtld-%.c $(before-compile); $(compile-command.c)
-$(objpfx)rtld-%.os: $(objpfx)%.S $(before-compile); $(compile-command.S)
-$(objpfx)rtld-%.os: $(objpfx)%.s $(before-compile); $(compile-command.s)
-$(objpfx)rtld-%.os: $(objpfx)%.c $(before-compile); $(compile-command.c)
+$(objpfx)rtld-%.os: $(objpfx)rtld-%.S $(before-compile)
+       $(rtld-compile-command.S)
+$(objpfx)rtld-%.os: $(objpfx)rtld-%.s $(before-compile)
+       $(rtld-compile-command.s)
+$(objpfx)rtld-%.os: $(objpfx)rtld-%.c $(before-compile)
+       $(rtld-compile-command.c)
+$(objpfx)rtld-%.os: $(objpfx)%.S $(before-compile)
+       $(rtld-compile-command.S)
+$(objpfx)rtld-%.os: $(objpfx)%.s $(before-compile)
+       $(rtld-compile-command.s)
+$(objpfx)rtld-%.os: $(objpfx)%.c $(before-compile)
+       $(rtld-compile-command.c)
 
 # The command line setting of rtld-modules (see above) tells us
 # what we need to build, and that tells us what dependency files we need.
@@ -129,6 +139,11 @@ ifdef rtld-depfiles
 endif
 
 # This here is the whole point of all the shenanigans.
-rtld-CPPFLAGS := -DNOT_IN_libc=1 -DIS_IN_rtld=1 -DIN_LIB=rtld
+# Set libof-* for each routine.
+cpp-srcs-left := $(rtld-modules:%.os=%)
+lib := rtld
+include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))
+
+rtld-CFLAGS += $(no-stack-protector) $(no-fortify-source)
 
 endif