[PATCH] D58280: [yaml2obj][obj2yaml] - Support SHT_GNU_versym (.gnu.version) section.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 19 06:26:10 PST 2019


grimar marked an inline comment as done.
grimar added inline comments.


================
Comment at: tools/yaml2obj/yaml2elf.cpp:565
+  for (uint16_t V : Section.Entries) {
+    Elf_Half Version = (Elf_Half)V;
+    OS.write((const char *)&Version, sizeof(Elf_Half));
----------------
jhenderson wrote:
> grimar wrote:
> > jhenderson wrote:
> > > Do you need this cast here? It looks superfluous.
> > Yep :(, MSVS2017 complains:
> > 
> > error C2440: 'initializing': cannot convert from 'uint16_t' to 'llvm::support::detail::packed_endian_specific_integral<uint16_t,llvm::support::little,1>'
> Sounds to me like there's a missing conversion constructor or similar in that type then...
I think it would be a bit simpler to do something like:

```
for (uint16_t V : Section.Entries)
  support::endian::write<uint16_t>(OS, V, ELFT::TargetEndianness);
```

(Elf_Half is always 2 bytes).
It seems can simplify/cleanup a few other methods of this file too.
I'll take a look.


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

https://reviews.llvm.org/D58280





More information about the llvm-commits mailing list