From 312e510eff40cbb8a947833efafcfd6290641671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Wed, 30 Nov 2022 11:56:02 +0200 Subject: [PATCH] add lto and fpic learning about linkers. Thanks, Drepper --- build.zig | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build.zig b/build.zig index 43a1732..b08ebb2 100644 --- a/build.zig +++ b/build.zig @@ -43,6 +43,7 @@ pub fn build(b: *zbs.Builder) void { //"-DDEBUG", }); cmph.strip = strip; + cmph.want_lto = true; cmph.compress_debug_sections = .zlib; cmph.omit_frame_pointer = true; cmph.addIncludePath("deps/cmph/src"); @@ -60,16 +61,19 @@ pub fn build(b: *zbs.Builder) void { "-W", "-Wno-unused-function", "-fvisibility=hidden", + "-fpic", //"-DDEBUG", }); bdz.omit_frame_pointer = true; bdz.addIncludePath("deps/cmph/src"); bdz.addIncludePath("include/deps/cmph"); + bdz.want_lto = true; { const exe = b.addExecutable("turbonss-unix2db", "src/turbonss-unix2db.zig"); exe.compress_debug_sections = .zlib; exe.strip = strip; + exe.want_lto = true; exe.setTarget(target); exe.setBuildMode(mode); addCmphDeps(exe, cmph); @@ -80,6 +84,7 @@ pub fn build(b: *zbs.Builder) void { const exe = b.addExecutable("turbonss-analyze", "src/turbonss-analyze.zig"); exe.compress_debug_sections = .zlib; exe.strip = strip; + exe.want_lto = true; exe.setTarget(target); exe.setBuildMode(mode); exe.install(); @@ -89,6 +94,7 @@ pub fn build(b: *zbs.Builder) void { const exe = b.addExecutable("turbonss-makecorpus", "src/turbonss-makecorpus.zig"); exe.compress_debug_sections = .zlib; exe.strip = strip; + exe.want_lto = true; exe.setTarget(target); exe.setBuildMode(mode); exe.install(); @@ -98,6 +104,7 @@ pub fn build(b: *zbs.Builder) void { const exe = b.addExecutable("turbonss-getent", "src/turbonss-getent.zig"); exe.compress_debug_sections = .zlib; exe.strip = strip; + exe.want_lto = true; exe.linkLibC(); exe.linkLibrary(bdz); exe.addIncludePath("deps/cmph/src"); @@ -116,6 +123,7 @@ pub fn build(b: *zbs.Builder) void { }); so.compress_debug_sections = .zlib; so.strip = strip; + so.want_lto = true; so.linkLibC(); so.linkLibrary(bdz); so.addIncludePath("deps/cmph/src");