sbc100 added inline comments.
================ Comment at: clang/lib/CodeGen/CodeGenModule.cpp:6360 + auto *GA = llvm::GlobalAlias::create("__main_void", F); + GA->setVisibility(F->getVisibility()); + } ---------------- sbc100 wrote: > sunfish wrote: > > sbc100 wrote: > > > sunfish wrote: > > > > Can this use `GA->setVisibility(GlobalValue::HiddenVisibility)`? > > > > `__main_void` is an implementation detail, so in theory users shouldn't > > > > be setting interesting visibility attributes on it. > > > The caller main / __main_void could live in different shared library the > > > main function itself. > > > > > > IIRC the caller of `main` is normally something like crt1.o and it should > > > be able to see `__main_void` if, and only if, it can see `main`. i.e. if > > > should have the same visibility as main itself, no? > > Typically crt1.o is linked into the same exe/dso as `main`, so it needs > > `main` to have external linkage, but it doesn't need `main` to have any > > particular visibility. > > > > In Emscripten, is `main` being called from a different dso, or from JS > > following visibility rules for different dsos? > No, emscirpten is not different that respect. Typically main lives in the > same DSO as crt1.o. > > But it doesn't have to, and we have a few tests that check it can be in a > separate dso. Actually I think verified that setting this to hidden works for emscripten (at least the tests pass). @sunfish.. do you know if you were relying on this symbols being marked as "used"? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75277/new/ https://reviews.llvm.org/D75277 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits