Commit 705e9cb3ca

Motiejus Jakštys <motiejus@jakstys.lt>
2022-06-23 07:52:35
[linker] ignore --sort-common
From ld.lld(1): --sort-common This option is ignored for GNU compatibility. Refs https://github.com/zigchroot/zig-chroot/issues/1
1 parent b1b944a
Changed files (1)
src/main.zig
@@ -1619,6 +1619,10 @@ fn buildOutputType(
                                         build_id = true;
                                         warn("ignoring build-id style argument: '{s}'", .{value});
                                         continue;
+                                    } else if (mem.eql(u8, key, "--sort-common")) {
+                                        // this ignores --sort=common=<anything>; ignoring plain --sort-common
+                                        // is done below.
+                                        continue;
                                     }
                                     try linker_args.append(key);
                                     try linker_args.append(value);
@@ -1631,6 +1635,9 @@ fn buildOutputType(
                                 needed = true;
                             } else if (mem.eql(u8, linker_arg, "-no-pie")) {
                                 want_pie = false;
+                            } else if (mem.eql(u8, linker_arg, "--sort-common")) {
+                                // from ld.lld(1): --sort-common is ignored for GNU compatibility,
+                                // this ignores plain --sort-common
                             } else if (mem.eql(u8, linker_arg, "--whole-archive") or
                                 mem.eql(u8, linker_arg, "-whole-archive"))
                             {