[cfe-dev] Understanding Options.td
David Blaikie via cfe-dev
cfe-dev at lists.llvm.org
Tue Mar 5 09:56:24 PST 2019
I haven't looked - but my first guess at an argument to seek inspiration
from, would be -fuse-ld. See how that's handled, how it warns if the
compiler isn't doing a link action, etc.
On Tue, Mar 5, 2019 at 7:29 AM David Greene via cfe-dev <
cfe-dev at lists.llvm.org> wrote:
> I am looking at adding an option that should only be passed by the user
> at link time. The option affects how clang behaves and does not get
> passed to the linker itself. Clang should warn if the option is given
> in a non-linking context.
>
> Looking at Driver/Options.td, I see a couple of definitions that might
> be relevant:
>
> // LinkerInput - The option is a linker input.
> def LinkerInput : OptionFlag;
>
> def Link_Group : OptionGroup<"<T/e/s/t/u group>">, DocName<"Linker flags">,
> DocBrief<[{Flags that are passed on to the linker}]>;
>
> I also see some uses of these:
>
> def hip_device_lib_path_EQ : Joined<["--"], "hip-device-lib-path=">,
> Group<Link_Group>,
> HelpText<"HIP device library path">;
> def hip_device_lib_EQ : Joined<["--"], "hip-device-lib=">,
> Group<Link_Group>,
> HelpText<"HIP device library">;
>
> def framework : Separate<["-"], "framework">, Flags<[LinkerInput]>;
>
> I am not sure how to interpret this. On the one hand, I imagine the HIP
> options are options that affect how clang behaves but do not get passed
> to the linker, so Link_Group seems like the right things to use. On the
> other hand, I don't think linkers support a -framework option so maybe
> LinkerInput is what I should use. I don't know what "linker input"
> means, nor what "passed on to the linker" means given what I am seeing
> in Options.td.
>
> Is there some guidance on the use of Flags and Group for options? What
> is the right incantation for my needs?
>
> Thanks!
>
> -David
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190305/a202f8f1/attachment.html>
More information about the cfe-dev
mailing list