add module flag to emit CodeView for COFF object files

see #516
master
Andrew Kelley 2017-10-10 18:04:02 -04:00
parent 1c28631738
commit aa78827db2
4 changed files with 14 additions and 1 deletions

View File

@ -189,6 +189,10 @@ make install
./zig build --build-file ../build.zig test
```
#### Windows
See https://github.com/zig-lang/zig/wiki/Building-Zig-on-Windows
### Release / Install Build
Once installed, `ZIG_LIBC_LIB_DIR` and `ZIG_LIBC_INCLUDE_DIR` can be overridden

View File

@ -4992,7 +4992,11 @@ static void init(CodeGen *g) {
LLVMSetTarget(g->module, buf_ptr(&g->triple_str));
ZigLLVMAddModuleDebugInfoFlag(g->module);
if (g->zig_target.oformat == ZigLLVM_COFF) {
ZigLLVMAddModuleCodeViewFlag(g->module);
} else {
ZigLLVMAddModuleDebugInfoFlag(g->module);
}
LLVMTargetRef target_ref;
char *err_msg = nullptr;

View File

@ -706,6 +706,10 @@ void ZigLLVMAddModuleDebugInfoFlag(LLVMModuleRef module) {
unwrap(module)->addModuleFlag(Module::Warning, "Debug Info Version", DEBUG_METADATA_VERSION);
}
void ZigLLVMAddModuleCodeViewFlag(LLVMModuleRef module) {
unwrap(module)->addModuleFlag(Module::Warning, "CodeView", 1);
}
static AtomicOrdering mapFromLLVMOrdering(LLVMAtomicOrdering Ordering) {
switch (Ordering) {
case LLVMAtomicOrderingNotAtomic: return AtomicOrdering::NotAtomic;

View File

@ -112,6 +112,7 @@ unsigned ZigLLVMTag_DW_structure_type(void);
ZigLLVMDIBuilder *ZigLLVMCreateDIBuilder(LLVMModuleRef module, bool allow_unresolved);
void ZigLLVMAddModuleDebugInfoFlag(LLVMModuleRef module);
void ZigLLVMAddModuleCodeViewFlag(LLVMModuleRef module);
void ZigLLVMSetCurrentDebugLocation(LLVMBuilderRef builder, int line, int column, ZigLLVMDIScope *scope);
void ZigLLVMClearCurrentDebugLocation(LLVMBuilderRef builder);