Using compilers with -o absolute-path/to/target is broken for recent cctools #117
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
With the latest build of
cctoolsin conda-forge, using Clang or GFortran with an absolute path to the output target results in a broken binary.Here is a simple reproducer for Fortran code. With a test file
sanitycheckf.f90:And using the
arm64-apple-darwin20.0.0-gfortrancompiler, I see the following on an arm64 Macbook:Showing that a simple absolute path is enough to trigger the problem.
On https://github.com/conda-forge/cctools-and-ld64-feedstock/issues/50#issuecomment-1047433827 @erykoff observed the same issue with a hello world C program and Clang.
Copying the produced binary (
cp sanitycheckf sanitycheckf2 && cp sanitycheckf2 sanitycheckf) makes the problem go away. Downgrading to an oldercctoolsversion also made the problem go away.Just to be clear, my test with
clangwas a symlink toarm64-apple-darwin0.0.0-clangfrom conda-forge. But it seems that the problem is not the compiler, but theld64linker as @rgommers points out on the feedstock issue that downgradingld64specifically fixes the problem.See #118, but the problem is triggered when
mmapis used which is triggered when either (a) the output file exists (but is deleted!) or (b) a path (relative or absolute) is specified. I tested this and everything seems to work fine.correct way to fix this would be to invalidate the cache created at
mmaptime.See
github.com/llvm/llvm-project@151990dd94 (diff-eae7124ad4)