abi-test: Skip the ABI check, since the crt[in].o files are compiled with different settings.
supported by the notes. The next pair of characters indicate who
produced the notes and which version of this producer has been
used. A 'p' character indicates a compiler plugin. An 'l'
- character indicates the linker. Other characters may be defined in
- the future. Multiple producers can contribute to the notes. Their
- identifying pair of characters should be appended to the version
- note.
+ character indicates the linker. An 'a' character indicates the
+ assembler. Other characters may be defined in the future. Multiple
+ producers can contribute to the notes. Their identifying pair of
+ characters should be appended to the version note.
The description field for the version note should not be empty.
This note serves as the base address for other open notes that
return
fi
fi
-
+
+ verbose "NOTES: `cat $tmpfile`"
+
if [ $ignore_gaps -eq 0 ];
then
grep -q -e "Gap in build notes" $tmpfile
## Process this file with automake to produce Makefile.in.
-TESTS=compile-test hardening-test hardening-fail-test abi-test missing-notes-test function-sections-test
+TESTS=compile-test \
+ hardening-test \
+ hardening-fail-test \
+ abi-test \
+ missing-notes-test \
+ function-sections-test \
+ assembler-gap-test
+
XFAIL_TESTS=hardening-fail-test
# FIXME: Add a test for merging notes...
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-TESTS = compile-test hardening-test hardening-fail-test abi-test missing-notes-test function-sections-test
+TESTS = compile-test \
+ hardening-test \
+ hardening-fail-test \
+ abi-test \
+ missing-notes-test \
+ function-sections-test \
+ assembler-gap-test
+
XFAIL_TESTS = hardening-fail-test
all: all-am
# $OBJCOPY --merge-notes abi-test.exe abi-test-merged.exe
# The --ignore-FORTIFY and --ignore-stack-prot options are here to skip the
-# checks that fail because they require a version of readelf that knows how
-# to fully parse the annobin notes and such a version is not in common
-# release (yet).
-# FIXME: Remove these options once readelf has been updated.
+# checks that fail because the startup and end files (Scrti.o, crtn.o) are
+# built without these safeguards, whereas the test files use them. Similarly
+# the --ignore-ABI option is because these two files are compiled with different
+# ABI settings from normal code.
#
# The --ignore-gaps option is there because currently Scrti.o contains some
# annobin notes, but crti.o dies not. Thus *any* program built with normal
# startup code will contain a gap.
-# FIXME: Add assembler support for generating notes.
-$srcdir/../scripts/check-abi.sh --readelf=$READELF --inconsistencies --ignore-FORTIFY --ignore-stack-prot --ignore-gaps abi-test.exe
+# FIXME: Remove once we have the assembler generating notes.
+$srcdir/../scripts/check-abi.sh --readelf=$READELF --inconsistencies \
+ --ignore-FORTIFY --ignore-stack-prot \
+ --ignore-gaps --ignore-ABI \
+ abi-test.exe
+
--- /dev/null
+#!/bin/bash
+
+# Copyright (c) 2018 Red Hat.
+#
+# This is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published
+# by the Free Software Foundation; either version 3, or (at your
+# option) any later version.
+#
+# It is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+
+# Test building an assembler source file without creating a gap in the notes.
+
+rm -f hello.o gap.o hello3.o assembler-gap-test.exe assembler-gas-test.out
+
+GAS=as
+# GAS=/work/builds/binutils/current/x86_64-pc-linux-gnu/gas/as-new
+GCC=gcc
+READELF=readelf
+
+PLUGIN=../plugin/.libs/annobin.so
+
+$GCC -fplugin=$PLUGIN -c $srcdir/hello.c
+
+$GAS --generate-missing-build-notes=yes $srcdir/gap.S -o gap.o
+# $GAS --generate-missing-build-notes=no $srcdir/gap.S -o gap.o
+
+$GCC -fplugin=$PLUGIN -c $srcdir/hello3.c
+
+$GCC hello.o gap.o hello3.o -o assembler-gap-test.exe -Wl,--defsym,big_stack=0
+
+# FIXME - we should check that the notes were parsed correctly...
+$READELF --notes --wide assembler-gap-test.exe > /dev/null 2> assembler-gap-test.out
+
+# FAIL if there was a gap in the notes...
+if [ -s assembler-gap-test.out ];
+then
+ exit 1
+fi
+
GCC=gcc
READELF=readelf
-OBJCOPY=objcopy
PLUGIN=../plugin/.libs/annobin.so
--- /dev/null
+ .text
+ .dc.l 0
+ .dc.l 2
+ .dc.l 4
+ .dc.l 6
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-rm -f hello.o hello2.o hello3.o libhello.so compile-test.exe
+rm -f hello.o hello2.o hello3.o libhello.so missing-notes-test.exe
GCC=gcc
READELF=readelf
-OBJCOPY=objcopy
PLUGIN=../plugin/.libs/annobin.so