about summary refs log tree commit diff
path: root/Makerules
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2022-05-16 06:17:14 -0700
committerH.J. Lu <hjl.tools@gmail.com>2022-05-18 13:04:13 -0700
commit2d5ec6692f5746ccb11db60976a6481ef8e9d74f (patch)
tree93ce3ec2b6d4fb72bcd3bac0432ea1405683c967 /Makerules
parent728894dba4a19578bd803906de184a8dd51ed13c (diff)
downloadglibc-2d5ec6692f5746ccb11db60976a6481ef8e9d74f.tar.gz
glibc-2d5ec6692f5746ccb11db60976a6481ef8e9d74f.tar.xz
glibc-2d5ec6692f5746ccb11db60976a6481ef8e9d74f.zip
Enable DT_RELR in glibc shared libraries and PIEs automatically
Enable DT_RELR in glibc shared libraries and position independent
executables (PIE) automatically if linker supports -z pack-relative-relocs.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Diffstat (limited to 'Makerules')
-rw-r--r--Makerules2
1 files changed, 2 insertions, 0 deletions
diff --git a/Makerules b/Makerules
index 354528b8c7..dfe89e9e39 100644
--- a/Makerules
+++ b/Makerules
@@ -536,6 +536,7 @@ lib%.so: lib%_pic.a $(+preinit) $(+postinit) $(link-libc-deps)
 define build-shlib-helper
 $(LINK.o) -shared -static-libgcc -Wl,-O1 $(sysdep-LDFLAGS) \
 	  $(if $($(@F)-no-z-defs)$(no-z-defs),,-Wl,-z,defs) $(rtld-LDFLAGS) \
+	  $(if $($(@F)-no-dt-relr),$(no-dt-relr-ldflag),$(dt-relr-ldflag)) \
 	  $(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) \
 	  $(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \
 	  -Wl,-soname=lib$(libprefix)$(@F:lib%.so=%).so$($(@F)-version) \
@@ -588,6 +589,7 @@ endef
 define build-module-helper
 $(LINK.o) -shared -static-libgcc $(sysdep-LDFLAGS) $(rtld-LDFLAGS) \
 	  $(if $($(@F)-no-z-defs)$(no-z-defs),,-Wl,-z,defs) \
+	  $(if $($(@F)-no-dt-relr),$(no-dt-relr-ldflag),$(dt-relr-ldflag)) \
 	  -B$(csu-objpfx) $(load-map-file) \
 	  $(LDFLAGS.so) $(LDFLAGS-$(@F:%.so=%).so) \
 	  $(link-test-modules-rpath-link) \