[PATCH] Introduce new gold plugin option "relocation-pic"

Rafael EspĂ­ndola rafael.espindola at gmail.com
Thu Feb 13 06:50:49 PST 2014


I think this is OK.

Peter, can you just confirm that the handling of hasZeroBaseShadow is
correct? In particular, its interaction with -static.

On 13 February 2014 08:46, Alexey Volkov <avolkov.intel at gmail.com> wrote:
>   Hi Rafael,
>
>   I've rewritten my patch with "-pie" linker option.
>   Unfortunately I couldn't use isPIEDefault function since PIE will be turned on for all objects generated in Clang::ConstructJob.
>   Analysis of compiler options is not sufficient since the same object can be used for library or for executable.
>
> Hi rafael,
>
> http://llvm-reviews.chandlerc.com/D2668
>
> CHANGE SINCE LAST DIFF
>   http://llvm-reviews.chandlerc.com/D2668?vs=6795&id=7051#toc
>
> Files:
>   lib/Driver/Tools.cpp
>   test/Driver/gold-lto.c
>
> Index: lib/Driver/Tools.cpp
> ===================================================================
> --- lib/Driver/Tools.cpp
> +++ lib/Driver/Tools.cpp
> @@ -6547,7 +6547,9 @@
>    const SanitizerArgs &Sanitize = ToolChain.getSanitizerArgs();
>    const bool IsPIE =
>      !Args.hasArg(options::OPT_shared) &&
> -    (Args.hasArg(options::OPT_pie) || Sanitize.hasZeroBaseShadow());
> +    !Args.hasArg(options::OPT_static) &&
> +    (Args.hasArg(options::OPT_pie) || Sanitize.hasZeroBaseShadow() ||
> +     isAndroid);
>
>    ArgStringList CmdArgs;
>
> Index: test/Driver/gold-lto.c
> ===================================================================
> --- test/Driver/gold-lto.c
> +++ test/Driver/gold-lto.c
> @@ -19,3 +19,8 @@
>  // CHECK-ARM-V7A: "-plugin" "{{.*}}/LLVMgold.so"
>  // CHECK-ARM-V7A: "-plugin-opt=mcpu=cortex-a8"
>  // CHECK-ARM-V7A: "-plugin-opt=foo"
> +//
> +// RUN: %clang -target i686-linux-android -### %t.o -flto 2>&1 \
> +// RUN:     | FileCheck %s --check-prefix=CHECK-X86-ANDROID
> +// CHECK-X86-ANDROID: "-pie"
> +// CHECK-X86-ANDROID: "-plugin" "{{.*}}/LLVMgold.so"
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>



More information about the llvm-commits mailing list