From d38c5a7ff58b1b3f95522f9cd765ecd552b4091c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20Prchl=C3=ADk?= Date: Wed, 3 Jul 2024 15:11:58 +0200 Subject: [PATCH] Add coverage for RHEL-42954 binutils: Disable separate-code for aarch64 --- .../main.fmf | 6 ++++ .../reproducer.c | 5 +++ .../Disable-separate-code-for-aarch64/test.sh | 31 +++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 tests/bugs/Disable-separate-code-for-aarch64/main.fmf create mode 100644 tests/bugs/Disable-separate-code-for-aarch64/reproducer.c create mode 100755 tests/bugs/Disable-separate-code-for-aarch64/test.sh diff --git a/tests/bugs/Disable-separate-code-for-aarch64/main.fmf b/tests/bugs/Disable-separate-code-for-aarch64/main.fmf new file mode 100644 index 0000000..d4a4d7e --- /dev/null +++ b/tests/bugs/Disable-separate-code-for-aarch64/main.fmf @@ -0,0 +1,6 @@ +summary: Disable separate-code for aarch64 + +duration: 10m + +link+: + - verifies: https://issues.redhat.com/browse/RHEL-42954 diff --git a/tests/bugs/Disable-separate-code-for-aarch64/reproducer.c b/tests/bugs/Disable-separate-code-for-aarch64/reproducer.c new file mode 100644 index 0000000..cf601ce --- /dev/null +++ b/tests/bugs/Disable-separate-code-for-aarch64/reproducer.c @@ -0,0 +1,5 @@ +extern int printf (const char *, ...); +int i = 42; +const int * j = & i; + +int main (void) { return printf ("hello world %d\n", * j); } diff --git a/tests/bugs/Disable-separate-code-for-aarch64/test.sh b/tests/bugs/Disable-separate-code-for-aarch64/test.sh new file mode 100755 index 0000000..dfa1578 --- /dev/null +++ b/tests/bugs/Disable-separate-code-for-aarch64/test.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +. "$TMT_TREE/tests/lib.sh" || exit 1 + +rlJournalStart + rlPhaseStartSetup + buTestHeader + buEnterTmpDir + + buCopyReproducers "reproducer.c" + rlPhaseEnd + + rlPhaseStartTest + + rlRun "gcc -O0 -o reproducer reproducer.c" + rlRun "readelf -lW ./reproducer |& tee output" + rlAssertEquals "only two LOAD sections are expected" "$(grep "LOAD" output | wc -l)" "2" + + rlRun "gcc -O0 -o reproducer -Wl,-z,separate-code reproducer.c" + rlRun "readelf -lW ./reproducer |& tee output" + rlAssertEquals "four LOAD sections are expected" "$(grep "LOAD" output | wc -l)" "4" + rlPhaseEnd + + rlPhaseStartCleanup + buExitTmpDir + rlPhaseEnd +rlJournalPrintText +rlJournalEnd