Skip to content

Commit

Permalink
Build with -Wl,-z,noexecstack to fix glibc 2.41 compatibility
Browse files Browse the repository at this point in the history
Explicitly pass `-Wl,-z,noexecstack` to the linker, to ensure that
`libpytorch_cpu.so` is compiled without an executable stack.  This is
necessary because the raw assembly in oneDNN triggers:

```
$BUILD_PREFIX/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: warning: ittptmark64.S.o: missing .note.GNU-stack section implies executable stack
```

...and glibc 2.41 no longer permits loading libraries with executable
stack.

Fixes conda-forge#350
  • Loading branch information
mgorny committed Feb 10, 2025
1 parent be20390 commit 04d9011
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ export LDFLAGS="$(echo $LDFLAGS | sed 's/-Wl,--as-needed//g')"
# error on osx-64.
export LDFLAGS="$(echo $LDFLAGS | sed 's/-Wl,-dead_strip_dylibs//g')"
export LDFLAGS_LD="$(echo $LDFLAGS_LD | sed 's/-dead_strip_dylibs//g')"
# Explicitly force non-executable stack to fix compatibility with glibc 2.41, due to:
# ittptmark64.S.o: missing .note.GNU-stack section implies executable stack
LDFLAGS+=" -Wl,-z,noexecstack"
if [[ "$c_compiler" == "clang" ]]; then
export CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations -Wno-unknown-warning-option -Wno-error=unused-command-line-argument -Wno-error=vla-cxx-extension"
export CFLAGS="$CFLAGS -Wno-deprecated-declarations -Wno-unknown-warning-option -Wno-error=unused-command-line-argument -Wno-error=vla-cxx-extension"
Expand Down

0 comments on commit 04d9011

Please sign in to comment.