]> sourceware.org Git - annobin.git/commitdiff
check-abi: With --verbose, show all the notes extracted.
authorNick Clifton <nickc@redhat.com>
Mon, 30 Apr 2018 08:58:30 +0000 (09:58 +0100)
committerNick Clifton <nickc@redhat.com>
Mon, 30 Apr 2018 08:58:30 +0000 (09:58 +0100)
abi-test: Skip the ABI check, since the crt[in].o files are compiled with different settings.

doc/annotation.proposal.txt
scripts/check-abi.sh
tests/Makefile.am
tests/Makefile.in
tests/abi-test
tests/assembler-gap-test [new file with mode: 0755]
tests/function-sections-test
tests/gap.S [new file with mode: 0644]
tests/missing-notes-test

index 9dee4e85c7ba65c0522036571b62237cf25ad1e1..1fe0d0bff411e44cce8ce749571aaa4fe4599212 100644 (file)
@@ -141,10 +141,10 @@ Some examples:
   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
index c8550c0d8a032dd1f13b6e87eb20672c3653d8a8..09498f8f704d164f1fb8b193698b8b324e2dc8c8 100755 (executable)
@@ -368,7 +368,9 @@ scan_file ()
            return
        fi
     fi
-       
+
+    verbose "NOTES: `cat $tmpfile`"
+
     if [ $ignore_gaps -eq 0 ];
     then
         grep -q -e "Gap in build notes" $tmpfile
index 081d49b66c0c613ca6c982db050478c9810156ab..9c945d02c6f61b5e7eecbd5a260384badcc6affb 100644 (file)
@@ -6,7 +6,14 @@
 
 ## 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...
index 2c9e0071e7679baa8ed91fe79d8614eac508d616..6745fa281be7dbe9c4c14f33433a8db5f6c18cff 100644 (file)
@@ -211,7 +211,14 @@ target_vendor = @target_vendor@
 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
 
index dc701f8efb9555c32771c09b9b2d4d377d438086..2f6998b7c1c38c914ae33a843d768b26d56099e4 100755 (executable)
@@ -65,13 +65,17 @@ $GCC -fplugin=$PLUGIN \
 # $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
+
diff --git a/tests/assembler-gap-test b/tests/assembler-gap-test
new file mode 100755 (executable)
index 0000000..4b7a9e6
--- /dev/null
@@ -0,0 +1,44 @@
+#!/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
+
index a6ccb39251f001fe39ce2454c69a4c997a6537bd..0a9d2ce01fb859edf0471253c6dafa608d3b2cb1 100755 (executable)
@@ -16,7 +16,6 @@ rm -f hello.o hello2.o hello3.o libhello.so function-section-test.exe
 
 GCC=gcc
 READELF=readelf
-OBJCOPY=objcopy
 
 PLUGIN=../plugin/.libs/annobin.so
 
diff --git a/tests/gap.S b/tests/gap.S
new file mode 100644 (file)
index 0000000..bcb1400
--- /dev/null
@@ -0,0 +1,6 @@
+       .text
+       .dc.l   0
+       .dc.l   2
+       .dc.l   4
+       .dc.l   6
+       
index 74ecab00b35696402d868978ee15433d5aaf4a6a..9a365232cd3c1ca38cb54a814b99414cf68ed6dc 100755 (executable)
 # 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
 
This page took 0.040655 seconds and 5 git commands to generate.