[PATCH] D44750: [RISCV] Use init_array instead of ctors for RISCV target, by default

Alex Bradbury via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 22 03:39:04 PDT 2018


asb accepted this revision.
asb added a comment.
This revision is now accepted and ready to land.

Hi Mandeep, thanks for the patch. This looks good to me, but there are just two changes I would suggest prior to committing:

- Basing the test on test/CodeGen/Hexagon/ctor.ll would be better - that demonstrates that the -use-ctors flag is respected, which seems worth doing
- The patch description explains what was changed, but not how or why. I might add something like "LLVM defaults to the newer .init_array/.fini_array scheme for static constructors rather than the less desirable .ctors/.dtors (the UseCtors flag defaults to false). This wasn't being respected in the RISC-V backend because it fails to call TargetLoweringObjectFileELF::InitializeELF with the the appropriate flag for UseInitArray. This patch fixes this by implementing RISCVELFTargetObjectFile and overriding its Initialize method to call InitializeELF(TM.Options.UseInitArray)."


Repository:
  rL LLVM

https://reviews.llvm.org/D44750





More information about the llvm-commits mailing list