Skip to content

-ffile-prefix-map=<staging>=. injection in compiler-wrapper#19

Open
SebastianPaucar wants to merge 1 commit into
spack:mainfrom
SebastianPaucar:feature/debug-prefix-map
Open

-ffile-prefix-map=<staging>=. injection in compiler-wrapper#19
SebastianPaucar wants to merge 1 commit into
spack:mainfrom
SebastianPaucar:feature/debug-prefix-map

Conversation

@SebastianPaucar

Copy link
Copy Markdown

This PR adds SPACK_DEBUG_PREFIX_MAP, which allows the compiler wrapper to inject -ffile-prefix-map=<staging>=. into cc.sh ONLY when SPACK_DEBUG_PREFIX_MAP is set, so that debug information no longer contains the temporary Spack staging directory, replacing it with a relative (.) path instead, avoiding leakage of temporary build paths, and making binaries more reproducible. The new test added in test/run.sh verifies that the flag is added only when expected for the C, C++, and Fortran wrappers.

Companion PRs for both spack-packages and the main spack repos will be submitted separately.

@haampie, could you please take a look when you have a chance?

Comment thread cc.sh Outdated
fi

# -ffile-prefix-map=<staging>=. injection for build reproducibility
if [ -n "${SPACK_DEBUG_PREFIX_MAP:-}" ]; then

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a compiler flag, it should not be passed to the linker (see mode).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just updated. Thanks for pointing it out! Added mode guard on it, so the compiler flag is injected during compilation, not linking.

…tests added in test/run.sh (test_debug_prefix_map)

Signed-off-by: SebastianPaucar <paucar.sebastian@hotmail.com>
@SebastianPaucar SebastianPaucar force-pushed the feature/debug-prefix-map branch from 7edd455 to 215a209 Compare June 29, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants