]> git.ipfire.org Git - thirdparty/gcc.git/commit
gcc/file-prefix-map: Allow remapping of relative paths
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 1 Nov 2022 19:45:08 +0000 (13:45 -0600)
committerJeff Law <jlaw@ventanamicro.com>
Tue, 1 Nov 2022 19:45:51 +0000 (13:45 -0600)
commite5c15eb183f17e806ad6b58c9497321ded87866f
tree724ef299f6dbfe5622af0d4571e55c54d2b593a7
parentbdf0018519c39931fdcc7aeffe9e87ba756894d7
gcc/file-prefix-map: Allow remapping of relative paths

Relative paths currently aren't remapped by -ffile-prefix-map and friends.
When cross compiling with separate 'source' and 'build' directories, the same
relative paths between directories may not be available on target as compared
to build time.

In order to be able to remap these relative build paths to paths that would
work on target, resolve paths within the file-prefix-map function using
realpath().

This does cause a change of behaviour if users were previously relying upon
symlinks or absolute paths not being resolved.

Use basename to ensure plain filenames don't have paths added.

gcc/ChangeLog:

* file-prefix-map.cc (remap_filename): Allow remapping of relative paths.
gcc/file-prefix-map.cc