about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorStan Shebs <stanshebs@google.com>2018-02-14 09:15:44 -0800
committerStan Shebs <stanshebs@google.com>2019-04-24 11:04:33 -0700
commit52a7cb28f99848030069890105165a5da6d54147 (patch)
tree848b8caca532fbd32fb3569b83d6153fa030400b /elf
parent1cfcdae9796ab91b7f89f8ee7a808bf12842f8e3 (diff)
downloadglibc-52a7cb28f99848030069890105165a5da6d54147.tar.gz
glibc-52a7cb28f99848030069890105165a5da6d54147.tar.xz
glibc-52a7cb28f99848030069890105165a5da6d54147.zip
Add a --with-lld option to choose LLVMs lld linker
Diffstat (limited to 'elf')
-rw-r--r--elf/Makefile3
-rw-r--r--elf/rtld.c6
2 files changed, 8 insertions, 1 deletions
diff --git a/elf/Makefile b/elf/Makefile
index 9cf5cd8dfd..2d7162d3cc 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -458,9 +458,10 @@ $(objpfx)librtld.map: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a
 	rm -f $@.o
 	mv -f $@T $@
 
+# For lld, add to regexp below for optional address and size to be at front of line.
 $(objpfx)librtld.mk: $(objpfx)librtld.map Makefile
 	LC_ALL=C \
-	sed -n 's@^$(common-objpfx)\([^(]*\)(\([^)]*\.os\)) *.*$$@\1 \2@p' \
+	sed -n 's@^[0-9a-f ]*$(common-objpfx)\([^(]*\)(\([^)]*\.os\)) *.*$$@\1 \2@p' \
 	    $< | \
 	while read lib file; do \
 	  case $$lib in \
diff --git a/elf/rtld.c b/elf/rtld.c
index 631021d73e..c1443cba7d 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -393,7 +393,13 @@ _dl_start_final (void *arg, struct dl_start_final_info *info)
 #endif
   _dl_setup_hash (&GL(dl_rtld_map));
   GL(dl_rtld_map).l_real = &GL(dl_rtld_map);
+#if defined(__clang__)
+  /* Work around an lld complaint that _begin cannot have a reloc and
+     also be absolute because of _begin=0 on linker line.  */
+  GL(dl_rtld_map).l_map_start = (ElfW(Addr)) 0;
+#else
   GL(dl_rtld_map).l_map_start = (ElfW(Addr)) _begin;
+#endif
   GL(dl_rtld_map).l_map_end = (ElfW(Addr)) _end;
   GL(dl_rtld_map).l_text_end = (ElfW(Addr)) _etext;
   /* Copy the TLS related data if necessary.  */