[PATCH] D66642: [yaml2obj] - Don't allow setting StOther and Other/Visibility at the same time.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 25 23:39:52 PDT 2019


MaskRay added inline comments.


================
Comment at: lib/ObjectYAML/ELFEmitter.cpp:471
+    else if (Sym.StOther)
+      Symbol.st_other = *Sym.StOther;
+
----------------
grimar wrote:
> MaskRay wrote:
> > jhenderson wrote:
> > > I just want to be clear that st_other is zero-initialized?
> > It is uninitialized.
> > It is uninitialized.
> 
> I think you're mistaken. It should be initialized because of 'Ret.resize(Symbols.size() + 1)' call. It is value initialized, i.e. zero initialized in this case.
> (https://en.cppreference.com/w/cpp/container/vector/resize).
> 
> That is how it works for `st_name` or `st_shndx` I think. Am I missing something?
> 
> 
Sorry, I was mistaken. I didn't notice the vector::resize call above. The elements are value initialized (zeroed), so the code is ok.


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

https://reviews.llvm.org/D66642





More information about the llvm-commits mailing list