Skip to content

Commit 40d8518

Browse files
committed
apply -flto and -ffunction-sections when compiling libc++
1 parent d321a4b commit 40d8518

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/libcxx.zig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ pub fn buildLibCXX(comp: *Compilation) !void {
174174
.want_tsan = comp.bin_file.options.tsan,
175175
.want_pic = comp.bin_file.options.pic,
176176
.want_pie = comp.bin_file.options.pie,
177+
.want_lto = comp.bin_file.options.lto,
178+
.function_sections = comp.bin_file.options.function_sections,
177179
.emit_h = null,
178180
.strip = comp.compilerRtStrip(),
179181
.is_native_os = comp.bin_file.options.is_native_os,
@@ -292,6 +294,8 @@ pub fn buildLibCXXABI(comp: *Compilation) !void {
292294
.want_tsan = comp.bin_file.options.tsan,
293295
.want_pic = comp.bin_file.options.pic,
294296
.want_pie = comp.bin_file.options.pie,
297+
.want_lto = comp.bin_file.options.lto,
298+
.function_sections = comp.bin_file.options.function_sections,
295299
.emit_h = null,
296300
.strip = comp.compilerRtStrip(),
297301
.is_native_os = comp.bin_file.options.is_native_os,

src/libunwind.zig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ pub fn buildStaticLib(comp: *Compilation) !void {
113113
.want_tsan = false,
114114
.want_pic = comp.bin_file.options.pic,
115115
.want_pie = comp.bin_file.options.pie,
116+
.want_lto = comp.bin_file.options.lto,
117+
.function_sections = comp.bin_file.options.function_sections,
116118
.emit_h = null,
117119
.strip = comp.compilerRtStrip(),
118120
.is_native_os = comp.bin_file.options.is_native_os,

0 commit comments

Comments
 (0)