http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52885
Bug #: 52885 Summary: Request: Add -aslr switch that invokes -fPIE/-pie or -fPIC/-shared as appropriate Classification: Unclassified Product: gcc Version: 4.6.1 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: other AssignedTo: unassig...@gcc.gnu.org ReportedBy: noloa...@gmail.com When writing makefiles or using automake and friends, its currently not possible to to supply 'generic' set of flags via CFLAGS (or CXXFLAGS) and produce position independent code and utilize layout randomization. For example the following will properly setup makefiles for programs, but not shared objects: $ configure CFLAGS="-Wall -Wextra -Wconversion -fPIE -pie -Wno-unused-parameter -Wformat=2 -Wformat-security -fstack-protector-all -Wstrict-overflow -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now" Others have also felt the discomfort: http://lists.fedoraproject.org/pipermail/devel-announce/2011-August/000821.html. Please provide a switch that allows us to use position independent code and layout randomization that works on both programs and shared objects. I suggest the switch "-aslr" or "-ASLR".