[Bug c/29838] New: -fstack-protector shouldn't use TLS in freestanding mode

samuel dot thibault at ens-lyon dot org gcc-bugzilla@gcc.gnu.org
Wed Nov 15 01:14:00 GMT 2006


Hi,

On some architectures, when given -fstack-protector (which is the default on
ubuntu), gcc generates a TLS reference for the stack guard. For instance, on
linux x86 with a fairly recent version of glibc:

echo 'void f (void) { volatile char a[8]; a[3]; }' | gcc -S -x c -O2
-fstack-protector - -o -

generates a %gs:0x14 reference.

In freestanding mode, this poses problem because the target (typically an OS
kernel) does not necessarily have TLS.  In such case, gcc should default back
to referencing __stack_chk_guard.

Samuel


-- 
           Summary: -fstack-protector shouldn't use TLS in freestanding mode
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: samuel dot thibault at ens-lyon dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29838



More information about the Gcc-bugs mailing list