llvm / llvm/llvm-project

ld64.lld doesn't respect -macos_version_min

Open
#159,747 4 comments 0 reactions 0 assignees View on GitHub
lld:MachO
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Over the years, Apple's ld64 has accepted multiple ways of specifying the target OS version. The current flag is `-platform_version`, but it has previously been `-macos_version_min` and `-macosx_version_min`.

Apple's ld64 accepts all three, but lld only accepts the latest one. This is a major issue when using gcc, which prefers `-macos_version_min`.

The end result is that ld64.lld **is not** a drop in replacement for ld64, as any usage results in:

```
ld64.lld: error: must specify -platform_version
```

Contributor guide

Open the contributing guide

Research direction

Start by tracing ld64.lld's option parsing and the handling of the required target OS version. Verify how -platform_version, -macos_version_min, and -macosx_version_min are currently recognized. The work is done when the older aliases are accepted and a GCC-generated invocation no longer fails with the missing -platform_version error.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.