r278395 - Don't enable PIE on i686-unknown-cloudabi.

Joerg Sonnenberger via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 11 13:41:54 PDT 2016


On Thu, Aug 11, 2016 at 08:03:22PM -0000, Ed Schouten via cfe-commits wrote:
> Modified: cfe/trunk/lib/Driver/ToolChains.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=278395&r1=278394&r2=278395&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Driver/ToolChains.cpp (original)
> +++ cfe/trunk/lib/Driver/ToolChains.cpp Thu Aug 11 15:03:22 2016
> @@ -3344,6 +3344,19 @@ Tool *CloudABI::buildLinker() const {
>    return new tools::cloudabi::Linker(*this);
>  }
>  
> +bool CloudABI::isPIEDefault() const {
> +  // Only enable PIE on architectures that support PC-relative
> +  // addressing. PC-relative addressing is required, as the process
> +  // startup code must be able to relocate itself.
> +  switch (getTriple().getArch()) {
> +  case llvm::Triple::aarch64:
> +  case llvm::Triple::x86_64:
> +    return true;
> +  default:
> +    return false;
> +  }
> +}
> +
>  SanitizerMask CloudABI::getSupportedSanitizers() const {
>    SanitizerMask Res = ToolChain::getSupportedSanitizers();
>    Res |= SanitizerKind::SafeStack;
> 

This comment doesn't make sense to me. x86 requires a relative call per
function to effectively compute EIP. The only difference for relocation
purposes is that GP register. All other questions are identical between
x86 and x86_64.

Joerg


More information about the cfe-commits mailing list