mirror of
https://github.com/ziglang/zig.git
synced 2025-12-27 16:43:07 +00:00
Merge pull request #8876 from xxxbxxx/cxx-lto
build libc++ with lto and function-sections
This commit is contained in:
commit
8c5d4295e5
@ -129,6 +129,8 @@ pub fn buildLibCXX(comp: *Compilation) !void {
|
||||
try cflags.append("-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS");
|
||||
try cflags.append("-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS");
|
||||
try cflags.append("-D_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS");
|
||||
try cflags.append("-fvisibility=hidden");
|
||||
try cflags.append("-fvisibility-inlines-hidden");
|
||||
|
||||
if (target.abi.isMusl()) {
|
||||
try cflags.append("-D_LIBCPP_HAS_MUSL_LIBC");
|
||||
@ -144,7 +146,6 @@ pub fn buildLibCXX(comp: *Compilation) !void {
|
||||
try cflags.append("-fPIC");
|
||||
}
|
||||
try cflags.append("-nostdinc++");
|
||||
try cflags.append("-fvisibility-inlines-hidden");
|
||||
try cflags.append("-std=c++14");
|
||||
try cflags.append("-Wno-user-defined-literals");
|
||||
|
||||
@ -174,6 +175,8 @@ pub fn buildLibCXX(comp: *Compilation) !void {
|
||||
.want_tsan = comp.bin_file.options.tsan,
|
||||
.want_pic = comp.bin_file.options.pic,
|
||||
.want_pie = comp.bin_file.options.pie,
|
||||
.want_lto = comp.bin_file.options.lto,
|
||||
.function_sections = comp.bin_file.options.function_sections,
|
||||
.emit_h = null,
|
||||
.strip = comp.compilerRtStrip(),
|
||||
.is_native_os = comp.bin_file.options.is_native_os,
|
||||
@ -247,6 +250,8 @@ pub fn buildLibCXXABI(comp: *Compilation) !void {
|
||||
try cflags.append("-D_LIBCXXABI_BUILDING_LIBRARY");
|
||||
try cflags.append("-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS");
|
||||
try cflags.append("-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS");
|
||||
try cflags.append("-fvisibility=hidden");
|
||||
try cflags.append("-fvisibility-inlines-hidden");
|
||||
|
||||
if (target.abi.isMusl()) {
|
||||
try cflags.append("-D_LIBCPP_HAS_MUSL_LIBC");
|
||||
@ -292,6 +297,8 @@ pub fn buildLibCXXABI(comp: *Compilation) !void {
|
||||
.want_tsan = comp.bin_file.options.tsan,
|
||||
.want_pic = comp.bin_file.options.pic,
|
||||
.want_pie = comp.bin_file.options.pie,
|
||||
.want_lto = comp.bin_file.options.lto,
|
||||
.function_sections = comp.bin_file.options.function_sections,
|
||||
.emit_h = null,
|
||||
.strip = comp.compilerRtStrip(),
|
||||
.is_native_os = comp.bin_file.options.is_native_os,
|
||||
|
||||
@ -69,6 +69,8 @@ pub fn buildStaticLib(comp: *Compilation) !void {
|
||||
}
|
||||
try cflags.append("-D_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS");
|
||||
try cflags.append("-Wa,--noexecstack");
|
||||
try cflags.append("-fvisibility=hidden");
|
||||
try cflags.append("-fvisibility-inlines-hidden");
|
||||
|
||||
// This is intentionally always defined because the macro definition means, should it only
|
||||
// build for the target specified by compiler defines. Since we pass -target the compiler
|
||||
@ -113,6 +115,8 @@ pub fn buildStaticLib(comp: *Compilation) !void {
|
||||
.want_tsan = false,
|
||||
.want_pic = comp.bin_file.options.pic,
|
||||
.want_pie = comp.bin_file.options.pie,
|
||||
.want_lto = comp.bin_file.options.lto,
|
||||
.function_sections = comp.bin_file.options.function_sections,
|
||||
.emit_h = null,
|
||||
.strip = comp.compilerRtStrip(),
|
||||
.is_native_os = comp.bin_file.options.is_native_os,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user