Skip to content
Snippets Groups Projects
Commit 35c5fe69 authored by Cheng Shao's avatar Cheng Shao :beach:
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)
parent ec0170b6
No related branches found
No related tags found
No related merge requests found
...@@ -29,6 +29,9 @@ splitSectionsArgs = do ...@@ -29,6 +29,9 @@ splitSectionsArgs = do
) then ) then
( mconcat ( mconcat
[ builder (Ghc CompileHs) ? arg "-fsplit-sections" [ 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) , builder MergeObjects ? ifM (expr isWinTarget)
(pure ["-T", "driver/utils/merge_sections_pe.ld"]) (pure ["-T", "driver/utils/merge_sections_pe.ld"])
(pure ["-T", "driver/utils/merge_sections.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