Compile this code: struct foo { int a, b; } const struct foo f;
The compiler will mark the variable f in .bss instead of, as the const indicates, into .rodata. This can be a security problem. In glibc we deliberately use const wherever possible (as should everybody) to prevent anybody from changing the value. Allowing changes would allw an intruder to modify the variable and influence the semantics of the program. Yes, this means that binaries get larger. But that's what the programmer requested. -- Summary: zero-initialized constants are place in .bss Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: drepper at redhat dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25522