https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70268
--- Comment #1 from hongxu jia <hongxu.jia at windriver dot com> --- So I suggest gcc could provide a option '-ffile-prefix-map=<old>=<new>' to map <old> directory in __FILE__ and replace it with <new> directory. It is similar to '-fdebug-prefix-map=<old>=<new>', but the latter is used for DWARF, and the newly added option only works on '__FILE__', '__BASE_FILE__' and '__builtin_FILE()' ----------------------------------------------- 5. Compile C source file with '-ffile-prefix-map' $ gcc ./test.c -ffile-prefix-map=/usr/include= -o test 4. Execute and the header file is not pull path. $ ./test __FILE__ ./test.c __FILE__ /test.h -----------------------------------------------