]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
elf: Support lld-style link map for librtld.map
authorFangrui Song <maskray@google.com>
Tue, 21 Apr 2020 16:28:42 +0000 (13:28 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 21 Apr 2020 18:10:10 +0000 (15:10 -0300)
GNU ld and gold's -Map include a line like:

  path/to/build/libc_pic.a(check_fds.os)

lld -Map does not have the archive member list, but we can still derive the
members from the following output

             VMA              LMA     Size Align Out     In      Symbol
...
           1a1c0            1a1c0       e2    16         path/to/build/libc_pic.a(check_fds.os):(.text)

elf/Makefile

index 9b1d58c7ad75409ca84b55f7778ce41ceb0590f0..6919e53c140761c9b49f63675b34c6e2015330e3 100644 (file)
@@ -514,9 +514,10 @@ $(objpfx)librtld.map: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a
        rm -f $@.o
        mv -f $@T $@
 
+# For lld, skip preceding addresses and values before matching the archive and the member.
 $(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 \