Diagnosing Missing GCC -fstack-protector-strong Protection
How to detect and fix missing stack canary protection when using GCC's -fstack-protector-strong flag.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
How to detect and fix missing stack canary protection when using GCC's -fstack-protector-strong flag.
A diagnostic workflow for GCC's -Wmaybe-uninitialized: how to tell real uninitialized-use bugs from optimization-level artifacts, fix the actual path, and know when to escalate.
Learn how to use GCC's Link-Time Optimization (-flto) to enable cross-module inlining and dead-code elimination, reducing binary size and improving performance.
Assuming GCC accepts the linker option -Wl,--build-id to embed a unique identifier in the produced executable, I have a project that is compiled with GCC, the resulting binary is backed up, and later the backup is restored to the same or a different filesystem. I want to confirm that the restored binary is identical to the original with respect to the build‑
Consider this AMD64 assembly program: .globl _start _start: xorl %edi, %edi movl $60, %eax syscall If I compile that with gcc -nostdlib and run ldd a.out , I get this: statically linked If I instead compile that with gcc -static -nostdlib and run ldd a.out , I get this: not a dynamic executable What's the difference between statically linked and not a dynami
Goal The goal is to determine whether the -Wshadow option should emit a warning when a C++ lambda capture introduces a name that hides an outer variable. Constraints The GCC manual states that -Wshadow applies only to C, yet GCC 10 produces a warning for such lambda captures while GCC 12 does not, and the bug tracker lists this discrepancy as an open issue.
Consider this empty program: int main() { return 0; } If I compile it with C++ with g++ main.cpp && strace ./a.out , and analyze the output with strace , I observed that the last lines of the output are (you can add -O3 that the effect is the same): mprotect(0x7f71af154000, 45056, PROT_READ) = 0 mprotect(0x7f71af38b000, 4096, PROT_READ) = 0 brk(NULL)
Symptom When compiling with -flto and -fcommon , GCC often succeeds linking multiple source files that each declare a tentative global variable. Switching to -fno-common triggers duplicate symbol errors during the LTO phase, even though standard linking without LTO honours the flags consistently. Uncertainty The GCC manual does not explicitly state whether -
Deterministic Binary Generation Achieving bit-for-bit identical binaries across different build environments in GCC requires neutralizing non-deterministic inputs. While -frandom-seed stabilizes optimization passes, the default expansion of __DATE__ and __TIME__ macros introduces temporal variance. Path and Timestamp Constraints To maintain a repeatable deve