[PATCH] D112735: export unique symbol list for xcoff with llvm-objdump new option "--export-unique-symbol"

Digger Lin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 28 13:15:50 PDT 2021


DiggerLin marked 4 inline comments as done.
DiggerLin added inline comments.


================
Comment at: llvm/include/llvm/Object/SymbolicFile.h:122
                                  // (IR only)
+    SF_Protected = 1U << 12,     // Symbol has protected visibility
+    SF_Internal = 1U << 13       // Symbol has internal visibility
----------------
MaskRay wrote:
> DiggerLin wrote:
> > MaskRay wrote:
> > > I don't think we need new bits.
> > > 
> > > If internal visibility has similar behavior with hidden visibility, just reuse it or not set symbol properties at all.
> > > 
> > > I am mostly concerned with the fact that BFD style describing all binary format's every symbol property simply does not work.
> > we need the "protected" visibility in xcoff object file.
> > 
> > The AIX linker  accepts 4 of such visibility attribute types:
> > 
> > export: Symbol is exported with the global export attribute.
> > hidden: Symbol is not exported.
> > protected: Symbol is exported but cannot be rebound (preempted), even if runtime linking is being used.
> > internal: Symbol is not exported. The address of the symbol must not be provided to other programs or shared objects, but the linker does not verify this.
> > 
> >  please  reference 
> > 1. [[ https://www.ibm.com/docs/en/aix/7.1?topic=formats-xcoff-object-file-format | xcoff-object-file-format ]] . (search "Symbol visibility" in file". )
> > 
> > 2. https://developer.ibm.com/articles/au-aix-symbol-visibility/ , search 'STV_PROTECTED"
> > 
> Thanks for the pointers. But see my comment below: the request is about removing the unneeded `SF_*` abstraction.
sorry that , I can not get "the request is about removing the unneeded SF_* abstraction"

your suggestion is to change  from "SF_Protected"  to "Protected"  ?  if so, my suggestion is that we keep "SF_Protected" as in this patch. and create a NFC to remove "SF_" 



================
Comment at: llvm/tools/llvm-objdump/XCOFFDump.cpp:163
+  // Skip Shared object file.
+  if (O->isXCOFF()) {
+    if (dyn_cast<const XCOFFObjectFile>(O)->getFlags() & XCOFF::F_SHROBJ)
----------------
MaskRay wrote:
> You can skip all `O->isXCOFF()` checks in this function thanks to the early return.
thanks


================
Comment at: llvm/tools/llvm-objdump/XCOFFDump.cpp:230
+
+    if (Flags & SymbolRef::SF_Protected) {
+      ExportSymbols.push_back(SymNameVisibilityTy(SymName, "protected"));
----------------
MaskRay wrote:
> Just switch with the underlying binary format, instead of using a `SymbolRef` abstraction, then `SF_Protected` will not be needed.
sorry again, I can not got the comment, can you explain it more detail ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112735



More information about the llvm-commits mailing list