[PATCH] D37391: [yaml2obj][ELF] Add support for symbol indexes greater than SHN_LORESERVE

Roland McGrath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 1 12:39:56 PDT 2017


mcgrathr requested changes to this revision.
mcgrathr added inline comments.
This revision now requires changes to proceed.


================
Comment at: lib/ObjectYAML/ELFYAML.cpp:491
+  ECase(SHN_COMMON);
+  ECase(SHN_XINDEX);
+  ECase(SHN_HIRESERVE);
----------------
SHN_XINDEX is a special animal unlike other special cases.  It means the real shndx value is elsewhere.  See SHN_XINDEX handling elsewhere in the code base (or the ELF spec).

SHN_UNDEF, SHN_ABS, and SHN_COMMON are standard special cases.  Those just go through as they are.
(Note that SHN_UNDEF is not in the [SHN_LORESERVE,SHN_HIRESERVE] range like all the others here are.)

SHN_{LO,HI}* are not actual values, but markers for the ranges used for machine-specific and OS-specific values.
It doesn't make sense to match them.

I think you need to handle each such value specially, because the correct way to treat it will depend on the specific machine/OS-specific definition.
All the ones I've seen are basically variants of SHN_COMMON and are handled the same way (just pass it through).  But I think the only safe thing is to go case by case for handling specific ones we understand, and error out if you encounter one we don't know how to handle.


Repository:
  rL LLVM

https://reviews.llvm.org/D37391





More information about the llvm-commits mailing list