Skip to content

Commit

Permalink
ReadMe: Mac deployment workaround, new PM example (#948)
Browse files Browse the repository at this point in the history
* Example for Mac with the new pass manager and a real file.

* Troubleshooting suggestion for Mac dynamic_lookup/
chained fixups linker warning and subsequent “symbol not found in flat namespace” crash.
Thanks to Ronald Oussoren (python/cpython#97524 (comment)).

This works and seems needed on my ARM M1 MacOS 12.7 21G816, when compiling with either Apple clang-1400.0.29.202
or Homebrew clang version 16.0.5.  The discussion there suggests that the Clang in Xcode 14.3 might fix this, but that
won’t run on my MacOS.

I’m not submitting my change to the CMake file (FlashSheridan@7c642778),
since it presumably isn’t affecting most users and might be a performance hit.  Feel free to pull it if you disagree.
  • Loading branch information
FlashSheridan authored Oct 19, 2023
1 parent d2ff751 commit e1ca0c0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,14 @@ $LLVM2_BUILD/bin/opt -load $ALIVE2_HOME/alive2/build/tv/tv.so -load-pass-plugin
```


On a Mac:
On a Mac with the old pass manager:
```
$LLVM2_BUILD/bin/opt -load $ALIVE2_HOME/alive2/build/tv/tv.dylib -load-pass-plugin $ALIVE2_HOME/alive2/build/tv/tv.dylib -tv -instcombine -tv -o /dev/null foo.ll
```
On a Mac with the new pass manager:
```
$LLVM2_BUILD/bin/opt -load $ALIVE2_HOME/alive2/build/tv/tv.dylib -load-pass-plugin $ALIVE2_HOME/alive2/build/tv/tv.dylib -passes=tv -passes=instcombine -passes=tv -o /dev/null $LLVM2_HOME/llvm/test/Analysis/AssumptionCache/basic.ll
```
You can run any pass or combination of passes, but on the command line
they must be placed in between the two invocations of the Alive2 `-tv`
pass.
Expand Down Expand Up @@ -301,6 +305,14 @@ If you want to use this functionality, you will need to manually start
and stop, as appropriate, a Redis server instance on localhost. Alive2
should be the only user of this server.

Troubleshooting
--------
Some combinations of Clang and MacOS versions may give link warnings
“-undefined dynamic_lookup may not work with chained fixups,” and
runtime errors with “symbol not found in flat namespace.” Setting
[CMAKE_OSX_DEPLOYMENT_TARGET](https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_DEPLOYMENT_TARGET.html) as a cache entry to 11.0
or less at the beginning of CMakeLists.txt may work around this.

LLVM Bugs Found by Alive2
--------

Expand Down

0 comments on commit e1ca0c0

Please sign in to comment.