Tiny Core Linux

Tiny Core Base => TCB Talk => Topic started by: Zhe on January 10, 2026, 11:54:11 AM

Title: Is it necessary to add security-related compilation parameters
Post by: Zhe on January 10, 2026, 11:54:11 AM
Hi, Is it necessary to add security-related parameters?

Code: [Select]

==========================================
Basic Compilation Options
==========================================

export ARCH="i486"
export CFLAGS="-march=${ARCH} -mtune=i686 -Os -pipe \
-fstack-protector-strong -fstack-clash-protection \
-fPIE -fno-plt \
-fno-common \
-ffunction-sections -fdata-sections \
-D_FORTIFY_SOURCE=2"

export CXXFLAGS="${CFLAGS} -D_GLIBCXX_ASSERTIONS"

export LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu \
-Wl,--reduce-memory-overheads \
-Wl,-pie -Wl,-z,relro -Wl,-z,now \
-Wl,--gc-sections -Wl,--as-needed -Wl,--sort-common \
-Wl,-z,noexecstack -Wl,-z,readonly-text"

==========================================
Aggressive Optimization Options
==========================================

export CFLAGS="${CFLAGS} \
-flto=auto -fuse-linker-plugin \
-fomit-frame-pointer \
-g0 -fno-unwind-tables -fno-asynchronous-unwind-tables"

export CXXFLAGS="${CFLAGS} -fno-exceptions -fno-rtti"

export LDFLAGS="${LDFLAGS} -flto=auto -Wl,-s"


What are your thoughts on this?