# /etc/portage/env/codex-lowmem.conf
# Alternative compiler configuration (Clang/LLVM) to mitigate low-memory compilation issues

# 1. Alternative compiler: Clang/LLVM toolchain
CC="clang"
CXX="clang++"
CPP="clang-cpp"
AR="llvm-ar"
NM="llvm-nm"
RANLIB="llvm-ranlib"

# 2. Parallel jobs reduction: limit make to 1 job to prevent RAM exhaustion
MAKEOPTS="-j1"

# 3. Memory-efficient linker: use LLD and release unneeded memory pages
LDFLAGS="${LDFLAGS} -fuse-ld=lld -Wl,--no-keep-memory"

# 4. Memory-efficient LTO: use ThinLTO instead of full monolithic LTO
CFLAGS="${CFLAGS} -flto=thin"
CXXFLAGS="${CXXFLAGS} -flto=thin"
