[cfe-dev] Understanding Options.td

Shoaib Meenai via cfe-dev cfe-dev at lists.llvm.org
Tue Mar 5 09:27:50 PST 2019


I can't speak to the rest, but -framework *is* supported by the Darwin linker (ld64), so I would expect that option to be passed through to the linker at least on Darwin.

From: cfe-dev <cfe-dev-bounces at lists.llvm.org> on behalf of cfe-dev <cfe-dev at lists.llvm.org>
Reply-To: David Greene <dag at cray.com>
Date: Tuesday, March 5, 2019 at 7:29 AM
To: cfe-dev <cfe-dev at lists.llvm.org>
Subject: [cfe-dev] Understanding Options.td

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<mailto:cfe-dev at lists.llvm.org>
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_cfe-2Ddev&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=Io4QkBpxp1wDg8XQBEa_B8jelhDU4NFA2N2taFfCSl0&s=cYHtM_PBjOiwFgXfkO7YurK6hddMsJTvfGEIB0jW2jQ&e=

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190305/ca44e0c0/attachment.html>


More information about the cfe-dev mailing list