Code review comment for ~epics-core/epics-base/+git/make:rpath-origin

Revision history for this message
mdavidsaver (mdavidsaver) wrote :

In the course of testing this I've come across two gcc/binutils bugs related to $ORIGIN. Both have been fixed, but will remain an issue for older toolchains.

Prior to binutils 2.28 -rpath $ORIGIN entries weren't correctly used to locate library dependencies. That is, when 'ld' needs to find a library on which an explicitly specified library depends.

Practically speaking this is a problem with the 'calc' module which has optional dependencies on sscan and seq. Downstream modules like streamdevice link against 'calc' without mentioning 'sscan' and 'pv'. This is apparently even stricter than is necessary for single pass static linking.

A partial workaround without side effects is to also include an absolute '-rpath-link' for every relative '-rpath'.

https://sourceware.org/bugzilla/show_bug.cgi?id=16936

I've also seen that even older gcc (circa RHEL5) seem to expand '$' variables internally before passing to 'ld'. So preventing expansion with single quotes like -Wl,-rpath,'$ORIGIN' isn't enough. It is necessary to escape once. -Wl,-rpath,'\$ORIGIN'

I haven't able to find a ticket on this one.

« Back to merge proposal