Skip to content
Snippets Groups Projects
Commit 352ef7be authored by Cheng Shao's avatar Cheng Shao
Browse files

hadrian: build C/C++ with split sections when enabled

When split sections is enabled, ensure -fsplit-sections is passed to
GHC as well when invoking GHC to compile C/C++; and pass
-ffunction-sections -fdata-sections to gcc/clang when compiling C/C++
with the hadrian Cc builder. Fixes #23381.

(cherry picked from commit 0958937e)
(cherry picked from commit 7d5a22c2)
(cherry picked from commit 6de1c17d)
parent 45c008f2
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,9 @@ splitSectionsArgs = do
) then
( mconcat
[ builder (Ghc CompileHs) ? arg "-fsplit-sections"
, builder (Ghc CompileCWithGhc) ? arg "-fsplit-sections"
, builder (Ghc CompileCppWithGhc) ? arg "-fsplit-sections"
, builder (Cc CompileC) ? arg "-ffunction-sections" <> arg "-fdata-sections"
, builder MergeObjects ? ifM (expr isWinTarget)
(pure ["-T", "driver/utils/merge_sections_pe.ld"])
(pure ["-T", "driver/utils/merge_sections.ld"])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment