Introducing something like RPATH's $ORIGIN for GCC spec files
John Ericson
git@johnericson.me
Wed Jun 11 18:56:18 GMT 2025
Hello,
I am doing some investigation into making existing software more relocatable. One source of non-reloctability I've noticed is absolute paths in spec files. Relative paths I assume would be relative the current working directory, which is not very useful when the spec file doesn't know where GCC will be run from. Just as ELF RPATHs have $ORIGIN, which is relative the executable itself, I wonder if we could introduce a variable to spec files which would be the directory where the spec file is located.
I am not too familiar with spec files, so I wanted to ask here if has this been proposed before and (b) what would a good design look like? E.g. reading the docs I imagine %(origin) (variable expansion for variable named "origin") would be a good syntax for this, but perhaps there are reasons I am not aware of why another design would be better.
If a design is approved, I am happy to contribute a patch for this.
Thanks,
John
More information about the Gcc
mailing list