[PATCH] D61454: [CodeGen][ObjC] Remove the leading 'l_' from ObjC symbols and make private symbols in the __DATA segment internal.

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 2 15:58:13 PDT 2019


rjmccall added inline comments.


================
Comment at: lib/CodeGen/CGObjCMac.cpp:3961
+  // linkage so that the linker preserves the symbol name.
+  llvm::GlobalValue::LinkageTypes LT = ExplicitDataSegment || Section.empty()
+                                           ? llvm::GlobalValue::InternalLinkage
----------------
ahatanak wrote:
> vsk wrote:
> > Hm. I wonder whether it'd be less error-prone to simply define LT as 'Section.empty() || Section.startswith("__DATA")'. Is there an advantage to explicitly defining 'ExplicitDataSegment' in the caller? 
> I was just trying to avoid scanning the string, but probably doing so isn't that expensive.
Yeah, probably not.  I'd love it if there was some better way to specify these sections that felt less Mach-O-specific and more semantic, but given what we're doing, I think it'd be cleaner to scan the section name.

Or you could just pass the linkage down; I'm not sure DATA vs. OBJC is the only interesting division between things.


Repository:
  rC Clang

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

https://reviews.llvm.org/D61454





More information about the cfe-commits mailing list