On Wed, Sep 17, 2014 at 03:16:52PM +0400, Andrey Turetskiy wrote: > Hi, > This patch (attached) contains the prototype of mechanism for passing > options to offload target compiler. > If one need to pass additional options for target compiler, one may > add option ‘–ftarget-options=<target name>=<target options>’ to host > compiler (target name can be skipped, that will append specified > options for every target). > > Options preparing takes place in lto-wrapper in several stages: > 1. Read (host) options from .gnu.target_lto_.opts section for every > object file and merge them as during lto > 2. Remove CL_TARGET, CL_DRIVER and CL_LTO options > 3. For every offload target: search for option ‘–ftarget-options’ with > argument corresponding to target triple, parse it and merge with > remained host options > > Here is an example of option merging: > ./install/bin/gcc -fopenmp -c a.c -O0 -mno-sse -ftarget-options=="-O2 -msse"
I don't like the == in there. Doesn't <target name>, being a target triplet or something like that, always have to start with alphanumeric character, and options always have to start with -? Thus, can't you decide from the first character after -ftarget-options= whether it is for all or specific target? If the character after = is whitespace or -, it will be for all targets and -ftarget-options=<target options> form, otherwise it must be -ftarget-options=<target name>=<target options> form. Jakub