[PATCH] D68085: [yaml2obj/obj2yaml] - Add support for SHT_HASH sections.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 26 08:26:01 PDT 2019


MaskRay added a comment.

> SHT_HASH specification is: https://docs.oracle.com/cd/E23824_01/html/819-0690/chapter6-48031.html

Use the official one: http://www.sco.com/developers/gabi/latest/ch5.dynamic.html#hash



================
Comment at: tools/obj2yaml/elf2yaml.cpp:645
+  DataExtractor::Cursor Cur(0);
+  DataExtractor Data(Content, Obj.isLE(), ELFT::Is64Bits ? 8 : 4);
+  uint32_t NBucket = Data.getUnsigned(Cur, 4);
----------------
> ELFT::Is64Bits ? 8 : 4

AddressSize is not used. A dummy 0 works as well.


================
Comment at: tools/obj2yaml/elf2yaml.cpp:646
+  DataExtractor Data(Content, Obj.isLE(), ELFT::Is64Bits ? 8 : 4);
+  uint32_t NBucket = Data.getUnsigned(Cur, 4);
+  uint32_t NChain = Data.getUnsigned(Cur, 4);
----------------
Use getU32(Cur)


================
Comment at: tools/obj2yaml/elf2yaml.cpp:653
+
+  std::vector<uint32_t> Bucket;
+  while (NBucket--)
----------------
```
  S->Bucket.emplace(NBucket);
  for (uint32_t &V : *S->Bucket)
    V = Data.getU32(Cur);
```


================
Comment at: tools/obj2yaml/elf2yaml.cpp:663
+
+  assert(Cur && "entries were not read correctly");
+  return S.release();
----------------
if LLVM_ENABLE_ABI_BREAKING_CHECKS && !LLVM_ENABLE_ASSERTIONS, this will fail.

Add `!Cur` outside.


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

https://reviews.llvm.org/D68085





More information about the llvm-commits mailing list