build legacy-support for an older OS than the host OS?

Fred Wright fw at fwright.net
Wed Jun 4 22:48:03 UTC 2025



On Thu, 5 Jun 2025, René J.V. Bertin wrote:

> On Wednesday June 04 2025 13:44:31 Fred Wright wrote:
>
>> The *real* purpose of the "reexport" library is for cases where a
>> precompiled binary is being used almost as is but with a binary patch.
>> This allows the legacy-support library to be patched into the executable
>> *instead of* (rather than in addition to) the system library, with the
>> reexport allowing it to use the system library anyway.
>
> I was indeed thinking of that, and the "symbol XXX expected in libsystem" errors you'd get otherwise.
>
> But I don't see why it wouldn't also work the other way round. If the 
> linker records, say, clock_gettime as provided by 
> libMacportsLegacySupport.dylib, why would it take that symbol from 
> libSystem if it also provides it (even if it's not the only one 
> providing it)?

The dynamic linker looks up symbols in libraries in the order that they're 
loaded, which I believe is based on the order that they are listed in the 
executable.  The reexporting library is needed in the case where you're 
*replacing* the reference to libSystem in the executable with the 
reference to libMacportsLegacySystem, and allowing the symbol references 
to be passed through the latter to its own reference to libSystem.

Fred Wright


More information about the macports-dev mailing list