Skip to content

Overhaul relocation logic#27

Closed
johnwparent wants to merge 0 commit intospack:mainfrom
johnwparent:overhaul-relocation-logic
Closed

Overhaul relocation logic#27
johnwparent wants to merge 0 commit intospack:mainfrom
johnwparent:overhaul-relocation-logic

Conversation

@johnwparent
Copy link
Copy Markdown
Collaborator

@johnwparent johnwparent commented Jan 31, 2026

Relocation: Change strategy

Previously we were searching a set of prefixes for DLLs during relocation. If we found a dll that matched the dll we were looking for (based on file name) we performed relocation based on that path. This is both dangerous and extraneous.

This is dangerous as mutli config layouts may have the same binary with the same name in mutliple different paths for different configs or variations. Since we were previously only checking the filename, this could lead to a false positive detection and bad relocation not detected until runtime.

This is extraneous as we should never need to search. We have the dll locations before and after relocation, whether from the stage to install prefix or from buildcache to buildcache, so rather than a filesystem search, we can have a linear time operation where we search through a list of relocation old->new prefix mappings.

Spack core will set an environment variable of the structure:
old_prefix|new_prefix and the compiler wrapper now composes a map out of that list and then PE files looking to relocate their internal dll references get a constant time lookup.

Based on #26

@johnwparent johnwparent force-pushed the overhaul-relocation-logic branch from fb2dfa3 to 3f1a773 Compare April 9, 2026 22:58
@johnwparent johnwparent force-pushed the overhaul-relocation-logic branch from 594c39f to a31c5ad Compare April 28, 2026 14:52
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.

1 participant