[PATCH] D72567: [ELF] Avoid false-positive assert in getErrPlace()

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 12 14:52:37 PST 2020


MaskRay added a comment.

FTR, `SHT_NOBITS` sections have nullptr as `.data().data()` because:

  template <class ELFT>
  static ArrayRef<uint8_t> getSectionContents(ObjFile<ELFT> &file,
                                              const typename ELFT::Shdr &hdr) {
    if (hdr.sh_type == SHT_NOBITS)
      return makeArrayRef<uint8_t>(nullptr, hdr.sh_size);
    return check(file.getObj().getSectionContents(&hdr));
  }



================
Comment at: lld/test/ELF/mips-jalr-non-functions.s:14
+# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %S/Inputs/common.s -o %t-common.o
+# RUN: ld.lld -shared %t-common.o %t.o -o %t.so 2>&1 | FileCheck %s -check-prefix WARNING-MESSAGE
 # RUN: llvm-objdump --no-show-raw-insn --no-leading-addr -d %t.so | FileCheck %s
----------------
```
# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %S/Inputs/common.s -o %t-common.o
# RUN: ld.lld -shared %t-common.o %t.o -o %t.so 2>&1 | FileCheck %s -check-prefix WARNING-MESSAGE
```


The RUN lines are the only needed change. Changes below (e.g. `.comm common_sym,4,4`) are unneeded.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72567/new/

https://reviews.llvm.org/D72567





More information about the llvm-commits mailing list