[no-plt] enable no-plt behavior on linux arm64 and amd64 targets

This commit is contained in:
A1029384756
2026-06-08 10:58:05 -04:00
parent 43b057dfeb
commit da742fc526
4 changed files with 26 additions and 0 deletions

View File

@@ -602,6 +602,7 @@ struct BuildContext {
RelocMode reloc_mode;
bool disable_red_zone;
bool disable_unwind;
bool no_plt;
isize max_error_count;
@@ -1902,6 +1903,12 @@ gb_internal void init_build_context(TargetMetrics *cross_target, Subtarget subta
if (bc->reloc_mode == RelocMode_Default) {
bc->reloc_mode = RelocMode_PIC;
}
switch (metrics->arch) {
case TargetArch_arm64:
case TargetArch_amd64:
bc->no_plt = true;
break;
}
} else if (metrics->os == TargetOs_openbsd) {
// Always use PIC for OpenBSD: it defaults to PIE
if (bc->reloc_mode == RelocMode_Default) {