Skip to content

Commit

Permalink
linux_and_macos.yml: Start linking with -Wl,--as-needed in CI
Browse files Browse the repository at this point in the history
.. to protect against future build system regressions
with reguard to as-needed.
  • Loading branch information
hartwork committed Nov 28, 2023
1 parent 714dadf commit 89dd141
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/linux_and_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,21 @@ jobs:
run: |-
set -x
# macOS default linker does not seem to support --as-needed,
# would error out saying "ld: unknown option: --as-needed"
if [[ ${{ runner.os }} = macOS ]]; then
as_needed=
else
as_needed='-Wl,--as-needed'
fi
# ASan: https://clang.llvm.org/docs/AddressSanitizer.html
# UBSan: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
sanitizer='-fsanitize=address,undefined -fno-sanitize-recover=all'
${MAKE} --version 2>/dev/null || true
CFLAGS="-std=gnu99 -pedantic -Werror ${sanitizer}" LDFLAGS="${sanitizer}" ${MAKE}
CFLAGS="-std=gnu99 -pedantic -Werror ${sanitizer}" LDFLAGS="${as_needed} ${sanitizer}" ${MAKE}
- name: 'Install'
env:
Expand Down

0 comments on commit 89dd141

Please sign in to comment.