about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
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.  */