[LLVMdev] getting gold plugin to work?

Sandeep Patel deeppatel1987 at gmail.com
Mon Oct 5 18:18:42 PDT 2009


On Mon, Oct 5, 2009 at 9:09 PM, Rafael Espindola <espindola at google.com> wrote:
>> If we can decide the way we want the options passed, I can take a stab
>> at it (or more likely Viktor will).
>
> The linker has a -plugin-opt option. You probably do something like
>
> -fplugin-opt=-mcpu=
>
...
>> I assume the plugin's options should be either the existing cl::opt
>> ones (-mcpu, etc.) or similar to the llc ones.
>
> You are free to name it, but using something similar to a llc option
> is probably a good idea.

LINK_COMMAND_SPEC in gcc.c will need to change to add:
    %{O*:-plugin-opt=-O%*} \
    %{w:-plugin-opt=-w} \
    %{f*:-plugin-opt=-f%*} \
    ${m*:-plugin-opt=-m%*} \

and then the plugin will need to have an argument translation process
similar to llvm-gcc's LLVM_SET_TARGET_OPTIONS,
LLVM_SET_MACHINE_OPTIONS, and LLVM_SET_SUBTARGET_FEATURES as well as
all the logic in llvm-backend.cpp for translating options. I don't see
any way to unify this logic with the llvm-gcc logic because llvm-gcc's
decisions are derived from global state instead of a direct argument
translation process. Yuck.

Opinions welcome.

deep



More information about the llvm-dev mailing list