[Bug other/52885] New: Request: Add -aslr switch that invokes -fPIE/-pie or -fPIC/-shared as appropriate

noloader at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Apr 5 23:18:00 GMT 2012


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: unassigned@gcc.gnu.org
        ReportedBy: noloader@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".



More information about the Gcc-bugs mailing list