authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-10-10 18:04:02-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-10-10 18:04:02-04:00
logaa78827db2931d5affa13c5612f821e1328ec5ac
tree1bc22cb2d0aaf51d2790e32cad5bde355d3df984
parent1c28631738a7b65e23e5bffc582695faf016045f

add module flag to emit CodeView for COFF object files

see #516

4 files changed, 14 insertions(+), 1 deletions(-)

README.md+4
......@@ -189,6 +189,10 @@ make install
189189./zig build --build-file ../build.zig test
190190```
191191
192#### Windows
193
194See https://github.com/zig-lang/zig/wiki/Building-Zig-on-Windows
195
192196### Release / Install Build
193197
194198Once installed, `ZIG_LIBC_LIB_DIR` and `ZIG_LIBC_INCLUDE_DIR` can be overridden
src/codegen.cpp+5-1
......@@ -4992,7 +4992,11 @@ static void init(CodeGen *g) {
49924992
49934993 LLVMSetTarget(g->module, buf_ptr(&g->triple_str));
49944994
4995 ZigLLVMAddModuleDebugInfoFlag(g->module);
4995 if (g->zig_target.oformat == ZigLLVM_COFF) {
4996 ZigLLVMAddModuleCodeViewFlag(g->module);
4997 } else {
4998 ZigLLVMAddModuleDebugInfoFlag(g->module);
4999 }
49965000
49975001 LLVMTargetRef target_ref;
49985002 char *err_msg = nullptr;
src/zig_llvm.cpp+4
......@@ -706,6 +706,10 @@ void ZigLLVMAddModuleDebugInfoFlag(LLVMModuleRef module) {
706706 unwrap(module)->addModuleFlag(Module::Warning, "Debug Info Version", DEBUG_METADATA_VERSION);
707707}
708708
709void ZigLLVMAddModuleCodeViewFlag(LLVMModuleRef module) {
710 unwrap(module)->addModuleFlag(Module::Warning, "CodeView", 1);
711}
712
709713static AtomicOrdering mapFromLLVMOrdering(LLVMAtomicOrdering Ordering) {
710714 switch (Ordering) {
711715 case LLVMAtomicOrderingNotAtomic: return AtomicOrdering::NotAtomic;
src/zig_llvm.hpp+1
......@@ -112,6 +112,7 @@ unsigned ZigLLVMTag_DW_structure_type(void);
112112
113113ZigLLVMDIBuilder *ZigLLVMCreateDIBuilder(LLVMModuleRef module, bool allow_unresolved);
114114void ZigLLVMAddModuleDebugInfoFlag(LLVMModuleRef module);
115void ZigLLVMAddModuleCodeViewFlag(LLVMModuleRef module);
115116
116117void ZigLLVMSetCurrentDebugLocation(LLVMBuilderRef builder, int line, int column, ZigLLVMDIScope *scope);
117118void ZigLLVMClearCurrentDebugLocation(LLVMBuilderRef builder);