Commit c9fb5240d6

Andrew Kelley <andrew@ziglang.org>
2019-02-19 14:39:36
remove --no-rosegment workaround now that valgrind bug is fixed
See #896 Zig 0.3.0+ and Valgrind 3.14+ do not need the workaround.
1 parent 007a260
src/all_types.hpp
@@ -1819,7 +1819,6 @@ struct CodeGen {
     bool is_single_threaded;
     bool is_native_target;
     bool linker_rdynamic;
-    bool no_rosegment_workaround;
     bool each_lib_rpath;
     bool disable_pic;
 
src/codegen.cpp
@@ -8487,7 +8487,6 @@ static Error check_cache(CodeGen *g, Buf *manifest_dir, Buf *digest) {
     cache_bool(ch, g->is_single_threaded);
     cache_bool(ch, g->is_native_target);
     cache_bool(ch, g->linker_rdynamic);
-    cache_bool(ch, g->no_rosegment_workaround);
     cache_bool(ch, g->each_lib_rpath);
     cache_bool(ch, g->disable_pic);
     cache_buf_opt(ch, g->mmacosx_version_min);
src/link.cpp
@@ -231,9 +231,6 @@ static void construct_linker_job_elf(LinkJob *lj) {
         lj->args.append(g->linker_script);
     }
 
-    if (g->no_rosegment_workaround) {
-        lj->args.append("--no-rosegment");
-    }
     lj->args.append("--gc-sections");
 
     lj->args.append("-m");
src/main.cpp
@@ -92,7 +92,6 @@ static int print_full_usage(const char *arg0, FILE *file, int return_code) {
         "  -L[dir]                      alias for --library-path\n"
         "  -rdynamic                    add all symbols to the dynamic symbol table\n"
         "  -rpath [path]                add directory to the runtime library search path\n"
-        "  --no-rosegment               compromise security to workaround valgrind bug\n"
         "  --subsystem [subsystem]      (windows) /SUBSYSTEM:<subsystem> to the linker\n"
         "  -framework [name]            (darwin) link against framework\n"
         "  -mios-version-min [ver]      (darwin) set iOS deployment target\n"
@@ -393,7 +392,6 @@ int main(int argc, char **argv) {
     BuildMode build_mode = BuildModeDebug;
     ZigList<const char *> test_exec_args = {0};
     int runtime_args_start = -1;
-    bool no_rosegment_workaround = false;
     bool system_linker_hack = false;
     TargetSubsystem subsystem = TargetSubsystemAuto;
     bool is_single_threaded = false;
@@ -573,8 +571,6 @@ int main(int argc, char **argv) {
                 verbose_cimport = true;
             } else if (strcmp(arg, "-rdynamic") == 0) {
                 rdynamic = true;
-            } else if (strcmp(arg, "--no-rosegment") == 0) {
-                no_rosegment_workaround = true;
             } else if (strcmp(arg, "--each-lib-rpath") == 0) {
                 each_lib_rpath = true;
             } else if (strcmp(arg, "-ftime-report") == 0) {
@@ -977,7 +973,6 @@ int main(int argc, char **argv) {
             }
 
             codegen_set_rdynamic(g, rdynamic);
-            g->no_rosegment_workaround = no_rosegment_workaround;
             if (mmacosx_version_min && mios_version_min) {
                 fprintf(stderr, "-mmacosx-version-min and -mios-version-min options not allowed together\n");
                 return EXIT_FAILURE;
src-self-hosted/link.zig
@@ -145,10 +145,6 @@ fn constructLinkerArgsElf(ctx: *Context) !void {
     //    lj->args.append("-T");
     //    lj->args.append(g->linker_script);
     //}
-
-    //if (g->no_rosegment_workaround) {
-    //    lj->args.append("--no-rosegment");
-    //}
     try ctx.args.append(c"--gc-sections");
 
     //lj->args.append("-m");
std/build.zig
@@ -851,7 +851,6 @@ pub const LibExeObjStep = struct {
     disable_libc: bool,
     frameworks: BufSet,
     verbose_link: bool,
-    no_rosegment: bool,
     c_std: Builder.CStd,
 
     // zig only stuff
@@ -924,7 +923,6 @@ pub const LibExeObjStep = struct {
 
     fn initExtraArgs(builder: *Builder, name: []const u8, root_src: ?[]const u8, kind: Kind, static: bool, ver: Version) LibExeObjStep {
         var self = LibExeObjStep{
-            .no_rosegment = false,
             .strip = false,
             .builder = builder,
             .verbose_link = false,
@@ -967,7 +965,6 @@ pub const LibExeObjStep = struct {
 
     fn initC(builder: *Builder, name: []const u8, kind: Kind, version: Version, static: bool) LibExeObjStep {
         var self = LibExeObjStep{
-            .no_rosegment = false,
             .builder = builder,
             .name = name,
             .kind = kind,
@@ -1009,10 +1006,6 @@ pub const LibExeObjStep = struct {
         return self;
     }
 
-    pub fn setNoRoSegment(self: *LibExeObjStep, value: bool) void {
-        self.no_rosegment = value;
-    }
-
     fn computeOutFileNames(self: *LibExeObjStep) void {
         switch (self.kind) {
             Kind.Obj => {
@@ -1382,9 +1375,6 @@ pub const LibExeObjStep = struct {
             }
         }
 
-        if (self.no_rosegment) {
-            try zig_args.append("--no-rosegment");
-        }
         if (self.system_linker_hack) {
             try zig_args.append("--system-linker-hack");
         }
@@ -1704,7 +1694,6 @@ pub const TestStep = struct {
     lib_paths: ArrayList([]const u8),
     packages: ArrayList(Pkg),
     object_files: ArrayList([]const u8),
-    no_rosegment: bool,
     output_path: ?[]const u8,
     system_linker_hack: bool,
     override_std_dir: ?[]const u8,
@@ -1726,17 +1715,12 @@ pub const TestStep = struct {
             .lib_paths = ArrayList([]const u8).init(builder.allocator),
             .packages = ArrayList(Pkg).init(builder.allocator),
             .object_files = ArrayList([]const u8).init(builder.allocator),
-            .no_rosegment = false,
             .output_path = null,
             .system_linker_hack = false,
             .override_std_dir = null,
         };
     }
 
-    pub fn setNoRoSegment(self: *TestStep, value: bool) void {
-        self.no_rosegment = value;
-    }
-
     pub fn addLibPath(self: *TestStep, path: []const u8) void {
         self.lib_paths.append(path) catch unreachable;
     }
@@ -1938,9 +1922,6 @@ pub const TestStep = struct {
             zig_args.append("--pkg-end") catch unreachable;
         }
 
-        if (self.no_rosegment) {
-            try zig_args.append("--no-rosegment");
-        }
         if (self.system_linker_hack) {
             try zig_args.append("--system-linker-hack");
         }
build.zig
@@ -49,7 +49,6 @@ pub fn build(b: *Builder) !void {
         .c_header_files = nextValue(&index, build_info),
         .dia_guids_lib = nextValue(&index, build_info),
         .llvm = undefined,
-        .no_rosegment = b.option(bool, "no-rosegment", "Workaround to enable valgrind builds") orelse false,
     };
     ctx.llvm = try findLLVM(b, ctx.llvm_config_exe);
 
@@ -289,8 +288,6 @@ fn nextValue(index: *usize, build_info: []const u8) []const u8 {
 }
 
 fn configureStage2(b: *Builder, exe: var, ctx: Context) !void {
-    exe.setNoRoSegment(ctx.no_rosegment);
-
     exe.addIncludeDir("src");
     exe.addIncludeDir(ctx.cmake_binary_dir);
     addCppLib(b, exe, ctx.cmake_binary_dir, "zig_cpp");
@@ -375,5 +372,4 @@ const Context = struct {
     c_header_files: []const u8,
     dia_guids_lib: []const u8,
     llvm: LibraryDep,
-    no_rosegment: bool,
 };