mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-06 02:34:05 +00:00
openbsd: defaults to PIE executable
OpenBSD uses PIE code by default to allow the system to load the binary at a random location. don't pass -no-pie to preserve this behaviour, and build objects with -fPIC (LLVMRelocPIC).
This commit is contained in:
@@ -1295,6 +1295,11 @@ void lb_generate_code(lbGenerator *gen) {
|
||||
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) {
|
||||
target_machines[i] = LLVMCreateTargetMachine(
|
||||
target, target_triple, llvm_cpu,
|
||||
|
||||
Reference in New Issue
Block a user