Go to file
Jakub Jelinek 3d0af0c997 lto: Stream current working directory for first streamed relative filename and adjust relative paths [PR93865]
If the gcc -c -flto ... commands to compile some or all objects are run in a
different directory (or in different directories) from the directory in
which the gcc -flto link line is invoked, then the .debug_line will be
incorrect if there are any relative filenames, it will use those relative
filenames while .debug_info will contain a different DW_AT_comp_dir.

The following patch streams (at most once after each clear_line_info)
the current working directory (what we record in DW_AT_comp_dir) when
encountering the first relative pathname, and when reading the location info
reads it back and if the current working directory at that point is
different from the saved one, adjusts relative paths by adding a relative
prefix how to go from the current working directory to the previously saved
path (with a fallback e.g. for DOS e:\\foo vs. d:\\bar change to use
absolute directory).

2020-09-10  Jakub Jelinek  <jakub@redhat.com>

	PR debug/93865
	* lto-streamer.h (struct output_block): Add emit_pwd member.
	* lto-streamer-out.c: Include toplev.h.
	(clear_line_info): Set emit_pwd.
	(lto_output_location_1): Encode the ob->current_file != xloc.file
	bit directly into the location number.  If changing file, emit
	additionally a bit whether pwd is emitted and emit it before the
	first relative pathname since clear_line_info.
	(output_function, output_constructor): Don't call clear_line_info
	here.
	* lto-streamer-in.c (struct string_pair_map): New type.
	(struct string_pair_map_hasher): New type.
	(string_pair_map_hasher::hash): New method.
	(string_pair_map_hasher::equal): New method.
	(path_name_pair_hash_table, string_pair_map_allocator): New variables.
	(relative_path_prefix, canon_relative_path_prefix,
	canon_relative_file_name): New functions.
	(canon_file_name): Add relative_prefix argument, if non-NULL
	and string is a relative path, return canon_relative_file_name.
	(lto_location_cache::input_location_and_block): Decode file change
	bit from the location number.  If changing file, unpack bit whether
	pwd is streamed and stream in pwd.  Adjust canon_file_name caller.
	(lto_free_file_name_hash): Delete path_name_pair_hash_table
	and string_pair_map_allocator.
2020-09-10 11:25:02 +02:00
config Fixup config/ChangeLog. 2020-09-10 10:17:51 +02:00
contrib Daily bump. 2020-08-27 00:16:27 +00:00
fixincludes
gcc lto: Stream current working directory for first streamed relative filename and adjust relative paths [PR93865] 2020-09-10 11:25:02 +02:00
gnattools
gotools
include Daily bump. 2020-09-10 00:16:28 +00:00
INSTALL
intl
libada
libatomic Daily bump. 2020-09-08 00:16:32 +00:00
libbacktrace Daily bump. 2020-09-10 00:16:28 +00:00
libcc1
libcpp Daily bump. 2020-09-08 00:16:32 +00:00
libdecnumber
libffi
libgcc Daily bump. 2020-09-10 00:16:28 +00:00
libgfortran Daily bump. 2020-09-04 00:16:32 +00:00
libgo gotest: use a space rather than a middle dot in target lists 2020-08-27 16:18:01 -07:00
libgomp Daily bump. 2020-09-09 00:16:29 +00:00
libhsail-rt
libiberty Daily bump. 2020-09-09 00:16:29 +00:00
libitm
libobjc
liboffloadmic
libphobos Daily bump. 2020-09-10 00:16:28 +00:00
libquadmath
libsanitizer
libssp
libstdc++-v3 Daily bump. 2020-09-08 00:16:32 +00:00
libvtv
lto-plugin Daily bump. 2020-09-10 00:16:28 +00:00
maintainer-scripts
zlib
.dir-locals.el
.gitattributes
.gitignore
ABOUT-NLS
ar-lib
ChangeLog Daily bump. 2020-08-27 00:16:27 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in
config.guess
config.rpath
config.sub
configure
configure.ac
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.RUNTIME
depcomp
install-sh
libtool-ldflags
libtool.m4
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS MAINTAINERS: Add myself as OpenACC maintainer 2020-08-26 17:58:22 +02:00
Makefile.def
Makefile.in
Makefile.tpl
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
symlink-tree
test-driver
ylwrap

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.