https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80881

--- Comment #50 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> Please note that RIP-relative addresses are one byte shorter than absolute
> addresses and are interchangeable on x86_64 Linux. If this is also true on
> Windows (UNSPEC_PCREL was introduced for PE linkers) then the above should
> also be emitted without flag_pic.

The crucial bits are these in config/i386/cygming.h:

/* Don't allow flag_pic to propagate since gas may produce invalid code
   otherwise.  */

#undef  SUBTARGET_OVERRIDE_OPTIONS
#define SUBTARGET_OVERRIDE_OPTIONS                                      \
do {                                                                    \
  flag_pic = TARGET_64BIT ? 1 : 0;                                      \
} while (0)

so 64-bit code is always PIC whereas 32-bit code is never PIC.

Reply via email to