iains / darwin-xtools

[June-2019, 2.2.4] A set of modifications to ctools and ld64 that enable support for older systems with up-to-date-tools.
21 stars 5 forks source link

xtools-ld64 fails to acknowledge non-release macOS version: ld: malformed 32-bit x.y.z version number: 10.0.0d2 #9

Open barracuda156 opened 1 year ago

barracuda156 commented 1 year ago

@iains At the same time Apple ld64-97 works fine. Maybe it is possible to unbreak this? I am interested to test xtools, and perhaps we gain nothing by not recognizing developer versions. (This is not even a PPC issue, there are far more x86 developer builds around.)

iains commented 1 year ago

thanks for the report - hopefully I'll get some time to work on xtools later in the year, I guess this should be fixable.

barracuda156 commented 1 year ago

@iains This: https://github.com/iains/darwin-xtools/blob/6446947f3e99db52a40b30a38f36b9ae33492aea/ld64/src/ld/Options.cpp#L1774-L1775

P. S. By the way, libkern/version.h inside the framework (unfortunately, lacking in /usr/include) has all needed defines to differentiate between released and various stages of developer builds; it should be rather easy to fix 10A190 in way that will not affect 10.6.x Rosetta and therefore can be mergeable to upstream. I am just not sure how to include it in a neat way without specifying complete path /System/Library/Frameworks/Kernel.framework/Versions/A/Headers/libkern/version.h inside a define of OS version. If included into gcc/config/rs6000/darwin.h, a fallback for 10A190 can be included inside #if version_stage == 0x20 condition, like it has now fallbacks for Rosetta. This is what 10.6.8 has:

/* VERSION_STAGE, version_stage, is an integer set to one of the following: */
#define VERSION_STAGE_DEV   0x20
#define VERSION_STAGE_ALPHA 0x40
#define VERSION_STAGE_BETA  0x60
#define VERSION_STAGE_RELEASE   0x80
#define VERSION_STAGE       VERSION_STAGE_RELEASE
extern const int version_stage;

10A190 has VERSION_STAGE defined to VERSION_STAGE_DEV.