mirror of
https://github.com/ziglang/zig.git
synced 2024-11-17 01:23:54 +00:00
Added .pe ObjectFormat
MachO linker no longer collects unused dwarf debug information
This commit is contained in:
parent
e9b137f23a
commit
e9807418e7
@ -468,6 +468,7 @@ pub const Target = struct {
|
||||
/// TODO Get rid of this one.
|
||||
unknown,
|
||||
coff,
|
||||
pe,
|
||||
elf,
|
||||
macho,
|
||||
wasm,
|
||||
|
@ -68,7 +68,7 @@ pub const File = struct {
|
||||
pub fn openPath(allocator: *Allocator, dir: fs.Dir, sub_path: []const u8, options: Options) !*File {
|
||||
switch (options.object_format) {
|
||||
.unknown => unreachable,
|
||||
.coff => return Coff.openPath(allocator, dir, sub_path, options),
|
||||
.coff, .pe => return Coff.openPath(allocator, dir, sub_path, options),
|
||||
.elf => return Elf.openPath(allocator, dir, sub_path, options),
|
||||
.macho => return MachO.openPath(allocator, dir, sub_path, options),
|
||||
.wasm => return Wasm.openPath(allocator, dir, sub_path, options),
|
||||
|
@ -316,31 +316,8 @@ pub fn updateDecl(self: *MachO, module: *Module, decl: *Module.Decl) !void {
|
||||
var code_buffer = std.ArrayList(u8).init(self.base.allocator);
|
||||
defer code_buffer.deinit();
|
||||
|
||||
var dbg_line_buffer = std.ArrayList(u8).init(self.base.allocator);
|
||||
defer dbg_line_buffer.deinit();
|
||||
|
||||
var dbg_info_buffer = std.ArrayList(u8).init(self.base.allocator);
|
||||
defer dbg_info_buffer.deinit();
|
||||
|
||||
var dbg_info_type_relocs: File.DbgInfoTypeRelocsTable = .{};
|
||||
defer {
|
||||
var it = dbg_info_type_relocs.iterator();
|
||||
while (it.next()) |entry| {
|
||||
entry.value.relocs.deinit(self.base.allocator);
|
||||
}
|
||||
dbg_info_type_relocs.deinit(self.base.allocator);
|
||||
}
|
||||
|
||||
const typed_value = decl.typed_value.most_recent.typed_value;
|
||||
const res = try codegen.generateSymbol(
|
||||
&self.base,
|
||||
decl.src(),
|
||||
typed_value,
|
||||
&code_buffer,
|
||||
&dbg_line_buffer,
|
||||
&dbg_info_buffer,
|
||||
&dbg_info_type_relocs,
|
||||
);
|
||||
const res = try codegen.generateSymbol(&self.base, decl.src(), typed_value, &code_buffer, .none);
|
||||
|
||||
const code = switch (res) {
|
||||
.externally_managed => |x| x,
|
||||
|
@ -153,8 +153,8 @@ const usage_build_generic =
|
||||
\\ elf Executable and Linking Format
|
||||
\\ c Compile to C source code
|
||||
\\ wasm WebAssembly
|
||||
\\ pe Portable Executable (Windows)
|
||||
\\ coff (planned) Common Object File Format (Windows)
|
||||
\\ pe (planned) Portable Executable (Windows)
|
||||
\\ macho (planned) macOS relocatables
|
||||
\\ hex (planned) Intel IHEX
|
||||
\\ raw (planned) Dump machine code directly
|
||||
@ -451,7 +451,7 @@ fn buildOutputType(
|
||||
} else if (mem.eql(u8, ofmt, "coff")) {
|
||||
break :blk .coff;
|
||||
} else if (mem.eql(u8, ofmt, "pe")) {
|
||||
break :blk .coff;
|
||||
break :blk .pe;
|
||||
} else if (mem.eql(u8, ofmt, "macho")) {
|
||||
break :blk .macho;
|
||||
} else if (mem.eql(u8, ofmt, "wasm")) {
|
||||
@ -524,10 +524,7 @@ fn buildOutputType(
|
||||
try stderr.print("\nUnable to parse command: {}\n", .{@errorName(err)});
|
||||
continue;
|
||||
}) |line| {
|
||||
const actual_line = if (line[line.len - 1] == '\r')
|
||||
line[0 .. line.len - 1]
|
||||
else
|
||||
line;
|
||||
const actual_line = mem.trimRight(u8, line, "\r\n ");
|
||||
|
||||
if (mem.eql(u8, actual_line, "update")) {
|
||||
if (output_mode == .Exe) {
|
||||
|
Loading…
Reference in New Issue
Block a user