This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: add command line option to gcc


On Fri, 6 Sep 2019 at 04:26, Tim Rice wrote:
>
>
> I have a use case where I would like gcc to accept -Kthread
> and act as if it was passed -pthread. So -Kthread would
> be a synonym for -pthread.

For a specific target, or universally?

> I am having trouble figuring out how the option processing is handled.
> Possibly in gcc/gcc.c but I am stumped here.

You could use "specs" to tell the driver to use -pthread when -Kthread
is given e.g.

%{Kthread: -pthread}

This can either be hardcoded into the 'gcc' driver program (which
would be done in gcc/gcc.c or in a per-target file under gcc/config)
or provided in a specs file with the -specs option (see the manual).

The quick and dirty way to test that would be to dump the current
specs to a file with 'gcc -dumpspecs > kthread.spec' and then edit the
file so that everywhere you see %{pthread: xxx} you add %{Kthread:
xxx} to make it do the same thing. Then you can run gcc
-specs=kthread.spec -Kthread ...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]