E5ten added inline comments.

================
Comment at: clang/lib/Driver/ToolChains/Gnu.cpp:563
+          crtend = Args.hasArg(options::OPT_shared) || IsPIE || IsStaticPIE ?
+              "crtend_shared" : "crtend";
+          CmdArgs.push_back(ToolChain.getCompilerRTArgString(
----------------
phosek wrote:
> MaskRay wrote:
> > phosek wrote:
> > > MaskRay wrote:
> > > > I believe `crtbegin.o` `crtend.o` should just work. It is not necessary 
> > > > to use `crtbegin_shared.o` `crtend_shared.o`.
> > > This is related to your comments on D28791, specifically that we should 
> > > be using `crtbegin_shared.o` for `-shared` or `-pie` and `crtbegin.o` 
> > > otherwise, is that not the case?
> > Yes. I think we can rename `crtbegin_shared.o` to `crtbegin.o` and use it 
> > for every configuration: `-no-pie` `-pie` `-shared` `-static` `-static 
> > -pie`.
> We've checked the glibc implementation of `__cxa_finalize`. A nonzero 
> `__dso_handle` has to match the value passed to `__cxa_atexit` but a zero 
> `__dso_handle` matches every function registered. So it matters that DSO fini 
> calls use `&__dso_handle` to match their registrations for the `dlclose` 
> case, but it also matters that the main executable fini call use zero to run 
> all the dtors at exit time. It's not clear it really needs to be that way, 
> but it would affect how the dtors get run which might affect some use cases. 
> Hence, I don't think we can combine `crtbegin.o` and `crtbegin_shared.o`.
I may be wrong but from what I can see crtend and crtend_shared are identical, 
so while the crtbegins must stay separate can't the 2 crtends be merged into 
one that gets used in all cases instead of having a duplicate object under a 
different name?


Repository:
  rC Clang

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

https://reviews.llvm.org/D59264



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to