This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Sanitize block partitioning under -freorder-blocks-and-partition


Hi,
With Martin we made script for testing the profiling failures.
First do

ld --verbose >~/script

then apply

--- /home/jh/script2	2013-08-31 17:59:11.000000000 +0200
+++ /home/jh/script	2013-08-31 17:39:40.000000000 +0200
@@ -1,12 +1,3 @@
-GNU ld (GNU Binutils for Debian) 2.20.1-system.20100303
-  Supported emulations:
-   elf_x86_64
-   elf_i386
-   i386linux
-   elf_l1om
-using internal linker script:
-==================================================
-/* Script for -z combreloc: combine and sort reloc sections */
 OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64",
 	      "elf64-x86-64")
 OUTPUT_ARCH(i386:x86-64)
@@ -55,6 +46,7 @@
     KEEP (*(.init))
   } =0x90909090
   .plt            : { *(.plt) *(.iplt) }
+  .text.unlikely (NOLOAD) : { *(.text.unlikely .text.*_unlikely .text.unlikely.*) }
   .text           :
   {
     *(.text.unlikely .text.*_unlikely)
@@ -218,4 +210,3 @@
 }
 
 
-==================================================

then create t.c as:
__attribute__ ((noinline))
t()
{
  printf ("test\n");
}
main(int argc)
{
  if (argc>1)
        t();
return 0;
}

and dotests as:

for name in $*
do
rm a.out *.gcda 2>/dev/null
./xgcc -B ./ -Ofast -fprofile-generate $name --static  2>/dev/null
if [ -f a.out ]
then
./a.out >/dev/null 2>/dev/null || continue 
./xgcc -B ./ -Ofast -fprofile-use -freorder-blocks-and-partition -Wl,-T,/home/jh/script --static $name   2>/dev/null
./a.out t >/dev/null 2>/dev/null || echo FAIL $name
else
echo skip $name
fi
done

Then run:

jh@gcc10:~/trunk/build/gcc$ sh dotests t.c
FAIL t.c

You should get FAIL if things are fine, because t.c depends behaviour on number
of command line parameters.  If that fail you can run i.e.

jh@gcc10:~/trunk/build/gcc$ sh dotests ~/trunk/gcc/testsuite/gcc.c-torture/execute/*.c
skip /home/jh/trunk/gcc/testsuite/gcc.c-torture/execute/20000402-1.c
FAIL /home/jh/trunk/gcc/testsuite/gcc.c-torture/execute/20000422-1.c
FAIL /home/jh/trunk/gcc/testsuite/gcc.c-torture/execute/20000910-2.c
skip /home/jh/trunk/gcc/testsuite/gcc.c-torture/execute/20010329-1.c

Those with fail get cold section executed.  When you run tehm again through dotests you can do gdb a.out
and see what function gets split incorrectly.

Honza


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]