mirror of
https://github.com/roc-lang/roc.git
synced 2024-10-26 18:28:43 +03:00
fix debug info and add it all to the llvm backend
This commit is contained in:
parent
7b1c009ca2
commit
496cd6710a
@ -151,9 +151,6 @@ fn gen_from_mono_module_llvm<'a>(
|
||||
let context = Context::create();
|
||||
let module = arena.alloc(module_from_builtins(target, &context, "app"));
|
||||
|
||||
// strip Zig debug stuff
|
||||
// module.strip_debug_info();
|
||||
|
||||
// mark our zig-defined builtins as internal
|
||||
let app_ll_file = {
|
||||
let mut temp = PathBuf::from(roc_file_path);
|
||||
@ -245,8 +242,7 @@ fn gen_from_mono_module_llvm<'a>(
|
||||
|
||||
env.dibuilder.finalize();
|
||||
|
||||
// we don't use the debug info, and it causes weird errors.
|
||||
module.strip_debug_info();
|
||||
// TODO: pipeline flag here to conditionally strip debug info.
|
||||
|
||||
// Uncomment this to see the module's optimized LLVM instruction output:
|
||||
// env.module.print_to_stderr();
|
||||
@ -361,8 +357,6 @@ fn gen_from_mono_module_llvm<'a>(
|
||||
|
||||
MemoryBuffer::create_from_file(&app_o_file).expect("memory buffer creation works")
|
||||
} else if emit_debug_info {
|
||||
module.strip_debug_info();
|
||||
|
||||
let mut app_ll_dbg_file = PathBuf::from(roc_file_path);
|
||||
app_ll_dbg_file.set_extension("dbg.ll");
|
||||
|
||||
|
@ -7,7 +7,7 @@ const CrossTarget = std.zig.CrossTarget;
|
||||
const Arch = std.Target.Cpu.Arch;
|
||||
|
||||
pub fn build(b: *Build) void {
|
||||
// const mode = b.standardOptimizeOption(.{ .preferred_optimize_mode = .ReleaseFast });
|
||||
// const mode = b.standardOptimizeOption(.{ .preferred_optimize_mode = .Debug });
|
||||
const mode = b.standardOptimizeOption(.{ .preferred_optimize_mode = .ReleaseFast });
|
||||
|
||||
// Options
|
||||
@ -57,7 +57,8 @@ fn generateLlvmIrFile(
|
||||
object_name: []const u8,
|
||||
) void {
|
||||
const obj = b.addObject(.{ .name = object_name, .root_source_file = main_path, .optimize = mode, .target = target, .use_llvm = true });
|
||||
obj.strip = true;
|
||||
obj.strip = false;
|
||||
obj.disable_stack_probing = true;
|
||||
|
||||
// Generating the bin seems required to get zig to generate the llvm ir.
|
||||
_ = obj.getEmittedBin();
|
||||
@ -86,9 +87,10 @@ fn generateObjectFile(
|
||||
object_name: []const u8,
|
||||
) void {
|
||||
const obj = b.addObject(.{ .name = object_name, .root_source_file = main_path, .optimize = mode, .target = target, .use_llvm = true });
|
||||
obj.strip = true;
|
||||
obj.strip = false;
|
||||
obj.link_function_sections = true;
|
||||
obj.force_pic = true;
|
||||
obj.disable_stack_probing = true;
|
||||
|
||||
const obj_file = obj.getEmittedBin();
|
||||
|
||||
|
@ -4717,6 +4717,8 @@ fn expose_function_to_host_help_c_abi_v2<'a, 'ctx>(
|
||||
let subprogram = env.new_subprogram(c_function_name);
|
||||
c_function.set_subprogram(subprogram);
|
||||
|
||||
debug_info_init!(env, c_function);
|
||||
|
||||
// STEP 2: build the exposed function's body
|
||||
let builder = env.builder;
|
||||
let context = env.context;
|
||||
|
@ -233,9 +233,6 @@ fn create_llvm_module<'a>(
|
||||
exposed_to_host: MutSet::default(),
|
||||
};
|
||||
|
||||
// strip Zig debug stuff
|
||||
module.strip_debug_info();
|
||||
|
||||
// Add roc_alloc, roc_realloc, and roc_dealloc, since the repl has no
|
||||
// platform to provide them.
|
||||
add_default_roc_externs(&env);
|
||||
@ -279,9 +276,6 @@ fn create_llvm_module<'a>(
|
||||
|
||||
env.dibuilder.finalize();
|
||||
|
||||
// strip all debug info: we don't use it at the moment and causes weird validation issues
|
||||
module.strip_debug_info();
|
||||
|
||||
// Uncomment this to see the module's un-optimized LLVM instruction output:
|
||||
// env.module.print_to_stderr();
|
||||
|
||||
|
@ -255,9 +255,6 @@ fn mono_module_to_dylib_llvm<'a>(
|
||||
|
||||
env.dibuilder.finalize();
|
||||
|
||||
// we don't use the debug info, and it causes weird errors.
|
||||
module.strip_debug_info();
|
||||
|
||||
// Uncomment this to see the module's un-optimized LLVM instruction output:
|
||||
// env.module.print_to_stderr();
|
||||
|
||||
|
@ -713,9 +713,6 @@ pub fn expect_mono_module_to_dylib<'a>(
|
||||
|
||||
env.dibuilder.finalize();
|
||||
|
||||
// we don't use the debug info, and it causes weird errors.
|
||||
module.strip_debug_info();
|
||||
|
||||
// Uncomment this to see the module's un-optimized LLVM instruction output:
|
||||
// env.module.print_to_stderr();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user