efff188
--- annobin.orig/tests/fortify-test	2022-01-10 09:50:07.005146672 +0000
efff188
+++ annobin-10.45/tests/fortify-test	2022-01-10 10:23:56.827404265 +0000
efff188
@@ -37,30 +37,37 @@ fi
efff188
 # Now add in our newly built plugin.
efff188
 OPTS+=" -fplugin=$PLUGIN"
efff188
 
efff188
+# For debugging purposes, generate a linker map as well.
efff188
+OPTS+=" -Wl,-Map,fortify-test.map"
efff188
+
efff188
 start_test
efff188
 
efff188
-$GCC $OPTS -Wp,-U_FORTIFY_SOURCE -fno-lto $srcdir/main.c -o main.exe
efff188
+# Use atexit.c rather than main.c as it is bigger.
efff188
+COMMAND="$GCC $OPTS -Wp,-U_FORTIFY_SOURCE -fno-lto $srcdir/atexit.c -o fortify-test.exe"
efff188
+$COMMAND
efff188
 if [ $? != 0 ];
efff188
 then
efff188
     echo " $TEST_NAME: FAIL: unable to compile test file"
efff188
-    echo " $TEST_NAME: compile command: $GCC $OPTS -Wp,-U_FORTIFY_SOURCE -fno-lto $srcdir/main.c -o main.exe"
efff188
+    echo " $TEST_NAME: command: $COMMAND"
efff188
     end_test
efff188
     exit 1
efff188
 fi
efff188
 
efff188
 # Run annocheck
efff188
 
efff188
-SKIPS="--skip-cf-protection --skip-property-note --skip-stack-realign --skip-entry --skip-dynamic-tags --skip-lto --skip-warnings --skip-dynamic-tags --skip-not-dynamic-tags --skip-branch-protection --skip-not-branch-protection"
efff188
-$ANNOCHECK main.exe $SKIPS > main.out
efff188
-grep -e "Overall: FAIL" main.out
efff188
+SKIPS="--skip-all --test-fortify"
efff188
+A_COMMAND="$ANNOCHECK fortify-test.exe $SKIPS"
efff188
+$A_COMMAND > fortify-test.out
efff188
+grep -e "Overall: FAIL" fortify-test.out
efff188
 if [ $? != 0 ];
efff188
 then
efff188
     echo " $TEST_NAME: FAIL: compiling with -D_FORTIFY_SOURCE=2 still produces an executable that passes annocheck"
efff188
-    echo " $TEST_NAME: compile command: $GCC $OPTS -Wp,-U_FORTIFY_SOURCE -fno-lto $srcdir/main.c -o main.exe"
efff188
-    echo " $TEST_NAME: annocheck command: $ANNOCHECK main.exe $SKIPS"
efff188
+    echo " $TEST_NAME: compile command: $COMMAND"
efff188
+    echo " $TEST_NAME: annocheck command: $A_COMMAND"
efff188
     echo " $TEST_NAME: annocheck output (with verbose enabled):"
efff188
-    $ANNOCHECK main.exe $SKIPS --verbose
efff188
-    uuencode main.exe main.exe
efff188
+    $A_COMMAND --verbose
efff188
+    uuencode fortify-test.exe fortify-test.exe
efff188
+    uuencode fortify-test.map fortify-test.map
efff188
     end_test
efff188
     exit 1
efff188
 fi
efff188
--- annobin.orig/gcc-plugin/annobin.cc	2022-01-10 09:50:06.991146761 +0000
efff188
+++ annobin-10.45/gcc-plugin/annobin.cc	2022-01-10 11:31:49.507826587 +0000
efff188
@@ -1,5 +1,5 @@
efff188
 /* annobin - a gcc plugin for annotating binary files.
efff188
-   Copyright (c) 2017 - 2021 Red Hat.
efff188
+   Copyright (c) 2017 - 2022 Red Hat.
efff188
    Created by Nick Clifton.
efff188
 
efff188
   This is free software; you can redistribute it and/or modify it
efff188
@@ -2485,6 +2485,7 @@ annobin_emit_end_symbol (const char * su
efff188
   fprintf (asm_out_file, "\t.size %s%s, 0\n", annobin_current_endname, suffix);
efff188
   annobin_inform (INFORM_VERBOSE, "Create symbol %s%s", annobin_current_endname, suffix);
efff188
 
efff188
+#if 0
efff188
   /* If there is a bias to the start symbol, we can end up with the case where
efff188
      the start symbol is after the end symbol.  (If the section is empty).
efff188
      Catch that and adjust the start symbol.  This also pacifies eu-elflint
efff188
@@ -2509,7 +2510,8 @@ annobin_emit_end_symbol (const char * su
efff188
 	       annobin_current_endname, suffix);
efff188
       fprintf (asm_out_file, "\t.endif\n");
efff188
     }
efff188
-
efff188
+#endif
efff188
+  
efff188
   fprintf (asm_out_file, "\t.popsection\n");
efff188
 }
efff188
 
efff188
@@ -2774,7 +2776,7 @@ plugin_init (struct plugin_name_args *
efff188
 	 solution is needed.  */
efff188
       annobin_attach_type = group;
efff188
 #if GCCPLUGIN_VERSION_MAJOR >= 11
efff188
-      if (target_start_sym_bias == 0)
efff188
+      /*      if (target_start_sym_bias == 0)*/
efff188
 	annobin_attach_type = link_order;
efff188
 #endif
efff188
     }