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 #350
  • Loading branch information
mgorny authored and h-vetinari committed Feb 10, 2025
1 parent 1acfd43 commit 9f6f4db
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ export _GLIBCXX_USE_CXX11_ABI=1
if [[ "$target_platform" == "osx-64" ]]; then
export CXXFLAGS="$CXXFLAGS -DTARGET_OS_OSX=1"
export CFLAGS="$CFLAGS -DTARGET_OS_OSX=1"
elif [[ "$target_platform" == linux-* ]]; then
# 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="${LDFLAGS} -Wl,-z,noexecstack"
fi

# Dynamic libraries need to be lazily loaded so that torch
Expand Down

0 comments on commit 9f6f4db

Please sign in to comment.