Skip to content

Commit 601b9e6

Browse files
committed
Fix build-static.sh script
`build-static.sh` didn't create a statically-linked binary. Fixes #315
1 parent 6fb6465 commit 601b9e6

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

build-static.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ RUN apt-get update && \
2424
rm -rf /var/lib/apt/lists/*
2525
EOF
2626

27-
EXTRA_LDFLAGS='-fuse-ld=lld -static'
27+
LDFLAGS='-fuse-ld=lld -static'
2828

2929
# libstdc++'s `std::__glibcxx_rwlock_rdlock` refers these symbols
3030
# as weak symbols, although they need to be defined. Otherwise,
3131
# the program crashes after juping to address 0.
3232
# So, we force loading symbols as a workaround.
33-
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-u,pthread_rwlock_rdlock"
34-
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-u,pthread_rwlock_unlock"
35-
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-u,pthread_rwlock_wrlock"
33+
LDFLAGS="$LDFLAGS -Wl,-u,pthread_rwlock_rdlock"
34+
LDFLAGS="$LDFLAGS -Wl,-u,pthread_rwlock_unlock"
35+
LDFLAGS="$LDFLAGS -Wl,-u,pthread_rwlock_wrlock"
3636

3737
docker_args=(-v "`pwd`:/mold:Z" -u "$(id -u)":"$(id -g)")
3838
if docker --version | grep -q podman; then
@@ -41,5 +41,4 @@ fi
4141

4242
docker run -it --rm "${docker_args[@]}" \
4343
mold-build-ubuntu20 \
44-
make -C /mold -j"$(nproc)" CC=clang CXX=clang++ \
45-
EXTRA_LDFLAGS="$EXTRA_LDFLAGS" "$@"
44+
make -C /mold -j"$(nproc)" CC=clang CXX=clang++ LDFLAGS="$LDFLAGS" "$@"

0 commit comments

Comments
 (0)