Blob Blame History Raw
#!/bin/bash

# Copyright (c) 2018-2019 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 running the section size checker

rm -f hello.o hello2.o hello3.o hello_lib.o section-size.exe

GCC=${GCC:-gcc}
ANNOCHECK=${ANNOCHECK:-../annocheck/annocheck}
PLUGIN=${PLUGIN:-../gcc-plugin/.libs/annobin.so}

PLUGIN_OPTS="-fplugin-arg-annobin-no-attach"

$GCC -fplugin=$PLUGIN $PLUGIN_OPTS -c $srcdir/hello.c $srcdir/hello2.c $srcdir/hello3.c $srcdir/hello_lib.c
$GCC hello.o hello2.o hello3.o hello_lib.o -o section-size.exe

$ANNOCHECK -v --disable-hardened --section-size=.gnu.build.attributes --human --ignore-unknown .