[llvm-bugs] [Bug 41693] New: bogus zero words in .init_array from COMDAT inputs

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 1 17:55:26 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=41693

            Bug ID: 41693
           Summary: bogus zero words in .init_array from COMDAT inputs
           Product: lld
           Version: unspecified
          Hardware: All
               URL: https://storage.googleapis.com/fuchsia-build/reproduce
                    r/lld-combreloc+comdat.tar.gz
                OS: other
            Status: NEW
          Severity: normal
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: roland at hack.frob.com
                CC: jakehehrlich at google.com, llvm-bugs at lists.llvm.org,
                    peter.smith at linaro.org, phosek at chromium.org

The --reproduce tarball at
https://storage.googleapis.com/fuchsia-build/reproducer/lld-combreloc+comdat.tar.gz
demonstrates the issue
with ld.lld from monorepo rev 2efd30571bcc53003376410d4221f7e4dd19f4c3.

readelf -W -x.init_array libc.so.debug shows:


Hex dump of section '.init_array':
  0x00292000 80d50700 00000000 a0d50700 00000000 ................
  0x00292010 00000000 00000000 00000000 00000000 ................
  0x00292020 00000000 00000000 00000000 00000000 ................
  0x00292030 00000000 00000000 00000000 00000000 ................
  0x00292040 00000000 00000000 00000000 00000000 ................
  0x00292050 00000000 00000000 00000000 00000000 ................
  0x00292060 00000000 00000000 00000000 00000000 ................
  0x00292070 00000000 00000000 00000000 00000000 ................
  0x00292080 00000000 00000000 00000000 00000000 ................
  0x00292090 00000000 00000000 00000000 00000000 ................
  0x002920a0 00000000 00000000 00000000 00000000 ................
  0x002920b0 00000000 00000000 00000000 00000000 ................
  0x002920c0 00000000 00000000 00000000 00000000 ................
  0x002920d0 00000000 00000000 00000000 00000000 ................
  0x002920e0 00000000 00000000 00000000 00000000 ................
  0x002920f0 00000000 00000000 00000000 00000000 ................
  0x00292100 00000000 00000000 00000000 00000000 ................

The first two entries are valid.  The remaining all-zeros entries are bogus.
The link map shows:

          292000           292000      110     8 .init_array
          292000           292000        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/system/ulib/c/zircon/zircon.getentropy.c.o:(.init_array.2)
          292008           292008        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/system/ulib/c/zircon/zircon.getentropy.c.o:(.init_array.2)
          292010           292010        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/system/ulib/c/zircon/zircon.internal.c.o:(.init_array.2)
          292018           292018        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/scudo/scudo.checksum.cc.o:(.init_array.2)
          292020           292020        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/scudo/scudo.common.cc.o:(.init_array.2)
          292028           292028        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/scudo/scudo.flags.cc.o:(.init_array.2)
          292030           292030        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/scudo/scudo.flags_parser.cc.o:(.init_array.2)
          292038           292038        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/scudo/scudo.fuchsia.cc.o:(.init_array.2)
          292040           292040        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/scudo/scudo.report.cc.o:(.init_array.2)
          292048           292048        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/scudo/scudo.string_utils.cc.o:(.init_array.2)
          292050           292050        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/scudo/scudo.wrappers_c.cc.o:(.init_array.2)
          292058           292058        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/musl/ldso/ldso.dynlink.c.o:(.init_array.2)
          292060           292060        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/musl/pthread/pthread.pthread_attr_get.c.o:(.init_array.2)
          292068           292068        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/musl/pthread/pthread.pthread_cond_timedwait.c.o:(.init_array.2)
          292070           292070        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/musl/pthread/pthread.pthread_create.c.o:(.init_array.2)
          292078           292078        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/musl/pthread/pthread.pthread_getspecific.c.o:(.init_array.2)
          292080           292080        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/musl/pthread/pthread.pthread_mutex_lock.c.o:(.init_array.2)
          292088           292088        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/musl/pthread/pthread.pthread_mutex_unlock.c.o:(.init_array.2)
          292090           292090        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/musl/src/conf/conf.confstr.c.o:(.init_array.2)
          292098           292098        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/musl/src/exit/exit.atexit.c.o:(.init_array.2)
          2920a0           2920a0        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/musl/src/fenv/x86_64/fenv.fenv.c.o:(.init_array.2)
          2920a8           2920a8        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/musl/src/internal/internal.floatscan.c.o:(.init_array.2)
          2920b0           2920b0        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/musl/src/ldso/ldso.dlerror.c.o:(.init_array.2)
          2920b8           2920b8        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/musl/src/locale/locale.iconv.c.o:(.init_array.2)
          2920c0           2920c0        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/musl/src/locale/locale.pleval.c.o:(.init_array.2)
          2920c8           2920c8        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/musl/src/network/network.ether.c.o:(.init_array.2)
          2920d0           2920d0        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/musl/src/network/network.getifaddrs.c.o:(.init_array.2)
          2920d8           2920d8        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/musl/src/network/network.ns_parse.c.o:(.init_array.2)
          2920e0           2920e0        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/musl/src/regex/regex.fnmatch.c.o:(.init_array.2)
          2920e8           2920e8        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/musl/src/stdio/stdio.vfprintf.c.o:(.init_array.2)
          2920f0           2920f0        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/musl/src/thread/thread.allocate.c.o:(.init_array.2)
          2920f8           2920f8        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/musl/stubs/stubs.socketstubs.c.o:(.init_array.2)
          292100           292100        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/musl/third_party/smoothsort/smoothsort.qsort.c.o:(.init_array.2)
          292108           292108        8     8        
tmp/fuchsia/zircon/build-gcc/user-x64-ubsan-sancov-full.shlib/obj/third_party/ulib/musl/third_party/tre/tre.regcomp.c.o:(.init_array.2)

Examining input objects shows that they all have SHT_INIT_ARRAY sections in
COMDAT groups.  It appears that slots in the output section are being assigned
for discarded input COMDAT groups as well as the preserved ones, but then of
course no values (or relocs for them) are written there.  But that's just a
guess as to what's going on.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190502/abcbc40b/attachment-0001.html>


More information about the llvm-bugs mailing list