[libLTO] Set data-sections by default in libLTO.
authorQuinn Pham <Quinn.Pham@ibm.com>
Wed, 20 Jul 2022 14:14:38 +0000 (09:14 -0500)
committerQuinn Pham <quinn.pham@ibm.com>
Wed, 27 Jul 2022 13:34:40 +0000 (08:34 -0500)
commitf565444b486d49f84297c3a279ca24d785961ea8
tree5c3049aceaa9ae6d8422b240220869b8e6f270ed
parent5caa941f683270c3e5078ec46f208212b565c505
[libLTO] Set data-sections by default in libLTO.

This patch changes legacy LTO to set data-sections by default. The user can
explicitly unset data-sections. The reason for this patch is to match the
behaviour of lld and gold plugin. Both lld and gold plugin have data-sections on
by default.

This patch also fixes the forwarding of the clang options -fno-data-sections and
-fno-function-sections to libLTO. Now, when -fno-data/function-sections are
specified in clang, -data/function-sections=0 will be passed to libLTO to
explicitly unset data/function-sections.

Reviewed By: w2yehia, MaskRay

Differential Revision: https://reviews.llvm.org/D129401
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/test/Driver/function-sections.c
clang/test/Driver/gold-lto-sections.c [deleted file]
llvm/lib/LTO/LTOCodeGenerator.cpp
llvm/test/LTO/PowerPC/data-sections-aix.ll [new file with mode: 0644]
llvm/test/LTO/PowerPC/data-sections-linux.ll [new file with mode: 0644]