This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/25522] New: zero-initialized constants are place in .bss
- From: "drepper at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Dec 2005 19:04:38 -0000
- Subject: [Bug middle-end/25522] New: zero-initialized constants are place in .bss
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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