http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53453
--- Comment #8 from Jack Howarth <howarth at nitro dot med.uc.edu> 2012-05-24 19:52:04 UTC --- Are we sure this test for... /* Don't add cwd for <built-in>. */ if (!IS_ABSOLUTE_PATH (filename) && filename[0] != '<') add_comp_dir_attribute (die); is still required? The original description says "When dwarf2out sees an input file without a dir separator, it puts the current working directory in the list of directories to search.". However this change predates.... r70189 Author: aoliva Date: Tue Aug 5 21:15:57 2003 UTC (8 years, 9 months ago) Changed paths: 17 Log Message: * c.opt: Introduce -fworking-directory. * doc/cpp.texi, doc/invoke.texi, doc/cppopts.texi: Document it. * c-common.h (flag_working_directory): Declare. * c-common.c (flag_working_directory): Define. * c-opts.c (c_common_handle_options): Set it. (sanitize_cpp_opts): Set... * cpplib.h (struct cpp_options): ... working_directory option. (struct cpp_callbacks): Add dir_change. * cppinit.c (read_original_filename): Call... (read_original_directory): New. Look for # 1 "directory//" and process it. (cpp_read_main_file): Call dir_change callback if working_directory option is set. * gcc.c (cpp_unique_options): Pass -g*. * c-lex.c (cb_dir_change): New. (init_c_lex): Set dir_change callback. * toplev.c (src_pwd): New static variable. (set_src_pwd, get_src_pwd): New functions. * toplev.h (get_src_pwd, set_src_pwd): Declare. * dbxout.c (dbxout_init): Call get_src_pwd() instead of getpwd(). * dwarf2out.c (gen_compile_unit_die): Likewise. * dwarfout.c (output_compile_unit_die, dwarfout_init): Likewise. which changed... --- trunk/gcc/dwarf2out.c 2003/08/01 21:51:13 70072 +++ trunk/gcc/dwarf2out.c 2003/08/05 21:15:57 70189 @@ -9506,7 +9506,7 @@ static void add_comp_dir_attribute (dw_die_ref die) { - const char *wd = getpwd (); + const char *wd = get_src_pwd (); if (wd != NULL) add_AT_string (die, DW_AT_comp_dir, wd); } so that DW_AT_comp_dir pointed at the source directory rather than at the working directory. Might that not eliminate dwarf2out putting the current working directory in the list of directories to search? Perhaps the hack... /* Don't add cwd for <built-in>. */ if (!IS_ABSOLUTE_PATH (filename) && filename[0] != '<') is no longer required post revision 70189.