Skip to content

Commit

Permalink
make sure tests still pass with older binutils and add CI target with…
Browse files Browse the repository at this point in the history
… newer binutils
  • Loading branch information
nlsandler committed Aug 27, 2024
1 parent 9f30d8d commit 28ca23d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
fail-fast: true
matrix:
python-version: ["3.8", "3.12"] #, "3.9", "3.10", "3.11"]
os: [ubuntu-latest, macos-latest]
os: [ubuntu-22.04, ubuntu-24.04, macos-latest]
runs-on: ${{ matrix.os }}
needs: [build-final-nqcc, build-partial-nqcc]
steps:
Expand Down
23 changes: 22 additions & 1 deletion test_framework/test_tests/test_programs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,26 @@

from .. import basic, regalloc

LD_HAS_ERROR_EXECSTACK: bool
# Check whether our version of ld supports the --error-execstack option
# Linux w/ binutils 2.42 or later does; earlier binutils and macOS linker don't

if basic.IS_OSX:
LD_HAS_ERROR_EXECSTACK = False
else:
try:
subprocess.run(
"ld --error-execstack -v",
shell=True,
check=True,
text=True,
capture_output=True,
)
# if that didn't throw a CalledProcessError, this option is supported
LD_HAS_ERROR_EXECSTACK = True
except subprocess.CalledProcessError:
LD_HAS_ERROR_EXECSTACK = False


def build_compiler_args(source_file: Path) -> List[str]:
"""Given a source file, build the list of files/extra options we need for standalone compilation"""
Expand Down Expand Up @@ -66,7 +86,8 @@ def compile_and_run_sanitized(self, source_file: Path) -> None:
"-O3",
"-fsanitize=undefined",
]
if not basic.IS_OSX:

if LD_HAS_ERROR_EXECSTACK:
subproc_args.extend(
[
# Linux only: executable stack should produce linker error (this catches missing execstack note in assembly test files)
Expand Down

0 comments on commit 28ca23d

Please sign in to comment.