How to get the preprocessor output as part of the compilation process?

Valdis Kl=?utf-8?Q?=c4=93?=tnieks valdis.kletnieks at vt.edu
Mon Dec 9 22:17:35 EST 2019


On Mon, 09 Dec 2019 13:10:11 +0300, Konstantin Andreev said:
> The universal approach that always works in this and many similar cases is just
> to replace the instrumented binary by your interception shell script.

> E.g. rename gcc to gcc.hide (generally, moving into another location may not
> work) and setup 'gcc' script that does what you want: replaces `-c' with the
> `-E', replaces `-o' argument, etc ..., calls gcc.hide to preprocess source then
> calls gcc.hide with original non-modified command line.

> This is cumbersome process, you can break some things,

And in fact, what you may want to do is have your script invoke gcc
*twice*, once with -E, and then a second time with -c, because otherwise
the build will die the first time it tries to link together two or more non-existent
.o files.

Using 'make -k' *might* also work, but will leave the build log output littered
with a *lot* of error messages.

Or explain why you're doing this - there may be a simpler way to achieve
your goal. For instance, if you're trying to build a cross-reference of what
.c files include what .h directly or indirectly, there's already specialized tools
for doing that sort of thing, such as 'cxref'.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20191209/cf0ed7c6/attachment.sig>


More information about the Kernelnewbies mailing list