[cfe-dev] clang doesn't find filename from linemarker when compiling preprocessed source

Taewook Oh via cfe-dev cfe-dev at lists.llvm.org
Mon Jan 9 09:36:46 PST 2017


Clang appears to always use name as specified on the command line, whereas gcc uses the name as specified in the first linemarker when compiling a preprocessed source. If I use a temporary preprocess file during my build process, the name of the temp file is embedded into the object file. Is this a by-design behavior? Thanks!

Repro:
$ touch test.c
$ gcc -E -o test.i test.c
$ gcc -c -o test.o test.i
$ readelf -a test.o | grep test
1: 0000000000000000 0 FILE LOCAL DEFAULT ABS test.c
$ clang test.c -E -o test.i
$ clang -c -o test.o test.i
$ readelf -a test.o | grep test
1: 0000000000000000 0 FILE LOCAL DEFAULT ABS test.i
$ clang -c -o test.o test.c
$ readelf -a test.o | grep test
1: 0000000000000000 0 FILE LOCAL DEFAULT ABS test.c
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170109/d0ab5597/attachment.html>


More information about the cfe-dev mailing list