[RISCV] enable LTO support, pass some options to linker.
authorSam Elliott <selliott@lowrisc.org>
Mon, 14 Oct 2019 14:00:13 +0000 (14:00 +0000)
committerSam Elliott <selliott@lowrisc.org>
Mon, 14 Oct 2019 14:00:13 +0000 (14:00 +0000)
commitcdcf58e5af025989a8dd52bc0d9c032712a160c8
treef9cd2c209296ed7ba195a6e5597b951ea66be72c
parentce56e1a1cc5714f4af5675dd963cfebed766d9e1
[RISCV] enable LTO support, pass some options to linker.

Summary:
1. enable LTO need to pass target feature and abi to LTO code generation
   RISCV backend need the target feature to decide which extension used in
   code generation.
2. move getTargetFeatures to CommonArgs.h and add ForLTOPlugin flag
3. add general tools::getTargetABI in CommonArgs.h because different target uses different
   way to get the target ABI.

Patch by Kuan Hsu Chen (khchen)

Reviewers: lenary, lewis-revill, asb, MaskRay

Reviewed By: lenary

Subscribers: hiraditya, dschuff, aheejin, fedor.sergeev, mehdi_amini, inglorion, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, steven_wu, rogfer01, MartinMosbeck, brucehoult, the_o, dexonsmith, rkruppe, PkmX, jocewei, psnobl, benna, Jim, lenary, s.egerton, pzheng, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D67409

llvm-svn: 374774
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/lib/Driver/ToolChains/CommonArgs.h
clang/lib/Driver/ToolChains/RISCVToolchain.cpp
clang/lib/Driver/ToolChains/RISCVToolchain.h
clang/test/Driver/gold-lto.c