Expose an option for producing 64-bit DWARF format
This commit enables producing 64-bit DWARF format for Zig executables that are produced through the LLVM backend. This is achieved by exposing both command-line flags and CompileStep flags. The production of the 64-bit format only affects binaries that use the DWARF format and it is disabled on MacOS due to it being problematic. This commit, despite generating the interface for the Zig user to be able to tell the compile which format is wanted, is just implemented for the LLVM backend, so clang and the self-hosted backends will need this to be implemented in a future commit. This is an effort to work around #7962, since the emission of the 64-bit format automatically produces 64-bit relocations. Further investigation will be needed to make DWARF 32-bit format to emit bigger relocations when needed and not make the linker angry.
This commit is contained in:
committed by
Andrew Kelley
parent
fac120bc3a
commit
d026202a26
@@ -433,7 +433,14 @@ pub const Object = struct {
|
||||
if (!options.strip) {
|
||||
switch (options.target.ofmt) {
|
||||
.coff => llvm_module.addModuleCodeViewFlag(),
|
||||
else => llvm_module.addModuleDebugInfoFlag(),
|
||||
else => {
|
||||
const dwarf_format = options.dwarf_format orelse .dwarf32;
|
||||
const produce_dwarf64 = switch (dwarf_format) {
|
||||
.dwarf32 => false,
|
||||
.dwarf64 => true,
|
||||
};
|
||||
llvm_module.addModuleDebugInfoFlag(produce_dwarf64);
|
||||
},
|
||||
}
|
||||
const di_builder = llvm_module.createDIBuilder(true);
|
||||
opt_di_builder = di_builder;
|
||||
|
||||
@@ -409,7 +409,7 @@ pub const Module = opaque {
|
||||
extern fn LLVMSetTarget(M: *Module, Triple: [*:0]const u8) void;
|
||||
|
||||
pub const addModuleDebugInfoFlag = ZigLLVMAddModuleDebugInfoFlag;
|
||||
extern fn ZigLLVMAddModuleDebugInfoFlag(module: *Module) void;
|
||||
extern fn ZigLLVMAddModuleDebugInfoFlag(module: *Module, dwarf64: bool) void;
|
||||
|
||||
pub const addModuleCodeViewFlag = ZigLLVMAddModuleCodeViewFlag;
|
||||
extern fn ZigLLVMAddModuleCodeViewFlag(module: *Module) void;
|
||||
|
||||
Reference in New Issue
Block a user