Skip to content

Fix build with GCC 14 and binutils >= 2.40 on Linux - #1161

Open
blshkv wants to merge 1 commit into
alliedmodders:masterfrom
blshkv:fix-modern-toolchain
Open

blshkv wants to merge 1 commit into
alliedmodders:masterfrom
blshkv:fix-modern-toolchain

Conversation

@blshkv

@blshkv blshkv commented Aug 16, 2026

Copy link
Copy Markdown

Problem

Building AMX Mod X on modern Linux toolchains (GCC 14 + binutils 2.40+) fails with five distinct errors. GCC 14 tightened several diagnostics to hard errors, and binutils 2.40 made --error-rwx-segments the default, turning text relocations in shared libraries into linker errors (the same issue macOS already handles via -Wl,-read_only_relocs,suppress).

Fixes

  • compiler/libpc300/prefix.c — declare end as const char * in br_extract_dir() and br_extract_prefix(). strrchr() returns const char * when its input is const char *; GCC 14 promotes -Wdiscarded-qualifiers to an error.

  • compiler/libpc300/AMBuilder — add -Wl,-z,notext on Linux. The i386 sources are compiled without -fPIC; binutils ≥ 2.40 made --error-rwx-segments the default, causing the link to fail with text relocation errors.

  • amxmodx/AMBuilder — add an elif builder.target_platform == 'linux' block with -Wl,-z,notext. The macOS branch already uses -Wl,-read_only_relocs,suppress for the same reason; Linux now needs the equivalent.

  • modules/regex/AMBuilder — add -Wl,-z,notext on Linux when linking the pre-built lib_linux/libpcre.a, which was built without -fPIC and therefore contains text relocations that binutils ≥ 2.40 rejects.

  • modules/sqlite/AMBuilder — add -Wl,-z,notext on Linux and suppress -Wno-misleading-indentation -Wno-return-local-addr in binary.compiler.cflags. These are false-positive warnings triggered by the vendored SQLite amalgamation (third_party/sqlite/sqlite3.c) under GCC 14.

Tested on

Gentoo Linux, GCC 14, binutils 2.46, targeting i386.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant