]> de.git.xonotic.org Git - xonotic/netradiant.git/commit
macos: workaround AppleClang compiler strrchr optimization bug illwieckz/macos-workaround-strrchr
authorThomas Debesse <dev@illwieckz.net>
Fri, 29 Mar 2024 19:22:32 +0000 (20:22 +0100)
committerThomas Debesse <dev@illwieckz.net>
Fri, 29 Mar 2024 19:22:32 +0000 (20:22 +0100)
commitaf2526b0d2feb496d9cd9a8b87c8fe5575d0baa2
tree0fca88f456848710044765be24d5fb14dd35dbd6
parent514df13d15f09f330454b20a1a1b4b6e66e31e10
macos: workaround AppleClang compiler strrchr optimization bug

Apple shipped a clang built for macOS with an optimization enabled
that is not available on macOS. This compiler error may then be faced:

  ld: Undefined symbols:
_memrchr, referenced from:
    name_read(char const*) in map.cpp.o

This is a compiler error:

> On Mac OSX (macOS version 12.4, sdk version 12.1) llvm can replace call
> to strrchr() with call to memrchr() when string length is known at
> compile time. This results in link error, because memrchr is not present
> in libSystem.
> -- https://github.com/llvm/llvm-project/issues/62254

We workaround this by making the string length not known at build time
on macOS to avoid triggering the unavailable compiler optimization.
libs/uniquenames.h