binutils/tests/bugs/Disable-separate-code-for-aarch64/test.sh
2024-07-31 10:01:30 +02:00

31 lines
809 B
Bash
Executable file

#!/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 -c "LOAD" output)" "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 -c "LOAD" output)" "4"
rlPhaseEnd
rlPhaseStartCleanup
buExitTmpDir
rlPhaseEnd
rlJournalPrintText
rlJournalEnd