Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mach-O build version #95

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

rygorous
Copy link

@rygorous rygorous commented Oct 4, 2024

Add a build_version directive for Mach-O emitting LC_BUILD_VERSION

Newer Xcode linkers warn when this is not present. This has overlap with issue #13,
but this implementation adds a build_version directive matching llvm-as .build_version
syntax to the Mach-O format. This is implemented as a pragma internally which
allows both specifying in the source (matching how it's normally used in llvm-as)
and on the command line via the --pragma command-line option.

I'm not aware of any "official" documentation of the llvm-as .build_version syntax,
so I worked off the parser in https://github.com/llvm/llvm-project/blob/main/llvm/lib/MC/MCParser/DarwinAsmParser.cpp

Fabian Giesen added 3 commits October 4, 2024 13:14
pragma->tail is described as "anything after the operation", but
existing parsing passed just the first whitespace-delimited
word. Change the parsing to just strip leading and trailing
white space off the rest of the line, but keep interior spaces
if there are any.

This is preparation for a build_version pragma for Mach-O matching
the llvm-as .build_version syntax.

Signed-off-by: Fabian Giesen <fabian.giesen@epicgames.com>
Matches the llvm-as .build_version syntax. Newer MacOS linker
complains when object files don't contain a LC_BUILD_VERSION.

Signed-off-by: Fabian Giesen <fabian.giesen@epicgames.com>
Signed-off-by: Fabian Giesen <fabian.giesen@epicgames.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant