mirror of
https://github.com/odin-lang/Odin.git
synced 2026-07-22 15:32:35 +00:00
[stack-canaries] fixed platform behavior
This commit is contained in:
@@ -1909,16 +1909,6 @@ gb_internal void init_build_context(TargetMetrics *cross_target, Subtarget subta
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if (metrics->os == TargetOs_linux) {
|
||||
if (bc->reloc_mode == RelocMode_Default) {
|
||||
bc->reloc_mode = RelocMode_PIC;
|
||||
}
|
||||
switch (metrics->arch) {
|
||||
case TargetArch_arm64:
|
||||
case TargetArch_amd64:
|
||||
bc->no_plt = LLVM_VERSION_MAJOR >= 19;
|
||||
break;
|
||||
}
|
||||
} else if (metrics->os == TargetOs_openbsd) {
|
||||
// Always use PIC for OpenBSD: it defaults to PIE
|
||||
if (bc->reloc_mode == RelocMode_Default) {
|
||||
@@ -1947,10 +1937,37 @@ gb_internal void init_build_context(TargetMetrics *cross_target, Subtarget subta
|
||||
bc->metrics.target_triplet = str_lit("i686-linux-android");
|
||||
bc->reloc_mode = RelocMode_PIC;
|
||||
break;
|
||||
|
||||
default:
|
||||
GB_PANIC("Unknown architecture for -subtarget:android");
|
||||
}
|
||||
} else if (metrics->os == TargetOs_linux) {
|
||||
if (bc->reloc_mode == RelocMode_Default) {
|
||||
bc->reloc_mode = RelocMode_PIC;
|
||||
}
|
||||
switch (metrics->arch) {
|
||||
case TargetArch_arm64:
|
||||
case TargetArch_amd64:
|
||||
bc->no_plt = LLVM_VERSION_MAJOR >= 19;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (metrics->os == TargetOs_windows ||
|
||||
metrics->os == TargetOs_darwin ||
|
||||
metrics->os == TargetOs_linux ||
|
||||
metrics->os == TargetOs_freebsd ||
|
||||
metrics->os == TargetOs_openbsd ||
|
||||
metrics->os == TargetOs_netbsd) {
|
||||
if (bc->stack_protector == StackProtector_Default) {
|
||||
bc->stack_protector = StackProtector_Ssp;
|
||||
}
|
||||
} else {
|
||||
if (bc->stack_protector == StackProtector_Default) {
|
||||
bc->stack_protector = StackProtector_None;
|
||||
} else {
|
||||
gb_printf_err("-stack-protector is not supported on this target\n");
|
||||
gb_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (bc->metrics.os == TargetOs_windows) {
|
||||
|
||||
Reference in New Issue
Block a user