mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 23:28:48 +00:00
Merge pull request #1565 from semarie/openbsd-pie
openbsd: defaults to PIE executable
This commit is contained in:
@@ -1295,6 +1295,11 @@ void lb_generate_code(lbGenerator *gen) {
|
|||||||
reloc_mode = LLVMRelocPIC;
|
reloc_mode = LLVMRelocPIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (build_context.metrics.os == TargetOs_openbsd) {
|
||||||
|
// Always use PIC for OpenBSD: it defaults to PIE
|
||||||
|
reloc_mode = LLVMRelocPIC;
|
||||||
|
}
|
||||||
|
|
||||||
for_array(i, gen->modules.entries) {
|
for_array(i, gen->modules.entries) {
|
||||||
target_machines[i] = LLVMCreateTargetMachine(
|
target_machines[i] = LLVMCreateTargetMachine(
|
||||||
target, target_triple, llvm_cpu,
|
target, target_triple, llvm_cpu,
|
||||||
|
|||||||
+2
-1
@@ -463,7 +463,8 @@ i32 linker_stage(lbGenerator *gen) {
|
|||||||
#endif
|
#endif
|
||||||
link_settings = gb_string_appendc(link_settings, "-Wl,-init,'_odin_entry_point' ");
|
link_settings = gb_string_appendc(link_settings, "-Wl,-init,'_odin_entry_point' ");
|
||||||
link_settings = gb_string_appendc(link_settings, "-Wl,-fini,'_odin_exit_point' ");
|
link_settings = gb_string_appendc(link_settings, "-Wl,-fini,'_odin_exit_point' ");
|
||||||
} else {
|
} else if (build_context.metrics.os != TargetOs_openbsd) {
|
||||||
|
// OpenBSD defaults to PIE executable. do not pass -no-pie for it.
|
||||||
link_settings = gb_string_appendc(link_settings, "-no-pie ");
|
link_settings = gb_string_appendc(link_settings, "-no-pie ");
|
||||||
}
|
}
|
||||||
if (build_context.out_filepath.len > 0) {
|
if (build_context.out_filepath.len > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user