-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Asm code is not compiling under Xcode #3622
Comments
This is caused by an assembler directive being outside the ifdef. Moving it inside the ifdef will fix the problem. (Change is trivial.) See https://gnats.netbsd.org/57383 |
The statement is : /* Stack marking
* ref: https://wiki.gentoo.org/wiki/Hardened/GNU_stack_quickstart
*/
#if defined(__ELF__) && defined(__GNUC__)
.section .note.GNU-stack,"",%progbits
#endif This statement is meant to avoid executable stacks, which is considered harmful in certain security contexts. This is a complex situation, where some environments require this statement, while others do not. Note that the statement is not unconditional : cc @terrelln. |
The reason the build fails (on my machine) is that Xcode adds a
The Now I wonder why I'll try to dig deeper in the next days. |
When forcing the source file language to `C`, Xcode enforces the file to be compiled as `C` by appending `-x c` to the compiler command line. For now try to limit the damage and only enforce the language if the ASM and C compilers differ. Reproducer (CMake `3.26.4`, Xcode `14.3`): ``` cmake -S build/cmake -B _b -GXcode -DCMAKE_OSX_ARCHITECTURES=x86_64 cmake --build _b ``` Fix: facebook#3622
This gets broken by zstd/build/cmake/lib/CMakeLists.txt Lines 104 to 108 in 5059618
introduced by @terrelln in 651a381 for #3193 My proposal to fix it is in #3665. |
Reproducer (CMake `3.26.4`, Xcode `14.3`): ``` cmake -B _build -GXcode -DCMAKE_OSX_ARCHITECTURES=x86_64 -DZSTD_FROM_INTERNET=ON -DREDIS_STORAGE_BACKEND=OFF cmake --build _build ``` See facebook/zstd#3622
Reproducer (CMake 3.26.4, Xcode 14.3): cmake -B _build -GXcode -DCMAKE_OSX_ARCHITECTURES=x86_64 \ -DZSTD_FROM_INTERNET=ON -DREDIS_STORAGE_BACKEND=OFF cmake --build _build See facebook/zstd#3622
When forcing the source file language to `C`, Xcode enforces the file to be compiled as `C` by appending `-x c` to the compiler command line. For now try to limit the damage and only enforce the language if the ASM and C compilers differ. Reproducer (CMake `3.26.4`, Xcode `14.3`): ``` cmake -S build/cmake -B _b -GXcode -DCMAKE_OSX_ARCHITECTURES=x86_64 cmake --build _b ``` Fix: facebook#3622
When forcing the source file language to `C`, Xcode enforces the file to be compiled as `C` by appending `-x c` to the compiler command line. For now try to limit the damage and only enforce the language if the ASM and C compilers differ. Reproducer (CMake `3.26.4`, Xcode `14.3`): ``` cmake -S build/cmake -B _b -GXcode -DCMAKE_OSX_ARCHITECTURES=x86_64 cmake --build _b ``` Fix: facebook#3622
This doesn't need reopening, but I hit the exact same issue compiling with the (proprietary) Sony PS5 tool chain. Commenting out the (NB the source comment says this will disable the use of assembler) |
I have added zstd library to my project as subdirectory using CMake. And when I configure and try to compile using Xcode it shows error in huff_decompress asm code. Problem appeared from 1.5.4 release version.
Steps to reproduce the behavior:
Expected behavior:
Program compiling without errors.
Desktop:
The text was updated successfully, but these errors were encountered: