From d7f09764d7bc66b9997c811c22e11efc87b44792 Mon Sep 17 00:00:00 2001 From: Diego Novillo Date: Sat, 3 Oct 2009 17:10:11 -0400 Subject: [PATCH] Merge lto branch into trunk. From-SVN: r152434 --- ChangeLog | 29 + Makefile.def | 6 +- Makefile.in | 998 +- Makefile.tpl | 6 + configure | 880 +- configure.ac | 154 +- contrib/ChangeLog | 6 + contrib/gcc_update | 3 + gcc/ChangeLog | 451 + gcc/Makefile.in | 111 +- gcc/builtins.c | 50 + gcc/c-common.c | 38 - gcc/c-common.h | 2 - gcc/c-opts.c | 23 + gcc/c.opt | 4 +- gcc/cgraph.c | 23 +- gcc/cgraph.h | 36 +- gcc/cgraphbuild.c | 23 + gcc/cgraphunit.c | 51 +- gcc/collect2.c | 401 +- gcc/collect2.h | 2 +- gcc/common.opt | 17 + gcc/config.in | 12 + gcc/config/rs6000/rs6000.c | 6 +- gcc/configure | 67 +- gcc/configure.ac | 14 + gcc/doc/install.texi | 33 + gcc/doc/invoke.texi | 223 +- gcc/doc/sourcebuild.texi | 56 +- gcc/except.c | 9 +- gcc/flags.h | 11 + gcc/fortran/ChangeLog | 4 + gcc/fortran/options.c | 22 + gcc/gcc.c | 82 +- gcc/gimple.c | 1173 +- gcc/gimple.h | 19 + gcc/ipa-cp.c | 8 +- gcc/ipa-inline.c | 31 +- gcc/ipa-prop.c | 4 + gcc/ipa-pure-const.c | 146 +- gcc/ipa-reference.c | 172 +- gcc/java/ChangeLog | 4 + gcc/java/config-lang.in | 2 +- gcc/langhooks-def.h | 18 +- gcc/langhooks.c | 52 + gcc/langhooks.h | 19 + gcc/lto-cgraph.c | 693 + gcc/lto-compress.c | 314 + gcc/lto-compress.h | 42 + gcc/lto-opts.c | 409 + gcc/lto-section-in.c | 489 + gcc/lto-section-out.c | 652 + gcc/lto-streamer-in.c | 2624 ++++ gcc/lto-streamer-out.c | 2548 ++++ gcc/lto-streamer.c | 860 ++ gcc/lto-streamer.h | 1054 ++ gcc/lto-symtab.c | 793 ++ gcc/lto-wpa-fixup.c | 281 + gcc/lto-wrapper.c | 378 + gcc/lto/ChangeLog | 2543 ++++ gcc/lto/Make-lang.in | 89 + gcc/lto/common.c | 46 + gcc/lto/common.h | 34 + gcc/lto/config-lang.in | 32 + gcc/lto/lang-specs.h | 24 + gcc/lto/lang.opt | 43 + gcc/lto/lto-elf.c | 674 + gcc/lto/lto-lang.c | 1188 ++ gcc/lto/lto-tree.h | 61 + gcc/lto/lto.c | 2067 +++ gcc/lto/lto.h | 60 + gcc/opts.c | 39 +- gcc/passes.c | 286 +- gcc/testsuite/ChangeLog | 238 + gcc/testsuite/g++.dg/20090107-1.C | 12 + gcc/testsuite/g++.dg/20090121-1.C | 19 + gcc/testsuite/g++.dg/README | 1 + gcc/testsuite/g++.dg/dg.exp | 1 + gcc/testsuite/g++.dg/ipa/20090113-1.C | 25 + gcc/testsuite/g++.dg/lto/20080709_0.C | 11 + gcc/testsuite/g++.dg/lto/20080829_0.C | 9 + gcc/testsuite/g++.dg/lto/20080904_0.C | 37 + gcc/testsuite/g++.dg/lto/20080907_0.C | 3 + gcc/testsuite/g++.dg/lto/20080908-1_0.C | 36 + gcc/testsuite/g++.dg/lto/20080908-2_0.C | 3 + gcc/testsuite/g++.dg/lto/20080908-3_0.C | 14 + gcc/testsuite/g++.dg/lto/20080909-1_0.C | 3 + gcc/testsuite/g++.dg/lto/20080910-1_0.C | 2 + gcc/testsuite/g++.dg/lto/20080912-1_0.C | 3 + gcc/testsuite/g++.dg/lto/20080912_0.C | 4 + gcc/testsuite/g++.dg/lto/20080915_0.C | 29 + gcc/testsuite/g++.dg/lto/20080916_0.C | 12 + gcc/testsuite/g++.dg/lto/20080917_0.C | 29 + gcc/testsuite/g++.dg/lto/20080924_0.C | 16 + gcc/testsuite/g++.dg/lto/20080926_0.C | 4 + gcc/testsuite/g++.dg/lto/20081008_0.C | 36 + gcc/testsuite/g++.dg/lto/20081022.h | 8 + gcc/testsuite/g++.dg/lto/20081022_0.C | 11 + gcc/testsuite/g++.dg/lto/20081022_1.C | 7 + gcc/testsuite/g++.dg/lto/20081023_0.C | 14 + gcc/testsuite/g++.dg/lto/20081109-1_0.C | 5 + gcc/testsuite/g++.dg/lto/20081109-2_0.C | 15 + gcc/testsuite/g++.dg/lto/20081109_0.C | 28 + gcc/testsuite/g++.dg/lto/20081109_1.C | 4 + gcc/testsuite/g++.dg/lto/20081118-1_0.C | 27 + gcc/testsuite/g++.dg/lto/20081118-1_1.C | 12 + gcc/testsuite/g++.dg/lto/20081118_0.C | 20 + gcc/testsuite/g++.dg/lto/20081118_1.C | 20 + gcc/testsuite/g++.dg/lto/20081119-1.h | 8 + gcc/testsuite/g++.dg/lto/20081119-1_0.C | 12 + gcc/testsuite/g++.dg/lto/20081119-1_1.C | 9 + gcc/testsuite/g++.dg/lto/20081119_0.C | 24 + gcc/testsuite/g++.dg/lto/20081119_1.C | 18 + gcc/testsuite/g++.dg/lto/20081120-1_0.C | 10 + gcc/testsuite/g++.dg/lto/20081120-1_1.C | 8 + gcc/testsuite/g++.dg/lto/20081120-2_0.C | 13 + gcc/testsuite/g++.dg/lto/20081120-2_1.C | 11 + gcc/testsuite/g++.dg/lto/20081123_0.C | 8 + gcc/testsuite/g++.dg/lto/20081123_1.C | 16 + gcc/testsuite/g++.dg/lto/20081125.h | 15 + gcc/testsuite/g++.dg/lto/20081125_0.C | 18 + gcc/testsuite/g++.dg/lto/20081125_1.C | 7 + gcc/testsuite/g++.dg/lto/20081127_0.C | 2 + gcc/testsuite/g++.dg/lto/20081127_1.C | 3 + gcc/testsuite/g++.dg/lto/20081203_0.C | 5 + gcc/testsuite/g++.dg/lto/20081203_1.C | 4 + gcc/testsuite/g++.dg/lto/20081204-1_0.C | 14 + gcc/testsuite/g++.dg/lto/20081204-1_1.C | 3 + gcc/testsuite/g++.dg/lto/20081204-2_0.C | 10 + gcc/testsuite/g++.dg/lto/20081204-2_1.C | 14 + gcc/testsuite/g++.dg/lto/20081209_0.C | 18 + gcc/testsuite/g++.dg/lto/20081209_1.C | 9 + gcc/testsuite/g++.dg/lto/20081211-1.h | 6 + gcc/testsuite/g++.dg/lto/20081211-1_0.C | 19 + gcc/testsuite/g++.dg/lto/20081211-1_1.C | 6 + gcc/testsuite/g++.dg/lto/20081217-1_0.C | 28 + gcc/testsuite/g++.dg/lto/20081217-2_0.C | 20 + gcc/testsuite/g++.dg/lto/20081219_0.C | 72 + gcc/testsuite/g++.dg/lto/20081219_1.C | 42 + gcc/testsuite/g++.dg/lto/20090106_0.C | 203 + gcc/testsuite/g++.dg/lto/20090112_0.C | 11 + gcc/testsuite/g++.dg/lto/20090128_0.C | 88 + gcc/testsuite/g++.dg/lto/20090221_0.C | 53 + gcc/testsuite/g++.dg/lto/20090302_0.C | 9 + gcc/testsuite/g++.dg/lto/20090302_1.C | 7 + gcc/testsuite/g++.dg/lto/20090303_0.C | 22 + gcc/testsuite/g++.dg/lto/20090311-1.h | 22 + gcc/testsuite/g++.dg/lto/20090311-1_0.C | 34 + gcc/testsuite/g++.dg/lto/20090311-1_1.C | 28 + gcc/testsuite/g++.dg/lto/20090311_0.C | 13 + gcc/testsuite/g++.dg/lto/20090311_1.C | 13 + gcc/testsuite/g++.dg/lto/20090312.h | 2 + gcc/testsuite/g++.dg/lto/20090312_0.C | 14 + gcc/testsuite/g++.dg/lto/20090312_1.C | 21 + gcc/testsuite/g++.dg/lto/20090313_0.C | 5 + gcc/testsuite/g++.dg/lto/20090313_1.C | 12 + gcc/testsuite/g++.dg/lto/20090315_0.C | 9 + gcc/testsuite/g++.dg/lto/20090315_1.C | 7 + gcc/testsuite/g++.dg/lto/20091002-1_0.C | 58 + gcc/testsuite/g++.dg/lto/20091002-2_0.C | 20 + gcc/testsuite/g++.dg/lto/20091002-3_0.C | 15 + gcc/testsuite/g++.dg/lto/README | 35 + gcc/testsuite/g++.dg/lto/lto.exp | 58 + gcc/testsuite/g++.dg/lto/pr40818_0.C | 11 + gcc/testsuite/g++.dg/opt/thunk3-1.C | 6 + gcc/testsuite/g++.dg/opt/thunk4.C | 63 + .../gcc.c-torture/execute/builtins/builtins.exp | 2 +- .../gcc.c-torture/execute/builtins/lib/abs.c | 4 + .../gcc.c-torture/execute/builtins/lib/bfill.c | 1 + .../gcc.c-torture/execute/builtins/lib/bzero.c | 1 + .../gcc.c-torture/execute/builtins/lib/fprintf.c | 2 + .../gcc.c-torture/execute/builtins/lib/memchr.c | 1 + .../gcc.c-torture/execute/builtins/lib/memcmp.c | 1 + .../gcc.c-torture/execute/builtins/lib/memmove.c | 1 + .../gcc.c-torture/execute/builtins/lib/mempcpy.c | 1 + .../gcc.c-torture/execute/builtins/lib/memset.c | 1 + .../gcc.c-torture/execute/builtins/lib/printf.c | 2 + .../gcc.c-torture/execute/builtins/lib/sprintf.c | 1 + .../gcc.c-torture/execute/builtins/lib/stpcpy.c | 1 + .../gcc.c-torture/execute/builtins/lib/strcat.c | 1 + .../gcc.c-torture/execute/builtins/lib/strchr.c | 2 + .../gcc.c-torture/execute/builtins/lib/strcmp.c | 1 + .../gcc.c-torture/execute/builtins/lib/strcpy.c | 1 + .../gcc.c-torture/execute/builtins/lib/strcspn.c | 1 + .../gcc.c-torture/execute/builtins/lib/strlen.c | 1 + .../gcc.c-torture/execute/builtins/lib/strncat.c | 1 + .../gcc.c-torture/execute/builtins/lib/strncmp.c | 1 + .../gcc.c-torture/execute/builtins/lib/strncpy.c | 1 + .../gcc.c-torture/execute/builtins/lib/strpbrk.c | 1 + .../gcc.c-torture/execute/builtins/lib/strrchr.c | 2 + .../gcc.c-torture/execute/builtins/lib/strspn.c | 1 + .../gcc.c-torture/execute/builtins/lib/strstr.c | 1 + gcc/testsuite/gcc.c-torture/execute/execute.exp | 2 +- gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp | 2 +- gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp | 2 +- gcc/testsuite/gcc.dg/20081223-1.c | 5 + gcc/testsuite/gcc.dg/lto/20080908_0.c | 16 + gcc/testsuite/gcc.dg/lto/20080917_0.c | 29 + gcc/testsuite/gcc.dg/lto/20080924_0.c | 9 + gcc/testsuite/gcc.dg/lto/20081024_0.c | 26 + gcc/testsuite/gcc.dg/lto/20081109_0.c | 3 + gcc/testsuite/gcc.dg/lto/20081111_0.c | 11 + gcc/testsuite/gcc.dg/lto/20081111_1.c | 7 + gcc/testsuite/gcc.dg/lto/20081112_0.c | 14 + gcc/testsuite/gcc.dg/lto/20081112_1.c | 13 + gcc/testsuite/gcc.dg/lto/20081115_0.c | 32 + gcc/testsuite/gcc.dg/lto/20081115_1.c | 11 + gcc/testsuite/gcc.dg/lto/20081115_2.c | 5 + gcc/testsuite/gcc.dg/lto/20081118_0.c | 28 + gcc/testsuite/gcc.dg/lto/20081118_1.c | 13 + gcc/testsuite/gcc.dg/lto/20081118_2.c | 11 + gcc/testsuite/gcc.dg/lto/20081120-1_0.c | 5 + gcc/testsuite/gcc.dg/lto/20081120-1_1.c | 3 + gcc/testsuite/gcc.dg/lto/20081120-2_0.c | 3 + gcc/testsuite/gcc.dg/lto/20081120-2_1.c | 2 + gcc/testsuite/gcc.dg/lto/20081125_0.c | 6 + gcc/testsuite/gcc.dg/lto/20081125_1.c | 4 + gcc/testsuite/gcc.dg/lto/20081126_0.c | 8 + gcc/testsuite/gcc.dg/lto/20081201-1_0.c | 33 + gcc/testsuite/gcc.dg/lto/20081201-1_1.c | 13 + gcc/testsuite/gcc.dg/lto/20081201-1_2.c | 7 + gcc/testsuite/gcc.dg/lto/20081201-2_0.c | 16 + gcc/testsuite/gcc.dg/lto/20081201-2_1.c | 5 + gcc/testsuite/gcc.dg/lto/20081202-1_0.c | 11 + gcc/testsuite/gcc.dg/lto/20081202-1_1.c | 10 + gcc/testsuite/gcc.dg/lto/20081202-2_0.c | 13 + gcc/testsuite/gcc.dg/lto/20081202-2_1.c | 16 + gcc/testsuite/gcc.dg/lto/20081204-1_0.c | 7 + gcc/testsuite/gcc.dg/lto/20081204-1_1.c | 5 + gcc/testsuite/gcc.dg/lto/20081204-2_0.c | 5 + gcc/testsuite/gcc.dg/lto/20081210-1_0.c | 21 + gcc/testsuite/gcc.dg/lto/20081212-1_0.c | 4 + gcc/testsuite/gcc.dg/lto/20081222_0.c | 11 + gcc/testsuite/gcc.dg/lto/20081222_0.h | 1 + gcc/testsuite/gcc.dg/lto/20081222_1.c | 16 + gcc/testsuite/gcc.dg/lto/20081224_0.c | 9 + gcc/testsuite/gcc.dg/lto/20081224_0.h | 3 + gcc/testsuite/gcc.dg/lto/20081224_1.c | 2 + gcc/testsuite/gcc.dg/lto/20090116_0.c | 12 + gcc/testsuite/gcc.dg/lto/20090120_0.c | 14 + gcc/testsuite/gcc.dg/lto/20090126-1_0.c | 7 + gcc/testsuite/gcc.dg/lto/20090126-2_0.c | 7 + gcc/testsuite/gcc.dg/lto/20090206-1_0.c | 10 + gcc/testsuite/gcc.dg/lto/20090206-2_0.c | 18 + gcc/testsuite/gcc.dg/lto/20090210_0.c | 6 + gcc/testsuite/gcc.dg/lto/20090210_1.c | 22 + gcc/testsuite/gcc.dg/lto/20090213_0.c | 11 + gcc/testsuite/gcc.dg/lto/20090213_1.c | 6 + gcc/testsuite/gcc.dg/lto/20090218-1_0.c | 4 + gcc/testsuite/gcc.dg/lto/20090218-1_1.c | 9 + gcc/testsuite/gcc.dg/lto/20090218-2_0.c | 3 + gcc/testsuite/gcc.dg/lto/20090218-2_1.c | 19 + gcc/testsuite/gcc.dg/lto/20090218_0.c | 7 + gcc/testsuite/gcc.dg/lto/20090218_1.c | 6 + gcc/testsuite/gcc.dg/lto/20090218_2.c | 6 + gcc/testsuite/gcc.dg/lto/20090218_3.c | 3 + gcc/testsuite/gcc.dg/lto/20090219_0.c | 28 + gcc/testsuite/gcc.dg/lto/20090312_0.c | 43 + gcc/testsuite/gcc.dg/lto/20090312_1.c | 9 + gcc/testsuite/gcc.dg/lto/20090313_0.c | 9 + gcc/testsuite/gcc.dg/lto/20090706-1_0.c | 42 + gcc/testsuite/gcc.dg/lto/20090706-2_0.c | 16 + gcc/testsuite/gcc.dg/lto/20090717_0.c | 4 + gcc/testsuite/gcc.dg/lto/20090717_1.c | 11 + gcc/testsuite/gcc.dg/lto/20090729_0.c | 4 + gcc/testsuite/gcc.dg/lto/20090729_1.c | 4 + gcc/testsuite/gcc.dg/lto/20090812_0.c | 11 + gcc/testsuite/gcc.dg/lto/20090812_1.c | 26 + gcc/testsuite/gcc.dg/lto/20090914-1_0.c | 13 + gcc/testsuite/gcc.dg/lto/README | 35 + gcc/testsuite/gcc.dg/lto/lto.exp | 57 + .../gcc.target/i386/math-torture/math-torture.exp | 2 +- gcc/testsuite/gfortran.dg/lto/lto.exp | 57 + gcc/testsuite/gfortran.dg/lto/pr40724_0.f | 3 + gcc/testsuite/gfortran.dg/lto/pr40724_1.f | 3 + gcc/testsuite/gfortran.dg/lto/pr40725_0.f03 | 16 + gcc/testsuite/gfortran.dg/lto/pr40725_1.c | 12 + gcc/testsuite/gfortran.dg/lto/pr41069_0.f90 | 7 + gcc/testsuite/gfortran.dg/lto/pr41069_1.f90 | 10 + gcc/testsuite/gfortran.dg/lto/pr41069_2.f90 | 9 + gcc/testsuite/lib/c-torture.exp | 9 + gcc/testsuite/lib/gcc-dg.exp | 13 +- gcc/testsuite/lib/lto.exp | 501 + gcc/testsuite/lib/target-supports.exp | 8 + gcc/testsuite/lib/torture-options.exp | 10 +- gcc/timevar.def | 9 + gcc/tlink.c | 2 +- gcc/toplev.c | 21 + gcc/tree-cfg.c | 2 +- gcc/tree-flow.h | 1 + gcc/tree-inline.c | 6 +- gcc/tree-optimize.c | 5 +- gcc/tree-pass.h | 26 +- gcc/tree.c | 224 +- gcc/tree.h | 11 +- include/ChangeLog | 5 + include/lto-symtab.h | 41 + include/plugin-api.h | 263 + lto-plugin/ChangeLog | 347 + lto-plugin/Makefile.am | 19 + lto-plugin/Makefile.in | 680 + lto-plugin/acinclude.m4 | 7 + lto-plugin/aclocal.m4 | 939 ++ lto-plugin/configure | 12715 +++++++++++++++++++ lto-plugin/configure.ac | 12 + lto-plugin/lto-plugin.c | 689 + lto-plugin/lto-symtab.c | 359 + maintainer-scripts/ChangeLog | 4 + maintainer-scripts/gcc_release | 2 +- 309 files changed, 43534 insertions(+), 342 deletions(-) create mode 100644 gcc/lto-cgraph.c create mode 100644 gcc/lto-compress.c create mode 100644 gcc/lto-compress.h create mode 100644 gcc/lto-opts.c create mode 100644 gcc/lto-section-in.c create mode 100644 gcc/lto-section-out.c create mode 100644 gcc/lto-streamer-in.c create mode 100644 gcc/lto-streamer-out.c create mode 100644 gcc/lto-streamer.c create mode 100644 gcc/lto-streamer.h create mode 100644 gcc/lto-symtab.c create mode 100644 gcc/lto-wpa-fixup.c create mode 100644 gcc/lto-wrapper.c create mode 100644 gcc/lto/ChangeLog create mode 100644 gcc/lto/Make-lang.in create mode 100644 gcc/lto/common.c create mode 100644 gcc/lto/common.h create mode 100644 gcc/lto/config-lang.in create mode 100644 gcc/lto/lang-specs.h create mode 100644 gcc/lto/lang.opt create mode 100644 gcc/lto/lto-elf.c create mode 100644 gcc/lto/lto-lang.c create mode 100644 gcc/lto/lto-tree.h create mode 100644 gcc/lto/lto.c create mode 100644 gcc/lto/lto.h create mode 100644 gcc/testsuite/g++.dg/20090107-1.C create mode 100644 gcc/testsuite/g++.dg/20090121-1.C create mode 100644 gcc/testsuite/g++.dg/ipa/20090113-1.C create mode 100644 gcc/testsuite/g++.dg/lto/20080709_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20080829_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20080904_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20080907_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20080908-1_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20080908-2_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20080908-3_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20080909-1_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20080910-1_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20080912-1_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20080912_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20080915_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20080916_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20080917_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20080924_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20080926_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20081008_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20081022.h create mode 100644 gcc/testsuite/g++.dg/lto/20081022_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20081022_1.C create mode 100644 gcc/testsuite/g++.dg/lto/20081023_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20081109-1_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20081109-2_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20081109_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20081109_1.C create mode 100644 gcc/testsuite/g++.dg/lto/20081118-1_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20081118-1_1.C create mode 100644 gcc/testsuite/g++.dg/lto/20081118_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20081118_1.C create mode 100644 gcc/testsuite/g++.dg/lto/20081119-1.h create mode 100644 gcc/testsuite/g++.dg/lto/20081119-1_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20081119-1_1.C create mode 100644 gcc/testsuite/g++.dg/lto/20081119_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20081119_1.C create mode 100644 gcc/testsuite/g++.dg/lto/20081120-1_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20081120-1_1.C create mode 100644 gcc/testsuite/g++.dg/lto/20081120-2_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20081120-2_1.C create mode 100644 gcc/testsuite/g++.dg/lto/20081123_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20081123_1.C create mode 100644 gcc/testsuite/g++.dg/lto/20081125.h create mode 100644 gcc/testsuite/g++.dg/lto/20081125_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20081125_1.C create mode 100644 gcc/testsuite/g++.dg/lto/20081127_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20081127_1.C create mode 100644 gcc/testsuite/g++.dg/lto/20081203_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20081203_1.C create mode 100644 gcc/testsuite/g++.dg/lto/20081204-1_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20081204-1_1.C create mode 100644 gcc/testsuite/g++.dg/lto/20081204-2_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20081204-2_1.C create mode 100644 gcc/testsuite/g++.dg/lto/20081209_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20081209_1.C create mode 100644 gcc/testsuite/g++.dg/lto/20081211-1.h create mode 100644 gcc/testsuite/g++.dg/lto/20081211-1_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20081211-1_1.C create mode 100644 gcc/testsuite/g++.dg/lto/20081217-1_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20081217-2_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20081219_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20081219_1.C create mode 100644 gcc/testsuite/g++.dg/lto/20090106_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20090112_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20090128_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20090221_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20090302_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20090302_1.C create mode 100644 gcc/testsuite/g++.dg/lto/20090303_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20090311-1.h create mode 100644 gcc/testsuite/g++.dg/lto/20090311-1_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20090311-1_1.C create mode 100644 gcc/testsuite/g++.dg/lto/20090311_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20090311_1.C create mode 100644 gcc/testsuite/g++.dg/lto/20090312.h create mode 100644 gcc/testsuite/g++.dg/lto/20090312_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20090312_1.C create mode 100644 gcc/testsuite/g++.dg/lto/20090313_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20090313_1.C create mode 100644 gcc/testsuite/g++.dg/lto/20090315_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20090315_1.C create mode 100644 gcc/testsuite/g++.dg/lto/20091002-1_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20091002-2_0.C create mode 100644 gcc/testsuite/g++.dg/lto/20091002-3_0.C create mode 100644 gcc/testsuite/g++.dg/lto/README create mode 100644 gcc/testsuite/g++.dg/lto/lto.exp create mode 100644 gcc/testsuite/g++.dg/lto/pr40818_0.C create mode 100644 gcc/testsuite/g++.dg/opt/thunk3-1.C create mode 100644 gcc/testsuite/g++.dg/opt/thunk4.C create mode 100644 gcc/testsuite/gcc.dg/20081223-1.c create mode 100644 gcc/testsuite/gcc.dg/lto/20080908_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20080917_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20080924_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081024_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081109_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081111_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081111_1.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081112_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081112_1.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081115_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081115_1.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081115_2.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081118_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081118_1.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081118_2.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081120-1_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081120-1_1.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081120-2_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081120-2_1.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081125_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081125_1.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081126_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081201-1_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081201-1_1.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081201-1_2.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081201-2_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081201-2_1.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081202-1_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081202-1_1.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081202-2_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081202-2_1.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081204-1_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081204-1_1.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081204-2_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081210-1_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081212-1_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081222_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081222_0.h create mode 100644 gcc/testsuite/gcc.dg/lto/20081222_1.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081224_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20081224_0.h create mode 100644 gcc/testsuite/gcc.dg/lto/20081224_1.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090116_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090120_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090126-1_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090126-2_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090206-1_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090206-2_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090210_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090210_1.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090213_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090213_1.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090218-1_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090218-1_1.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090218-2_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090218-2_1.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090218_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090218_1.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090218_2.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090218_3.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090219_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090312_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090312_1.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090313_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090706-1_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090706-2_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090717_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090717_1.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090729_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090729_1.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090812_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090812_1.c create mode 100644 gcc/testsuite/gcc.dg/lto/20090914-1_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/README create mode 100644 gcc/testsuite/gcc.dg/lto/lto.exp create mode 100644 gcc/testsuite/gfortran.dg/lto/lto.exp create mode 100644 gcc/testsuite/gfortran.dg/lto/pr40724_0.f create mode 100644 gcc/testsuite/gfortran.dg/lto/pr40724_1.f create mode 100644 gcc/testsuite/gfortran.dg/lto/pr40725_0.f03 create mode 100644 gcc/testsuite/gfortran.dg/lto/pr40725_1.c create mode 100644 gcc/testsuite/gfortran.dg/lto/pr41069_0.f90 create mode 100644 gcc/testsuite/gfortran.dg/lto/pr41069_1.f90 create mode 100644 gcc/testsuite/gfortran.dg/lto/pr41069_2.f90 create mode 100644 gcc/testsuite/lib/lto.exp create mode 100644 include/lto-symtab.h create mode 100644 include/plugin-api.h create mode 100644 lto-plugin/ChangeLog create mode 100644 lto-plugin/Makefile.am create mode 100644 lto-plugin/Makefile.in create mode 100644 lto-plugin/acinclude.m4 create mode 100644 lto-plugin/aclocal.m4 create mode 100755 lto-plugin/configure create mode 100644 lto-plugin/configure.ac create mode 100644 lto-plugin/lto-plugin.c create mode 100644 lto-plugin/lto-symtab.c diff --git a/ChangeLog b/ChangeLog index 3fc53057096..a9de26532c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,32 @@ +2009-10-03 2009-02-05 Rafael Avila de Espindola + + * Makefile.def: all-lto-plugin depends on all-libiberty. + set bootstrap=true for lto-plugin. + Add lto-plugin. + * Makefile.in: Regenerate. + * configure.ac (host_libs): Add lto-plugin. + * configure: Regenerate. + + +2009-10-03 Diego Novillo + + * Makefile.tpl (HOST_EXPORTS): Add LIBELFLIBS and LIBELFINC. + (HOST_LIBELFLIBS): Define. + (HOST_LIBELFINC): Define. + * Makefile.in: Regenerate. + * configure.ac: Add --enable-lto. + Add --with-libelf, --with-libelf-include and --with-libelf-lib. + If --enable-lto is used, add 'lto' to new_enable_languages. + If --enable-lto is used and gold is enabled, add + lto-plugin to configdirs. + * configure: Regenerate. + +2009-10-03 Simon Baldwin + + * configure.ac: If --with-system-zlib, suppress local zlib and + pass --with-system-zlib to subdir configure scripts. + * configure: Regenerate. + 2009-10-01 Loren J. Rittle Paolo Bonzini diff --git a/Makefile.def b/Makefile.def index 5834232f133..52d486fdb7b 100644 --- a/Makefile.def +++ b/Makefile.def @@ -97,7 +97,8 @@ host_modules= { module= ld; bootstrap=true; }; host_modules= { module= libcpp; bootstrap=true; }; host_modules= { module= libdecnumber; bootstrap=true; }; host_modules= { module= libgui; }; -host_modules= { module= libiberty; bootstrap=true; }; +host_modules= { module= libiberty; bootstrap=true; + extra_configure_flags='@extra_host_libiberty_configure_flags@';}; // We abuse missing to avoid installing anything for libiconv. host_modules= { module= libiconv; extra_configure_flags='--disable-shared'; @@ -141,6 +142,7 @@ host_modules= { module= libtermcap; no_check=true; missing=maintainer-clean; }; host_modules= { module= utils; no_check=true; }; host_modules= { module= gnattools; }; +host_modules= { module= lto-plugin; bootstrap=true; }; target_modules = { module= libstdc++-v3; bootstrap=true; @@ -346,6 +348,8 @@ dependencies = { module=all-fixincludes; on=all-libiberty; }; dependencies = { module=all-gnattools; on=all-target-libada; }; +dependencies = { module=all-lto-plugin; on=all-libiberty; }; + dependencies = { module=configure-mpfr; on=all-gmp; }; dependencies = { module=configure-mpc; on=all-mpfr; }; dependencies = { module=configure-ppl; on=all-gmp; }; diff --git a/Makefile.in b/Makefile.in index 4f8691113e3..8738cd49f30 100644 --- a/Makefile.in +++ b/Makefile.in @@ -219,6 +219,8 @@ HOST_EXPORTS = \ PPLINC="$(HOST_PPLINC)"; export PPLINC; \ CLOOGLIBS="$(HOST_CLOOGLIBS)"; export CLOOGLIBS; \ CLOOGINC="$(HOST_CLOOGINC)"; export CLOOGINC; \ + LIBELFLIBS="$(HOST_LIBELFLIBS)" ; export LIBELFLIBS; \ + LIBELFINC="$(HOST_LIBELFINC)" ; export LIBELFINC; \ @if gcc-bootstrap $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \ @endif gcc-bootstrap @@ -293,6 +295,10 @@ HOST_PPLINC = @pplinc@ HOST_CLOOGLIBS = @clooglibs@ HOST_CLOOGINC = @clooginc@ +# Where to find libelf +HOST_LIBELFLIBS = @libelflibs@ +HOST_LIBELFINC = @libelfinc@ + # ---------------------------------------------- # Programs producing files for the BUILD machine # ---------------------------------------------- @@ -854,7 +860,8 @@ configure-host: \ maybe-configure-tk \ maybe-configure-libtermcap \ maybe-configure-utils \ - maybe-configure-gnattools + maybe-configure-gnattools \ + maybe-configure-lto-plugin .PHONY: configure-target configure-target: \ maybe-configure-target-libstdc++-v3 \ @@ -1026,6 +1033,9 @@ all-host: maybe-all-tk all-host: maybe-all-libtermcap all-host: maybe-all-utils all-host: maybe-all-gnattools +@if lto-plugin-no-bootstrap +all-host: maybe-all-lto-plugin +@endif lto-plugin-no-bootstrap .PHONY: all-target @@ -1147,6 +1157,7 @@ info-host: maybe-info-tk info-host: maybe-info-libtermcap info-host: maybe-info-utils info-host: maybe-info-gnattools +info-host: maybe-info-lto-plugin .PHONY: info-target @@ -1259,6 +1270,7 @@ dvi-host: maybe-dvi-tk dvi-host: maybe-dvi-libtermcap dvi-host: maybe-dvi-utils dvi-host: maybe-dvi-gnattools +dvi-host: maybe-dvi-lto-plugin .PHONY: dvi-target @@ -1371,6 +1383,7 @@ pdf-host: maybe-pdf-tk pdf-host: maybe-pdf-libtermcap pdf-host: maybe-pdf-utils pdf-host: maybe-pdf-gnattools +pdf-host: maybe-pdf-lto-plugin .PHONY: pdf-target @@ -1483,6 +1496,7 @@ html-host: maybe-html-tk html-host: maybe-html-libtermcap html-host: maybe-html-utils html-host: maybe-html-gnattools +html-host: maybe-html-lto-plugin .PHONY: html-target @@ -1595,6 +1609,7 @@ TAGS-host: maybe-TAGS-tk TAGS-host: maybe-TAGS-libtermcap TAGS-host: maybe-TAGS-utils TAGS-host: maybe-TAGS-gnattools +TAGS-host: maybe-TAGS-lto-plugin .PHONY: TAGS-target @@ -1707,6 +1722,7 @@ install-info-host: maybe-install-info-tk install-info-host: maybe-install-info-libtermcap install-info-host: maybe-install-info-utils install-info-host: maybe-install-info-gnattools +install-info-host: maybe-install-info-lto-plugin .PHONY: install-info-target @@ -1819,6 +1835,7 @@ install-pdf-host: maybe-install-pdf-tk install-pdf-host: maybe-install-pdf-libtermcap install-pdf-host: maybe-install-pdf-utils install-pdf-host: maybe-install-pdf-gnattools +install-pdf-host: maybe-install-pdf-lto-plugin .PHONY: install-pdf-target @@ -1931,6 +1948,7 @@ install-html-host: maybe-install-html-tk install-html-host: maybe-install-html-libtermcap install-html-host: maybe-install-html-utils install-html-host: maybe-install-html-gnattools +install-html-host: maybe-install-html-lto-plugin .PHONY: install-html-target @@ -2043,6 +2061,7 @@ installcheck-host: maybe-installcheck-tk installcheck-host: maybe-installcheck-libtermcap installcheck-host: maybe-installcheck-utils installcheck-host: maybe-installcheck-gnattools +installcheck-host: maybe-installcheck-lto-plugin .PHONY: installcheck-target @@ -2155,6 +2174,7 @@ mostlyclean-host: maybe-mostlyclean-tk mostlyclean-host: maybe-mostlyclean-libtermcap mostlyclean-host: maybe-mostlyclean-utils mostlyclean-host: maybe-mostlyclean-gnattools +mostlyclean-host: maybe-mostlyclean-lto-plugin .PHONY: mostlyclean-target @@ -2267,6 +2287,7 @@ clean-host: maybe-clean-tk clean-host: maybe-clean-libtermcap clean-host: maybe-clean-utils clean-host: maybe-clean-gnattools +clean-host: maybe-clean-lto-plugin .PHONY: clean-target @@ -2379,6 +2400,7 @@ distclean-host: maybe-distclean-tk distclean-host: maybe-distclean-libtermcap distclean-host: maybe-distclean-utils distclean-host: maybe-distclean-gnattools +distclean-host: maybe-distclean-lto-plugin .PHONY: distclean-target @@ -2491,6 +2513,7 @@ maintainer-clean-host: maybe-maintainer-clean-tk maintainer-clean-host: maybe-maintainer-clean-libtermcap maintainer-clean-host: maybe-maintainer-clean-utils maintainer-clean-host: maybe-maintainer-clean-gnattools +maintainer-clean-host: maybe-maintainer-clean-lto-plugin .PHONY: maintainer-clean-target @@ -2656,7 +2679,8 @@ check-host: \ maybe-check-tk \ maybe-check-libtermcap \ maybe-check-utils \ - maybe-check-gnattools + maybe-check-gnattools \ + maybe-check-lto-plugin .PHONY: check-target check-target: \ @@ -2794,7 +2818,8 @@ install-host-nogcc: \ maybe-install-tk \ maybe-install-libtermcap \ maybe-install-utils \ - maybe-install-gnattools + maybe-install-gnattools \ + maybe-install-lto-plugin .PHONY: install-host install-host: \ @@ -2873,7 +2898,8 @@ install-host: \ maybe-install-tk \ maybe-install-libtermcap \ maybe-install-utils \ - maybe-install-gnattools + maybe-install-gnattools \ + maybe-install-lto-plugin .PHONY: install-target install-target: \ @@ -28249,7 +28275,7 @@ configure-libiberty: libsrcdir="$$s/libiberty"; \ $(SHELL) $${libsrcdir}/configure \ $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ - --target=${target_alias} $${srcdiroption} \ + --target=${target_alias} $${srcdiroption} @extra_host_libiberty_configure_flags@ \ || exit 1 @endif libiberty @@ -28283,7 +28309,8 @@ configure-stage1-libiberty: $(SHELL) $${libsrcdir}/configure \ $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ --target=${target_alias} $${srcdiroption} \ - $(STAGE1_CONFIGURE_FLAGS) + $(STAGE1_CONFIGURE_FLAGS) \ + @extra_host_libiberty_configure_flags@ @endif libiberty-bootstrap .PHONY: configure-stage2-libiberty maybe-configure-stage2-libiberty @@ -28316,7 +28343,8 @@ configure-stage2-libiberty: $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ --target=${target_alias} $${srcdiroption} \ --with-build-libsubdir=$(HOST_SUBDIR) \ - $(STAGE2_CONFIGURE_FLAGS) + $(STAGE2_CONFIGURE_FLAGS) \ + @extra_host_libiberty_configure_flags@ @endif libiberty-bootstrap .PHONY: configure-stage3-libiberty maybe-configure-stage3-libiberty @@ -28349,7 +28377,8 @@ configure-stage3-libiberty: $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ --target=${target_alias} $${srcdiroption} \ --with-build-libsubdir=$(HOST_SUBDIR) \ - $(STAGE3_CONFIGURE_FLAGS) + $(STAGE3_CONFIGURE_FLAGS) \ + @extra_host_libiberty_configure_flags@ @endif libiberty-bootstrap .PHONY: configure-stage4-libiberty maybe-configure-stage4-libiberty @@ -28382,7 +28411,8 @@ configure-stage4-libiberty: $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ --target=${target_alias} $${srcdiroption} \ --with-build-libsubdir=$(HOST_SUBDIR) \ - $(STAGE4_CONFIGURE_FLAGS) + $(STAGE4_CONFIGURE_FLAGS) \ + @extra_host_libiberty_configure_flags@ @endif libiberty-bootstrap .PHONY: configure-stageprofile-libiberty maybe-configure-stageprofile-libiberty @@ -28415,7 +28445,8 @@ configure-stageprofile-libiberty: $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ --target=${target_alias} $${srcdiroption} \ --with-build-libsubdir=$(HOST_SUBDIR) \ - $(STAGEprofile_CONFIGURE_FLAGS) + $(STAGEprofile_CONFIGURE_FLAGS) \ + @extra_host_libiberty_configure_flags@ @endif libiberty-bootstrap .PHONY: configure-stagefeedback-libiberty maybe-configure-stagefeedback-libiberty @@ -28448,7 +28479,8 @@ configure-stagefeedback-libiberty: $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ --target=${target_alias} $${srcdiroption} \ --with-build-libsubdir=$(HOST_SUBDIR) \ - $(STAGEfeedback_CONFIGURE_FLAGS) + $(STAGEfeedback_CONFIGURE_FLAGS) \ + @extra_host_libiberty_configure_flags@ @endif libiberty-bootstrap @@ -42970,6 +43002,872 @@ maintainer-clean-gnattools: +.PHONY: configure-lto-plugin maybe-configure-lto-plugin +maybe-configure-lto-plugin: +@if gcc-bootstrap +configure-lto-plugin: stage_current +@endif gcc-bootstrap +@if lto-plugin +maybe-configure-lto-plugin: configure-lto-plugin +configure-lto-plugin: + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/lto-plugin/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/lto-plugin ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/lto-plugin; \ + cd "$(HOST_SUBDIR)/lto-plugin" || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/lto-plugin/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/lto-plugin"; \ + libsrcdir="$$s/lto-plugin"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ + --target=${target_alias} $${srcdiroption} \ + || exit 1 +@endif lto-plugin + + + +.PHONY: configure-stage1-lto-plugin maybe-configure-stage1-lto-plugin +maybe-configure-stage1-lto-plugin: +@if lto-plugin-bootstrap +maybe-configure-stage1-lto-plugin: configure-stage1-lto-plugin +configure-stage1-lto-plugin: + @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/lto-plugin + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGE1_TFLAGS)"; \ + test ! -f $(HOST_SUBDIR)/lto-plugin/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + CFLAGS="$(STAGE1_CFLAGS)"; export CFLAGS; \ + CXXFLAGS="$(STAGE1_CFLAGS)"; export CXXFLAGS; \ + LIBCFLAGS="$(LIBCFLAGS)"; export LIBCFLAGS; \ + echo Configuring stage 1 in $(HOST_SUBDIR)/lto-plugin ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/lto-plugin ; \ + cd $(HOST_SUBDIR)/lto-plugin || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/lto-plugin/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/lto-plugin"; \ + libsrcdir="$$s/lto-plugin"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ + --target=${target_alias} $${srcdiroption} \ + $(STAGE1_CONFIGURE_FLAGS) +@endif lto-plugin-bootstrap + +.PHONY: configure-stage2-lto-plugin maybe-configure-stage2-lto-plugin +maybe-configure-stage2-lto-plugin: +@if lto-plugin-bootstrap +maybe-configure-stage2-lto-plugin: configure-stage2-lto-plugin +configure-stage2-lto-plugin: + @[ $(current_stage) = stage2 ] || $(MAKE) stage2-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/lto-plugin + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGE2_TFLAGS)"; \ + test ! -f $(HOST_SUBDIR)/lto-plugin/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + CFLAGS="$(STAGE2_CFLAGS)"; export CFLAGS; \ + CXXFLAGS="$(STAGE2_CFLAGS)"; export CXXFLAGS; \ + LIBCFLAGS="$(STAGE2_CFLAGS)"; export LIBCFLAGS; \ + echo Configuring stage 2 in $(HOST_SUBDIR)/lto-plugin ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/lto-plugin ; \ + cd $(HOST_SUBDIR)/lto-plugin || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/lto-plugin/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/lto-plugin"; \ + libsrcdir="$$s/lto-plugin"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ + --target=${target_alias} $${srcdiroption} \ + --with-build-libsubdir=$(HOST_SUBDIR) \ + $(STAGE2_CONFIGURE_FLAGS) +@endif lto-plugin-bootstrap + +.PHONY: configure-stage3-lto-plugin maybe-configure-stage3-lto-plugin +maybe-configure-stage3-lto-plugin: +@if lto-plugin-bootstrap +maybe-configure-stage3-lto-plugin: configure-stage3-lto-plugin +configure-stage3-lto-plugin: + @[ $(current_stage) = stage3 ] || $(MAKE) stage3-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/lto-plugin + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGE3_TFLAGS)"; \ + test ! -f $(HOST_SUBDIR)/lto-plugin/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + CFLAGS="$(STAGE3_CFLAGS)"; export CFLAGS; \ + CXXFLAGS="$(STAGE3_CFLAGS)"; export CXXFLAGS; \ + LIBCFLAGS="$(STAGE3_CFLAGS)"; export LIBCFLAGS; \ + echo Configuring stage 3 in $(HOST_SUBDIR)/lto-plugin ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/lto-plugin ; \ + cd $(HOST_SUBDIR)/lto-plugin || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/lto-plugin/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/lto-plugin"; \ + libsrcdir="$$s/lto-plugin"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ + --target=${target_alias} $${srcdiroption} \ + --with-build-libsubdir=$(HOST_SUBDIR) \ + $(STAGE3_CONFIGURE_FLAGS) +@endif lto-plugin-bootstrap + +.PHONY: configure-stage4-lto-plugin maybe-configure-stage4-lto-plugin +maybe-configure-stage4-lto-plugin: +@if lto-plugin-bootstrap +maybe-configure-stage4-lto-plugin: configure-stage4-lto-plugin +configure-stage4-lto-plugin: + @[ $(current_stage) = stage4 ] || $(MAKE) stage4-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/lto-plugin + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGE4_TFLAGS)"; \ + test ! -f $(HOST_SUBDIR)/lto-plugin/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + CFLAGS="$(STAGE4_CFLAGS)"; export CFLAGS; \ + CXXFLAGS="$(STAGE4_CFLAGS)"; export CXXFLAGS; \ + LIBCFLAGS="$(STAGE4_CFLAGS)"; export LIBCFLAGS; \ + echo Configuring stage 4 in $(HOST_SUBDIR)/lto-plugin ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/lto-plugin ; \ + cd $(HOST_SUBDIR)/lto-plugin || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/lto-plugin/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/lto-plugin"; \ + libsrcdir="$$s/lto-plugin"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ + --target=${target_alias} $${srcdiroption} \ + --with-build-libsubdir=$(HOST_SUBDIR) \ + $(STAGE4_CONFIGURE_FLAGS) +@endif lto-plugin-bootstrap + +.PHONY: configure-stageprofile-lto-plugin maybe-configure-stageprofile-lto-plugin +maybe-configure-stageprofile-lto-plugin: +@if lto-plugin-bootstrap +maybe-configure-stageprofile-lto-plugin: configure-stageprofile-lto-plugin +configure-stageprofile-lto-plugin: + @[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/lto-plugin + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGEprofile_TFLAGS)"; \ + test ! -f $(HOST_SUBDIR)/lto-plugin/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + CFLAGS="$(STAGEprofile_CFLAGS)"; export CFLAGS; \ + CXXFLAGS="$(STAGEprofile_CFLAGS)"; export CXXFLAGS; \ + LIBCFLAGS="$(STAGEprofile_CFLAGS)"; export LIBCFLAGS; \ + echo Configuring stage profile in $(HOST_SUBDIR)/lto-plugin ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/lto-plugin ; \ + cd $(HOST_SUBDIR)/lto-plugin || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/lto-plugin/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/lto-plugin"; \ + libsrcdir="$$s/lto-plugin"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ + --target=${target_alias} $${srcdiroption} \ + --with-build-libsubdir=$(HOST_SUBDIR) \ + $(STAGEprofile_CONFIGURE_FLAGS) +@endif lto-plugin-bootstrap + +.PHONY: configure-stagefeedback-lto-plugin maybe-configure-stagefeedback-lto-plugin +maybe-configure-stagefeedback-lto-plugin: +@if lto-plugin-bootstrap +maybe-configure-stagefeedback-lto-plugin: configure-stagefeedback-lto-plugin +configure-stagefeedback-lto-plugin: + @[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/lto-plugin + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGEfeedback_TFLAGS)"; \ + test ! -f $(HOST_SUBDIR)/lto-plugin/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + CFLAGS="$(STAGEfeedback_CFLAGS)"; export CFLAGS; \ + CXXFLAGS="$(STAGEfeedback_CFLAGS)"; export CXXFLAGS; \ + LIBCFLAGS="$(STAGEfeedback_CFLAGS)"; export LIBCFLAGS; \ + echo Configuring stage feedback in $(HOST_SUBDIR)/lto-plugin ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/lto-plugin ; \ + cd $(HOST_SUBDIR)/lto-plugin || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/lto-plugin/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/lto-plugin"; \ + libsrcdir="$$s/lto-plugin"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ + --target=${target_alias} $${srcdiroption} \ + --with-build-libsubdir=$(HOST_SUBDIR) \ + $(STAGEfeedback_CONFIGURE_FLAGS) +@endif lto-plugin-bootstrap + + + + + +.PHONY: all-lto-plugin maybe-all-lto-plugin +maybe-all-lto-plugin: +@if gcc-bootstrap +all-lto-plugin: stage_current +@endif gcc-bootstrap +@if lto-plugin +TARGET-lto-plugin=all +maybe-all-lto-plugin: all-lto-plugin +all-lto-plugin: configure-lto-plugin + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/lto-plugin && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) \ + $(TARGET-lto-plugin)) +@endif lto-plugin + + + +.PHONY: all-stage1-lto-plugin maybe-all-stage1-lto-plugin +.PHONY: clean-stage1-lto-plugin maybe-clean-stage1-lto-plugin +maybe-all-stage1-lto-plugin: +maybe-clean-stage1-lto-plugin: +@if lto-plugin-bootstrap +maybe-all-stage1-lto-plugin: all-stage1-lto-plugin +all-stage1: all-stage1-lto-plugin +TARGET-stage1-lto-plugin = $(TARGET-lto-plugin) +all-stage1-lto-plugin: configure-stage1-lto-plugin + @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGE1_TFLAGS)"; \ + $(HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/lto-plugin && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) \ + CFLAGS="$(STAGE1_CFLAGS)" \ + CXXFLAGS="$(STAGE1_CFLAGS)" \ + LIBCFLAGS="$(LIBCFLAGS)" \ + CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ + CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ + LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ + $(EXTRA_HOST_FLAGS) \ + TFLAGS="$(STAGE1_TFLAGS)" \ + $(TARGET-stage1-lto-plugin) + +maybe-clean-stage1-lto-plugin: clean-stage1-lto-plugin +clean-stage1: clean-stage1-lto-plugin +clean-stage1-lto-plugin: + @if [ $(current_stage) = stage1 ]; then \ + [ -f $(HOST_SUBDIR)/lto-plugin/Makefile ] || exit 0; \ + else \ + [ -f $(HOST_SUBDIR)/stage1-lto-plugin/Makefile ] || exit 0; \ + $(MAKE) stage1-start; \ + fi; \ + cd $(HOST_SUBDIR)/lto-plugin && \ + $(MAKE) $(EXTRA_HOST_FLAGS) \ + clean +@endif lto-plugin-bootstrap + + +.PHONY: all-stage2-lto-plugin maybe-all-stage2-lto-plugin +.PHONY: clean-stage2-lto-plugin maybe-clean-stage2-lto-plugin +maybe-all-stage2-lto-plugin: +maybe-clean-stage2-lto-plugin: +@if lto-plugin-bootstrap +maybe-all-stage2-lto-plugin: all-stage2-lto-plugin +all-stage2: all-stage2-lto-plugin +TARGET-stage2-lto-plugin = $(TARGET-lto-plugin) +all-stage2-lto-plugin: configure-stage2-lto-plugin + @[ $(current_stage) = stage2 ] || $(MAKE) stage2-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGE2_TFLAGS)"; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/lto-plugin && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) \ + CFLAGS="$(STAGE2_CFLAGS)" \ + CXXFLAGS="$(STAGE2_CFLAGS)" \ + LIBCFLAGS="$(STAGE2_CFLAGS)" \ + CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ + CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ + LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ + $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + TFLAGS="$(STAGE2_TFLAGS)" \ + $(TARGET-stage2-lto-plugin) + +maybe-clean-stage2-lto-plugin: clean-stage2-lto-plugin +clean-stage2: clean-stage2-lto-plugin +clean-stage2-lto-plugin: + @if [ $(current_stage) = stage2 ]; then \ + [ -f $(HOST_SUBDIR)/lto-plugin/Makefile ] || exit 0; \ + else \ + [ -f $(HOST_SUBDIR)/stage2-lto-plugin/Makefile ] || exit 0; \ + $(MAKE) stage2-start; \ + fi; \ + cd $(HOST_SUBDIR)/lto-plugin && \ + $(MAKE) $(EXTRA_HOST_FLAGS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif lto-plugin-bootstrap + + +.PHONY: all-stage3-lto-plugin maybe-all-stage3-lto-plugin +.PHONY: clean-stage3-lto-plugin maybe-clean-stage3-lto-plugin +maybe-all-stage3-lto-plugin: +maybe-clean-stage3-lto-plugin: +@if lto-plugin-bootstrap +maybe-all-stage3-lto-plugin: all-stage3-lto-plugin +all-stage3: all-stage3-lto-plugin +TARGET-stage3-lto-plugin = $(TARGET-lto-plugin) +all-stage3-lto-plugin: configure-stage3-lto-plugin + @[ $(current_stage) = stage3 ] || $(MAKE) stage3-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGE3_TFLAGS)"; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/lto-plugin && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) \ + CFLAGS="$(STAGE3_CFLAGS)" \ + CXXFLAGS="$(STAGE3_CFLAGS)" \ + LIBCFLAGS="$(STAGE3_CFLAGS)" \ + CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ + CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ + LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ + $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + TFLAGS="$(STAGE3_TFLAGS)" \ + $(TARGET-stage3-lto-plugin) + +maybe-clean-stage3-lto-plugin: clean-stage3-lto-plugin +clean-stage3: clean-stage3-lto-plugin +clean-stage3-lto-plugin: + @if [ $(current_stage) = stage3 ]; then \ + [ -f $(HOST_SUBDIR)/lto-plugin/Makefile ] || exit 0; \ + else \ + [ -f $(HOST_SUBDIR)/stage3-lto-plugin/Makefile ] || exit 0; \ + $(MAKE) stage3-start; \ + fi; \ + cd $(HOST_SUBDIR)/lto-plugin && \ + $(MAKE) $(EXTRA_HOST_FLAGS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif lto-plugin-bootstrap + + +.PHONY: all-stage4-lto-plugin maybe-all-stage4-lto-plugin +.PHONY: clean-stage4-lto-plugin maybe-clean-stage4-lto-plugin +maybe-all-stage4-lto-plugin: +maybe-clean-stage4-lto-plugin: +@if lto-plugin-bootstrap +maybe-all-stage4-lto-plugin: all-stage4-lto-plugin +all-stage4: all-stage4-lto-plugin +TARGET-stage4-lto-plugin = $(TARGET-lto-plugin) +all-stage4-lto-plugin: configure-stage4-lto-plugin + @[ $(current_stage) = stage4 ] || $(MAKE) stage4-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGE4_TFLAGS)"; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/lto-plugin && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) \ + CFLAGS="$(STAGE4_CFLAGS)" \ + CXXFLAGS="$(STAGE4_CFLAGS)" \ + LIBCFLAGS="$(STAGE4_CFLAGS)" \ + CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ + CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ + LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ + $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + TFLAGS="$(STAGE4_TFLAGS)" \ + $(TARGET-stage4-lto-plugin) + +maybe-clean-stage4-lto-plugin: clean-stage4-lto-plugin +clean-stage4: clean-stage4-lto-plugin +clean-stage4-lto-plugin: + @if [ $(current_stage) = stage4 ]; then \ + [ -f $(HOST_SUBDIR)/lto-plugin/Makefile ] || exit 0; \ + else \ + [ -f $(HOST_SUBDIR)/stage4-lto-plugin/Makefile ] || exit 0; \ + $(MAKE) stage4-start; \ + fi; \ + cd $(HOST_SUBDIR)/lto-plugin && \ + $(MAKE) $(EXTRA_HOST_FLAGS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif lto-plugin-bootstrap + + +.PHONY: all-stageprofile-lto-plugin maybe-all-stageprofile-lto-plugin +.PHONY: clean-stageprofile-lto-plugin maybe-clean-stageprofile-lto-plugin +maybe-all-stageprofile-lto-plugin: +maybe-clean-stageprofile-lto-plugin: +@if lto-plugin-bootstrap +maybe-all-stageprofile-lto-plugin: all-stageprofile-lto-plugin +all-stageprofile: all-stageprofile-lto-plugin +TARGET-stageprofile-lto-plugin = $(TARGET-lto-plugin) +all-stageprofile-lto-plugin: configure-stageprofile-lto-plugin + @[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGEprofile_TFLAGS)"; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/lto-plugin && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) \ + CFLAGS="$(STAGEprofile_CFLAGS)" \ + CXXFLAGS="$(STAGEprofile_CFLAGS)" \ + LIBCFLAGS="$(STAGEprofile_CFLAGS)" \ + CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ + CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ + LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ + $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + TFLAGS="$(STAGEprofile_TFLAGS)" \ + $(TARGET-stageprofile-lto-plugin) + +maybe-clean-stageprofile-lto-plugin: clean-stageprofile-lto-plugin +clean-stageprofile: clean-stageprofile-lto-plugin +clean-stageprofile-lto-plugin: + @if [ $(current_stage) = stageprofile ]; then \ + [ -f $(HOST_SUBDIR)/lto-plugin/Makefile ] || exit 0; \ + else \ + [ -f $(HOST_SUBDIR)/stageprofile-lto-plugin/Makefile ] || exit 0; \ + $(MAKE) stageprofile-start; \ + fi; \ + cd $(HOST_SUBDIR)/lto-plugin && \ + $(MAKE) $(EXTRA_HOST_FLAGS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif lto-plugin-bootstrap + + +.PHONY: all-stagefeedback-lto-plugin maybe-all-stagefeedback-lto-plugin +.PHONY: clean-stagefeedback-lto-plugin maybe-clean-stagefeedback-lto-plugin +maybe-all-stagefeedback-lto-plugin: +maybe-clean-stagefeedback-lto-plugin: +@if lto-plugin-bootstrap +maybe-all-stagefeedback-lto-plugin: all-stagefeedback-lto-plugin +all-stagefeedback: all-stagefeedback-lto-plugin +TARGET-stagefeedback-lto-plugin = $(TARGET-lto-plugin) +all-stagefeedback-lto-plugin: configure-stagefeedback-lto-plugin + @[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGEfeedback_TFLAGS)"; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/lto-plugin && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) \ + CFLAGS="$(STAGEfeedback_CFLAGS)" \ + CXXFLAGS="$(STAGEfeedback_CFLAGS)" \ + LIBCFLAGS="$(STAGEfeedback_CFLAGS)" \ + CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ + CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ + LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ + $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + TFLAGS="$(STAGEfeedback_TFLAGS)" \ + $(TARGET-stagefeedback-lto-plugin) + +maybe-clean-stagefeedback-lto-plugin: clean-stagefeedback-lto-plugin +clean-stagefeedback: clean-stagefeedback-lto-plugin +clean-stagefeedback-lto-plugin: + @if [ $(current_stage) = stagefeedback ]; then \ + [ -f $(HOST_SUBDIR)/lto-plugin/Makefile ] || exit 0; \ + else \ + [ -f $(HOST_SUBDIR)/stagefeedback-lto-plugin/Makefile ] || exit 0; \ + $(MAKE) stagefeedback-start; \ + fi; \ + cd $(HOST_SUBDIR)/lto-plugin && \ + $(MAKE) $(EXTRA_HOST_FLAGS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif lto-plugin-bootstrap + + + + + +.PHONY: check-lto-plugin maybe-check-lto-plugin +maybe-check-lto-plugin: +@if lto-plugin +maybe-check-lto-plugin: check-lto-plugin + +check-lto-plugin: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/lto-plugin && \ + $(MAKE) $(FLAGS_TO_PASS) check) + +@endif lto-plugin + +.PHONY: install-lto-plugin maybe-install-lto-plugin +maybe-install-lto-plugin: +@if lto-plugin +maybe-install-lto-plugin: install-lto-plugin + +install-lto-plugin: installdirs + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/lto-plugin && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif lto-plugin + +# Other targets (info, dvi, pdf, etc.) + +.PHONY: maybe-info-lto-plugin info-lto-plugin +maybe-info-lto-plugin: +@if lto-plugin +maybe-info-lto-plugin: info-lto-plugin + +info-lto-plugin: \ + configure-lto-plugin + @[ -f ./lto-plugin/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in lto-plugin" ; \ + (cd $(HOST_SUBDIR)/lto-plugin && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + info) \ + || exit 1 + +@endif lto-plugin + +.PHONY: maybe-dvi-lto-plugin dvi-lto-plugin +maybe-dvi-lto-plugin: +@if lto-plugin +maybe-dvi-lto-plugin: dvi-lto-plugin + +dvi-lto-plugin: \ + configure-lto-plugin + @[ -f ./lto-plugin/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in lto-plugin" ; \ + (cd $(HOST_SUBDIR)/lto-plugin && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + dvi) \ + || exit 1 + +@endif lto-plugin + +.PHONY: maybe-pdf-lto-plugin pdf-lto-plugin +maybe-pdf-lto-plugin: +@if lto-plugin +maybe-pdf-lto-plugin: pdf-lto-plugin + +pdf-lto-plugin: \ + configure-lto-plugin + @[ -f ./lto-plugin/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing pdf in lto-plugin" ; \ + (cd $(HOST_SUBDIR)/lto-plugin && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + pdf) \ + || exit 1 + +@endif lto-plugin + +.PHONY: maybe-html-lto-plugin html-lto-plugin +maybe-html-lto-plugin: +@if lto-plugin +maybe-html-lto-plugin: html-lto-plugin + +html-lto-plugin: \ + configure-lto-plugin + @[ -f ./lto-plugin/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in lto-plugin" ; \ + (cd $(HOST_SUBDIR)/lto-plugin && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + html) \ + || exit 1 + +@endif lto-plugin + +.PHONY: maybe-TAGS-lto-plugin TAGS-lto-plugin +maybe-TAGS-lto-plugin: +@if lto-plugin +maybe-TAGS-lto-plugin: TAGS-lto-plugin + +TAGS-lto-plugin: \ + configure-lto-plugin + @[ -f ./lto-plugin/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in lto-plugin" ; \ + (cd $(HOST_SUBDIR)/lto-plugin && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + TAGS) \ + || exit 1 + +@endif lto-plugin + +.PHONY: maybe-install-info-lto-plugin install-info-lto-plugin +maybe-install-info-lto-plugin: +@if lto-plugin +maybe-install-info-lto-plugin: install-info-lto-plugin + +install-info-lto-plugin: \ + configure-lto-plugin \ + info-lto-plugin + @[ -f ./lto-plugin/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in lto-plugin" ; \ + (cd $(HOST_SUBDIR)/lto-plugin && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + install-info) \ + || exit 1 + +@endif lto-plugin + +.PHONY: maybe-install-pdf-lto-plugin install-pdf-lto-plugin +maybe-install-pdf-lto-plugin: +@if lto-plugin +maybe-install-pdf-lto-plugin: install-pdf-lto-plugin + +install-pdf-lto-plugin: \ + configure-lto-plugin \ + pdf-lto-plugin + @[ -f ./lto-plugin/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-pdf in lto-plugin" ; \ + (cd $(HOST_SUBDIR)/lto-plugin && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + install-pdf) \ + || exit 1 + +@endif lto-plugin + +.PHONY: maybe-install-html-lto-plugin install-html-lto-plugin +maybe-install-html-lto-plugin: +@if lto-plugin +maybe-install-html-lto-plugin: install-html-lto-plugin + +install-html-lto-plugin: \ + configure-lto-plugin \ + html-lto-plugin + @[ -f ./lto-plugin/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in lto-plugin" ; \ + (cd $(HOST_SUBDIR)/lto-plugin && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + install-html) \ + || exit 1 + +@endif lto-plugin + +.PHONY: maybe-installcheck-lto-plugin installcheck-lto-plugin +maybe-installcheck-lto-plugin: +@if lto-plugin +maybe-installcheck-lto-plugin: installcheck-lto-plugin + +installcheck-lto-plugin: \ + configure-lto-plugin + @[ -f ./lto-plugin/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in lto-plugin" ; \ + (cd $(HOST_SUBDIR)/lto-plugin && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + installcheck) \ + || exit 1 + +@endif lto-plugin + +.PHONY: maybe-mostlyclean-lto-plugin mostlyclean-lto-plugin +maybe-mostlyclean-lto-plugin: +@if lto-plugin +maybe-mostlyclean-lto-plugin: mostlyclean-lto-plugin + +mostlyclean-lto-plugin: + @[ -f ./lto-plugin/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in lto-plugin" ; \ + (cd $(HOST_SUBDIR)/lto-plugin && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + mostlyclean) \ + || exit 1 + +@endif lto-plugin + +.PHONY: maybe-clean-lto-plugin clean-lto-plugin +maybe-clean-lto-plugin: +@if lto-plugin +maybe-clean-lto-plugin: clean-lto-plugin + +clean-lto-plugin: + @[ -f ./lto-plugin/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in lto-plugin" ; \ + (cd $(HOST_SUBDIR)/lto-plugin && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + clean) \ + || exit 1 + +@endif lto-plugin + +.PHONY: maybe-distclean-lto-plugin distclean-lto-plugin +maybe-distclean-lto-plugin: +@if lto-plugin +maybe-distclean-lto-plugin: distclean-lto-plugin + +distclean-lto-plugin: + @[ -f ./lto-plugin/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in lto-plugin" ; \ + (cd $(HOST_SUBDIR)/lto-plugin && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + distclean) \ + || exit 1 + +@endif lto-plugin + +.PHONY: maybe-maintainer-clean-lto-plugin maintainer-clean-lto-plugin +maybe-maintainer-clean-lto-plugin: +@if lto-plugin +maybe-maintainer-clean-lto-plugin: maintainer-clean-lto-plugin + +maintainer-clean-lto-plugin: + @[ -f ./lto-plugin/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in lto-plugin" ; \ + (cd $(HOST_SUBDIR)/lto-plugin && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + maintainer-clean) \ + || exit 1 + +@endif lto-plugin + + + # --------------------------------------- # Modules which run on the target machine # --------------------------------------- @@ -53466,6 +54364,11 @@ stage1-start:: mkdir stage1-zlib; \ mv stage1-zlib zlib @endif zlib +@if lto-plugin + @cd $(HOST_SUBDIR); [ -d stage1-lto-plugin ] || \ + mkdir stage1-lto-plugin; \ + mv stage1-lto-plugin lto-plugin +@endif lto-plugin @[ -d stage1-$(TARGET_SUBDIR) ] || \ mkdir stage1-$(TARGET_SUBDIR); \ mv stage1-$(TARGET_SUBDIR) $(TARGET_SUBDIR) @@ -53556,6 +54459,11 @@ stage1-end:: cd $(HOST_SUBDIR); mv zlib stage1-zlib ; \ fi @endif zlib +@if lto-plugin + @if test -d $(HOST_SUBDIR)/lto-plugin ; then \ + cd $(HOST_SUBDIR); mv lto-plugin stage1-lto-plugin ; \ + fi +@endif lto-plugin @if test -d $(TARGET_SUBDIR) ; then \ mv $(TARGET_SUBDIR) stage1-$(TARGET_SUBDIR) ; \ fi @@ -53706,6 +54614,12 @@ stage2-start:: mv stage2-zlib zlib ; \ mv stage1-zlib prev-zlib || test -f stage1-lean @endif zlib +@if lto-plugin + @cd $(HOST_SUBDIR); [ -d stage2-lto-plugin ] || \ + mkdir stage2-lto-plugin; \ + mv stage2-lto-plugin lto-plugin ; \ + mv stage1-lto-plugin prev-lto-plugin || test -f stage1-lean +@endif lto-plugin @[ -d stage2-$(TARGET_SUBDIR) ] || \ mkdir stage2-$(TARGET_SUBDIR); \ mv stage2-$(TARGET_SUBDIR) $(TARGET_SUBDIR) ; \ @@ -53814,6 +54728,12 @@ stage2-end:: mv prev-zlib stage1-zlib ; : ; \ fi @endif zlib +@if lto-plugin + @if test -d $(HOST_SUBDIR)/lto-plugin ; then \ + cd $(HOST_SUBDIR); mv lto-plugin stage2-lto-plugin ; \ + mv prev-lto-plugin stage1-lto-plugin ; : ; \ + fi +@endif lto-plugin @if test -d $(TARGET_SUBDIR) ; then \ mv $(TARGET_SUBDIR) stage2-$(TARGET_SUBDIR) ; \ mv prev-$(TARGET_SUBDIR) stage1-$(TARGET_SUBDIR) ; : ; \ @@ -53988,6 +54908,12 @@ stage3-start:: mv stage3-zlib zlib ; \ mv stage2-zlib prev-zlib || test -f stage2-lean @endif zlib +@if lto-plugin + @cd $(HOST_SUBDIR); [ -d stage3-lto-plugin ] || \ + mkdir stage3-lto-plugin; \ + mv stage3-lto-plugin lto-plugin ; \ + mv stage2-lto-plugin prev-lto-plugin || test -f stage2-lean +@endif lto-plugin @[ -d stage3-$(TARGET_SUBDIR) ] || \ mkdir stage3-$(TARGET_SUBDIR); \ mv stage3-$(TARGET_SUBDIR) $(TARGET_SUBDIR) ; \ @@ -54096,6 +55022,12 @@ stage3-end:: mv prev-zlib stage2-zlib ; : ; \ fi @endif zlib +@if lto-plugin + @if test -d $(HOST_SUBDIR)/lto-plugin ; then \ + cd $(HOST_SUBDIR); mv lto-plugin stage3-lto-plugin ; \ + mv prev-lto-plugin stage2-lto-plugin ; : ; \ + fi +@endif lto-plugin @if test -d $(TARGET_SUBDIR) ; then \ mv $(TARGET_SUBDIR) stage3-$(TARGET_SUBDIR) ; \ mv prev-$(TARGET_SUBDIR) stage2-$(TARGET_SUBDIR) ; : ; \ @@ -54326,6 +55258,12 @@ stage4-start:: mv stage4-zlib zlib ; \ mv stage3-zlib prev-zlib || test -f stage3-lean @endif zlib +@if lto-plugin + @cd $(HOST_SUBDIR); [ -d stage4-lto-plugin ] || \ + mkdir stage4-lto-plugin; \ + mv stage4-lto-plugin lto-plugin ; \ + mv stage3-lto-plugin prev-lto-plugin || test -f stage3-lean +@endif lto-plugin @[ -d stage4-$(TARGET_SUBDIR) ] || \ mkdir stage4-$(TARGET_SUBDIR); \ mv stage4-$(TARGET_SUBDIR) $(TARGET_SUBDIR) ; \ @@ -54434,6 +55372,12 @@ stage4-end:: mv prev-zlib stage3-zlib ; : ; \ fi @endif zlib +@if lto-plugin + @if test -d $(HOST_SUBDIR)/lto-plugin ; then \ + cd $(HOST_SUBDIR); mv lto-plugin stage4-lto-plugin ; \ + mv prev-lto-plugin stage3-lto-plugin ; : ; \ + fi +@endif lto-plugin @if test -d $(TARGET_SUBDIR) ; then \ mv $(TARGET_SUBDIR) stage4-$(TARGET_SUBDIR) ; \ mv prev-$(TARGET_SUBDIR) stage3-$(TARGET_SUBDIR) ; : ; \ @@ -54652,6 +55596,12 @@ stageprofile-start:: mv stageprofile-zlib zlib ; \ mv stage1-zlib prev-zlib || test -f stage1-lean @endif zlib +@if lto-plugin + @cd $(HOST_SUBDIR); [ -d stageprofile-lto-plugin ] || \ + mkdir stageprofile-lto-plugin; \ + mv stageprofile-lto-plugin lto-plugin ; \ + mv stage1-lto-plugin prev-lto-plugin || test -f stage1-lean +@endif lto-plugin @[ -d stageprofile-$(TARGET_SUBDIR) ] || \ mkdir stageprofile-$(TARGET_SUBDIR); \ mv stageprofile-$(TARGET_SUBDIR) $(TARGET_SUBDIR) ; \ @@ -54760,6 +55710,12 @@ stageprofile-end:: mv prev-zlib stage1-zlib ; : ; \ fi @endif zlib +@if lto-plugin + @if test -d $(HOST_SUBDIR)/lto-plugin ; then \ + cd $(HOST_SUBDIR); mv lto-plugin stageprofile-lto-plugin ; \ + mv prev-lto-plugin stage1-lto-plugin ; : ; \ + fi +@endif lto-plugin @if test -d $(TARGET_SUBDIR) ; then \ mv $(TARGET_SUBDIR) stageprofile-$(TARGET_SUBDIR) ; \ mv prev-$(TARGET_SUBDIR) stage1-$(TARGET_SUBDIR) ; : ; \ @@ -54911,6 +55867,12 @@ stagefeedback-start:: mv stagefeedback-zlib zlib ; \ mv stageprofile-zlib prev-zlib || test -f stageprofile-lean @endif zlib +@if lto-plugin + @cd $(HOST_SUBDIR); [ -d stagefeedback-lto-plugin ] || \ + mkdir stagefeedback-lto-plugin; \ + mv stagefeedback-lto-plugin lto-plugin ; \ + mv stageprofile-lto-plugin prev-lto-plugin || test -f stageprofile-lean +@endif lto-plugin @[ -d stagefeedback-$(TARGET_SUBDIR) ] || \ mkdir stagefeedback-$(TARGET_SUBDIR); \ mv stagefeedback-$(TARGET_SUBDIR) $(TARGET_SUBDIR) ; \ @@ -55019,6 +55981,12 @@ stagefeedback-end:: mv prev-zlib stageprofile-zlib ; : ; \ fi @endif zlib +@if lto-plugin + @if test -d $(HOST_SUBDIR)/lto-plugin ; then \ + cd $(HOST_SUBDIR); mv lto-plugin stagefeedback-lto-plugin ; \ + mv prev-lto-plugin stageprofile-lto-plugin ; : ; \ + fi +@endif lto-plugin @if test -d $(TARGET_SUBDIR) ; then \ mv $(TARGET_SUBDIR) stagefeedback-$(TARGET_SUBDIR) ; \ mv prev-$(TARGET_SUBDIR) stageprofile-$(TARGET_SUBDIR) ; : ; \ @@ -55422,6 +56390,14 @@ all-stageprofile-libcpp: maybe-all-stageprofile-intl all-stagefeedback-libcpp: maybe-all-stagefeedback-intl all-fixincludes: maybe-all-libiberty all-gnattools: maybe-all-target-libada +all-lto-plugin: maybe-all-libiberty + +all-stage1-lto-plugin: maybe-all-stage1-libiberty +all-stage2-lto-plugin: maybe-all-stage2-libiberty +all-stage3-lto-plugin: maybe-all-stage3-libiberty +all-stage4-lto-plugin: maybe-all-stage4-libiberty +all-stageprofile-lto-plugin: maybe-all-stageprofile-libiberty +all-stagefeedback-lto-plugin: maybe-all-stagefeedback-libiberty configure-mpfr: maybe-all-gmp configure-stage1-mpfr: maybe-all-stage1-gmp diff --git a/Makefile.tpl b/Makefile.tpl index 476cd5d291b..45a58c56a40 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -222,6 +222,8 @@ HOST_EXPORTS = \ PPLINC="$(HOST_PPLINC)"; export PPLINC; \ CLOOGLIBS="$(HOST_CLOOGLIBS)"; export CLOOGLIBS; \ CLOOGINC="$(HOST_CLOOGINC)"; export CLOOGINC; \ + LIBELFLIBS="$(HOST_LIBELFLIBS)" ; export LIBELFLIBS; \ + LIBELFINC="$(HOST_LIBELFINC)" ; export LIBELFINC; \ @if gcc-bootstrap $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \ @endif gcc-bootstrap @@ -296,6 +298,10 @@ HOST_PPLINC = @pplinc@ HOST_CLOOGLIBS = @clooglibs@ HOST_CLOOGINC = @clooginc@ +# Where to find libelf +HOST_LIBELFLIBS = @libelflibs@ +HOST_LIBELFINC = @libelfinc@ + # ---------------------------------------------- # Programs producing files for the BUILD machine # ---------------------------------------------- diff --git a/configure b/configure index 263b934c931..76084ed5158 100755 --- a/configure +++ b/configure @@ -553,6 +553,42 @@ PACKAGE_URL= ac_unique_file="move-if-change" enable_option_checking=no +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + ac_subst_vars='LTLIBOBJS LIBOBJS compare_exclusions @@ -637,6 +673,12 @@ CFLAGS_FOR_TARGET DEBUG_PREFIX_CFLAGS_FOR_TARGET SYSROOT_CFLAGS_FOR_TARGET stage1_languages +extra_host_libiberty_configure_flags +libelfinc +libelflibs +EGREP +GREP +CPP clooginc clooglibs pplinc @@ -764,6 +806,10 @@ with_cloog with_cloog_include with_cloog_lib enable_cloog_version_check +enable_lto +with_libelf +with_libelf_include +with_libelf_lib enable_stage1_languages enable_objc_gc with_build_sysroot @@ -787,6 +833,7 @@ CPPFLAGS CXX CXXFLAGS CCC +CPP AR AS DLLTOOL @@ -1441,6 +1488,7 @@ Optional Features: --enable-build-with-cxx build with C++ compiler instead of C compiler --disable-ppl-version-check disable check for PPL version --disable-cloog-version-check disable check for CLooG version + --enable-lto enable link time optimization support --enable-stage1-languages[=all] choose additional languages to build during stage1. Mostly useful for compiler development. --enable-objc-gc enable use of Boehm's garbage collector with the @@ -1495,6 +1543,11 @@ Optional Packages: plus --with-cloog-lib=PATH/lib --with-cloog-include=PATH Specify directory for installed CLooG include files --with-cloog-lib=PATH Specify the directory for the installed CLooG library + --with-libelf=PATH Specify prefix directory for the installed libelf package + Equivalent to --with-libelf-include=PATH/include + plus --with-libelf-lib=PATH/lib + --with-libelf-include=PATH Specify directory for installed libelf include files + --with-libelf-lib=PATH Specify the directory for the installed libelf library --with-build-sysroot=SYSROOT use sysroot as the system root during the build --with-debug-prefix-map='A=B C=D ...' @@ -1514,6 +1567,7 @@ Some influential environment variables: you have headers in a nonstandard directory CXX C++ compiler command CXXFLAGS C++ compiler flags + CPP C preprocessor AR AR for the host AS AS for the host DLLTOOL DLLTOOL for the host @@ -1760,6 +1814,203 @@ fi return $ac_retval } # ac_fn_c_try_link + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + return $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + return $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_header_compile cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -2768,6 +3019,13 @@ if test x$with_gnu_as = xno ; then noconfigdirs="$noconfigdirs gas" fi +use_included_zlib= +# Make sure we don't let ZLIB be added if we didn't want it. +if test x$with_system_zlib = xyes ; then + use_included_zlib=no + noconfigdirs="$noconfigdirs zlib" +fi + # some tools are so dependent upon X11 that if we're not building with X, # it's not even worth trying to configure, much less build, that tool. @@ -5667,6 +5925,602 @@ fi +# Check for LTO support. +# Check whether --enable-lto was given. +if test "${enable_lto+set}" = set; then : + enableval=$enable_lto; enable_lto=$enableval +else + enable_lto=yes; default_enable_lto=yes +fi + + +if test x"$enable_lto" = x"yes" ; then + # Make sure that libelf.h and gelf.h are available. + +# Check whether --with-libelf was given. +if test "${with_libelf+set}" = set; then : + withval=$with_libelf; +fi + + + +# Check whether --with-libelf_include was given. +if test "${with_libelf_include+set}" = set; then : + withval=$with_libelf_include; +fi + + + +# Check whether --with-libelf_lib was given. +if test "${with_libelf_lib+set}" = set; then : + withval=$with_libelf_lib; +fi + + + case $with_libelf in + "") + libelflibs="-lelf" + libelfinc="-I/usr/include/libelf" + ;; + *) + libelflibs="-L$with_libelf/lib -lelf" + libelfinc="-I$with_libelf/include -I$with_libelf/include/libelf" + LIBS="$libelflibs $LIBS" + ;; + esac + + if test "x$with_libelf_include" != x; then + libelfinc="-I$with_libelf_include" + fi + + if test "x$with_libelf_lib" != x; then + libelflibs="-L$with_libelf_lib -lelf" + LIBS="$libelflibs $LIBS" + fi + + if test "x$with_libelf$with_libelf_include$with_libelf_lib" = x \ + && test -d ${srcdir}/libelf; then + libelflibs='-L$$r/$(HOST_SUBDIR)/libelf/.libs -L$$r/$(HOST_SUBDIR)/libelf/_libs -lelf ' + libelfinc='-I$$r/$(HOST_SUBDIR)/libelf/include -I$$s/libelf/include' + LIBS="$libelflibs $LIBS" + fi + + saved_CFLAGS="$CFLAGS" + saved_CPPFLAGS="$CPPFLAGS" + saved_LIBS="$LIBS" + + CFLAGS="$CFLAGS $libelfinc" + CPPFLAGS="$CPPFLAGS $libelfinc" + LIBS="$LIBS $libelflibs" + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if test "${ac_cv_path_GREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if test "${ac_cv_header_stdc+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +eval as_val=\$$as_ac_Header + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in libelf.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "libelf.h" "ac_cv_header_libelf_h" "$ac_includes_default" +if test "x$ac_cv_header_libelf_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBELF_H 1 +_ACEOF + have_libelf_h=yes +fi + +done + + for ac_header in gelf.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "gelf.h" "ac_cv_header_gelf_h" "$ac_includes_default" +if test "x$ac_cv_header_gelf_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GELF_H 1 +_ACEOF + have_gelf_h=yes +fi + +done + + + for ac_header in libelf/libelf.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "libelf/libelf.h" "ac_cv_header_libelf_libelf_h" "$ac_includes_default" +if test "x$ac_cv_header_libelf_libelf_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBELF_LIBELF_H 1 +_ACEOF + have_libelf_libelf_h=yes +fi + +done + + for ac_header in libelf/gelf.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "libelf/gelf.h" "ac_cv_header_libelf_gelf_h" "$ac_includes_default" +if test "x$ac_cv_header_libelf_gelf_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBELF_GELF_H 1 +_ACEOF + have_libelf_gelf_h=yes +fi + +done + + + # If we couldn't find libelf.h and the user forced it, emit an error. + if test x"$have_libelf_h" != x"yes" \ + && test x"$have_libelf_libelf_h" != x"yes" ; then + if test x"$default_enable_lto" != x"yes" ; then + as_fn_error "LTO support requires libelf.h or libelf/libelf.h." "$LINENO" 5 + else + enable_lto=no + libelflibs= + libelfinc= + fi + fi + + # If we couldn't find gelf.h and the user forced it, emit an error. + if test x"$have_gelf_h" != x"yes" \ + && test x"$have_libelf_gelf_h" != x"yes" ; then + if test x"$default_enable_lto" != x"yes" ; then + as_fn_error "LTO support requires gelf.h or libelf/gelf.h." "$LINENO" 5 + else + enable_lto=no + libelflibs= + libelfinc= + fi + fi + + # Check that the detected libelf has the functions we need. We cannot + # rely on just detecting the headers since they do not include + # versioning information. Add functions, if needed. + if test x"$enable_lto" = x"yes" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the correct version of libelf" >&5 +$as_echo_n "checking for the correct version of libelf... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + + elf_errmsg (0); + elf_getscn (0, 0); + elf_nextscn (0, 0); + elf_strptr (0, 0, 0); + elf_getident (0, 0); + elf_getshdrstrndx (0, 0); + elf_begin (0, 0, 0); + elf_ndxscn (0); + elf_end (0); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; }; +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; }; enable_lto=no; libelflibs= ; libelfinc= + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + # If we couldn't enable LTO and the user forced it, emit an error. + if test x"$enable_lto" = x"no" \ + && test x"$default_enable_lto" != x"yes" ; then + as_fn_error "To enable LTO, GCC requires libelf v0.8.12+. +Try the --with-libelf, --with-libelf-include and --with-libelf-lib options +to specify its location." "$LINENO" 5 + fi + fi + + CFLAGS="$saved_CFLAGS" + CPPFLAGS="$saved_CPPFLAGS" + LIBS="$saved_LIBS" + + # Flags needed for libelf. + + +fi + # By default, C is the only stage 1 language. stage1_languages=,c, @@ -5735,6 +6589,18 @@ if test -d ${srcdir}/gcc; then done new_enable_languages=,c, + + # If LTO is enabled, add the LTO front end. + extra_host_libiberty_configure_flags= + if test "$enable_lto" = "yes" ; then + new_enable_languages="${new_enable_languages}lto," + if test "${ENABLE_GOLD}" = "yes" ; then + configdirs="$configdirs lto-plugin" + extra_host_libiberty_configure_flags=--enable-shared + fi + fi + + missing_languages=`echo ",$enable_languages," | sed -e s/,all,/,/ -e s/,c,/,/ ` potential_languages=,c, @@ -6197,7 +7063,7 @@ if test x"${with_libs}" != x && test x"${with_libs}" != xno ; then fi fi -# Set with_gnu_as and with_gnu_ld as appropriate. +# Set with_gnu_as, with_gnu_ld, and with_system_zlib as appropriate. # # This is done by determining whether or not the appropriate directory # is available, and by checking whether or not specific configurations @@ -6208,7 +7074,9 @@ fi # # If the default for a toolchain is to use GNU as and ld, and you don't # want to do that, then you should use the --without-gnu-as and -# --without-gnu-ld options for the configure script. +# --without-gnu-ld options for the configure script. Similarly, if +# the default is to use the included zlib and you don't want to do that, +# you should use the --with-system-zlib option for the configure script. if test x${use_gnu_as} = x && echo " ${configdirs} " | grep " gas " > /dev/null 2>&1 ; then @@ -6222,6 +7090,14 @@ if test x${use_gnu_ld} = x && extra_host_args="$extra_host_args --with-gnu-ld" fi +if test x${use_included_zlib} = x && + echo " ${configdirs} " | grep " zlib " > /dev/null 2>&1 ; then + : +else + with_system_zlib=yes + extra_host_args="$extra_host_args --with-system-zlib" +fi + # If using newlib, add --with-newlib to the extra_host_args so that gcc/configure # can detect this case. diff --git a/configure.ac b/configure.ac index 0e68f43a765..c961fe8ba98 100644 --- a/configure.ac +++ b/configure.ac @@ -260,6 +260,13 @@ if test x$with_gnu_as = xno ; then noconfigdirs="$noconfigdirs gas" fi +use_included_zlib= +# Make sure we don't let ZLIB be added if we didn't want it. +if test x$with_system_zlib = xyes ; then + use_included_zlib=no + noconfigdirs="$noconfigdirs zlib" +fi + # some tools are so dependent upon X11 that if we're not building with X, # it's not even worth trying to configure, much less build, that tool. @@ -1611,6 +1618,127 @@ fi AC_SUBST(clooglibs) AC_SUBST(clooginc) +# Check for LTO support. +AC_ARG_ENABLE(lto, +[ --enable-lto enable link time optimization support], +enable_lto=$enableval, +enable_lto=yes; default_enable_lto=yes) + +if test x"$enable_lto" = x"yes" ; then + # Make sure that libelf.h and gelf.h are available. + AC_ARG_WITH(libelf, [ --with-libelf=PATH Specify prefix directory for the installed libelf package + Equivalent to --with-libelf-include=PATH/include + plus --with-libelf-lib=PATH/lib]) + + AC_ARG_WITH(libelf_include, [ --with-libelf-include=PATH Specify directory for installed libelf include files]) + + AC_ARG_WITH(libelf_lib, [ --with-libelf-lib=PATH Specify the directory for the installed libelf library]) + + case $with_libelf in + "") + libelflibs="-lelf" + libelfinc="-I/usr/include/libelf" + ;; + *) + libelflibs="-L$with_libelf/lib -lelf" + libelfinc="-I$with_libelf/include -I$with_libelf/include/libelf" + LIBS="$libelflibs $LIBS" + ;; + esac + + if test "x$with_libelf_include" != x; then + libelfinc="-I$with_libelf_include" + fi + + if test "x$with_libelf_lib" != x; then + libelflibs="-L$with_libelf_lib -lelf" + LIBS="$libelflibs $LIBS" + fi + + if test "x$with_libelf$with_libelf_include$with_libelf_lib" = x \ + && test -d ${srcdir}/libelf; then + libelflibs='-L$$r/$(HOST_SUBDIR)/libelf/.libs -L$$r/$(HOST_SUBDIR)/libelf/_libs -lelf ' + libelfinc='-I$$r/$(HOST_SUBDIR)/libelf/include -I$$s/libelf/include' + LIBS="$libelflibs $LIBS" + fi + + saved_CFLAGS="$CFLAGS" + saved_CPPFLAGS="$CPPFLAGS" + saved_LIBS="$LIBS" + + CFLAGS="$CFLAGS $libelfinc" + CPPFLAGS="$CPPFLAGS $libelfinc" + LIBS="$LIBS $libelflibs" + + AC_CHECK_HEADERS(libelf.h, [have_libelf_h=yes]) + AC_CHECK_HEADERS(gelf.h, [have_gelf_h=yes]) + + AC_CHECK_HEADERS(libelf/libelf.h, [have_libelf_libelf_h=yes]) + AC_CHECK_HEADERS(libelf/gelf.h, [have_libelf_gelf_h=yes]) + + # If we couldn't find libelf.h and the user forced it, emit an error. + if test x"$have_libelf_h" != x"yes" \ + && test x"$have_libelf_libelf_h" != x"yes" ; then + if test x"$default_enable_lto" != x"yes" ; then + AC_MSG_ERROR([LTO support requires libelf.h or libelf/libelf.h.]) + else + enable_lto=no + libelflibs= + libelfinc= + fi + fi + + # If we couldn't find gelf.h and the user forced it, emit an error. + if test x"$have_gelf_h" != x"yes" \ + && test x"$have_libelf_gelf_h" != x"yes" ; then + if test x"$default_enable_lto" != x"yes" ; then + AC_MSG_ERROR([LTO support requires gelf.h or libelf/gelf.h.]) + else + enable_lto=no + libelflibs= + libelfinc= + fi + fi + + # Check that the detected libelf has the functions we need. We cannot + # rely on just detecting the headers since they do not include + # versioning information. Add functions, if needed. + if test x"$enable_lto" = x"yes" ; then + AC_MSG_CHECKING([for the correct version of libelf]) + AC_TRY_LINK( + [#include ],[ + elf_errmsg (0); + elf_getscn (0, 0); + elf_nextscn (0, 0); + elf_strptr (0, 0, 0); + elf_getident (0, 0); + elf_getshdrstrndx (0, 0); + elf_begin (0, 0, 0); + elf_ndxscn (0); + elf_end (0); + ], + [AC_MSG_RESULT([yes]);], + [AC_MSG_RESULT([no]); enable_lto=no; libelflibs= ; libelfinc= ] + ) + + # If we couldn't enable LTO and the user forced it, emit an error. + if test x"$enable_lto" = x"no" \ + && test x"$default_enable_lto" != x"yes" ; then + AC_MSG_ERROR([To enable LTO, GCC requires libelf v0.8.12+. +Try the --with-libelf, --with-libelf-include and --with-libelf-lib options +to specify its location.]) + fi + fi + + CFLAGS="$saved_CFLAGS" + CPPFLAGS="$saved_CPPFLAGS" + LIBS="$saved_LIBS" + + # Flags needed for libelf. + AC_SUBST(libelflibs) + AC_SUBST(libelfinc) +fi + # By default, C is the only stage 1 language. stage1_languages=,c, @@ -1679,6 +1807,18 @@ if test -d ${srcdir}/gcc; then done new_enable_languages=,c, + + # If LTO is enabled, add the LTO front end. + extra_host_libiberty_configure_flags= + if test "$enable_lto" = "yes" ; then + new_enable_languages="${new_enable_languages}lto," + if test "${ENABLE_GOLD}" = "yes" ; then + configdirs="$configdirs lto-plugin" + extra_host_libiberty_configure_flags=--enable-shared + fi + fi + AC_SUBST(extra_host_libiberty_configure_flags) + missing_languages=`echo ",$enable_languages," | sed -e s/,all,/,/ -e s/,c,/,/ ` potential_languages=,c, @@ -2088,7 +2228,7 @@ if test x"${with_libs}" != x && test x"${with_libs}" != xno ; then fi fi -# Set with_gnu_as and with_gnu_ld as appropriate. +# Set with_gnu_as, with_gnu_ld, and with_system_zlib as appropriate. # # This is done by determining whether or not the appropriate directory # is available, and by checking whether or not specific configurations @@ -2099,7 +2239,9 @@ fi # # If the default for a toolchain is to use GNU as and ld, and you don't # want to do that, then you should use the --without-gnu-as and -# --without-gnu-ld options for the configure script. +# --without-gnu-ld options for the configure script. Similarly, if +# the default is to use the included zlib and you don't want to do that, +# you should use the --with-system-zlib option for the configure script. if test x${use_gnu_as} = x && echo " ${configdirs} " | grep " gas " > /dev/null 2>&1 ; then @@ -2113,6 +2255,14 @@ if test x${use_gnu_ld} = x && extra_host_args="$extra_host_args --with-gnu-ld" fi +if test x${use_included_zlib} = x && + echo " ${configdirs} " | grep " zlib " > /dev/null 2>&1 ; then + : +else + with_system_zlib=yes + extra_host_args="$extra_host_args --with-system-zlib" +fi + # If using newlib, add --with-newlib to the extra_host_args so that gcc/configure # can detect this case. diff --git a/contrib/ChangeLog b/contrib/ChangeLog index b4627d293b6..2dc5d3af5ad 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,9 @@ +2009-10-03 H.J. Lu + Richard Guenther + + PR lto/39216 + * gcc_update: Adjust file timestamps for lto-plugin. + 2009-09-10 Iain Sandoe PR bootstrap/41245 diff --git a/contrib/gcc_update b/contrib/gcc_update index f29dcb60927..3e5a842338c 100755 --- a/contrib/gcc_update +++ b/contrib/gcc_update @@ -84,6 +84,9 @@ gcc/testsuite/gcc.dg/cpp/_Pragma3.c: gcc/testsuite/gcc.dg/cpp/mi1c.h # Similarly, without this, you will see: # direct2s.c:35: warning: current file is older than direct2.c gcc/testsuite/gcc.dg/cpp/direct2s.c: gcc/testsuite/gcc.dg/cpp/direct2.c +# lto-plugin +lto-plugin/configure: lto-plugin/configure.ac lto-plugin/aclocal.m4 +lto-plugin/Makefile.in: lto-plugin/Makefile.am lto-plugin/aclocal.m4 # And libraries, at last libbanshee/configure: libbanshee/configure.ac libmudflap/configure: libmudflap/configure.ac diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7263e90833f..62d725c12ad 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,454 @@ +2009-10-03 Simon Baldwin + Cary Coutant + Rafael Espindola + Richard Guenther + Jan Hubicka + Doug Kwan + H.J. Lu + Bill Maddox + Ryan Mansfield + Diego Novillo + Ollie Wild + Kenneth Zadeck + + * lto-cgraph.c: New file. + * lto-compress.c: New file. + * lto-compress.h: New file. + * lto-opts.c: New file. + * lto-section-in.c: New file. + * lto-section-out.c: New file. + * lto-streamer-in.c: New file. + * lto-streamer-out.c: New file. + * lto-streamer.c: New file. + * lto-streamer.h: New file. + * lto-symtab.c: New file. + * lto-wpa-fixup.c: New file. + * lto-wrapper.c: New file. + +2009-10-03 Simon Baldwin + Ben Elliston + Rafael Espindola + Nathan Froyd + Jan Hubicka + Doug Kwan + Diego Novillo + Kenneth Zadeck + + * Makefile.in (enable_lto): New. + (site.exp): If @enable_lto@ is set to 'yes' define + ENABLE_LTO. + (LINKER_PLUGIN_API_H): Define. + (LTO_SYMTAB_H): Define. + (LTO_STREAMER_H): Define. + (TREE_VECTORIZER_H): Define. + (INCLUDES): Add LIBELFINC. + (OBJS-common): Add lto-cgraph.o, lto-streamer-in.o, + lto-streamer-out.o, lto-section-in.o, lto-section-out.o, + lto-symtab.o, lto-opts.o, lto-streamer.o, lto-wpa-fixup.o, + lto-compress.o. + (MOSTLYCLEANFILES): Add lto-wrapper$(exeext) + (native): Add lto-wrapper$(exeext) + (lto-compress.o, lto-cgraph.o, lto-streamer-in.o, + lto-streamer-out.o, lto-section-in.o, lto-section-out.o, + lto-symtab.o, lto-opts.o, lto-streamer.o, + lto-wpa-fixup.o): New rules. + (gimple.o): Add dependency on LTO_HEADER_H and + LTO_SECTION_OUT_H. + (varasm.o): Add dependency on tree-iterator.h. + (cgraph.o): Add dependency on cif-code.def. + (ipa-reference.o): Add dependency on LTO_STREAMER_H. + (ipa-pure-const.o): Likewise. + (GTFILES): Add lto-symtab.c. + (install-lto-wrapper): New. + * configure.ac: If 'lto' is in enable_languages, define + ENABLE_LTO and enable_lto. + If LIBELFLIBS is set, define HAVE_libelf. + * config.in: Regenerate. + +2009-10-03 Rafael Espindola + Diego Novillo + + * cgraphunit.c (ipa_passes): Prevent lto1 from calling + ipa_write_summaries. + Call execute_ipa_summary_passes for all_regular_ipa_passes and + all_lto_gen_passes. + (cgraph_optimize): Make extern. + +2009-10-03 Nathan Froyd + Kenneth Zadeck + + * toplev.c (in_lto_p): Declare. + * collect2.c (scan_prog_file): Read all the output when reading + information for LTO. + (enum lto_mode_d): Declare. + +2009-10-03 Richard Guenther + Diego Novillo + + * gimple.c: Include target.h and alias.h. + (gimple_types): Declare. + (type_hash_cache): Declare. + (gimple_alloc_stat): Make extern. + (gimple_build_eh_must_not_throw): Call + gimple_eh_must_not_throw_set_fndecl. + (struct type_pair_d): Declare. + (type_pair_t): Declare. + (type_pair_hash): New. + (type_pair_eq): New. + (lookup_type_pair): New. + (gimple_force_type_merge): New. + (compare_type_names_p): New. + (compare_field_offset): New. + (gimple_types_compatible_p): New. + (struct sccs): Declare. + (next_dfs_num): Declare. + (iterative_hash_gimple_type): New. + (visit): New. + (iterative_hash_type_name): New. + (iterative_hash_gimple_type): New. + (gimple_type_hash): New. + (gimple_type_eq): New. + (gimple_register_type): New. + (print_gimple_types_stats): New. + (gimple_signed_or_unsigned_type): New. + (gimple_unsigned_type): New. + (gimple_signed_type): New. + (gimple_get_alias_set): New. + (gimple_decl_printable_name): Do not use DMGL_TYPES. + * gimple.h (gimple_alloc, gimple_alloc_stat): Declare. + (gimple_force_type_merge): Declare. + (gimple_types_compatible_p): Declare. + (gimple_register_type): Declare. + (print_gimple_types_stats): Declare. + (gimple_unsigned_type): Declare. + (gimple_signed_type): Declare. + (gimple_get_alias_set): Declare. + (gimple_eh_must_not_throw_set_fndecl): New. + +2009-10-03 Jan Hubicka + Kenneth Zadeck + + * ipa-pure-const.c: Include lto-streamer.h. + (register_hooks): Factor out of ... + (generate_summary): ... here. + (pure_const_write_summary): New. + (pure_const_read_summary): New. + (pass_ipa_pure_const): Add pure_const_write_summary and + pure_const_read_summary. + * ipa-reference.c: Include lto-streamer.h. + (add_new_function): New. + (remove_node_data): New. + (duplicate_node_data): New. + (ipa_init): Guard against multiple calls. + Move hook setup from analyze_function. + (write_node_summary_p): New. + (ipa_reference_write_summary): New. + (ipa_reference_read_summary): New. + (pass_ipa_reference): Add ipa_reference_write_summary and + ipa_reference_read_summary. + * cgraph.h (cgraph_local_info): Add field lto_file_data. + (struct cgraph_edge): Add fields lto_stmt_uid and + call_stmt_cannot_inline_p. + (cgraph_optimize): Declare. + (cgraph_decide_is_function_needed): Declare. + (reset_inline_failed): Declare. + (enum LTO_cgraph_tags): Declare. + (LTO_cgraph_tag_names): Declare. + (LCC_NOT_FOUND): Define. + +2009-10-03 Doug Kwan + Rafael Espindola + Jan Hubicka + Diego Novillo + Kenneth Zadeck + + * passes.c (all_regular_ipa_passes): New. + (all_ipa_passes): Rename to all_small_ipa_passes. + (init_optimization_passes): Init all_regular_ipa_passes. + * tree-pass.h (all_regular_ipa_passes): New. + (all_ipa_passes): Rename to all_small_ipa_passes. + * passes.c (all_lto_gen_passes): New. + (init_optimization_passes): Initialize all_lto_gen_passes. + (execute_ipa_summary_passes): Make non-static. + (ipa_write_summaries_1): New. + (ipa_write_summaries_2): New. + (ipa_write_summaries): New. + (ipa_write_summaries_of_cgraph_node_set): New. + (ipa_read_summaries_1): New. + (ipa_read_summaries): New. + (execute_ipa_pass_list): Call cgraph_process_new_functions. + (execute_regular_ipa_pass_list): Remove. + (init_optimization_passes): Schedule + pass_rebuild_cgraph_edges and pass_early_inline outside + of pass_all_early_optimizations. Document reason. + (pass_ipa_lto_gimple_out, pass_ipa_lto_wpa_fixup, + pass_ipa_lto_finish_out): New pass. + (pass_ipa_summary_passes): Start and stop timers if the pass + has them. + (execute_all_ipa_transforms): New. + (execute_one_pass): Don't call execute_one_ipa_transform_pass. + (dump_properties, debug_properties): New. + * tree-optimize.c (gate_all_early_local_passes): Return + false if we are in lto1. + (tree_rest_of_compilation): Call execute_all_ipa_transforms. + * tree-pass.h (execute_all_ipa_transforms): Declare. + (pass_ipa_function_and_variable_visibility): Declare. + (pass_ipa_early_inline): Declare. + (pass_ipa_lto_gimple_out): Declare. + (pass_ipa_lto_wpa_fixup): Declare. + (pass_ipa_lto_finish_out): Declare. + (all_small_ipa_passes, all_regular_ipa_passes, + all_lto_gen_passes): Declare. + (execute_ipa_summary_passes): Declare. + (execute_all_ipa_transforms): Declare. + (ipa_write_summaries): Declare + (ipa_write_summaries_of_cgraph_node_set): Declare. + (ipa_read_summaries): Declare. + +2009-10-03 Doug Kwan + Ollie Wild + + * ipa-prop.c (ipa_propagate_indirect_call_infos): Do + nothing in WPA. + + * collect2.c (LTO_MODE_NONE, LTO_MODE_LTO, LTO_MODE_WPA): New enums. + (lto_mode): New variable. + (maybe_run_lto_and_relink): Handle the -fwpa option. + (main): Handle the -fwpa option. + (maybe_unlink_list): New function. + * gcc.c (link_lto_options): Replace -flto with -fwpa. + * common.opt (flto): New flag. + * toplev.c (flag_generate_lto): Declare. + +2009-10-03 Simon Baldwin + + * common.opt (flto-compression-level): New flag. + + * opts.c: Include lto-opts.h. + (handle_option): Call lto_register_user_option for each + valid option handled. + * (decode_options): Clear registered options before the options + handling loop. + +2009-10-03 Cary Coutant + + * collect2.c (is_elf): New function. + (scan_prog_file): Require LTO object to be in ELF format. + +2009-10-03 Rafael Espindola + + * gcc.c (LINK_COMMAND_SPEC): Use the -pass-through option to pass + libgcc to the linker. + + * ipa-cp.c (cgraph_gate_cp): Return false if LTRANS is + running. + + * collect2.c (maybe_run_lto_and_relink): Execute lto-wrapper. + (collect_execute): Add flags argument. Pass flags to pex_run. Update + all callers. + * collect2.h (collect_execute): Add flags argument. + * tlink.c (tlink_execute): Update call to collect_execute. + * gcc.c (main): Set the COLLECT_LTO_WRAPPER environment variable. + (use_linker_plugin): New. + (use_linker_plugin_spec_function): New. + (LINK_COMMAND_SPEC): Pass plugin options to the linker. + (linker_plugin_file_spec): New. + (lto_wrapper_spec): New. + (lto_gcc_spec): New. + (static_specs): Add linker_plugin_file, lto_wrapper and lto_gcc. + (static_spec_functions): Add use-linker-plugin. + (process_command): Handle -use-linker-plugin. + (main): Use lto_wrapper_spec instead of lto_wrapper. Set + linker_plugin_file_spec and lto_gcc_spec. + (use_linker_plugin_spec_function): New. + +2009-10-03 Richard Guenther + + PR lto/41547 + PR lto/41548 + * tree.h (is_lang_specific): Include LANG_TYPE. + * tree.c (find_decls_types_r): Manually add interesting parts + of TYPE_FIELDS. Walk BINFO_VIRTUALS. Do not walk TYPE_METHODS. + + * gimple.c (type_pair_hash): Make symmetric. + (type_pair_eq): Likewise. + (lookup_type_pair): Increase initial hashtable size. + (gimple_force_type_merge): Rely on type-pair symmetry. + (visit): Remove excessive checking code. + (iterative_hash_type_name): Do not hash TYPE_NAME of + anonymous unions. + (gimple_register_type): Remove getenv calls, shrink initial + hashtable size. + + PR middle-end/41502 + * cgraphunit.c (ipa_passes): Do not remove bodies of extern + inline functions if not generating lto output. + + PR lto/41379 + * toplev.c (finalize): In WPA mode remove the asm file. + +2009-10-03 Doug Kwan + + * ipa-inline.c (cgraph_mark_inline): Check + edge->call_stmt_cannot_inline_p instead of calling + gimple_call_cannot_inline_p. + (cgraph_decide_inlining): Do nothing in WPA and LTRANS. + (cgraph_gate_ipa_early_inlining): Return false if + in_lto_p is set. + (inline_generate_summary): Do nothing in LTRANS. + * cgraph.c (initialize_inline_failed): Make sure + e->call_stmt exists before calling + gimple_call_cannot_inline_p. + (cgraph_create_edge): Set edge->call_stmt_cannot_inline_p. + (cgraph_clone_edge): Add argument STMT_UID. Modify all + callers. + Update new_edge->lto_stmt_uid. + * cgraphbuild.c (reset_inline_failed): New. + + * common.opt (fwpa): New flag. + (fltrans): New option. + * gcc.c (gcc_lto_option_t): New type. + (current_lto_option): New variable. + (lto_single_spec_function): Remove and is replaced by .. + (lto_option_spec_function): New function. + (LINK_COMMAND_SPEC): Use link_lto_option spec instead of just + passing the -flto flag. + (cc1_options): Separate non-LTO related parts into .. + (cc1_non_lto_options): Non-LTO related options shared by all FEs. + (lto1_options): New spec for lto FE. + (link_lto_options): New spec for handling LTO flags in linker. + (invoke_lto_single): Re-format to fit in 80 column. Replace + lto-single with lto-option. + (static_specs): Add cc1_non_lto_options, lto1_options and + link_lto_options. + (static_spec_function): Replace lto-single with lto-option. + (process_command): Handle -flto, -fwpa and -fltran + by setting current_lto_option and not passing it to subprocess + unconditionally. + +2009-10-03 Bill Maddox + + Add `gcc' driver support for link-time code generation (LTO). + + * collect2.c (enum pass): Add new literal PASS_LTOINFO. + (lto_flag, lto_objects, lto_o_file): New variables. + (struct lto_object, struct lto_object_list): New structures. + (collect_exit, handler): Remove LTO temporary output file on exit. + (add_lto_object): New function. + (maybe_run_lto_and_relink): New function. Perform link time code + generation and relinking for object files containing LTO information. + (main): Invoke maybe_run_lto_and_relink(). + (dump_argv): New function. For debugging, currently disabled. + (scan_prog_file): Add LTO information pass. + * gcc.c (LINK_COMMAND_SPEC): Pass `-flto' switch to linker, i.e., + collect2. + * toplev.c (compile_file): Emit assembler directive to create + the `gnu_lto_v1' marker symbol when compiling with `-flto'. + +2009-10-03 Diego Novillo + + * c.opt: Add LTO to warn_abi and warn_psabi. + + * tree.c (fld_worklist_push): Rename from PUSH. + Convert to static inline function. + Ignore language-specific nodes. + Update all users. + (find_decls_types_r): Do not traverse the subtrees of + language-specific nodes. + Do not traverse DECL_INITIAL for TYPE_DECLs. + * tree.h (is_lang_specific): New. + * langhooks.h (struct lang_hooks_for_decls): Remove + may_need_assembler_name_p. Update all users. + + * c-common.c (set_builtin_user_assembler_name): Move ... + * builtins.c (set_builtin_user_assembler_name): ... here. + (is_builtin_name): Add comment + (is_builtin_fn): New. + * except.c (output_ttype): Only call + lookup_type_for_runtime if TYPE is not a runtime type. + + * passes.c (register_pass): Call position_pass on + all_small_ipa_passes, all_regular_ipa_passes and + all_lto_gen_passes. + * timevar.def (TV_IPA_LTO_GIMPLE_IO): Define. + (TV_IPA_LTO_DECL_IO): Define. + (TV_IPA_LTO_CGRAPH_IO): Define. + (TV_LTO): Define. + (TV_WHOPR_WPA): Define. + (TV_WHOPR_WPA_IO): Define. + (TV_WHOPR_LTRANS): Define. + (TV_WHOPR_WPA_FIXUP): Define. + (TV_WHOPR_WPA_LTRANS_EXEC): Define. + * tree-cfg.c (tree_node_can_be_shared): Make extern. + * tree-flow.h (tree_node_can_be_shared): Declare. + * tree-inline.c (tree_can_inline_p): Check that E has a + statement associated with it. + * tree.c (free_lang_data_in_binf): Factor out of ... + (free_lang_data_in_type): ... here. + Call RECORD_OR_UNION_TYPE_P. + (need_assembler_name_p): Ignore DECL if it does not have + TREE_PUBLIC set. + Call lang_hooks.decls.may_need_assembler_name_p if set. + (free_lang_data_in_decl): Do not clear DECL_CONTEXT for + CONST_DECLs. + (free_lang_data): Set debug_info_level to + DINFO_LEVEL_NONE. + Set write_symbols to NO_DEBUG. + Set debug_hooks to do_nothing_debug_hooks. + (gate_free_lang_data): Return true if flag_generate_lto + is set. + (walk_tree_1): Call RECORD_OR_UNION_TYPE_P. + * c-common.h (set_builtin_user_assembler_name): Move ... + * tree.h (set_builtin_user_assembler_name): ... here. + + * common.opt (flto-report): New flag. + * opts.c (complain_wrong_lang): Do not complain if + running lto1. + * collect2.c (scan_prog_file): Send the error output of + 'nm' to HOST_BIT_BUCKET. + +2009-10-03 Ollie Wild + + * langhooks-def.h (lhd_begin_section): New function declaration. + (lhd_write_section): New function declaration. + (lhd_end_section): New function declaration. + (LANG_HOOKS_BEGIN_SECTION): New macro. + (LANG_HOOKS_WRITE_SECTION_DATA): New macro. + (LANG_HOOKS_END_SECTION): New macro. + (LANG_HOOKS_LTO): New macro. + (LANG_HOOKS_INITIALIZER): Add LANG_HOOKS_LTO. + * langhooks.c (output.h): Add include. + (saved_section): New static variable. + (lhd_begin_section): New function. + (lhd_write_section_data): New function. + (lhd_end_section): New function. + * langhooks.h (struct lang_hooks_for_lto): New structure. + (struct lang_hooks): Add member lto. + * Makefile.in (langhooks.o): Add dependency on output.h. + + * c-opts.c (c_common_post_options): Handle -flto and -fwhopr. + +2009-10-03 Richard Guenther + + * config/rs6000/rs6000.c (rs6000_output_function_epilogue): + Handle LTO. + +2009-10-03 Simon Baldwin + Richard Guenther + Janis Johnson + Doug Kwan + Diego Novillo + Ramana Radhakrishnan + Ollie Wild + + * doc/install.texi: Add documentation for libelf and --enable-lto. + * doc/invoke.texi: Document -fwpa, -flto, -fwhopr, + -fltrans, -flto-report, -flto-compression-level and + -use-linker-plugin. + * doc/sourcebuild.texi: Document use of zlib. + Document lto-plugin. + Add section for LTO Testing. + 2009-10-02 Cary Coutant Add support for comdat type sections for DWARF v4. Merge from dwarf4 diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 40fe3ba80fd..490a8c41eac 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -309,6 +309,13 @@ PPLINC = @PPLINC@ CLOOGLIBS = @CLOOGLIBS@ CLOOGINC = @CLOOGINC@ +# How to find libelf +LIBELFLIBS = @LIBELFLIBS@ +LIBELFINC = @LIBELFINC@ + +# Set to 'yes' if the LTO front end is enabled. +enable_lto = @enable_lto@ + # Libs and linker option needed for plugin support PLUGINLIBS = @pluginlibs@ @@ -407,6 +414,10 @@ PARTITION_H = $(srcdir)/../include/partition.h MD5_H = $(srcdir)/../include/md5.h DWARF2_H = $(srcdir)/../include/dwarf2.h +# Linker plugin API headers +LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h +LTO_SYMTAB_H = $(srcdir)/../include/lto-symtab.h + # Default native SYSTEM_HEADER_DIR, to be overridden by targets. NATIVE_SYSTEM_HEADER_DIR = /usr/include # Default cross SYSTEM_HEADER_DIR, to be overridden by targets. @@ -917,6 +928,9 @@ REAL_H = real.h $(MACHMODE_H) IRA_INT_H = ira.h ira-int.h $(CFGLOOP_H) alloc-pool.h DBGCNT_H = dbgcnt.h dbgcnt.def EBITMAP_H = ebitmap.h sbitmap.h +LTO_STREAMER_H = lto-streamer.h $(LINKER_PLUGIN_API_H) $(TARGET_H) \ + $(CGRAPH_H) vec.h vecprim.h $(TREE_H) $(GIMPLE_H) +TREE_VECTORIZER_H = tree-vectorizer.h $(TREE_DATA_REF_H) IPA_PROP_H = ipa-prop.h $(TREE_H) vec.h $(CGRAPH_H) GSTAB_H = gstab.h stab.def BITMAP_H = bitmap.h $(HASHTAB_H) statistics.h @@ -976,7 +990,8 @@ BUILD_LIBDEPS= $(BUILD_LIBIBERTY) # and the system's installed libraries. LIBS = @LIBS@ $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBIBERTY) $(LIBDECNUMBER) \ $(HOST_LIBS) -BACKENDLIBS = $(CLOOGLIBS) $(PPLLIBS) $(GMPLIBS) $(PLUGINLIBS) $(HOST_LIBS) +BACKENDLIBS = $(CLOOGLIBS) $(PPLLIBS) $(GMPLIBS) $(PLUGINLIBS) $(HOST_LIBS) \ + $(ZLIB) $(LIBELFLIBS) # Any system libraries needed just for GNAT. SYSLIBS = @GNAT_LIBEXC@ @@ -1005,7 +1020,7 @@ BUILD_ERRORS = build/errors.o INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \ -I$(srcdir)/../include @INCINTL@ \ $(CPPINC) $(GMPINC) $(DECNUMINC) \ - $(PPLINC) $(CLOOGINC) + $(PPLINC) $(CLOOGINC) $(LIBELFINC) .c.o: $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $< $(OUTPUT_OPTION) @@ -1215,6 +1230,16 @@ OBJS-common = \ loop-unroll.o \ loop-unswitch.o \ lower-subreg.o \ + lto-cgraph.o \ + lto-streamer-in.o \ + lto-streamer-out.o \ + lto-section-in.o \ + lto-section-out.o \ + lto-symtab.o \ + lto-opts.o \ + lto-streamer.o \ + lto-wpa-fixup.o \ + lto-compress.o \ mcf.o \ mode-switching.o \ modulo-sched.o \ @@ -1411,7 +1436,7 @@ MOSTLYCLEANFILES = insn-flags.h insn-config.h insn-codes.h \ genrtl.c genrtl.h gt-*.h gtype-*.h gtype-desc.c gtyp-input.list \ xgcc$(exeext) cpp$(exeext) cc1$(exeext) cc1*-dummy$(exeext) $(EXTRA_PASSES) \ $(EXTRA_PARTS) $(EXTRA_PROGRAMS) gcc-cross$(exeext) \ - $(SPECS) collect2$(exeext) \ + $(SPECS) collect2$(exeext) lto-wrapper$(exeext) \ gcov-iov$(build_exeext) gcov$(exeext) gcov-dump$(exeext) \ *.[0-9][0-9].* *.[si] *-checksum.c libbackend.a libgcc.mk @@ -1692,7 +1717,7 @@ rest.encap: lang.rest.encap # This is what is made with the host's compiler # whether making a cross compiler or not. native: config.status auto-host.h build-@POSUB@ $(LANGUAGES) \ - $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(COLLECT2) + $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(COLLECT2) lto-wrapper$(exeext) # Define the names for selecting languages in LANGUAGES. c: cc1$(exeext) @@ -1987,6 +2012,12 @@ collect2-aix.o : collect2-aix.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ tlink.o: tlink.c $(DEMANGLE_H) $(HASHTAB_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(OBSTACK_H) collect2.h intl.h +lto-wrapper$(exeext): lto-wrapper.o intl.o $(LIBDEPS) + $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o T$@ lto-wrapper.o intl.o $(LIBS) + mv -f T$@ $@ + +lto-wrapper.o: lto-wrapper.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) intl.h + # A file used by all variants of C. c-common.o : c-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ @@ -2158,10 +2189,54 @@ convert.o: convert.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ double-int.o: double-int.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) +# lto-compress.o needs $(ZLIBINC) added to the include flags. +lto-compress.o: lto-compress.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ + $(TREE_H) langhooks.h $(LTO_HEADER_H) $(LTO_SECTION_H) \ + lto-compress.h $(DIAGNOSTIC_H) errors.h + $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(ZLIBINC) $< $(OUTPUT_OPTION) + +lto-cgraph.o: lto-cgraph.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ + $(TM_H) $(TOPLEV_H) $(EXPR_H) $(FLAGS_H) $(PARAMS_H) input.h \ + $(VARRAY_H) $(HASHTAB_H) langhooks.h $(BASIC_BLOCK_H) \ + $(TREE_FLOW_H) $(CGRAPH_H) $(FUNCTION_H) $(GGC_H) $(DIAGNOSTIC_H) \ + except.h $(TIMEVAR_H) output.h pointer-set.h $(LTO_STREAMER_H) +lto-streamer-in.o: lto-streamer-in.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ + $(TM_H) $(TOPLEV_H) $(EXPR_H) $(FLAGS_H) $(PARAMS_H) input.h $(VARRAY_H) \ + $(HASHTAB_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) $(TREE_PASS_H) $(CGRAPH_H) \ + $(FUNCTION_H) $(GGC_H) $(DIAGNOSTIC_H) libfuncs.h $(EXCEPT_H) debug.h \ + $(TIMEVAR_H) output.h $(IPA_UTILS_H) $(LTO_STREAMER_H) +lto-streamer-out.o : lto-streamer-out.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ + $(TM_H) $(TOPLEV_H) $(TREE_H) $(EXPR_H) $(FLAGS_H) $(PARAMS_H) input.h \ + $(VARRAY_H) $(HASHTAB_H) $(BASIC_BLOCK_H) tree-iterator.h \ + $(TREE_FLOW_H) $(TREE_PASS_H) $(CGRAPH_H) $(FUNCTION_H) $(GGC_H) \ + $(DIAGNOSTIC_H) except.h $(LTO_STREAMER_H) errors.h +lto-section-in.o: lto-section-in.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ + $(TOPLEV_H) $(EXPR_H) $(FLAGS_H) $(PARAMS_H) input.h $(VARRAY_H) \ + $(HASHTAB_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) $(CGRAPH_H) $(FUNCTION_H) \ + $(GGC_H) $(DIAGNOSTIC_H) except.h $(TIMEVAR_H) output.h \ + $(LTO_STREAMER_H) lto-compress.h +lto-section-out.o : lto-section-out.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ + $(TM_H) $(TOPLEV_H) $(TREE_H) $(EXPR_H) $(PARAMS_H) input.h \ + $(VARRAY_H) $(HASHTAB_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) $(TREE_PASS_H) \ + $(CGRAPH_H) $(FUNCTION_H) $(GGC_H) except.h pointer-set.h \ + $(BITMAP_H) langhooks.h $(LTO_STREAMER_H) lto-compress.h +lto-symtab.o: lto-symtab.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ + toplev.h $(TREE_H) $(GIMPLE_H) $(GGC_H) $(LAMBDA_H) $(HASHTAB_H) \ + $(LTO_STREAMER_H) $(LINKER_PLUGIN_API_H) gt-lto-symtab.h +lto-opts.o: lto-opts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \ + $(HASHTAB_H) $(GGC_H) $(BITMAP_H) $(FLAGS_H) opts.h options.h \ + $(TARGET_H) $(TOPLEV_H) $(LTO_STREAMER_H) +lto-streamer.o: lto-streamer.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ + $(TM_H) $(TREE_H) $(GIMPLE_H) $(BITMAP_H) $(LTO_STREAMER_H) $(FLAGS_H) \ + $(TREE_FLOW_H) $(DIAGNOSTIC_H) $(LTO_SYMTAB_H) $(TOPLEV_H) +lto-wpa-fixup.o: lto-wpa-fixup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ + $(TM_H) $(TOPLEV_H) $(TREE_H) $(EXPR_H) $(FLAGS_H) $(CGRAPH_H) \ + $(FUNCTION_H) $(DIAGNOSTIC_H) $(BITMAP_H) $(TIMEVAR_H) \ + $(TREE_FLOW_H) $(TREE_PASS_H) $(LTO_STREAMER_H) langhooks.o : langhooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) $(TOPLEV_H) $(TREE_INLINE_H) $(RTL_H) insn-config.h $(INTEGRATE_H) \ langhooks.h $(TARGET_H) $(LANGHOOKS_DEF_H) $(FLAGS_H) $(GGC_H) $(DIAGNOSTIC_H) \ - intl.h $(GIMPLE_H) $(CGRAPH_H) + intl.h $(GIMPLE_H) $(CGRAPH_H) output.h tree.o : tree.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ all-tree.def $(FLAGS_H) $(FUNCTION_H) $(PARAMS_H) \ $(TOPLEV_H) $(GGC_H) $(HASHTAB_H) $(TARGET_H) output.h $(TM_P_H) \ @@ -2572,7 +2647,8 @@ tree-object-size.o: tree-object-size.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TREE_PASS_H) tree-ssa-propagate.h gimple.o : gimple.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \ $(GGC_H) $(GIMPLE_H) $(TOPLEV_H) $(DIAGNOSTIC_H) gt-gimple.h \ - $(TREE_FLOW_H) value-prof.h $(FLAGS_H) $(DEMANGLE_H) + $(TREE_FLOW_H) value-prof.h $(FLAGS_H) $(DEMANGLE_H) \ + $(TARGET_H) $(ALIAS_H) gimple-pretty-print.o : gimple-pretty-print.c $(CONFIG_H) $(SYSTEM_H) \ $(TREE_H) $(DIAGNOSTIC_H) $(REAL_H) $(HASHTAB_H) $(TREE_FLOW_H) \ $(TM_H) coretypes.h $(TREE_PASS_H) $(GIMPLE_H) value-prof.h @@ -2640,7 +2716,7 @@ passes.o : passes.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ langhooks.h insn-flags.h $(CFGLAYOUT_H) $(REAL_H) $(CFGLOOP_H) \ hosthooks.h $(CGRAPH_H) $(COVERAGE_H) $(TREE_PASS_H) $(TREE_DUMP_H) \ $(GGC_H) $(INTEGRATE_H) $(CPPLIB_H) opts.h $(TREE_FLOW_H) $(TREE_INLINE_H) \ - gt-passes.h $(DF_H) $(PREDICT_H) + gt-passes.h $(DF_H) $(PREDICT_H) $(LTO_HEADER_H) $(LTO_SECTION_OUT_H) plugin.o : plugin.c $(PLUGIN_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TOPLEV_H) $(TREE_H) $(TREE_PASS_H) intl.h $(PLUGIN_VERSION_H) $(GGC_H) @@ -2669,7 +2745,8 @@ varasm.o : varasm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ $(RTL_H) $(FLAGS_H) $(FUNCTION_H) $(EXPR_H) hard-reg-set.h $(REGS_H) \ output.h $(TOPLEV_H) xcoffout.h debug.h $(GGC_H) $(TM_P_H) \ $(HASHTAB_H) $(TARGET_H) langhooks.h gt-varasm.h $(BASIC_BLOCK_H) \ - $(CFGLAYOUT_H) $(CGRAPH_H) targhooks.h tree-mudflap.h $(REAL_H) tree-iterator.h + $(CFGLAYOUT_H) $(CGRAPH_H) targhooks.h tree-mudflap.h $(REAL_H) \ + tree-iterator.h function.o : function.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(TREE_H) $(CFGLAYOUT_H) $(GIMPLE_H) $(FLAGS_H) $(FUNCTION_H) $(EXPR_H) \ $(OPTABS_H) libfuncs.h $(REGS_H) hard-reg-set.h insn-config.h $(RECOG_H) \ @@ -2771,7 +2848,8 @@ simplify-rtx.o : simplify-rtx.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ cgraph.o : cgraph.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ langhooks.h $(TOPLEV_H) $(FLAGS_H) $(GGC_H) $(TARGET_H) $(CGRAPH_H) \ gt-cgraph.h output.h intl.h $(BASIC_BLOCK_H) debug.h $(HASHTAB_H) \ - $(TREE_INLINE_H) $(TREE_DUMP_H) $(TREE_FLOW_H) value-prof.h $(EXCEPT_H) + $(TREE_INLINE_H) $(TREE_DUMP_H) $(TREE_FLOW_H) cif-code.def \ + value-prof.h $(EXCEPT_H) cgraphunit.o : cgraphunit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) langhooks.h $(TREE_INLINE_H) $(TOPLEV_H) $(FLAGS_H) $(GGC_H) \ $(TARGET_H) $(CGRAPH_H) intl.h pointer-set.h $(FUNCTION_H) $(GIMPLE_H) \ @@ -2813,12 +2891,13 @@ ipa-reference.o : ipa-reference.c $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TM_H) $(TREE_H) $(TREE_FLOW_H) $(TREE_INLINE_H) langhooks.h \ pointer-set.h $(GGC_H) $(IPA_REFERENCE_H) $(IPA_UTILS_H) $(SPLAY_TREE_H) \ $(GIMPLE_H) $(CGRAPH_H) output.h $(FLAGS_H) $(TREE_PASS_H) \ - $(TIMEVAR_H) $(DIAGNOSTIC_H) $(FUNCTION_H) gt-ipa-reference.h + $(TIMEVAR_H) $(DIAGNOSTIC_H) $(FUNCTION_H) gt-ipa-reference.h \ + $(LTO_STREAMER_H) ipa-pure-const.o : ipa-pure-const.c $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TM_H) $(TREE_H) $(TREE_FLOW_H) $(TREE_INLINE_H) langhooks.h \ pointer-set.h $(GGC_H) $(IPA_UTILS_H) $(TARGET_H) \ $(GIMPLE_H) $(CGRAPH_H) output.h $(FLAGS_H) $(TREE_PASS_H) $(TIMEVAR_H) \ - $(DIAGNOSTIC_H) $(CFGLOOP_H) $(SCEV_H) + $(DIAGNOSTIC_H) $(CFGLOOP_H) $(SCEV_H) $(LTO_STREAMER_H) ipa-type-escape.o : ipa-type-escape.c $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TM_H) $(TREE_H) $(TREE_FLOW_H) $(TREE_INLINE_H) langhooks.h \ pointer-set.h $(GGC_H) $(IPA_TYPE_ESCAPE_H) $(IPA_UTILS_H) $(SPLAY_TREE_H) \ @@ -3504,6 +3583,7 @@ GTFILES = $(CPP_ID_DATA_H) $(srcdir)/input.h $(srcdir)/coretypes.h \ $(srcdir)/tree-phinodes.c \ $(srcdir)/ipa-reference.c \ $(srcdir)/tree-ssa-structalias.c \ + $(srcdir)/lto-symtab.c \ $(srcdir)/tree-ssa-alias.h \ @all_gtfiles@ @@ -4145,7 +4225,7 @@ maintainer-clean: # broken is small. install: install-common $(INSTALL_HEADERS) \ install-cpp install-man install-info install-@POSUB@ \ - install-driver + install-driver install-lto-wrapper ifeq ($(enable_plugin),yes) install: install-plugin @@ -4440,6 +4520,10 @@ install-collect2: collect2 installdirs # Install the driver program as $(libsubdir)/gcc for collect2. $(INSTALL_PROGRAM) xgcc$(exeext) $(DESTDIR)$(libexecsubdir)/gcc$(exeext) +# Install lto-wrapper. +install-lto-wrapper: lto-wrapper$(exeext) + $(INSTALL_PROGRAM) lto-wrapper$(exeext) $(DESTDIR)$(libexecsubdir)/lto-wrapper$(exeext) + # Cancel installation by deleting the installed files. uninstall: lang.uninstall -rm -rf $(DESTDIR)$(libsubdir) @@ -4491,6 +4575,9 @@ site.exp: ./config.status Makefile echo "set ENABLE_PLUGIN 1" >> ./tmp0; \ echo "set GMPINC \"$(GMPINC)\"" >> ./tmp0; \ fi + @if test "@enable_lto@" = "yes" ; then \ + echo "set ENABLE_LTO 1" >> ./tmp0; \ + fi # If newlib has been configured, we need to pass -B to gcc so it can find # newlib's crt0.o if it exists. This will cause a "path prefix not used" # message if it doesn't, but the testsuite is supposed to ignore the message - diff --git a/gcc/builtins.c b/gcc/builtins.c index 64840e1f620..c9bc23010a1 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -230,6 +230,8 @@ static tree do_mpfr_bessel_n (tree, tree, tree, static tree do_mpfr_remquo (tree, tree, tree); static tree do_mpfr_lgamma_r (tree, tree, tree); +/* Return true if NAME starts with __builtin_ or __sync_. */ + bool is_builtin_name (const char *name) { @@ -240,6 +242,16 @@ is_builtin_name (const char *name) return false; } + +/* Return true if DECL is a function symbol representing a built-in. */ + +bool +is_builtin_fn (tree decl) +{ + return TREE_CODE (decl) == FUNCTION_DECL && DECL_BUILT_IN (decl); +} + + /* Return true if NODE should be considered for inline expansion regardless of the optimization level. This means whenever a function is invoked with its "internal" name, which normally contains the prefix "__builtin". */ @@ -13856,3 +13868,41 @@ fold_call_stmt (gimple stmt, bool ignore) } return NULL_TREE; } + +/* Look up the function in built_in_decls that corresponds to DECL + and set ASMSPEC as its user assembler name. DECL must be a + function decl that declares a builtin. */ + +void +set_builtin_user_assembler_name (tree decl, const char *asmspec) +{ + tree builtin; + gcc_assert (TREE_CODE (decl) == FUNCTION_DECL + && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL + && asmspec != 0); + + builtin = built_in_decls [DECL_FUNCTION_CODE (decl)]; + set_user_assembler_name (builtin, asmspec); + switch (DECL_FUNCTION_CODE (decl)) + { + case BUILT_IN_MEMCPY: + init_block_move_fn (asmspec); + memcpy_libfunc = set_user_assembler_libfunc ("memcpy", asmspec); + break; + case BUILT_IN_MEMSET: + init_block_clear_fn (asmspec); + memset_libfunc = set_user_assembler_libfunc ("memset", asmspec); + break; + case BUILT_IN_MEMMOVE: + memmove_libfunc = set_user_assembler_libfunc ("memmove", asmspec); + break; + case BUILT_IN_MEMCMP: + memcmp_libfunc = set_user_assembler_libfunc ("memcmp", asmspec); + break; + case BUILT_IN_ABORT: + abort_libfunc = set_user_assembler_libfunc ("abort", asmspec); + break; + default: + break; + } +} diff --git a/gcc/c-common.c b/gcc/c-common.c index 4de92d0de95..bf57cb8a2df 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -5032,44 +5032,6 @@ c_common_nodes_and_builtins (void) memset (builtin_types, 0, sizeof (builtin_types)); } -/* Look up the function in built_in_decls that corresponds to DECL - and set ASMSPEC as its user assembler name. DECL must be a - function decl that declares a builtin. */ - -void -set_builtin_user_assembler_name (tree decl, const char *asmspec) -{ - tree builtin; - gcc_assert (TREE_CODE (decl) == FUNCTION_DECL - && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL - && asmspec != 0); - - builtin = built_in_decls [DECL_FUNCTION_CODE (decl)]; - set_user_assembler_name (builtin, asmspec); - switch (DECL_FUNCTION_CODE (decl)) - { - case BUILT_IN_MEMCPY: - init_block_move_fn (asmspec); - memcpy_libfunc = set_user_assembler_libfunc ("memcpy", asmspec); - break; - case BUILT_IN_MEMSET: - init_block_clear_fn (asmspec); - memset_libfunc = set_user_assembler_libfunc ("memset", asmspec); - break; - case BUILT_IN_MEMMOVE: - memmove_libfunc = set_user_assembler_libfunc ("memmove", asmspec); - break; - case BUILT_IN_MEMCMP: - memcmp_libfunc = set_user_assembler_libfunc ("memcmp", asmspec); - break; - case BUILT_IN_ABORT: - abort_libfunc = set_user_assembler_libfunc ("abort", asmspec); - break; - default: - break; - } -} - /* The number of named compound-literals generated thus far. */ static GTY(()) int compound_literal_number; diff --git a/gcc/c-common.h b/gcc/c-common.h index c1655ae69ff..db4f910e81b 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -839,8 +839,6 @@ extern tree c_build_qualified_type (tree, int); frontends. */ extern void c_common_nodes_and_builtins (void); -extern void set_builtin_user_assembler_name (tree decl, const char *asmspec); - extern void disable_builtin_function (const char *); extern void set_compound_literal_name (tree decl); diff --git a/gcc/c-opts.c b/gcc/c-opts.c index e026fd97dc7..6c2f5a59cd3 100644 --- a/gcc/c-opts.c +++ b/gcc/c-opts.c @@ -1033,6 +1033,29 @@ c_common_post_options (const char **pfilename) C_COMMON_OVERRIDE_OPTIONS; #endif + if (flag_lto || flag_whopr) + { +#ifdef ENABLE_LTO + flag_generate_lto = 1; + + /* When generating IL, do not operate in whole-program mode. + Otherwise, symbols will be privatized too early, causing link + errors later. */ + flag_whole_program = 0; + + /* FIXME lto. Disable var-tracking until debug information + is properly handled in free_lang_data. */ + flag_var_tracking = 0; +#else + error ("LTO support has not been enabled in this configuration"); +#endif + } + + /* Reconcile -flto and -fwhopr. Set additional flags as appropriate and + check option consistency. */ + if (flag_lto && flag_whopr) + error ("-flto and -fwhopr are mutually exclusive"); + /* Excess precision other than "fast" requires front-end support. */ if (c_dialect_cxx ()) diff --git a/gcc/c.opt b/gcc/c.opt index 21f7ab71246..006f9ae9c1b 100644 --- a/gcc/c.opt +++ b/gcc/c.opt @@ -113,11 +113,11 @@ C ObjC C++ ObjC++ Joined Separate -U Undefine Wabi -C ObjC C++ ObjC++ Var(warn_abi) Warning +C ObjC C++ ObjC++ LTO Var(warn_abi) Warning Warn about things that will change when compiling with an ABI-compliant compiler Wpsabi -C ObjC C++ ObjC++ Var(warn_psabi) Init(1) Undocumented +C ObjC C++ ObjC++ LTO Var(warn_psabi) Init(1) Undocumented Waddress C ObjC C++ ObjC++ Var(warn_address) Warning diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 15dd60a7ee4..8dcf4e43edb 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -802,7 +802,7 @@ initialize_inline_failed (struct cgraph_edge *e) e->inline_failed = CIF_REDEFINED_EXTERN_INLINE; else if (!callee->local.inlinable) e->inline_failed = CIF_FUNCTION_NOT_INLINABLE; - else if (gimple_call_cannot_inline_p (e->call_stmt)) + else if (e->call_stmt && gimple_call_cannot_inline_p (e->call_stmt)) e->inline_failed = CIF_MISMATCHED_ARGUMENTS; else e->inline_failed = CIF_FUNCTION_NOT_CONSIDERED; @@ -816,13 +816,19 @@ cgraph_create_edge (struct cgraph_node *caller, struct cgraph_node *callee, { struct cgraph_edge *edge; + + /* LTO does not actually have access to the call_stmt since these + have not been loaded yet. */ + if (call_stmt) + { #ifdef ENABLE_CHECKING /* This is rather pricely check possibly trigerring construction of call stmt hashtable. */ gcc_assert (!cgraph_edge (caller, call_stmt)); #endif - gcc_assert (is_gimple_call (call_stmt)); + gcc_assert (is_gimple_call (call_stmt)); + } if (free_edges) { @@ -860,7 +866,9 @@ cgraph_create_edge (struct cgraph_node *caller, struct cgraph_node *callee, gcc_assert (freq <= CGRAPH_FREQ_MAX); edge->loop_nest = nest; edge->indirect_call = 0; - if (caller->call_site_hash) + edge->call_stmt_cannot_inline_p = + (call_stmt ? gimple_call_cannot_inline_p (call_stmt) : false); + if (call_stmt && caller->call_site_hash) { void **slot; slot = htab_find_slot_with_hash (caller->call_site_hash, @@ -1624,8 +1632,8 @@ cgraph_function_possibly_inlined_p (tree decl) /* Create clone of E in the node N represented by CALL_EXPR the callgraph. */ struct cgraph_edge * cgraph_clone_edge (struct cgraph_edge *e, struct cgraph_node *n, - gimple call_stmt, gcov_type count_scale, int freq_scale, - int loop_nest, bool update_original) + gimple call_stmt, unsigned stmt_uid, gcov_type count_scale, + int freq_scale, int loop_nest, bool update_original) { struct cgraph_edge *new_edge; gcov_type count = e->count * count_scale / REG_BR_PROB_BASE; @@ -1638,6 +1646,7 @@ cgraph_clone_edge (struct cgraph_edge *e, struct cgraph_node *n, new_edge->inline_failed = e->inline_failed; new_edge->indirect_call = e->indirect_call; + new_edge->lto_stmt_uid = stmt_uid; if (update_original) { e->count -= new_edge->count; @@ -1702,8 +1711,8 @@ cgraph_clone_node (struct cgraph_node *n, gcov_type count, int freq, for (e = n->callees;e; e=e->next_callee) - cgraph_clone_edge (e, new_node, e->call_stmt, count_scale, freq, loop_nest, - update_original); + cgraph_clone_edge (e, new_node, e->call_stmt, e->lto_stmt_uid, + count_scale, freq, loop_nest, update_original); new_node->next_sibling_clone = n->clones; if (n->clones) diff --git a/gcc/cgraph.h b/gcc/cgraph.h index 292eccd0284..845897b2841 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -46,6 +46,10 @@ enum availability AVAIL_LOCAL }; +/* This is the information that is put into the cgraph local structure + to recover a function. */ +struct lto_file_decl_data; + extern const char * const cgraph_availability_names[]; /* Function inlining information. */ @@ -69,6 +73,9 @@ struct GTY(()) inline_summary Available after function is analyzed. */ struct GTY(()) cgraph_local_info { + /* File stream where this node is being written to. */ + struct lto_file_decl_data * GTY ((skip)) lto_file_data; + struct inline_summary inline_summary; /* Set when function function is visible in current compilation unit only @@ -277,6 +284,9 @@ struct GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_caller"))) cgrap struct cgraph_edge *prev_callee; struct cgraph_edge *next_callee; gimple call_stmt; + /* The stmt_uid of this call stmt. This is used by LTO to recover + the call_stmt when the function is serialized in. */ + unsigned int lto_stmt_uid; PTR GTY ((skip (""))) aux; /* When equal to CIF_OK, inline this call. Otherwise, points to the explanation why function was not inlined. */ @@ -291,6 +301,8 @@ struct GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_caller"))) cgrap unsigned int loop_nest : 30; /* Whether this edge describes a call that was originally indirect. */ unsigned int indirect_call : 1; + /* True if the corresponding CALL stmt cannot be inlined. */ + unsigned int call_stmt_cannot_inline_p : 1; /* Can this call throw externally? */ unsigned int can_throw_external : 1; /* Unique id of the edge. */ @@ -406,8 +418,8 @@ struct cgraph_global_info *cgraph_global_info (tree); struct cgraph_rtl_info *cgraph_rtl_info (tree); const char * cgraph_node_name (struct cgraph_node *); struct cgraph_edge * cgraph_clone_edge (struct cgraph_edge *, - struct cgraph_node *, - gimple, gcov_type, int, int, bool); + struct cgraph_node *, gimple, + unsigned, gcov_type, int, int, bool); struct cgraph_node * cgraph_clone_node (struct cgraph_node *, gcov_type, int, int, bool, VEC(cgraph_edge_p,heap) *); @@ -430,6 +442,7 @@ struct cgraph_node * cgraph_create_virtual_clone (struct cgraph_node *old_node, void cgraph_finalize_function (tree, bool); void cgraph_mark_if_needed (tree); void cgraph_finalize_compilation_unit (void); +void cgraph_optimize (void); void cgraph_mark_needed_node (struct cgraph_node *); void cgraph_mark_address_taken_node (struct cgraph_node *); void cgraph_mark_reachable_node (struct cgraph_node *); @@ -449,6 +462,8 @@ struct cgraph_node *save_inline_function_body (struct cgraph_node *); void record_references_in_initializer (tree); bool cgraph_process_new_functions (void); +bool cgraph_decide_is_function_needed (struct cgraph_node *, tree); + typedef void (*cgraph_edge_hook)(struct cgraph_edge *, void *); typedef void (*cgraph_node_hook)(struct cgraph_node *, void *); typedef void (*cgraph_2edge_hook)(struct cgraph_edge *, struct cgraph_edge *, @@ -476,6 +491,7 @@ void cgraph_materialize_all_clones (void); /* In cgraphbuild.c */ unsigned int rebuild_cgraph_edges (void); +void reset_inline_failed (struct cgraph_node *); int compute_call_stmt_bb_frequency (tree, basic_block bb); /* In ipa.c */ @@ -560,6 +576,22 @@ unsigned int compute_inline_parameters (struct cgraph_node *); /* Create a new static variable of type TYPE. */ tree add_new_static_var (tree type); +/* lto-cgraph.c */ + +enum LTO_cgraph_tags +{ + /* Must leave 0 for the stopper. */ + LTO_cgraph_avail_node = 1, + LTO_cgraph_overwritable_node, + LTO_cgraph_unavail_node, + LTO_cgraph_edge, + LTO_cgraph_last_tag +}; + +extern const char * LTO_cgraph_tag_names[LTO_cgraph_last_tag]; + +#define LCC_NOT_FOUND (-1) + /* Return true if iterator CSI points to nothing. */ static inline bool diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c index a7a8bd2b314..d61def279ad 100644 --- a/gcc/cgraphbuild.c +++ b/gcc/cgraphbuild.c @@ -78,6 +78,29 @@ record_reference (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) return NULL_TREE; } +/* Reset inlining information of all incoming call edges of NODE. */ + +void +reset_inline_failed (struct cgraph_node *node) +{ + struct cgraph_edge *e; + + for (e = node->callers; e; e = e->next_caller) + { + e->callee->global.inlined_to = NULL; + if (!node->analyzed) + e->inline_failed = CIF_BODY_NOT_AVAILABLE; + else if (node->local.redefined_extern_inline) + e->inline_failed = CIF_REDEFINED_EXTERN_INLINE; + else if (!node->local.inlinable) + e->inline_failed = CIF_FUNCTION_NOT_INLINABLE; + else if (e->call_stmt_cannot_inline_p) + e->inline_failed = CIF_MISMATCHED_ARGUMENTS; + else + e->inline_failed = CIF_FUNCTION_NOT_CONSIDERED; + } +} + /* Computes the frequency of the call statement so that it can be stored in cgraph_edge. BB is the basic block of the call statement. */ int diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 2ad07187e04..9a4f63d3aca 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -140,7 +140,6 @@ static void cgraph_expand_all_functions (void); static void cgraph_mark_functions_to_output (void); static void cgraph_expand_function (struct cgraph_node *); static void cgraph_output_pending_asms (void); -static void cgraph_optimize (void); static void cgraph_analyze_function (struct cgraph_node *); static FILE *cgraph_dump_file; @@ -314,8 +313,8 @@ cgraph_build_cdtor_fns (void) either outside this translation unit, something magic in the system configury. */ -static bool -decide_is_function_needed (struct cgraph_node *node, tree decl) +bool +cgraph_decide_is_function_needed (struct cgraph_node *node, tree decl) { if (MAIN_NAME_P (DECL_NAME (decl)) && TREE_PUBLIC (decl)) @@ -522,7 +521,7 @@ cgraph_finalize_function (tree decl, bool nested) node->finalized_by_frontend = true; record_cdtor_fn (node->decl); - if (decide_is_function_needed (node, decl)) + if (cgraph_decide_is_function_needed (node, decl)) cgraph_mark_needed_node (node); /* Since we reclaim unreachable nodes at the end of every language @@ -551,7 +550,7 @@ void cgraph_mark_if_needed (tree decl) { struct cgraph_node *node = cgraph_node (decl); - if (node->local.finalized && decide_is_function_needed (node, decl)) + if (node->local.finalized && cgraph_decide_is_function_needed (node, decl)) cgraph_mark_needed_node (node); } @@ -692,7 +691,8 @@ verify_cgraph_node (struct cgraph_node *node) if (node->analyzed && gimple_has_body_p (node->decl) && !TREE_ASM_WRITTEN (node->decl) - && (!DECL_EXTERNAL (node->decl) || node->global.inlined_to)) + && (!DECL_EXTERNAL (node->decl) || node->global.inlined_to) + && !flag_wpa) { if (this_cfun->cfg) { @@ -949,8 +949,8 @@ cgraph_analyze_functions (void) continue; } - gcc_assert (!node->analyzed && node->reachable); - cgraph_analyze_function (node); + if (!node->analyzed) + cgraph_analyze_function (node); for (edge = node->callees; edge; edge = edge->next_callee) if (!edge->callee->reachable) @@ -1355,15 +1355,31 @@ ipa_passes (void) current_function_decl = NULL; gimple_register_cfg_hooks (); bitmap_obstack_initialize (NULL); - execute_ipa_pass_list (all_ipa_passes); + execute_ipa_pass_list (all_small_ipa_passes); - /* Generate coverage variables and constructors. */ - coverage_finish (); + /* If pass_all_early_optimizations was not scheduled, the state of + the cgraph will not be properly updated. Update it now. */ + if (cgraph_state < CGRAPH_STATE_IPA_SSA) + cgraph_state = CGRAPH_STATE_IPA_SSA; - /* Process new functions added. */ - set_cfun (NULL); - current_function_decl = NULL; - cgraph_process_new_functions (); + if (!in_lto_p) + { + /* Generate coverage variables and constructors. */ + coverage_finish (); + + /* Process new functions added. */ + set_cfun (NULL); + current_function_decl = NULL; + cgraph_process_new_functions (); + } + + execute_ipa_summary_passes ((struct ipa_opt_pass_d *) all_regular_ipa_passes); + execute_ipa_summary_passes ((struct ipa_opt_pass_d *) all_lto_gen_passes); + + if (!in_lto_p) + ipa_write_summaries (); + + execute_ipa_pass_list (all_regular_ipa_passes); bitmap_obstack_release (NULL); } @@ -1371,7 +1387,7 @@ ipa_passes (void) /* Perform simple optimizations based on callgraph. */ -static void +void cgraph_optimize (void) { if (errorcount || sorrycount) @@ -1598,7 +1614,8 @@ cgraph_copy_node_for_versioning (struct cgraph_node *old_version, also cloned. */ for (e = old_version->callees;e; e=e->next_callee) { - new_e = cgraph_clone_edge (e, new_version, e->call_stmt, 0, e->frequency, + new_e = cgraph_clone_edge (e, new_version, e->call_stmt, + e->lto_stmt_uid, 0, e->frequency, e->loop_nest, true); new_e->count = e->count; } diff --git a/gcc/collect2.c b/gcc/collect2.c index 82c400bbaaf..20caa451f89 100644 --- a/gcc/collect2.c +++ b/gcc/collect2.c @@ -184,6 +184,15 @@ static int aix64_flag; /* true if -b64 */ static int aixrtl_flag; /* true if -brtl */ #endif +enum lto_mode_d { + LTO_MODE_NONE, /* Not doing LTO. */ + LTO_MODE_LTO, /* Normal LTO. */ + LTO_MODE_WHOPR /* WHOPR. */ +}; + +/* Current LTO mode. */ +static enum lto_mode_d lto_mode = LTO_MODE_NONE; + int debug; /* true if -debug */ static int shared_obj; /* true if -shared */ @@ -193,6 +202,7 @@ static const char *o_file; /* .o for constructor/destructor list. */ #ifdef COLLECT_EXPORT_LIST static const char *export_file; /* .x for AIX export list. */ #endif +static char **lto_o_files; /* Output files for LTO. */ const char *ldout; /* File for ld stdout. */ const char *lderrout; /* File for ld stderr. */ static const char *output_file; /* Output file for ld. */ @@ -250,6 +260,25 @@ static struct path_prefix *libpaths[3] = {&cmdline_lib_dirs, &libpath_lib_dirs, NULL}; #endif +/* List of names of object files containing LTO information. + These are a subset of the object file names appearing on the + command line, and must be identical, in the sense of pointer + equality, with the names passed to maybe_run_lto_and_relink(). */ + +struct lto_object +{ + const char *name; /* Name of object file. */ + struct lto_object *next; /* Next in linked list. */ +}; + +struct lto_object_list +{ + struct lto_object *first; /* First list element. */ + struct lto_object *last; /* Last list element. */ +}; + +static struct lto_object_list lto_objects; + /* Special kinds of symbols that a name may denote. */ typedef enum { @@ -272,6 +301,7 @@ static void prefix_from_string (const char *, struct path_prefix *); static void do_wait (const char *, struct pex_obj *); static void fork_execute (const char *, char **); static void maybe_unlink (const char *); +static void maybe_unlink_list (char **); static void add_to_list (struct head *, const char *); static int extract_init_priority (const char *); static void sort_ids (struct head *); @@ -310,7 +340,8 @@ typedef enum { PASS_FIRST, /* without constructors */ PASS_OBJ, /* individual objects */ PASS_LIB, /* looking for shared libraries */ - PASS_SECOND /* with constructors linked in */ + PASS_SECOND, /* with constructors linked in */ + PASS_LTOINFO /* looking for objects with LTO info */ } scanpass; /* ... and which kinds of symbols are to be considered. */ @@ -363,6 +394,9 @@ collect_exit (int status) maybe_unlink (export_file); #endif + if (lto_o_files) + maybe_unlink_list (lto_o_files); + if (ldout != 0 && ldout[0]) { dump_file (ldout, stdout); @@ -472,6 +506,9 @@ handler (int signo) maybe_unlink (export_file); #endif + if (lto_o_files) + maybe_unlink_list (lto_o_files); + if (response_file) maybe_unlink (response_file); @@ -815,6 +852,244 @@ prefix_from_string (const char *p, struct path_prefix *pprefix) } free (nstore); } + +/* Add an entry for the object file NAME to object file list LIST. + New entries are added at the end of the list. The original pointer + value of NAME is preserved, i.e., no string copy is performed. */ + +static void +add_lto_object (struct lto_object_list *list, const char *name) +{ + struct lto_object *n = XNEW (struct lto_object); + n->name = name; + n->next = NULL; + + if (list->last) + list->last->next = n; + else + list->first = n; + + list->last = n; +} + + +/* Perform a link-time recompilation and relink if any of the object + files contain LTO info. The linker command line LTO_LD_ARGV + represents the linker command that would produce a final executable + without the use of LTO. OBJECT_LST is a vector of object file names + appearing in LTO_LD_ARGV that are to be considerd for link-time + recompilation, where OBJECT is a pointer to the last valid element. + (This awkward convention avoids an impedance mismatch with the + usage of similarly-named variables in main().) The elements of + OBJECT_LST must be identical, i.e., pointer equal, to the + corresponding arguments in LTO_LD_ARGV. + + Upon entry, at least one linker run has been performed without the + use of any LTO info that might be present. Any recompilations + necessary for template instantiations have been performed, and + initializer/finalizer tables have been created if needed and + included in the linker command line LTO_LD_ARGV. If any of the + object files contain LTO info, we run the LTO back end on all such + files, and perform the final link with the LTO back end output + substituted for the LTO-optimized files. In some cases, a final + link with all link-time generated code has already been performed, + so there is no need to relink if no LTO info is found. In other + cases, our caller has not produced the final executable, and is + relying on us to perform the required link whether LTO info is + present or not. In that case, the FORCE argument should be true. + Note that the linker command line argument LTO_LD_ARGV passed into + this function may be modified in place. */ + +static void +maybe_run_lto_and_relink (char **lto_ld_argv, char **object_lst, + const char **object, bool force) +{ + const char **object_file = CONST_CAST2 (const char **, char **, object_lst); + + int num_lto_c_args = 1; /* Allow space for the terminating NULL. */ + + while (object_file < object) + { + /* If file contains LTO info, add it to the list of LTO objects. */ + scan_prog_file (*object_file++, PASS_LTOINFO, SCAN_ALL); + + /* Increment the argument count by the number of object file arguments + we will add. An upper bound suffices, so just count all of the + object files regardless of whether they contain LTO info. */ + num_lto_c_args++; + } + + if (lto_objects.first) + { + const char *opts; + char **lto_c_argv; + const char **lto_c_ptr; + const char *cp; + const char **p, **q, **r; + const char **lto_o_ptr; + struct lto_object *list; + char *lto_wrapper = getenv ("COLLECT_LTO_WRAPPER"); + struct pex_obj *pex; + const char *prog = "lto-wrapper"; + + if (!lto_wrapper) + fatal ("COLLECT_LTO_WRAPPER must be set."); + + /* There is at least one object file containing LTO info, + so we need to run the LTO back end and relink. */ + + /* Get compiler options passed down from the parent `gcc' command. + These must be passed to the LTO back end. */ + opts = getenv ("COLLECT_GCC_OPTIONS"); + + /* Increment the argument count by the number of inherited options. + Some arguments may be filtered out later. Again, an upper bound + suffices. */ + + cp = opts; + + while (cp && *cp) + { + extract_string (&cp); + num_lto_c_args++; + } + obstack_free (&temporary_obstack, temporary_firstobj); + + if (debug) + num_lto_c_args++; + + /* Increment the argument count by the number of initial + arguments added below. */ + num_lto_c_args += 9; + + lto_c_argv = (char **) xcalloc (sizeof (char *), num_lto_c_args); + lto_c_ptr = CONST_CAST2 (const char **, char **, lto_c_argv); + + *lto_c_ptr++ = lto_wrapper; + *lto_c_ptr++ = c_file_name; + + cp = opts; + + while (cp && *cp) + { + const char *s = extract_string (&cp); + + /* Pass the option or argument to the wrapper. */ + *lto_c_ptr++ = xstrdup (s); + } + obstack_free (&temporary_obstack, temporary_firstobj); + + if (debug) + *lto_c_ptr++ = xstrdup ("-debug"); + + /* Add LTO objects to the wrapper command line. */ + for (list = lto_objects.first; list; list = list->next) + *lto_c_ptr++ = list->name; + + *lto_c_ptr = NULL; + + /* Save intermediate WPA files in lto1 if debug. */ + if (debug) + putenv (xstrdup ("WPA_SAVE_LTRANS=1")); + + /* Run the LTO back end. */ + pex = collect_execute (prog, lto_c_argv, NULL, NULL, PEX_SEARCH); + { + int c; + FILE *stream; + size_t i, num_files; + char *start, *end; + + stream = pex_read_output (pex, 0); + gcc_assert (stream); + + num_files = 0; + while ((c = getc (stream)) != EOF) + { + obstack_1grow (&temporary_obstack, c); + if (c == '\n') + ++num_files; + } + + lto_o_files = XNEWVEC (char *, num_files + 1); + lto_o_files[num_files] = NULL; + start = XOBFINISH (&temporary_obstack, char *); + for (i = 0; i < num_files; ++i) + { + end = start; + while (*end != '\n') + ++end; + *end = '\0'; + + lto_o_files[i] = xstrdup (start); + + start = end + 1; + } + + obstack_free (&temporary_obstack, temporary_firstobj); + } + do_wait (prog, pex); + pex = NULL; + + /* After running the LTO back end, we will relink, substituting + the LTO output for the object files that we submitted to the + LTO. Here, we modify the linker command line for the relink. */ + p = CONST_CAST2 (const char **, char **, lto_ld_argv); + lto_o_ptr = CONST_CAST2 (const char **, char **, lto_o_files); + + while (*p != NULL) + { + for (list = lto_objects.first; list; list = list->next) + { + if (*p == list->name) /* Note test for pointer equality! */ + { + /* Excise argument from linker command line. */ + if (*lto_o_ptr) + { + /* Replace first argument with LTO output file. */ + *p++ = *lto_o_ptr++; + } + else + { + /* Move following arguments one position earlier, + overwriting the current argument. */ + q = p; + r = p + 1; + while (*r != NULL) + *q++ = *r++; + *q = NULL; + } + + /* No need to continue searching the LTO object list. */ + break; + } + } + + /* If we didn't find a match, move on to the next argument. + Otherwise, P has been set to the correct argument position + at which to continue. */ + if (!list) ++p; + } + + /* The code above assumes we will never have more lto output files than + input files. Otherwise, we need to resize lto_ld_argv. Check this + assumption. */ + if (*lto_o_ptr) + fatal ("too many lto output files"); + + /* Run the linker again, this time replacing the object files + optimized by the LTO with the temporary file generated by the LTO. */ + fork_execute ("ld", lto_ld_argv); + + maybe_unlink_list (lto_o_files); + } + else if (force) + { + /* Our caller is relying on us to do the link + even though there is no LTO back end work to be done. */ + fork_execute ("ld", lto_ld_argv); + } +} /* Main program. */ @@ -935,14 +1210,25 @@ main (int argc, char **argv) /* Parse command line early for instances of -debug. This allows the debug flag to be set before functions like find_a_file() - are called. */ + are called. We also look for the -flto or -fwhopr flag to know + what LTO mode we are in. */ { int i; + bool use_plugin = false; for (i = 1; argv[i] != NULL; i ++) { if (! strcmp (argv[i], "-debug")) debug = 1; + else if (! strcmp (argv[i], "-flto") && ! use_plugin) + lto_mode = LTO_MODE_LTO; + else if (! strcmp (argv[i], "-fwhopr") && ! use_plugin) + lto_mode = LTO_MODE_WHOPR; + else if (! strcmp (argv[i], "-plugin")) + { + use_plugin = true; + lto_mode = LTO_MODE_NONE; + } #ifdef COLLECT_EXPORT_LIST /* since -brtl, -bexport, -b64 are not position dependent also check for them here */ @@ -1194,6 +1480,20 @@ main (int argc, char **argv) } break; + case 'f': + if (strcmp (arg, "-flto") == 0 || strcmp (arg, "-fwhopr") == 0) + { +#ifdef ENABLE_LTO + /* Do not pass LTO flag to the linker. */ + ld1--; + ld2--; +#else + error ("LTO support has not been enabled in this " + "configuration"); +#endif + } + break; + case 'l': if (first_file) { @@ -1456,6 +1756,9 @@ main (int argc, char **argv) if (export_file != 0 && export_file[0]) maybe_unlink (export_file); #endif + if (lto_mode) + maybe_run_lto_and_relink (ld1_argv, object_lst, object, false); + maybe_unlink (c_file); maybe_unlink (o_file); return 0; @@ -1498,6 +1801,9 @@ main (int argc, char **argv) if (ld1_filter == SCAN_NOTHING) do_tlink (ld1_argv, object_lst); + if (lto_mode) + maybe_run_lto_and_relink (ld1_argv, object_lst, object, false); + /* Strip now if it was requested on the command line. */ if (strip_flag) { @@ -1591,9 +1897,15 @@ main (int argc, char **argv) #ifdef COLLECT_EXPORT_LIST /* On AIX we must call tlink because of possible templates resolution. */ do_tlink (ld2_argv, object_lst); + + if (lto_mode) + maybe_run_lto_and_relink (ld2_argv, object_lst, object, false); #else /* Otherwise, simply call ld because tlink is already done. */ - fork_execute ("ld", ld2_argv); + if (lto_mode) + maybe_run_lto_and_relink (ld2_argv, object_lst, object, true); + else + fork_execute ("ld", ld2_argv); /* Let scan_prog_file do any final mods (OSF/rose needs this for constructors/destructors in shared libraries. */ @@ -1661,7 +1973,7 @@ do_wait (const char *prog, struct pex_obj *pex) struct pex_obj * collect_execute (const char *prog, char **argv, const char *outname, - const char *errname) + const char *errname, int flags) { struct pex_obj *pex; const char *errmsg; @@ -1737,7 +2049,7 @@ collect_execute (const char *prog, char **argv, const char *outname, if (pex == NULL) fatal_perror ("pex_init failed"); - errmsg = pex_run (pex, PEX_LAST | PEX_SEARCH, argv[0], argv, outname, + errmsg = pex_run (pex, flags, argv[0], argv, outname, errname, &err); if (errmsg != NULL) { @@ -1761,7 +2073,7 @@ fork_execute (const char *prog, char **argv) { struct pex_obj *pex; - pex = collect_execute (prog, argv, NULL, NULL); + pex = collect_execute (prog, argv, NULL, NULL, PEX_LAST | PEX_SEARCH); do_wait (prog, pex); } @@ -1776,6 +2088,17 @@ maybe_unlink (const char *file) notice ("[Leaving %s]\n", file); } +/* Call maybe_unlink on the NULL-terminated list, FILE_LIST. */ + +static void +maybe_unlink_list (char **file_list) +{ + char **tmp = file_list; + + while (*tmp) + maybe_unlink (*(tmp++)); +} + static long sequence_number = 0; @@ -2170,6 +2493,25 @@ write_aix_file (FILE *stream, struct id *list) #ifdef OBJECT_FORMAT_NONE +/* Check to make sure the file is an ELF file. LTO objects must + be in ELF format. */ + +static bool +is_elf (const char *prog_name) +{ + FILE *f; + char buf[4]; + static char magic[4] = { 0x7f, 'E', 'L', 'F' }; + + f = fopen (prog_name, "r"); + if (f == NULL) + return false; + if (fread (buf, sizeof (buf), 1, f) != 1) + buf[0] = 0; + fclose (f); + return memcmp (buf, magic, sizeof (magic)) == 0; +} + /* Generic version to scan the name list of the loaded program for the symbols g++ uses for static constructors and destructors. */ @@ -2189,10 +2531,17 @@ scan_prog_file (const char *prog_name, scanpass which_pass, int err; char *p, buf[1024]; FILE *inf; + int found_lto = 0; if (which_pass == PASS_SECOND) return; + /* LTO objects must be in ELF format. This check prevents + us from accepting an archive containing LTO objects, which + gcc cannnot currently handle. */ + if (which_pass == PASS_LTOINFO && !is_elf (prog_name)) + return; + /* If we do not have an `nm', complain. */ if (nm_file_name == 0) fatal ("cannot find 'nm'"); @@ -2223,7 +2572,8 @@ scan_prog_file (const char *prog_name, scanpass which_pass, if (pex == NULL) fatal_perror ("pex_init failed"); - errmsg = pex_run (pex, 0, nm_file_name, real_nm_argv, NULL, NULL, &err); + errmsg = pex_run (pex, 0, nm_file_name, real_nm_argv, NULL, HOST_BIT_BUCKET, + &err); if (errmsg != NULL) { if (err != 0) @@ -2245,7 +2595,12 @@ scan_prog_file (const char *prog_name, scanpass which_pass, fatal_perror ("can't open nm output"); if (debug) - fprintf (stderr, "\nnm output with constructors/destructors.\n"); + { + if (which_pass == PASS_LTOINFO) + fprintf (stderr, "\nnm output with LTO info marker symbol.\n"); + else + fprintf (stderr, "\nnm output with constructors/destructors.\n"); + } /* Read each line of nm output. */ while (fgets (buf, sizeof buf, inf) != (char *) 0) @@ -2253,6 +2608,33 @@ scan_prog_file (const char *prog_name, scanpass which_pass, int ch, ch2; char *name, *end; + if (debug) + fprintf (stderr, "\t%s\n", buf); + + if (which_pass == PASS_LTOINFO) + { + if (found_lto) + continue; + + /* Look for the LTO info marker symbol, and add filename to + the LTO objects list if found. */ + for (p = buf; (ch = *p) != '\0' && ch != '\n'; p++) + if (ch == ' ' + && (strncmp (p +1 , "gnu_lto_v1", 10) == 0) + && ISSPACE( p[11])) + { + add_lto_object (<o_objects, prog_name); + + /* We need to read all the input, so we can't just + return here. But we can avoid useless work. */ + found_lto = 1; + + break; + } + + continue; + } + /* If it contains a constructor or destructor name, add the name to the appropriate list unless this is a kind of symbol we're not supposed to even consider. */ @@ -2319,9 +2701,6 @@ scan_prog_file (const char *prog_name, scanpass which_pass, default: /* not a constructor or destructor */ continue; } - - if (debug) - fprintf (stderr, "\t%s\n", buf); } if (debug) diff --git a/gcc/collect2.h b/gcc/collect2.h index 3990b4ffec6..81113cfb68b 100644 --- a/gcc/collect2.h +++ b/gcc/collect2.h @@ -23,7 +23,7 @@ along with GCC; see the file COPYING3. If not see extern void do_tlink (char **, char **); extern struct pex_obj *collect_execute (const char *, char **, const char *, - const char *); + const char *, int flags); extern void collect_exit (int) ATTRIBUTE_NORETURN; diff --git a/gcc/common.opt b/gcc/common.opt index 189f476a09e..de43201a4b2 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -749,6 +749,19 @@ floop-optimize Common Does nothing. Preserved for backward compatibility. +flto +Common Var(flag_lto) +Enable link-time optimization. + +; The initial value of -1 comes from Z_DEFAULT_COMPRESSION in zlib.h. +flto-compression-level= +Common Joined UInteger Var(flag_lto_compression_level) Init(-1) +-flto-compression-level= Use zlib compression level for IL + +flto-report +Common Report Var(flag_lto_report) Init(0) Optimization +Report various link-time optimization statistics + fmath-errno Common Report Var(flag_errno_math) Init(1) Optimization Set errno after built-in math functions @@ -1432,6 +1445,10 @@ fweb Common Report Var(flag_web) Init(2) Optimization Construct webs and split unrelated uses of single variable +fwhopr +Common Var(flag_whopr) +Enable partitioned link-time optimization. + ftree-builtin-call-dce Common Report Var(flag_tree_builtin_call_dce) Init(0) Optimization Enable conditional dead code elimination for builtin calls diff --git a/gcc/config.in b/gcc/config.in index 12573fd1579..220ff9f2ae2 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -113,6 +113,12 @@ #endif +/* Define to enable LTO support. */ +#ifndef USED_FOR_TARGET +#undef ENABLE_LTO +#endif + + /* Define to 1 if translation of program messages to the user's native language is requested. */ #ifndef USED_FOR_TARGET @@ -1453,6 +1459,12 @@ #endif +/* Define if libelf is in use. */ +#ifndef USED_FOR_TARGET +#undef HAVE_libelf +#endif + + /* Define if mpc is in use. */ #ifndef USED_FOR_TARGET #undef HAVE_mpc diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index cafe2b318aa..f44bc992a48 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -20052,8 +20052,10 @@ rs6000_output_function_epilogue (FILE *file, use language_string. C is 0. Fortran is 1. Pascal is 2. Ada is 3. C++ is 9. Java is 13. Objective-C is 14. Objective-C++ isn't assigned - a number, so for now use 9. */ - if (! strcmp (language_string, "GNU C")) + a number, so for now use 9. LTO isn't assigned a number either, + so for now use 0. */ + if (! strcmp (language_string, "GNU C") + || ! strcmp (language_string, "GNU GIMPLE")) i = 0; else if (! strcmp (language_string, "GNU F77") || ! strcmp (language_string, "GNU Fortran")) diff --git a/gcc/configure b/gcc/configure index a1e28a79e4b..e4f3c2e0acd 100755 --- a/gcc/configure +++ b/gcc/configure @@ -741,6 +741,8 @@ ac_subst_vars='LTLIBOBJS LIBOBJS enable_plugin pluginlibs +LIBELFINC +LIBELFLIBS CLOOGINC CLOOGLIBS PPLINC @@ -808,6 +810,7 @@ subdirs slibdir dollar gcc_tooldir +enable_lto MAINT zlibinc zlibdir @@ -1061,7 +1064,9 @@ GMPINC PPLLIBS PPLINC CLOOGLIBS -CLOOGINC' +CLOOGINC +LIBELFLIBS +LIBELFINC' # Initialize some variables set by options. @@ -1799,6 +1804,8 @@ Some influential environment variables: PPLINC How to find PPL include files CLOOGLIBS How to link CLOOG CLOOGINC How to find CLOOG include files + LIBELFLIBS How to link libelf + LIBELFINC How to find libelf include files Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -11565,13 +11572,13 @@ if test "${lt_cv_nm_interface+set}" = set; then : else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:11568: $ac_compile\"" >&5) + (eval echo "\"\$as_me:11575: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:11571: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:11578: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:11574: output\"" >&5) + (eval echo "\"\$as_me:11581: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -12776,7 +12783,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 12779 "configure"' > conftest.$ac_ext + echo '#line 12786 "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -14436,11 +14443,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14439: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14446: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14443: \$? = $ac_status" >&5 + echo "$as_me:14450: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14775,11 +14782,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14778: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14785: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14782: \$? = $ac_status" >&5 + echo "$as_me:14789: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14880,11 +14887,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14883: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14890: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14887: \$? = $ac_status" >&5 + echo "$as_me:14894: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14935,11 +14942,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14938: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14945: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14942: \$? = $ac_status" >&5 + echo "$as_me:14949: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17317,7 +17324,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 17320 "configure" +#line 17327 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -17413,7 +17420,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 17416 "configure" +#line 17423 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -19369,11 +19376,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:19372: $lt_compile\"" >&5) + (eval echo "\"\$as_me:19379: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:19376: \$? = $ac_status" >&5 + echo "$as_me:19383: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -19468,11 +19475,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:19471: $lt_compile\"" >&5) + (eval echo "\"\$as_me:19478: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:19475: \$? = $ac_status" >&5 + echo "$as_me:19482: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -19520,11 +19527,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:19523: $lt_compile\"" >&5) + (eval echo "\"\$as_me:19530: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:19527: \$? = $ac_status" >&5 + echo "$as_me:19534: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -24760,6 +24767,16 @@ do all_compilers="$all_compilers $compilers" all_outputs="$all_outputs $outputs" all_gtfiles="$all_gtfiles [$subdir] $gtfiles" + case ",$enable_languages," in + *,lto,*) + +$as_echo "#define ENABLE_LTO 1" >>confdefs.h + + enable_lto=yes + + ;; + *) ;; + esac done # Pick up gtfiles for c @@ -24941,6 +24958,14 @@ $as_echo "#define HAVE_cloog 1" >>confdefs.h fi + + +if test "x${LIBELFLIBS}" != "x" ; then + +$as_echo "#define HAVE_libelf 1" >>confdefs.h + +fi + # Check for plugin support # Check whether --enable-plugin was given. if test "${enable_plugin+set}" = set; then : diff --git a/gcc/configure.ac b/gcc/configure.ac index d7597d28341..79de6cd7964 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -4041,6 +4041,14 @@ changequote([,])dnl all_compilers="$all_compilers $compilers" all_outputs="$all_outputs $outputs" all_gtfiles="$all_gtfiles [[$subdir]] $gtfiles" + case ",$enable_languages," in + *,lto,*) + AC_DEFINE(ENABLE_LTO, 1, [Define to enable LTO support.]) + enable_lto=yes + AC_SUBST(enable_lto) + ;; + *) ;; + esac done # Pick up gtfiles for c @@ -4213,6 +4221,12 @@ if test "x${CLOOGLIBS}" != "x" ; then AC_DEFINE(HAVE_cloog, 1, [Define if cloog is in use.]) fi +AC_ARG_VAR(LIBELFLIBS,[How to link libelf]) +AC_ARG_VAR(LIBELFINC,[How to find libelf include files]) +if test "x${LIBELFLIBS}" != "x" ; then + AC_DEFINE(HAVE_libelf, 1, [Define if libelf is in use.]) +fi + # Check for plugin support AC_ARG_ENABLE(plugin, [ --enable-plugin enable plugin support], diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index bfa336e2e9e..6bf446b32fb 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -356,6 +356,15 @@ Alternatively, if an MPC source distribution is found in a subdirectory of your GCC sources named @file{mpc}, it will be built together with GCC@. +@item libelf version 0.8.12 (or later) + +Necessary to build link-time optimization (LTO) support. It can be +downloaded from @uref{http://www.mr511.de/software/libelf-0.8.12.tar.gz}, +though it is commonly available in several systems. + +The @option{--with-libelf} configure option should be used if libelf is +not installed in your default library search patch. + @end table @heading Tools/packages necessary for modifying GCC @@ -1893,6 +1902,30 @@ Use the @code{WCHAR} and Win32 W functions natively. Does @emph{not} add @code{-lunicows} to @file{libgcj.spec}. The built executables will only run on Microsoft Windows NT and above. @end table + +@item --enable-lto +Enable support for link-time optimization (LTO). This is enabled by +default if a working libelf implementation is found (see +@option{--with-libelf}). + +@item --with-libelf=@var{pathname} +@itemx --with-libelf-include=@var{pathname} +@itemx --with-libelf-lib=@var{pathname} +If you do not have libelf installed in a standard location and you +want to enable support for link-time optimization (LTO), you can +explicitly specify the directory where libelf is installed +(@samp{--with-libelf=@var{libelfinstalldir}}). The +@option{--with-libelf=@var{libelfinstalldir}} option is shorthand for +@option{--with-libelf-include=@var{libelfinstalldir}/include} +@option{--with-libelf-lib=@var{libelfinstalldir}/lib}. + +@item --enable-gold +Enable support for using @command{gold} as the linker. If gold support is +enabled together with @option{--enable-lto}, an additional directory +@file{lto-plugin} will be built. The code in this directory is a +plugin for gold that allows the link-time optimizer to extract object +files with LTO information out of library archives. See +@option{-flto} and @option{-fwhopr} for details. @end table @subsubheading AWT-Specific Options diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index e12241c97c1..9d39624ad9f 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -349,8 +349,8 @@ Objective-C and Objective-C++ Dialects}. -fno-ira-share-spill-slots -fira-verbose=@var{n} @gol -fivopts -fkeep-inline-functions -fkeep-static-consts @gol -floop-block -floop-interchange -floop-strip-mine -fgraphite-identity @gol --floop-parallelize-all @gol --fmerge-all-constants -fmerge-constants -fmodulo-sched @gol +-floop-parallelize-all -flto -flto-compression-level -flto-report -fltrans @gol +-fltrans-output-list -fmerge-all-constants -fmerge-constants -fmodulo-sched @gol -fmodulo-sched-allow-regmoves -fmove-loop-invariants -fmudflap @gol -fmudflapir -fmudflapth -fno-branch-count-reg -fno-default-inline @gol -fno-defer-pop -fno-function-cse -fno-guess-branch-probability @gol @@ -389,7 +389,7 @@ Objective-C and Objective-C++ Dialects}. -funit-at-a-time -funroll-all-loops -funroll-loops @gol -funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol -fvariable-expansion-in-unroller -fvect-cost-model -fvpt -fweb @gol --fwhole-program @gol +-fwhole-program -fwhopr -fwpa -use-linker-plugin @gol --param @var{name}=@var{value} -O -O0 -O1 -O2 -O3 -Os} @@ -7111,6 +7111,223 @@ compilation unit, not for the single source file itself. This option implies @option{-fwhole-file} for Fortran programs. +@item -flto +@opindex flto +This option runs the standard link-time optimizer. When invoked +with source code, it generates GIMPLE (one of GCC's internal +representations) and writes it to special ELF sections in the object +file. When the object files are linked together, all the function +bodies are read from these ELF sections and instantiated as if they +had been part of the same translation unit. + +To use the link-timer optimizer, @option{-flto} needs to be specified at +compile time and during the final link. For example, + +@smallexample +gcc -c -O2 -flto foo.c +gcc -c -O2 -flto bar.c +gcc -o myprog -flto -O2 foo.o bar.o +@end smallexample + +The first two invocations to GCC will save a bytecode representation +of GIMPLE into special ELF sections inside @file{foo.o} and +@file{bar.o}. The final invocation will read the GIMPLE bytecode from +@file{foo.o} and @file{bar.o}, merge the two files into a single +internal image, and compile the result as usual. Since both +@file{foo.o} and @file{bar.o} are merged into a single image, this +causes all the inter-procedural analyses and optimizations in GCC to +work across the two files as if they were a single one. This means, +for example, that the inliner will be able to inline functions in +@file{bar.o} into functions in @file{foo.o} and vice-versa. + +Another (simpler) way to enable link-time optimization is, + +@smallexample +gcc -o myprog -flto -O2 foo.c bar.c +@end smallexample + +The above will generate bytecode for @file{foo.c} and @file{bar.c}, +merge them together into a single GIMPLE representation and optimize +them as usual to produce @file{myprog}. + +The only important thing to keep in mind is that to enable link-time +optimizations the @option{-flto} flag needs to be passed to both the +compile and the link commands. + +Note that when a file is compiled with @option{-flto}, the generated +object file will be larger than a regular object file because it will +contain GIMPLE bytecodes and the usual final code. This means that +object files with LTO information can be linked as a normal object +file. So, in the previous example, if the final link is done with + +@smallexample +gcc -o myprog foo.o bar.o +@end smallexample + +The only difference will be that no inter-procedural optimizations +will be applied to produce @file{myprog}. The two object files +@file{foo.o} and @file{bar.o} will be simply sent to the regular +linker. + +Additionally, the optimization flags used to compile individual files +are not necessarily related to those used at link-time. For instance, + +@smallexample +gcc -c -O0 -flto foo.c +gcc -c -O0 -flto bar.c +gcc -o myprog -flto -O3 foo.o bar.o +@end smallexample + +This will produce individual object files with unoptimized assembler +code, but the resulting binary @file{myprog} will be optimized at +@option{-O3}. Now, if the final binary is generated without +@option{-flto}, then @file{myprog} will not be optimized. + +When producing the final binary with @option{-flto}, GCC will only +apply link-time optimizations to those files that contain bytecode. +Therefore, you can mix and match object files and libraries with +GIMPLE bytecodes and final object code. GCC will automatically select +which files to optimize in LTO mode and which files to link without +further processing. + +There are some code generation flags that GCC will preserve when +generating bytecodes, as they need to be used during the final link +stage. Currently, the following options are saved into the GIMPLE +bytecode files: @option{-fPIC}, @option{-fcommon} and all the +@option{-m} target flags. + +At link time, these options are read-in and reapplied. Note that the +current implementation makes no attempt at recognizing conflicting +values for these options. If two or more files have a conflicting +value (e.g., one file is compiled with @option{-fPIC} and another +isn't), the compiler will simply use the last value read from the +bytecode files. It is recommended, then, that all the files +participating in the same link be compiled with the same options. + +Another feature of LTO is that it is possible to apply interprocedural +optimizations on files written in different languages. This requires +some support in the language front end. Currently, the C, C++ and +Fortran front ends are capable of emitting GIMPLE bytecodes, so +something like this should work + +@smallexample +gcc -c -flto foo.c +g++ -c -flto bar.cc +gfortran -c -flto baz.f90 +g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran +@end smallexample + +Notice that the final link is done with @command{g++} to get the C++ +runtime libraries and @option{-lgfortran} is added to get the Fortran +runtime libraries. In general, when mixing languages in LTO mode, you +should use the same link command used when mixing languages in a +regular (non-LTO) compilation. This means that if your build process +was mixing languages before, all you need to add is @option{-flto} to +all the compile and link commands. + +If object files containing GIMPLE bytecode are stored in a library +archive, say @file{libfoo.a}, it is possible to extract and use them +in an LTO link if you are using @command{gold} as the linker (which, +in turn requires GCC to be configured with @option{--enable-gold}). +To enable this feature, use the flag @option{-use-linker-plugin} at +link-time: + +@smallexample +gcc -o myprog -O2 -flto -use-linker-plugin a.o b.o -lfoo +@end smallexample + +With the linker plugin enabled, @command{gold} will extract the needed +GIMPLE files from @file{libfoo.a} and pass them on to the running GCC +to make them part of the aggregated GIMPLE image to be optimized. + +If you are not using @command{gold} and/or do not specify +@option{-use-linker-plugin} then the objects inside @file{libfoo.a} +will be extracted and linked as usual, but they will not participate +in the LTO optimization process. + +Regarding portability: the current implementation of LTO makes no +attempt at generating bytecode that can be ported between different +types of hosts. The bytecode files are versioned and there is a +strict version check, so bytecode files generated in one version of +GCC will not work with an older/newer version of GCC. + +This option is disabled by default. + +@item -fwhopr +@opindex fwhopr +This option is identical in functionality to @option{-flto} but it +differs in how the final link stage is executed. Instead of loading +all the function bodies in memory, the callgraph is analyzed and +optimization decisions are made (whole program analysis or WPA). Once +optimization decisions are made, the callgraph is partitioned and the +different sections are compiled separately (local transformations or +LTRANS)@. This process allows optimizations on very large programs +that otherwise would not fit in memory. This option enables +@option{-fwpa} and @option{-fltrans} automatically. + +Disabled by default. + +@item -fwpa +@opindex fwpa +This is an internal option used by GCC when compiling with +@option{-fwhopr}. You should never need to use it. + +This option runs the link-time optimizer in the whole-program-analysis +(WPA) mode, which reads in summary information from all inputs and +performs a whole-program analysis based on summary information only. +It generates object files for subsequent runs of the link-time +optimizer where individual object files are optimized using both +summary information from the WPA mode and the actual function bodies. +It then drives the LTRANS phase. + +Disabled by default. + +@item -fltrans +@opindex fltrans +This is an internal option used by GCC when compiling with +@option{-fwhopr}. You should never need to use it. + +This option runs the link-time optimizer in the local-transformation (LTRANS) +mode, which reads in output from a previous run of the LTO in WPA mode. +In the LTRANS mode, LTO optimizes an object and produces the final assembly. + +Disabled by default. + +@item -fltrans-output-list=@var{file} +@opindex fltrans-output-list +This is an internal option used by GCC when compiling with +@option{-fwhopr}. You should never need to use it. + +This option specifies a file to which the names of LTRANS output files are +written. This option is only meaningful in conjunction with @option{-fwpa}. + +Disabled by default. + +@item -flto-compression-level=@var{n} +This option specifies the level of compression used for intermediate +language written to LTO object files, and is only meaningful in +conjunction with LTO mode (@option{-fwhopr}, @option{-flto}). Valid +values are 0 (no compression) to 9 (maximum compression). Values +outside this range are clamped to either 0 or 9. If the option is not +given, a default balanced compression setting is used. + +@item -flto-report +Prints a report with internal details on the workings of the link-time +optimizer. The contents of this report vary from version to version, +it is meant to be useful to GCC developers when processing object +files in LTO mode (via @option{-fwhopr} or @option{-flto}). + +Disabled by default. + +@item -use-linker-plugin +Enables the extraction of objects with GIMPLE bytecode information +from library archives. This option relies on features available only +in @command{gold}, so to use this you must configure GCC with +@option{--enable-gold}. See @option{-flto} for a description on the +effect of this flag and how to use it. + +Disabled by default. + @item -fcprop-registers @opindex fcprop-registers After register allocation and post-register allocation instruction splitting, diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 22b27e76ec9..4cbc36f14a3 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -93,12 +93,16 @@ The Objective-C and Objective-C++ runtime library. @item libstdc++-v3 The C++ runtime library. +@item lto-plugin +Plugin used by @command{gold} if link-time optimizations are enabled. + @item maintainer-scripts Scripts used by the @code{gccadmin} account on @code{gcc.gnu.org}. @item zlib -The @code{zlib} compression library, used by the Java front end and as -part of the Java runtime library. +The @code{zlib} compression library, used by the Java front end, as +part of the Java runtime library, and for compressing and uncompressing +GCC's intermediate language in LTO object files. @end table The build system in the top level directory, including how recursion @@ -137,11 +141,12 @@ The @file{gcc} directory contains the following subdirectories: @item @var{language} Subdirectories for various languages. Directories containing a file @file{config-lang.in} are language subdirectories. The contents of -the subdirectories @file{cp} (for C++), @file{objc} (for Objective-C) -and @file{objcp} (for Objective-C++) are documented in this manual -(@pxref{Passes, , Passes and Files of the Compiler}); those for other -languages are not. @xref{Front End, , Anatomy of a Language Front End}, -for details of the files in these directories. +the subdirectories @file{cp} (for C++), @file{lto} (for LTO), +@file{objc} (for Objective-C) and @file{objcp} (for Objective-C++) are +documented in this manual (@pxref{Passes, , Passes and Files of the +Compiler}); those for other languages are not. @xref{Front End, , +Anatomy of a Language Front End}, for details of the files in these +directories. @item config Configuration files for supported architectures and operating @@ -821,6 +826,7 @@ here; FIXME: document the others. * Ada Tests:: The Ada language testsuites. * C Tests:: The C language testsuites. * libgcj Tests:: The Java library testsuites. +* LTO Testing:: Support for testing link-time optimizations. * gcov Testing:: Support for testing gcov. * profopt Testing:: Support for testing profile-directed optimizations. * compat Testing:: Support for testing binary compatibility. @@ -1347,6 +1353,42 @@ bugs in libgcj that had caused Mauve test failures. We encourage developers to contribute test cases to Mauve. +@node LTO Testing +@subsection Support for testing link-time optimizations + +Tests for link-time optimizations usually require multiple source files +that are compiled separately, perhaps with different sets of options. +There are several special-purpose test directives used for these tests. + +@table @code +@item @{ dg-lto-do @var{do-what-keyword} @} +@var{do-what-keyword} specifies how the test is compiled and whether +it is executed. It is one of: + +@table @code +@item assemble +Compile with @option{-c} to produce a relocatable object file. +@item link +Compile, assemble, and link to produce an executable file. +@item run +Produce and run an executable file, which is expected to return +an exit code of 0. +@end table + +The default is @code{assemble}. That can be overridden for a set of +tests by redefining @code{dg-do-what-default} within the @code{.exp} +file for those tests. + +Unlike @code{dg-do}, @code{dg-lto-do} does not support an optional +@samp{target} or @samp{xfail} list. Use @code{dg-skip-if}, +@code{dg-xfail-if}, or @code{dg-xfail-run-if}. + +@item @{ dg-lto-options @{ @{ @var{options} @} [@{ @var{options} @}] @} [@{ target @var{selector} @}]@} +This directive provides a list of one or more sets of compiler options +to override @var{LTO_OPTIONS}. Each test will be compiled and run with +each of these sets of options. +@end table + @node gcov Testing @subsection Support for testing @command{gcov} diff --git a/gcc/except.c b/gcc/except.c index bb26bf4dc6f..c00bcd397bd 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -2886,7 +2886,14 @@ output_ttype (tree type, int tt_format, int tt_format_size) { struct varpool_node *node; - type = lookup_type_for_runtime (type); + /* FIXME lto. pass_ipa_free_lang_data changes all types to + runtime types so TYPE should already be a runtime type + reference. When pass_ipa_free_lang data is made a default + pass, we can then remove the call to lookup_type_for_runtime + below. */ + if (TYPE_P (type)) + type = lookup_type_for_runtime (type); + value = expand_expr (type, NULL_RTX, VOIDmode, EXPAND_INITIALIZER); /* Let cgraph know that the rtti decl is used. Not all of the diff --git a/gcc/flags.h b/gcc/flags.h index 8b71302f3e4..bd8b82d4372 100644 --- a/gcc/flags.h +++ b/gcc/flags.h @@ -111,6 +111,17 @@ extern int optimize; extern int optimize_size; +/* True if this is the LTO front end (lto1). This is used to disable + gimple generation and lowering passes that are normally run on the + output of a front end. These passes must be bypassed for lto since + they have already been done before the gimple was written. */ + +extern bool in_lto_p; + +/* Nonzero if we should write GIMPLE bytecode for link-time optimization. */ + +extern int flag_generate_lto; + /* Used to set the level of -Wstrict-aliasing, when no level is specified. The external way to set the default level is to use -Wstrict-aliasing=level. diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index c325d258ae8..c3444d48831 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,7 @@ +2009-10-03 Richard Guenther + + * options.c (gfc_post_options): Handle -flto and -fwhopr. + 2009-10-02 Tobias Burnus PR fortran/41479 diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c index 3e20f8e45d4..d2c6d9ba849 100644 --- a/gcc/fortran/options.c +++ b/gcc/fortran/options.c @@ -242,6 +242,28 @@ gfc_post_options (const char **pfilename) if (flag_whole_program) gfc_option.flag_whole_file = 1; + if (flag_lto || flag_whopr) + { +#ifdef ENABLE_LTO + flag_generate_lto = 1; + + /* When generating IL, do not operate in whole-program mode. + Otherwise, symbols will be privatized too early, causing link + errors later. */ + flag_whole_program = 0; + + /* But do enable whole-file mode. */ + gfc_option.flag_whole_file = 1; +#else + error ("LTO support has not been enabled in this configuration"); +#endif + } + + /* Reconcile -flto and -fwhopr. Set additional flags as appropriate and + check option consistency. */ + if (flag_lto && flag_whopr) + error ("-flto and -fwhopr are mutually exclusive"); + /* -fbounds-check is equivalent to -fcheck=bounds */ if (flag_bounds_check) gfc_option.rtcheck |= GFC_RTCHECK_BOUNDS; diff --git a/gcc/gcc.c b/gcc/gcc.c index a9ed7e21696..9be56f2cd02 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -764,10 +764,23 @@ proper position among the other output files. */ /* We want %{T*} after %{L*} and %D so that it can be used to specify linker scripts which exist in user specified directories, or in standard directories. */ +/* We pass any -flto and -fwhopr flags on to the linker, which is expected + to understand them. In practice, this means it had better be collect2. */ #ifndef LINK_COMMAND_SPEC #define LINK_COMMAND_SPEC "\ %{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\ - %(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\ + %(linker) \ + %{use-linker-plugin: \ + -plugin %(linker_plugin_file) \ + -plugin-opt=%(lto_wrapper) \ + -plugin-opt=%(lto_gcc) \ + %{static|static-libgcc:-plugin-opt=-pass-through=%(lto_libgcc)} \ + %{O*:-plugin-opt=-O%*} \ + %{w:-plugin-opt=-w} \ + %{f*:-plugin-opt=-f%*} \ + } \ + %{flto} %{fwhopr} %l " LINK_PIE_SPEC \ + "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\ %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\ %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\ %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)} %(mflib)\ @@ -815,6 +828,10 @@ static const char *endfile_spec = ENDFILE_SPEC; static const char *startfile_spec = STARTFILE_SPEC; static const char *switches_need_spaces = SWITCHES_NEED_SPACES; static const char *linker_name_spec = LINKER_NAME; +static const char *linker_plugin_file_spec = ""; +static const char *lto_wrapper_spec = ""; +static const char *lto_gcc_spec = ""; +static const char *lto_libgcc_spec = ""; static const char *link_command_spec = LINK_COMMAND_SPEC; static const char *link_libgcc_spec = LINK_LIBGCC_SPEC; static const char *startfile_prefix_spec = STARTFILE_PREFIX_SPEC; @@ -891,11 +908,15 @@ static const char *asm_options = static const char *invoke_as = #ifdef AS_NEEDS_DASH_FOR_PIPED_INPUT -"%{fcompare-debug=*|fdump-final-insns=*:%:compare-debug-dump-opt()}\ - %{!S:-o %|.s |\n as %(asm_options) %|.s %A }"; +"%{!fwpa:\ + %{fcompare-debug=*|fdump-final-insns=*:%:compare-debug-dump-opt()}\ + %{!S:-o %|.s |\n as %(asm_options) %|.s %A }\ + }"; #else -"%{fcompare-debug=*|fdump-final-insns=*:%:compare-debug-dump-opt()}\ - %{!S:-o %|.s |\n as %(asm_options) %m.s %A }"; +"%{!fwpa:\ + %{fcompare-debug=*|fdump-final-insns=*:%:compare-debug-dump-opt()}\ + %{!S:-o %|.s |\n as %(asm_options) %m.s %A }\ + }"; #endif /* Some compilers have limits on line lengths, and the multilib_select @@ -1653,6 +1674,10 @@ static struct spec_list static_specs[] = INIT_STATIC_SPEC ("multilib_exclusions", &multilib_exclusions), INIT_STATIC_SPEC ("multilib_options", &multilib_options), INIT_STATIC_SPEC ("linker", &linker_name_spec), + INIT_STATIC_SPEC ("linker_plugin_file", &linker_plugin_file_spec), + INIT_STATIC_SPEC ("lto_wrapper", <o_wrapper_spec), + INIT_STATIC_SPEC ("lto_gcc", <o_gcc_spec), + INIT_STATIC_SPEC ("lto_libgcc", <o_libgcc_spec), INIT_STATIC_SPEC ("link_libgcc", &link_libgcc_spec), INIT_STATIC_SPEC ("md_exec_prefix", &md_exec_prefix), INIT_STATIC_SPEC ("md_startfile_prefix", &md_startfile_prefix), @@ -6834,14 +6859,6 @@ main (int argc, char **argv) multilib_defaults = XOBFINISH (&multilib_obstack, const char *); } - /* Set up to remember the pathname of gcc and any options - needed for collect. We use argv[0] instead of programname because - we need the complete pathname. */ - obstack_init (&collect_obstack); - obstack_grow (&collect_obstack, "COLLECT_GCC=", sizeof ("COLLECT_GCC=") - 1); - obstack_grow (&collect_obstack, argv[0], strlen (argv[0]) + 1); - xputenv (XOBFINISH (&collect_obstack, char *)); - #ifdef INIT_ENVIRONMENT /* Set up any other necessary machine specific environment variables. */ xputenv (INIT_ENVIRONMENT); @@ -7055,6 +7072,27 @@ main (int argc, char **argv) the subdirectory based on the options. */ set_multilib_dir (); + /* Set up to remember the pathname of gcc and any options + needed for collect. We use argv[0] instead of programname because + we need the complete pathname. */ + obstack_init (&collect_obstack); + obstack_grow (&collect_obstack, "COLLECT_GCC=", sizeof ("COLLECT_GCC=") - 1); + obstack_grow (&collect_obstack, argv[0], strlen (argv[0]) + 1); + xputenv (XOBFINISH (&collect_obstack, char *)); + + /* Set up to remember the pathname of the lto wrapper. */ + + lto_wrapper_spec = find_a_file (&exec_prefixes, "lto-wrapper", X_OK, false); + if (lto_wrapper_spec) + { + obstack_init (&collect_obstack); + obstack_grow (&collect_obstack, "COLLECT_LTO_WRAPPER=", + sizeof ("COLLECT_LTO_WRAPPER=") - 1); + obstack_grow (&collect_obstack, lto_wrapper_spec, + strlen (lto_wrapper_spec) + 1); + xputenv (XOBFINISH (&collect_obstack, char *)); + } + /* Warn about any switches that no pass was interested in. */ for (i = 0; (int) i < n_switches; i++) @@ -7475,6 +7513,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" if (num_linker_inputs > 0 && error_count == 0 && print_subprocess_help < 2) { int tmp = execution_count; + const char *use_linker_plugin = "use-linker-plugin"; /* We'll use ld if we can't find collect2. */ if (! strcmp (linker_name_spec, "collect2")) @@ -7483,6 +7522,23 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" if (s == NULL) linker_name_spec = "ld"; } + + if (switch_matches (use_linker_plugin, + use_linker_plugin + strlen (use_linker_plugin), 0)) + { + linker_plugin_file_spec = find_a_file (&exec_prefixes, + "liblto_plugin.so", X_OK, + false); + if (!linker_plugin_file_spec) + fatal ("-use-linker-plugin, but liblto_plugin.so not found."); + + lto_libgcc_spec = find_a_file (&startfile_prefixes, "libgcc.a", + R_OK, true); + if (!lto_libgcc_spec) + fatal ("could not find libgcc.a."); + } + lto_gcc_spec = argv[0]; + /* Rebuild the COMPILER_PATH and LIBRARY_PATH environment variables for collect. */ putenv_from_prefixes (&exec_prefixes, "COMPILER_PATH", false); diff --git a/gcc/gimple.c b/gcc/gimple.c index 425463c31ca..af54306e54a 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -23,6 +23,7 @@ along with GCC; see the file COPYING3. If not see #include "system.h" #include "coretypes.h" #include "tm.h" +#include "target.h" #include "tree.h" #include "ggc.h" #include "hard-reg-set.h" @@ -33,8 +34,18 @@ along with GCC; see the file COPYING3. If not see #include "tree-flow.h" #include "value-prof.h" #include "flags.h" +#include "alias.h" #include "demangle.h" +/* Global type table. FIXME lto, it should be possible to re-use some + of the type hashing routines in tree.c (type_hash_canon, type_hash_lookup, + etc), but those assume that types were built with the various + build_*_type routines which is not the case with the streamer. */ +static htab_t gimple_types; +static struct pointer_map_t *type_hash_cache; + +/* Global type comparison cache. */ +static htab_t gtc_visited; /* All the tuples have their operand vector (if present) at the very bottom of the structure. Therefore, the offset required to find the @@ -115,8 +126,7 @@ gimple_size (enum gimple_code code) /* Allocate memory for a GIMPLE statement with code CODE and NUM_OPS operands. */ -#define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO) -static gimple +gimple gimple_alloc_stat (enum gimple_code code, unsigned num_ops MEM_STAT_DECL) { size_t size; @@ -613,7 +623,7 @@ gimple_build_eh_must_not_throw (tree decl) gcc_assert (TREE_CODE (decl) == FUNCTION_DECL); gcc_assert (flags_from_decl_or_type (decl) & ECF_NORETURN); - p->gimple_eh_mnt.fndecl = decl; + gimple_eh_must_not_throw_set_fndecl (p, decl); return p; } @@ -3000,6 +3010,1162 @@ gimple_call_copy_skip_args (gimple stmt, bitmap args_to_skip) } +static hashval_t gimple_type_hash (const void *); + +/* Structure used to maintain a cache of some type pairs compared by + gimple_types_compatible_p when comparing aggregate types. There are + four possible values for SAME_P: + + -2: The pair (T1, T2) has just been inserted in the table. + -1: The pair (T1, T2) is currently being compared. + 0: T1 and T2 are different types. + 1: T1 and T2 are the same type. + + This table is only used when comparing aggregate types to avoid + infinite recursion due to self-referential types. */ +struct type_pair_d +{ + tree t1; + tree t2; + int same_p; +}; +typedef struct type_pair_d *type_pair_t; + +/* Return a hash value for the type pair pointed-to by P. */ + +static hashval_t +type_pair_hash (const void *p) +{ + const struct type_pair_d *pair = (const struct type_pair_d *) p; + hashval_t val1 = iterative_hash_hashval_t (htab_hash_pointer (pair->t1), 0); + hashval_t val2 = iterative_hash_hashval_t (htab_hash_pointer (pair->t2), 0); + return (iterative_hash_hashval_t (val2, val1) + ^ iterative_hash_hashval_t (val1, val2)); +} + +/* Compare two type pairs pointed-to by P1 and P2. */ + +static int +type_pair_eq (const void *p1, const void *p2) +{ + const struct type_pair_d *pair1 = (const struct type_pair_d *) p1; + const struct type_pair_d *pair2 = (const struct type_pair_d *) p2; + return ((pair1->t1 == pair2->t1 && pair1->t2 == pair2->t2) + || (pair1->t1 == pair2->t2 && pair1->t2 == pair2->t1)); +} + +/* Lookup the pair of types T1 and T2 in *VISITED_P. Insert a new + entry if none existed. */ + +static type_pair_t +lookup_type_pair (tree t1, tree t2, htab_t *visited_p) +{ + struct type_pair_d pair; + type_pair_t p; + void **slot; + + if (*visited_p == NULL) + *visited_p = htab_create (251, type_pair_hash, type_pair_eq, free); + + pair.t1 = t1; + pair.t2 = t2; + slot = htab_find_slot (*visited_p, &pair, INSERT); + + if (*slot) + p = *((type_pair_t *) slot); + else + { + p = XNEW (struct type_pair_d); + p->t1 = t1; + p->t2 = t2; + p->same_p = -2; + *slot = (void *) p; + } + + return p; +} + + +/* Force merging the type T2 into the type T1. */ + +void +gimple_force_type_merge (tree t1, tree t2) +{ + void **slot; + type_pair_t p; + + /* There's no other way than copying t2 to t1 in this case. + Yuck. We'll just call this "completing" t1. */ + memcpy (t1, t2, tree_size (t1)); + + /* Adjust the hash value of T1 if it was computed already. Otherwise + we would be forced to not hash fields of structs to match the + hash value of an incomplete struct. */ + if (type_hash_cache + && (slot = pointer_map_contains (type_hash_cache, t1)) != NULL) + { + gimple_type_hash (t2); + *slot = *pointer_map_contains (type_hash_cache, t2); + } + + /* Adjust cached comparison results for T1 and T2 to make sure + they now compare compatible. */ + p = lookup_type_pair (t1, t2, >c_visited); + p->same_p = 1; +} + + +/* Return true if both types have the same name. */ + +static bool +compare_type_names_p (tree t1, tree t2) +{ + tree name1 = TYPE_NAME (t1); + tree name2 = TYPE_NAME (t2); + + /* Consider anonymous types all unique. */ + if (!name1 || !name2) + return false; + + if (TREE_CODE (name1) == TYPE_DECL) + { + name1 = DECL_NAME (name1); + if (!name1) + return false; + } + gcc_assert (TREE_CODE (name1) == IDENTIFIER_NODE); + + if (TREE_CODE (name2) == TYPE_DECL) + { + name2 = DECL_NAME (name2); + if (!name2) + return false; + } + gcc_assert (TREE_CODE (name2) == IDENTIFIER_NODE); + + /* Identifiers can be compared with pointer equality rather + than a string comparison. */ + if (name1 == name2) + return true; + + return false; +} + +/* Return true if the field decls F1 and F2 are at the same offset. */ + +static bool +compare_field_offset (tree f1, tree f2) +{ + if (DECL_OFFSET_ALIGN (f1) == DECL_OFFSET_ALIGN (f2)) + return (operand_equal_p (DECL_FIELD_OFFSET (f1), + DECL_FIELD_OFFSET (f2), 0) + && tree_int_cst_equal (DECL_FIELD_BIT_OFFSET (f1), + DECL_FIELD_BIT_OFFSET (f2))); + + /* Fortran and C do not always agree on what DECL_OFFSET_ALIGN + should be, so handle differing ones specially by decomposing + the offset into a byte and bit offset manually. */ + if (host_integerp (DECL_FIELD_OFFSET (f1), 0) + && host_integerp (DECL_FIELD_OFFSET (f2), 0)) + { + unsigned HOST_WIDE_INT byte_offset1, byte_offset2; + unsigned HOST_WIDE_INT bit_offset1, bit_offset2; + bit_offset1 = TREE_INT_CST_LOW (DECL_FIELD_BIT_OFFSET (f1)); + byte_offset1 = (TREE_INT_CST_LOW (DECL_FIELD_OFFSET (f1)) + + bit_offset1 / BITS_PER_UNIT); + bit_offset2 = TREE_INT_CST_LOW (DECL_FIELD_BIT_OFFSET (f2)); + byte_offset2 = (TREE_INT_CST_LOW (DECL_FIELD_OFFSET (f2)) + + bit_offset2 / BITS_PER_UNIT); + if (byte_offset1 != byte_offset2) + return false; + return bit_offset1 % BITS_PER_UNIT == bit_offset2 % BITS_PER_UNIT; + } + + return false; +} + +/* Return 1 iff T1 and T2 are structurally identical. + Otherwise, return 0. */ + +int +gimple_types_compatible_p (tree t1, tree t2) +{ + type_pair_t p = NULL; + + /* Check first for the obvious case of pointer identity. */ + if (t1 == t2) + goto same_types; + + /* Check that we have two types to compare. */ + if (t1 == NULL_TREE || t2 == NULL_TREE) + goto different_types; + + /* Can't be the same type if the types don't have the same code. */ + if (TREE_CODE (t1) != TREE_CODE (t2)) + goto different_types; + + /* Void types are always the same. */ + if (TREE_CODE (t1) == VOID_TYPE) + goto same_types; + + /* Can't be the same type if they have different CV qualifiers. */ + if (TYPE_QUALS (t1) != TYPE_QUALS (t2)) + goto different_types; + + /* If the hash values of t1 and t2 are different the types can't + possibly be the same. This helps keeping the type-pair hashtable + small, only tracking comparisons for hash collisions. */ + if (gimple_type_hash (t1) != gimple_type_hash (t2)) + return 0; + + /* If we've visited this type pair before (in the case of aggregates + with self-referential types), and we made a decision, return it. */ + p = lookup_type_pair (t1, t2, >c_visited); + if (p->same_p == 0 || p->same_p == 1) + { + /* We have already decided whether T1 and T2 are the + same, return the cached result. */ + return p->same_p == 1; + } + else if (p->same_p == -1) + { + /* We are currently comparing this pair of types, assume + that they are the same and let the caller decide. */ + return 1; + } + + gcc_assert (p->same_p == -2); + + /* Mark the (T1, T2) comparison in progress. */ + p->same_p = -1; + + /* If their attributes are not the same they can't be the same type. */ + if (!attribute_list_equal (TYPE_ATTRIBUTES (t1), TYPE_ATTRIBUTES (t2))) + goto different_types; + + /* For numerical types, the bounds must coincide. */ + if (INTEGRAL_TYPE_P (t1) + || SCALAR_FLOAT_TYPE_P (t1) + || FIXED_POINT_TYPE_P (t1)) + { + /* Can't be the same type if they have different size, alignment, + sign, precision or mode. Note that from now on, comparisons + between *_CST nodes must be done using tree_int_cst_equal because + we cannot assume that constants from T1 and T2 will be shared + since T1 and T2 are distinct pointers. */ + if (!tree_int_cst_equal (TYPE_SIZE (t1), TYPE_SIZE (t2)) + || !tree_int_cst_equal (TYPE_SIZE_UNIT (t1), TYPE_SIZE_UNIT (t2)) + || TYPE_ALIGN (t1) != TYPE_ALIGN (t2) + || TYPE_PRECISION (t1) != TYPE_PRECISION (t2) + || TYPE_MODE (t1) != TYPE_MODE (t2) + || TYPE_UNSIGNED (t1) != TYPE_UNSIGNED (t2)) + goto different_types; + + /* For non-enumeral types, check type bounds. FIXME lto, we + cannot check bounds on enumeral types because different front + ends will produce different values. In C, enumeral types are + integers, while in C++ each element will have its own + symbolic value. We should decide how enums are to be + represented in GIMPLE and have each front end lower to that. */ + if (TREE_CODE (t1) != ENUMERAL_TYPE) + { + tree min1 = TYPE_MIN_VALUE (t1); + tree max1 = TYPE_MAX_VALUE (t1); + tree min2 = TYPE_MIN_VALUE (t2); + tree max2 = TYPE_MAX_VALUE (t2); + bool min_equal_p = false; + bool max_equal_p = false; + + /* If either type has a minimum value, the other type must + have the same. */ + if (min1 == NULL_TREE && min2 == NULL_TREE) + min_equal_p = true; + else if (min1 && min2 && operand_equal_p (min1, min2, 0)) + min_equal_p = true; + + /* Likewise, if either type has a maximum value, the other + type must have the same. */ + if (max1 == NULL_TREE && max2 == NULL_TREE) + max_equal_p = true; + else if (max1 && max2 && operand_equal_p (max1, max2, 0)) + max_equal_p = true; + + if (!min_equal_p || !max_equal_p) + goto different_types; + } + + if (TREE_CODE (t1) == INTEGER_TYPE) + { + if (TYPE_IS_SIZETYPE (t1) == TYPE_IS_SIZETYPE (t2) + && TYPE_STRING_FLAG (t1) == TYPE_STRING_FLAG (t2)) + goto same_types; + else + goto different_types; + } + else if (TREE_CODE (t1) == BOOLEAN_TYPE) + goto same_types; + else if (TREE_CODE (t1) == REAL_TYPE) + goto same_types; + } + + /* Do type-specific comparisons. */ + switch (TREE_CODE (t1)) + { + case ARRAY_TYPE: + /* Array types are the same if the element types are the same and + the number of elements are the same. */ + if (!gimple_types_compatible_p (TREE_TYPE (t1), TREE_TYPE (t2)) + || TYPE_STRING_FLAG (t1) != TYPE_STRING_FLAG (t2)) + goto different_types; + else + { + tree i1 = TYPE_DOMAIN (t1); + tree i2 = TYPE_DOMAIN (t2); + + /* For an incomplete external array, the type domain can be + NULL_TREE. Check this condition also. */ + if (i1 == NULL_TREE && i2 == NULL_TREE) + goto same_types; + else if (i1 == NULL_TREE || i2 == NULL_TREE) + goto different_types; + /* If for a complete array type the possibly gimplified sizes + are different the types are different. */ + else if (((TYPE_SIZE (i1) != NULL) ^ (TYPE_SIZE (i2) != NULL)) + || (TYPE_SIZE (i1) + && TYPE_SIZE (i2) + && !operand_equal_p (TYPE_SIZE (i1), TYPE_SIZE (i2), 0))) + goto different_types; + else + { + tree min1 = TYPE_MIN_VALUE (i1); + tree min2 = TYPE_MIN_VALUE (i2); + tree max1 = TYPE_MAX_VALUE (i1); + tree max2 = TYPE_MAX_VALUE (i2); + + /* The minimum/maximum values have to be the same. */ + if ((min1 == min2 + || (min1 && min2 && operand_equal_p (min1, min2, 0))) + && (max1 == max2 + || (max1 && max2 && operand_equal_p (max1, max2, 0)))) + goto same_types; + else + goto different_types; + } + } + + case METHOD_TYPE: + /* Method types should belong to the same class. */ + if (!gimple_types_compatible_p (TYPE_METHOD_BASETYPE (t1), + TYPE_METHOD_BASETYPE (t2))) + goto different_types; + + /* Fallthru */ + + case FUNCTION_TYPE: + /* Function types are the same if the return type and arguments types + are the same. */ + if (!gimple_types_compatible_p (TREE_TYPE (t1), TREE_TYPE (t2))) + goto different_types; + else + { + if (!targetm.comp_type_attributes (t1, t2)) + goto different_types; + + if (TYPE_ARG_TYPES (t1) == TYPE_ARG_TYPES (t2)) + goto same_types; + else + { + tree parms1, parms2; + + for (parms1 = TYPE_ARG_TYPES (t1), parms2 = TYPE_ARG_TYPES (t2); + parms1 && parms2; + parms1 = TREE_CHAIN (parms1), parms2 = TREE_CHAIN (parms2)) + { + if (!gimple_types_compatible_p (TREE_VALUE (parms1), + TREE_VALUE (parms2))) + goto different_types; + } + + if (parms1 || parms2) + goto different_types; + + goto same_types; + } + } + + case POINTER_TYPE: + case REFERENCE_TYPE: + { + /* If the two pointers have different ref-all attributes, + they can't be the same type. */ + if (TYPE_REF_CAN_ALIAS_ALL (t1) != TYPE_REF_CAN_ALIAS_ALL (t2)) + goto different_types; + + /* If one pointer points to an incomplete type variant of + the other pointed-to type they are the same. */ + if (TREE_CODE (TREE_TYPE (t1)) == TREE_CODE (TREE_TYPE (t2)) + && (!COMPLETE_TYPE_P (TREE_TYPE (t1)) + || !COMPLETE_TYPE_P (TREE_TYPE (t2))) + && compare_type_names_p (TREE_TYPE (t1), TREE_TYPE (t2))) + { + /* If t2 is complete we want to choose it instead of t1. */ + if (COMPLETE_TYPE_P (TREE_TYPE (t2))) + gimple_force_type_merge (TREE_TYPE (t1), TREE_TYPE (t2)); + goto same_types; + } + + /* Otherwise, pointer and reference types are the same if the + pointed-to types are the same. */ + if (gimple_types_compatible_p (TREE_TYPE (t1), TREE_TYPE (t2))) + goto same_types; + + goto different_types; + } + + case ENUMERAL_TYPE: + { + /* For enumeral types, all the values must be the same. */ + tree v1, v2; + + if (TYPE_VALUES (t1) == TYPE_VALUES (t2)) + goto same_types; + + for (v1 = TYPE_VALUES (t1), v2 = TYPE_VALUES (t2); + v1 && v2; + v1 = TREE_CHAIN (v1), v2 = TREE_CHAIN (v2)) + { + tree c1 = TREE_VALUE (v1); + tree c2 = TREE_VALUE (v2); + + if (TREE_CODE (c1) == CONST_DECL) + c1 = DECL_INITIAL (c1); + + if (TREE_CODE (c2) == CONST_DECL) + c2 = DECL_INITIAL (c2); + + if (tree_int_cst_equal (c1, c2) != 1) + goto different_types; + } + + /* If one enumeration has more values than the other, they + are not the same. */ + if (v1 || v2) + goto different_types; + + goto same_types; + } + + case RECORD_TYPE: + case UNION_TYPE: + case QUAL_UNION_TYPE: + { + /* For aggregate types, all the fields must be the same. */ + tree f1, f2; + + /* Compare every field. */ + for (f1 = TYPE_FIELDS (t1), f2 = TYPE_FIELDS (t2); + f1 && f2; + f1 = TREE_CHAIN (f1), f2 = TREE_CHAIN (f2)) + { + /* The fields must have the same name, offset and type. */ + if (DECL_NAME (f1) != DECL_NAME (f2) + || !compare_field_offset (f1, f2) + || !gimple_types_compatible_p (TREE_TYPE (f1), + TREE_TYPE (f2))) + goto different_types; + } + + /* If one aggregate has more fields than the other, they + are not the same. */ + if (f1 || f2) + goto different_types; + + goto same_types; + } + + case VECTOR_TYPE: + if (TYPE_VECTOR_SUBPARTS (t1) != TYPE_VECTOR_SUBPARTS (t2)) + goto different_types; + + /* Fallthru */ + case COMPLEX_TYPE: + if (!gimple_types_compatible_p (TREE_TYPE (t1), TREE_TYPE (t2))) + goto different_types; + goto same_types; + + default: + goto different_types; + } + + /* Common exit path for types that are not compatible. */ +different_types: + if (p) + p->same_p = 0; + return 0; + + /* Common exit path for types that are compatible. */ +same_types: + if (p) + p->same_p = 1; + return 1; +} + + + + +/* Per pointer state for the SCC finding. The on_sccstack flag + is not strictly required, it is true when there is no hash value + recorded for the type and false otherwise. But querying that + is slower. */ + +struct sccs +{ + unsigned int dfsnum; + unsigned int low; + bool on_sccstack; + hashval_t hash; +}; + +static unsigned int next_dfs_num; + +static hashval_t +iterative_hash_gimple_type (tree, hashval_t, VEC(tree, heap) **, + struct pointer_map_t *, struct obstack *); + +/* DFS visit the edge from the callers type with state *STATE to T. + Update the callers type hash V with the hash for T if it is not part + of the SCC containing the callers type and return it. + SCCSTACK, SCCSTATE and SCCSTATE_OBSTACK are state for the DFS walk done. */ + +static hashval_t +visit (tree t, struct sccs *state, hashval_t v, + VEC (tree, heap) **sccstack, + struct pointer_map_t *sccstate, + struct obstack *sccstate_obstack) +{ + struct sccs *cstate = NULL; + void **slot; + + /* If there is a hash value recorded for this type then it can't + possibly be part of our parent SCC. Simply mix in its hash. */ + if ((slot = pointer_map_contains (type_hash_cache, t))) + return iterative_hash_hashval_t ((hashval_t) (size_t) *slot, v); + + if ((slot = pointer_map_contains (sccstate, t)) != NULL) + cstate = (struct sccs *)*slot; + if (!cstate) + { + hashval_t tem; + /* Not yet visited. DFS recurse. */ + tem = iterative_hash_gimple_type (t, v, + sccstack, sccstate, sccstate_obstack); + if (!cstate) + cstate = (struct sccs *)* pointer_map_contains (sccstate, t); + state->low = MIN (state->low, cstate->low); + /* If the type is no longer on the SCC stack and thus is not part + of the parents SCC mix in its hash value. Otherwise we will + ignore the type for hashing purposes and return the unaltered + hash value. */ + if (!cstate->on_sccstack) + return tem; + } + if (cstate->dfsnum < state->dfsnum + && cstate->on_sccstack) + state->low = MIN (cstate->dfsnum, state->low); + + /* We are part of our parents SCC, skip this type during hashing + and return the unaltered hash value. */ + return v; +} + +/* Hash the name of TYPE with the previous hash value V and return it. */ + +static hashval_t +iterative_hash_type_name (tree type, hashval_t v) +{ + tree name = TYPE_NAME (TYPE_MAIN_VARIANT (type)); + if (!name) + return v; + if (TREE_CODE (name) == TYPE_DECL) + name = DECL_NAME (name); + if (!name) + return v; + gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE); + /* Do not hash names of anonymous unions. At least the C++ FE insists + to have a non-NULL TYPE_NAME for them. See cp/cp-tree.h for all + the glory. */ +#ifndef NO_DOT_IN_LABEL + if (IDENTIFIER_POINTER (name)[0] == '.') + return v; +#else +#ifndef NO_DOLLAR_IN_LABEL + if (IDENTIFIER_POINTER (name)[0] == '$') + return v; +#else + if (!strncmp (IDENTIFIER_POINTER (name), "__anon_", sizeof ("__anon_") - 1)) + return v; +#endif +#endif + return iterative_hash_object (IDENTIFIER_HASH_VALUE (name), v); +} + +/* Returning a hash value for gimple type TYPE combined with VAL. + SCCSTACK, SCCSTATE and SCCSTATE_OBSTACK are state for the DFS walk done. + + To hash a type we end up hashing in types that are reachable. + Through pointers we can end up with cycles which messes up the + required property that we need to compute the same hash value + for structurally equivalent types. To avoid this we have to + hash all types in a cycle (the SCC) in a commutative way. The + easiest way is to not mix in the hashes of the SCC members at + all. To make this work we have to delay setting the hash + values of the SCC until it is complete. */ + +static hashval_t +iterative_hash_gimple_type (tree type, hashval_t val, + VEC(tree, heap) **sccstack, + struct pointer_map_t *sccstate, + struct obstack *sccstate_obstack) +{ + hashval_t v; + void **slot; + struct sccs *state; + +#ifdef ENABLE_CHECKING + /* Not visited during this DFS walk nor during previous walks. */ + gcc_assert (!pointer_map_contains (type_hash_cache, type) + && !pointer_map_contains (sccstate, type)); +#endif + state = XOBNEW (sccstate_obstack, struct sccs); + *pointer_map_insert (sccstate, type) = state; + + VEC_safe_push (tree, heap, *sccstack, type); + state->dfsnum = next_dfs_num++; + state->low = state->dfsnum; + state->on_sccstack = true; + + /* Combine a few common features of types so that types are grouped into + smaller sets; when searching for existing matching types to merge, + only existing types having the same features as the new type will be + checked. */ + v = iterative_hash_hashval_t (TREE_CODE (type), 0); + v = iterative_hash_hashval_t (TYPE_QUALS (type), v); + v = iterative_hash_hashval_t (TREE_ADDRESSABLE (type), v); + + /* Do not hash the types size as this will cause differences in + hash values for the complete vs. the incomplete type variant. */ + + /* Incorporate common features of numerical types. */ + if (INTEGRAL_TYPE_P (type) + || SCALAR_FLOAT_TYPE_P (type) + || FIXED_POINT_TYPE_P (type)) + { + v = iterative_hash_hashval_t (TYPE_PRECISION (type), v); + v = iterative_hash_hashval_t (TYPE_MODE (type), v); + v = iterative_hash_hashval_t (TYPE_UNSIGNED (type), v); + } + + /* For pointer and reference types, fold in information about the type + pointed to but do not recurse into possibly incomplete types to + avoid hash differences for complete vs. incomplete types. */ + if (POINTER_TYPE_P (type)) + { + if (AGGREGATE_TYPE_P (TREE_TYPE (type))) + { + v = iterative_hash_hashval_t (TREE_CODE (TREE_TYPE (type)), v); + v = iterative_hash_type_name (type, v); + } + else + v = visit (TREE_TYPE (type), state, v, + sccstack, sccstate, sccstate_obstack); + } + + /* Recurse for aggregates with a single element. */ + if (TREE_CODE (type) == ARRAY_TYPE + || TREE_CODE (type) == COMPLEX_TYPE + || TREE_CODE (type) == VECTOR_TYPE) + v = visit (TREE_TYPE (type), state, v, + sccstack, sccstate, sccstate_obstack); + + /* Incorporate function return and argument types. */ + if (TREE_CODE (type) == FUNCTION_TYPE || TREE_CODE (type) == METHOD_TYPE) + { + unsigned na; + tree p; + + /* For method types also incorporate their parent class. */ + if (TREE_CODE (type) == METHOD_TYPE) + v = visit (TYPE_METHOD_BASETYPE (type), state, v, + sccstack, sccstate, sccstate_obstack); + + v = visit (TREE_TYPE (type), state, v, + sccstack, sccstate, sccstate_obstack); + + for (p = TYPE_ARG_TYPES (type), na = 0; p; p = TREE_CHAIN (p)) + { + v = visit (TREE_VALUE (p), state, v, + sccstack, sccstate, sccstate_obstack); + na++; + } + + v = iterative_hash_hashval_t (na, v); + } + + if (TREE_CODE (type) == RECORD_TYPE + || TREE_CODE (type) == UNION_TYPE + || TREE_CODE (type) == QUAL_UNION_TYPE) + { + unsigned nf; + tree f; + + v = iterative_hash_type_name (type, v); + + for (f = TYPE_FIELDS (type), nf = 0; f; f = TREE_CHAIN (f)) + { + v = visit (TREE_TYPE (f), state, v, + sccstack, sccstate, sccstate_obstack); + nf++; + } + + v = iterative_hash_hashval_t (nf, v); + } + + /* Record hash for us. */ + state->hash = v; + + /* See if we found an SCC. */ + if (state->low == state->dfsnum) + { + tree x; + + /* Pop off the SCC and set its hash values. */ + do + { + struct sccs *cstate; + x = VEC_pop (tree, *sccstack); + gcc_assert (!pointer_map_contains (type_hash_cache, x)); + cstate = (struct sccs *)*pointer_map_contains (sccstate, x); + cstate->on_sccstack = false; + slot = pointer_map_insert (type_hash_cache, x); + *slot = (void *) (size_t) cstate->hash; + } + while (x != type); + } + + return iterative_hash_hashval_t (v, val); +} + + +/* Returns a hash value for P (assumed to be a type). The hash value + is computed using some distinguishing features of the type. Note + that we cannot use pointer hashing here as we may be dealing with + two distinct instances of the same type. + + This function should produce the same hash value for two compatible + types according to gimple_types_compatible_p. */ + +static hashval_t +gimple_type_hash (const void *p) +{ + VEC(tree, heap) *sccstack = NULL; + struct pointer_map_t *sccstate; + struct obstack sccstate_obstack; + hashval_t val; + void **slot; + + if (type_hash_cache == NULL) + type_hash_cache = pointer_map_create (); + + if ((slot = pointer_map_contains (type_hash_cache, p)) != NULL) + return iterative_hash_hashval_t ((hashval_t) (size_t) *slot, 0); + + /* Perform a DFS walk and pre-hash all reachable types. */ + next_dfs_num = 1; + sccstate = pointer_map_create (); + gcc_obstack_init (&sccstate_obstack); + val = iterative_hash_gimple_type (CONST_CAST2 (tree, const void *, p), 0, + &sccstack, sccstate, &sccstate_obstack); + VEC_free (tree, heap, sccstack); + pointer_map_destroy (sccstate); + obstack_free (&sccstate_obstack, NULL); + + return val; +} + + +/* Returns nonzero if P1 and P2 are equal. */ + +static int +gimple_type_eq (const void *p1, const void *p2) +{ + const_tree t1 = (const_tree) p1; + const_tree t2 = (const_tree) p2; + return gimple_types_compatible_p (CONST_CAST_TREE (t1), CONST_CAST_TREE (t2)); +} + + +/* Register type T in the global type table gimple_types. + If another type T', compatible with T, already existed in + gimple_types then return T', otherwise return T. This is used by + LTO to merge identical types read from different TUs. */ + +tree +gimple_register_type (tree t) +{ + void **slot; + + gcc_assert (TYPE_P (t)); + + if (gimple_types == NULL) + gimple_types = htab_create (16381, gimple_type_hash, gimple_type_eq, 0); + + slot = htab_find_slot (gimple_types, t, INSERT); + if (*slot + && *(tree *)slot != t) + { + tree new_type = (tree) *((tree *) slot); + + /* Do not merge types with different addressability. */ + gcc_assert (TREE_ADDRESSABLE (t) == TREE_ADDRESSABLE (new_type)); + + /* If t is not its main variant then make t unreachable from its + main variant list. Otherwise we'd queue up a lot of duplicates + there. */ + if (t != TYPE_MAIN_VARIANT (t)) + { + tree tem = TYPE_MAIN_VARIANT (t); + while (tem && TYPE_NEXT_VARIANT (tem) != t) + tem = TYPE_NEXT_VARIANT (tem); + if (tem) + TYPE_NEXT_VARIANT (tem) = TYPE_NEXT_VARIANT (t); + TYPE_NEXT_VARIANT (t) = NULL_TREE; + } + + /* If we are a pointer then remove us from the pointer-to or + reference-to chain. Otherwise we'd queue up a lot of duplicates + there. */ + if (TREE_CODE (t) == POINTER_TYPE) + { + if (TYPE_POINTER_TO (TREE_TYPE (t)) == t) + TYPE_POINTER_TO (TREE_TYPE (t)) = TYPE_NEXT_PTR_TO (t); + else + { + tree tem = TYPE_POINTER_TO (TREE_TYPE (t)); + while (tem && TYPE_NEXT_PTR_TO (tem) != t) + tem = TYPE_NEXT_PTR_TO (tem); + if (tem) + TYPE_NEXT_PTR_TO (tem) = TYPE_NEXT_PTR_TO (t); + } + TYPE_NEXT_PTR_TO (t) = NULL_TREE; + } + else if (TREE_CODE (t) == REFERENCE_TYPE) + { + if (TYPE_REFERENCE_TO (TREE_TYPE (t)) == t) + TYPE_REFERENCE_TO (TREE_TYPE (t)) = TYPE_NEXT_REF_TO (t); + else + { + tree tem = TYPE_REFERENCE_TO (TREE_TYPE (t)); + while (tem && TYPE_NEXT_REF_TO (tem) != t) + tem = TYPE_NEXT_REF_TO (tem); + if (tem) + TYPE_NEXT_REF_TO (tem) = TYPE_NEXT_REF_TO (t); + } + TYPE_NEXT_REF_TO (t) = NULL_TREE; + } + + t = new_type; + } + else + *slot = (void *) t; + + return t; +} + + +/* Show statistics on references to the global type table gimple_types. */ + +void +print_gimple_types_stats (void) +{ + if (gimple_types) + fprintf (stderr, "GIMPLE type table: size %ld, %ld elements, " + "%ld searches, %ld collisions (ratio: %f)\n", + (long) htab_size (gimple_types), + (long) htab_elements (gimple_types), + (long) gimple_types->searches, + (long) gimple_types->collisions, + htab_collisions (gimple_types)); + else + fprintf (stderr, "GIMPLE type table is empty\n"); + if (gtc_visited) + fprintf (stderr, "GIMPLE type comparison table: size %ld, %ld elements, " + "%ld searches, %ld collisions (ratio: %f)\n", + (long) htab_size (gtc_visited), + (long) htab_elements (gtc_visited), + (long) gtc_visited->searches, + (long) gtc_visited->collisions, + htab_collisions (gtc_visited)); + else + fprintf (stderr, "GIMPLE type comparison table is empty\n"); +} + + +/* Return a type the same as TYPE except unsigned or + signed according to UNSIGNEDP. */ + +static tree +gimple_signed_or_unsigned_type (bool unsignedp, tree type) +{ + tree type1; + + type1 = TYPE_MAIN_VARIANT (type); + if (type1 == signed_char_type_node + || type1 == char_type_node + || type1 == unsigned_char_type_node) + return unsignedp ? unsigned_char_type_node : signed_char_type_node; + if (type1 == integer_type_node || type1 == unsigned_type_node) + return unsignedp ? unsigned_type_node : integer_type_node; + if (type1 == short_integer_type_node || type1 == short_unsigned_type_node) + return unsignedp ? short_unsigned_type_node : short_integer_type_node; + if (type1 == long_integer_type_node || type1 == long_unsigned_type_node) + return unsignedp ? long_unsigned_type_node : long_integer_type_node; + if (type1 == long_long_integer_type_node + || type1 == long_long_unsigned_type_node) + return unsignedp + ? long_long_unsigned_type_node + : long_long_integer_type_node; +#if HOST_BITS_PER_WIDE_INT >= 64 + if (type1 == intTI_type_node || type1 == unsigned_intTI_type_node) + return unsignedp ? unsigned_intTI_type_node : intTI_type_node; +#endif + if (type1 == intDI_type_node || type1 == unsigned_intDI_type_node) + return unsignedp ? unsigned_intDI_type_node : intDI_type_node; + if (type1 == intSI_type_node || type1 == unsigned_intSI_type_node) + return unsignedp ? unsigned_intSI_type_node : intSI_type_node; + if (type1 == intHI_type_node || type1 == unsigned_intHI_type_node) + return unsignedp ? unsigned_intHI_type_node : intHI_type_node; + if (type1 == intQI_type_node || type1 == unsigned_intQI_type_node) + return unsignedp ? unsigned_intQI_type_node : intQI_type_node; + +#define GIMPLE_FIXED_TYPES(NAME) \ + if (type1 == short_ ## NAME ## _type_node \ + || type1 == unsigned_short_ ## NAME ## _type_node) \ + return unsignedp ? unsigned_short_ ## NAME ## _type_node \ + : short_ ## NAME ## _type_node; \ + if (type1 == NAME ## _type_node \ + || type1 == unsigned_ ## NAME ## _type_node) \ + return unsignedp ? unsigned_ ## NAME ## _type_node \ + : NAME ## _type_node; \ + if (type1 == long_ ## NAME ## _type_node \ + || type1 == unsigned_long_ ## NAME ## _type_node) \ + return unsignedp ? unsigned_long_ ## NAME ## _type_node \ + : long_ ## NAME ## _type_node; \ + if (type1 == long_long_ ## NAME ## _type_node \ + || type1 == unsigned_long_long_ ## NAME ## _type_node) \ + return unsignedp ? unsigned_long_long_ ## NAME ## _type_node \ + : long_long_ ## NAME ## _type_node; + +#define GIMPLE_FIXED_MODE_TYPES(NAME) \ + if (type1 == NAME ## _type_node \ + || type1 == u ## NAME ## _type_node) \ + return unsignedp ? u ## NAME ## _type_node \ + : NAME ## _type_node; + +#define GIMPLE_FIXED_TYPES_SAT(NAME) \ + if (type1 == sat_ ## short_ ## NAME ## _type_node \ + || type1 == sat_ ## unsigned_short_ ## NAME ## _type_node) \ + return unsignedp ? sat_ ## unsigned_short_ ## NAME ## _type_node \ + : sat_ ## short_ ## NAME ## _type_node; \ + if (type1 == sat_ ## NAME ## _type_node \ + || type1 == sat_ ## unsigned_ ## NAME ## _type_node) \ + return unsignedp ? sat_ ## unsigned_ ## NAME ## _type_node \ + : sat_ ## NAME ## _type_node; \ + if (type1 == sat_ ## long_ ## NAME ## _type_node \ + || type1 == sat_ ## unsigned_long_ ## NAME ## _type_node) \ + return unsignedp ? sat_ ## unsigned_long_ ## NAME ## _type_node \ + : sat_ ## long_ ## NAME ## _type_node; \ + if (type1 == sat_ ## long_long_ ## NAME ## _type_node \ + || type1 == sat_ ## unsigned_long_long_ ## NAME ## _type_node) \ + return unsignedp ? sat_ ## unsigned_long_long_ ## NAME ## _type_node \ + : sat_ ## long_long_ ## NAME ## _type_node; + +#define GIMPLE_FIXED_MODE_TYPES_SAT(NAME) \ + if (type1 == sat_ ## NAME ## _type_node \ + || type1 == sat_ ## u ## NAME ## _type_node) \ + return unsignedp ? sat_ ## u ## NAME ## _type_node \ + : sat_ ## NAME ## _type_node; + + GIMPLE_FIXED_TYPES (fract); + GIMPLE_FIXED_TYPES_SAT (fract); + GIMPLE_FIXED_TYPES (accum); + GIMPLE_FIXED_TYPES_SAT (accum); + + GIMPLE_FIXED_MODE_TYPES (qq); + GIMPLE_FIXED_MODE_TYPES (hq); + GIMPLE_FIXED_MODE_TYPES (sq); + GIMPLE_FIXED_MODE_TYPES (dq); + GIMPLE_FIXED_MODE_TYPES (tq); + GIMPLE_FIXED_MODE_TYPES_SAT (qq); + GIMPLE_FIXED_MODE_TYPES_SAT (hq); + GIMPLE_FIXED_MODE_TYPES_SAT (sq); + GIMPLE_FIXED_MODE_TYPES_SAT (dq); + GIMPLE_FIXED_MODE_TYPES_SAT (tq); + GIMPLE_FIXED_MODE_TYPES (ha); + GIMPLE_FIXED_MODE_TYPES (sa); + GIMPLE_FIXED_MODE_TYPES (da); + GIMPLE_FIXED_MODE_TYPES (ta); + GIMPLE_FIXED_MODE_TYPES_SAT (ha); + GIMPLE_FIXED_MODE_TYPES_SAT (sa); + GIMPLE_FIXED_MODE_TYPES_SAT (da); + GIMPLE_FIXED_MODE_TYPES_SAT (ta); + + /* For ENUMERAL_TYPEs in C++, must check the mode of the types, not + the precision; they have precision set to match their range, but + may use a wider mode to match an ABI. If we change modes, we may + wind up with bad conversions. For INTEGER_TYPEs in C, must check + the precision as well, so as to yield correct results for + bit-field types. C++ does not have these separate bit-field + types, and producing a signed or unsigned variant of an + ENUMERAL_TYPE may cause other problems as well. */ + if (!INTEGRAL_TYPE_P (type) + || TYPE_UNSIGNED (type) == unsignedp) + return type; + +#define TYPE_OK(node) \ + (TYPE_MODE (type) == TYPE_MODE (node) \ + && TYPE_PRECISION (type) == TYPE_PRECISION (node)) + if (TYPE_OK (signed_char_type_node)) + return unsignedp ? unsigned_char_type_node : signed_char_type_node; + if (TYPE_OK (integer_type_node)) + return unsignedp ? unsigned_type_node : integer_type_node; + if (TYPE_OK (short_integer_type_node)) + return unsignedp ? short_unsigned_type_node : short_integer_type_node; + if (TYPE_OK (long_integer_type_node)) + return unsignedp ? long_unsigned_type_node : long_integer_type_node; + if (TYPE_OK (long_long_integer_type_node)) + return (unsignedp + ? long_long_unsigned_type_node + : long_long_integer_type_node); + +#if HOST_BITS_PER_WIDE_INT >= 64 + if (TYPE_OK (intTI_type_node)) + return unsignedp ? unsigned_intTI_type_node : intTI_type_node; +#endif + if (TYPE_OK (intDI_type_node)) + return unsignedp ? unsigned_intDI_type_node : intDI_type_node; + if (TYPE_OK (intSI_type_node)) + return unsignedp ? unsigned_intSI_type_node : intSI_type_node; + if (TYPE_OK (intHI_type_node)) + return unsignedp ? unsigned_intHI_type_node : intHI_type_node; + if (TYPE_OK (intQI_type_node)) + return unsignedp ? unsigned_intQI_type_node : intQI_type_node; + +#undef GIMPLE_FIXED_TYPES +#undef GIMPLE_FIXED_MODE_TYPES +#undef GIMPLE_FIXED_TYPES_SAT +#undef GIMPLE_FIXED_MODE_TYPES_SAT +#undef TYPE_OK + + return build_nonstandard_integer_type (TYPE_PRECISION (type), unsignedp); +} + + +/* Return an unsigned type the same as TYPE in other respects. */ + +tree +gimple_unsigned_type (tree type) +{ + return gimple_signed_or_unsigned_type (true, type); +} + + +/* Return a signed type the same as TYPE in other respects. */ + +tree +gimple_signed_type (tree type) +{ + return gimple_signed_or_unsigned_type (false, type); +} + + +/* Return the typed-based alias set for T, which may be an expression + or a type. Return -1 if we don't do anything special. */ + +alias_set_type +gimple_get_alias_set (tree t) +{ + tree u; + + /* Permit type-punning when accessing a union, provided the access + is directly through the union. For example, this code does not + permit taking the address of a union member and then storing + through it. Even the type-punning allowed here is a GCC + extension, albeit a common and useful one; the C standard says + that such accesses have implementation-defined behavior. */ + for (u = t; + TREE_CODE (u) == COMPONENT_REF || TREE_CODE (u) == ARRAY_REF; + u = TREE_OPERAND (u, 0)) + if (TREE_CODE (u) == COMPONENT_REF + && TREE_CODE (TREE_TYPE (TREE_OPERAND (u, 0))) == UNION_TYPE) + return 0; + + /* That's all the expressions we handle specially. */ + if (!TYPE_P (t)) + return -1; + + /* For convenience, follow the C standard when dealing with + character types. Any object may be accessed via an lvalue that + has character type. */ + if (t == char_type_node + || t == signed_char_type_node + || t == unsigned_char_type_node) + return 0; + + /* Allow aliasing between signed and unsigned variants of the same + type. We treat the signed variant as canonical. */ + if (TREE_CODE (t) == INTEGER_TYPE && TYPE_UNSIGNED (t)) + { + tree t1 = gimple_signed_type (t); + + /* t1 == t can happen for boolean nodes which are always unsigned. */ + if (t1 != t) + return get_alias_set (t1); + } + else if (POINTER_TYPE_P (t)) + { + tree t1; + + /* Unfortunately, there is no canonical form of a pointer type. + In particular, if we have `typedef int I', then `int *', and + `I *' are different types. So, we have to pick a canonical + representative. We do this below. + + Technically, this approach is actually more conservative that + it needs to be. In particular, `const int *' and `int *' + should be in different alias sets, according to the C and C++ + standard, since their types are not the same, and so, + technically, an `int **' and `const int **' cannot point at + the same thing. + + But, the standard is wrong. In particular, this code is + legal C++: + + int *ip; + int **ipp = &ip; + const int* const* cipp = ipp; + And, it doesn't make sense for that to be legal unless you + can dereference IPP and CIPP. So, we ignore cv-qualifiers on + the pointed-to types. This issue has been reported to the + C++ committee. */ + t1 = build_type_no_quals (t); + if (t1 != t) + return get_alias_set (t1); + } + + return -1; +} + + /* Data structure used to count the number of dereferences to PTR inside an expression. */ struct count_ptr_d @@ -3344,7 +4510,6 @@ gimple_decl_printable_name (tree decl, int verbosity) if (verbosity >= 2) { dmgl_opts = DMGL_VERBOSE - | DMGL_TYPES | DMGL_ANSI | DMGL_GNU_V3 | DMGL_RET_POSTFIX; diff --git a/gcc/gimple.h b/gcc/gimple.h index e1e3b655b7d..e21d53fcb3c 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -855,6 +855,8 @@ bool gimple_assign_rhs_could_trap_p (gimple); void gimple_regimplify_operands (gimple, gimple_stmt_iterator *); bool empty_body_p (gimple_seq); unsigned get_gimple_rhs_num_ops (enum tree_code); +#define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO) +gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL); const char *gimple_decl_printable_name (tree, int); tree gimple_fold_obj_type_ref (tree, tree); @@ -913,6 +915,13 @@ extern bool is_gimple_call_addr (tree); extern tree get_call_expr_in (tree t); extern void recalculate_side_effects (tree); +extern void gimple_force_type_merge (tree, tree); +extern int gimple_types_compatible_p (tree, tree); +extern tree gimple_register_type (tree); +extern void print_gimple_types_stats (void); +extern tree gimple_unsigned_type (tree); +extern tree gimple_signed_type (tree); +extern alias_set_type gimple_get_alias_set (tree); extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *, unsigned *); extern bool walk_stmt_load_store_addr_ops (gimple, void *, @@ -2912,6 +2921,16 @@ gimple_eh_must_not_throw_fndecl (gimple gs) return gs->gimple_eh_mnt.fndecl; } +/* Set the function decl to be called by GS to DECL. */ + +static inline void +gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl) +{ + GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW); + gs->gimple_eh_mnt.fndecl = decl; +} + + /* GIMPLE_TRY accessors. */ /* Return the kind of try block represented by GIMPLE_TRY GS. This is diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index f7782cbbf83..a974dd0aab3 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -1273,7 +1273,13 @@ ipcp_generate_summary (void) static bool cgraph_gate_cp (void) { - return flag_ipa_cp; + /* FIXME lto. IPA-CP does not tolerate running when the inlining decisions + have not been applied. This happens when WPA modifies the callgraph. + Since those decisions are not applied until after all the IPA passes + have been run in LTRANS, this means that IPA passes may see partially + modified callgraphs. The solution to this is to apply WPA decisions + early during LTRANS. */ + return flag_ipa_cp && !flag_ltrans; } struct ipa_opt_pass_d pass_ipa_cp = diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index 8851d605372..0a02ae1770a 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -326,7 +326,7 @@ cgraph_mark_inline (struct cgraph_edge *edge) struct cgraph_node *what = edge->callee; struct cgraph_edge *e, *next; - gcc_assert (!gimple_call_cannot_inline_p (edge->call_stmt)); + gcc_assert (!edge->call_stmt_cannot_inline_p); /* Look for all calls, mark them inline and clone recursively all inlined functions. */ for (e = what->callers; e; e = next) @@ -1031,7 +1031,7 @@ cgraph_decide_inlining_of_small_functions (void) else { struct cgraph_node *callee; - if (gimple_call_cannot_inline_p (edge->call_stmt) + if (edge->call_stmt_cannot_inline_p || !cgraph_check_inline_limits (edge->caller, edge->callee, &edge->inline_failed, true)) { @@ -1111,7 +1111,13 @@ cgraph_decide_inlining (void) bool redo_always_inline = true; int initial_size = 0; - cgraph_remove_function_insertion_hook (function_insertion_hook_holder); + /* FIXME lto. We need to rethink how to coordinate different passes. */ + if (flag_ltrans) + return 0; + + /* FIXME lto. We need to re-think about how the passes get invoked. */ + if (!flag_wpa) + cgraph_remove_function_insertion_hook (function_insertion_hook_holder); max_count = 0; max_benefit = 0; @@ -1121,7 +1127,6 @@ cgraph_decide_inlining (void) struct cgraph_edge *e; gcc_assert (inline_summary (node)->self_size == node->global.size); - gcc_assert (node->needed || node->reachable); initial_size += node->global.size; for (e = node->callees; e; e = e->next_callee) if (max_count < e->count) @@ -1129,7 +1134,9 @@ cgraph_decide_inlining (void) if (max_benefit < inline_summary (node)->time_inlining_benefit) max_benefit = inline_summary (node)->time_inlining_benefit; } - gcc_assert (!max_count || (profile_info && flag_branch_probabilities)); + gcc_assert (in_lto_p + || !max_count + || (profile_info && flag_branch_probabilities)); overall_size = initial_size; nnodes = cgraph_postorder (order); @@ -1177,8 +1184,7 @@ cgraph_decide_inlining (void) for (e = node->callers; e; e = next) { next = e->next_caller; - if (!e->inline_failed - || gimple_call_cannot_inline_p (e->call_stmt)) + if (!e->inline_failed || e->call_stmt_cannot_inline_p) continue; if (cgraph_recursive_inlining_p (e->caller, e->callee, &e->inline_failed)) @@ -1225,7 +1231,7 @@ cgraph_decide_inlining (void) && node->callers->inline_failed && node->callers->caller != node && node->callers->caller->global.inlined_to != node - && !gimple_call_cannot_inline_p (node->callers->call_stmt) + && !node->callers->call_stmt_cannot_inline_p && !DECL_EXTERNAL (node->decl) && !DECL_COMDAT (node->decl)) { @@ -1411,7 +1417,7 @@ cgraph_decide_inlining_incrementally (struct cgraph_node *node, if (!e->callee->local.disregard_inline_limits && (mode != INLINE_ALL || !e->callee->local.inlinable)) continue; - if (gimple_call_cannot_inline_p (e->call_stmt)) + if (e->call_stmt_cannot_inline_p) continue; /* When the edge is already inlined, we just need to recurse into it in order to fully flatten the leaves. */ @@ -1529,7 +1535,7 @@ cgraph_decide_inlining_incrementally (struct cgraph_node *node, } if (!cgraph_check_inline_limits (node, e->callee, &e->inline_failed, false) - || gimple_call_cannot_inline_p (e->call_stmt)) + || e->call_stmt_cannot_inline_p) { if (dump_file) { @@ -1632,6 +1638,7 @@ static bool cgraph_gate_ipa_early_inlining (void) { return (flag_early_inlining + && !in_lto_p && (flag_branch_probabilities || flag_test_coverage || profile_arc_flag)); } @@ -1919,6 +1926,10 @@ inline_generate_summary (void) { struct cgraph_node *node; + /* FIXME lto. We should not run any IPA-summary pass in LTRANS mode. */ + if (flag_ltrans) + return; + function_insertion_hook_holder = cgraph_add_function_insertion_hook (&add_new_function, NULL); diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 23710067ee7..7ffb676d914 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -1150,6 +1150,10 @@ bool ipa_propagate_indirect_call_infos (struct cgraph_edge *cs, VEC (cgraph_edge_p, heap) **new_edges) { + /* FIXME lto: We do not stream out indirect call information. */ + if (flag_wpa) + return false; + /* Do nothing if the preparation phase has not been carried out yet (i.e. during early inlining). */ if (!ipa_node_params_vector) diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c index 04d4e112ed3..ea1d81ea5e2 100644 --- a/gcc/ipa-pure-const.c +++ b/gcc/ipa-pure-const.c @@ -51,6 +51,7 @@ along with GCC; see the file COPYING3. If not see #include "diagnostic.h" #include "langhooks.h" #include "target.h" +#include "lto-streamer.h" #include "cfgloop.h" #include "tree-scalar-evolution.h" @@ -648,13 +649,15 @@ remove_node_data (struct cgraph_node *node, void *data ATTRIBUTE_UNUSED) } -/* Analyze each function in the cgraph to see if it is locally PURE or - CONST. */ - -static void -generate_summary (void) +static void +register_hooks (void) { - struct cgraph_node *node; + static bool init_p = false; + + if (init_p) + return; + + init_p = true; node_removal_hook_holder = cgraph_add_node_removal_hook (&remove_node_data, NULL); @@ -662,6 +665,19 @@ generate_summary (void) cgraph_add_node_duplication_hook (&duplicate_node_data, NULL); function_insertion_hook_holder = cgraph_add_function_insertion_hook (&add_new_function, NULL); +} + + +/* Analyze each function in the cgraph to see if it is locally PURE or + CONST. */ + +static void +generate_summary (void) +{ + struct cgraph_node *node; + + register_hooks (); + /* There are some shared nodes, in particular the initializers on static declarations. We do not need to scan them more than once since all we would be interested in are the addressof @@ -682,6 +698,120 @@ generate_summary (void) visited_nodes = NULL; } + +/* Serialize the ipa info for lto. */ + +static void +pure_const_write_summary (cgraph_node_set set) +{ + struct cgraph_node *node; + struct lto_simple_output_block *ob + = lto_create_simple_output_block (LTO_section_ipa_pure_const); + unsigned int count = 0; + cgraph_node_set_iterator csi; + + for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi)) + { + node = csi_node (csi); + if (node->analyzed && get_function_state (node) != NULL) + count++; + } + + lto_output_uleb128_stream (ob->main_stream, count); + + /* Process all of the functions. */ + for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi)) + { + node = csi_node (csi); + if (node->analyzed && get_function_state (node) != NULL) + { + struct bitpack_d *bp; + funct_state fs; + int node_ref; + lto_cgraph_encoder_t encoder; + + fs = get_function_state (node); + + encoder = ob->decl_state->cgraph_node_encoder; + node_ref = lto_cgraph_encoder_encode (encoder, node); + lto_output_uleb128_stream (ob->main_stream, node_ref); + + /* Note that flags will need to be read in the opposite + order as we are pushing the bitflags into FLAGS. */ + bp = bitpack_create (); + bp_pack_value (bp, fs->pure_const_state, 2); + bp_pack_value (bp, fs->state_previously_known, 2); + bp_pack_value (bp, fs->looping_previously_known, 1); + bp_pack_value (bp, fs->looping, 1); + bp_pack_value (bp, fs->can_throw, 1); + lto_output_bitpack (ob->main_stream, bp); + bitpack_delete (bp); + } + } + + lto_destroy_simple_output_block (ob); +} + + +/* Deserialize the ipa info for lto. */ + +static void +pure_const_read_summary (void) +{ + struct lto_file_decl_data **file_data_vec = lto_get_file_decl_data (); + struct lto_file_decl_data *file_data; + unsigned int j = 0; + + register_hooks (); + while ((file_data = file_data_vec[j++])) + { + const char *data; + size_t len; + struct lto_input_block *ib + = lto_create_simple_input_block (file_data, + LTO_section_ipa_pure_const, + &data, &len); + if (ib) + { + unsigned int i; + unsigned int count = lto_input_uleb128 (ib); + + for (i = 0; i < count; i++) + { + unsigned int index; + struct cgraph_node *node; + struct bitpack_d *bp; + funct_state fs; + lto_cgraph_encoder_t encoder; + + fs = XCNEW (struct funct_state_d); + index = lto_input_uleb128 (ib); + encoder = file_data->cgraph_node_encoder; + node = lto_cgraph_encoder_deref (encoder, index); + set_function_state (node, fs); + + /* Note that the flags must be read in the opposite + order in which they were written (the bitflags were + pushed into FLAGS). */ + bp = lto_input_bitpack (ib); + fs->pure_const_state + = (enum pure_const_state_e) bp_unpack_value (bp, 2); + fs->state_previously_known + = (enum pure_const_state_e) bp_unpack_value (bp, 2); + fs->looping_previously_known = bp_unpack_value (bp, 1); + fs->looping = bp_unpack_value (bp, 1); + fs->can_throw = bp_unpack_value (bp, 1); + bitpack_delete (bp); + } + + lto_destroy_simple_input_block (file_data, + LTO_section_ipa_pure_const, + ib, data, len); + } + } +} + + static bool ignore_edge (struct cgraph_edge *e) { @@ -952,8 +1082,8 @@ struct ipa_opt_pass_d pass_ipa_pure_const = 0 /* todo_flags_finish */ }, generate_summary, /* generate_summary */ - NULL, /* write_summary */ - NULL, /* read_summary */ + pure_const_write_summary, /* write_summary */ + pure_const_read_summary, /* read_summary */ NULL, /* function_read_summary */ 0, /* TODOs */ NULL, /* function_transform */ diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c index 10daf56eab6..795684692bf 100644 --- a/gcc/ipa-reference.c +++ b/gcc/ipa-reference.c @@ -68,6 +68,15 @@ along with GCC; see the file COPYING3. If not see #include "timevar.h" #include "diagnostic.h" #include "langhooks.h" +#include "lto-streamer.h" + +static void add_new_function (struct cgraph_node *node, + void *data ATTRIBUTE_UNUSED); +static void remove_node_data (struct cgraph_node *node, + void *data ATTRIBUTE_UNUSED); +static void duplicate_node_data (struct cgraph_node *src, + struct cgraph_node *dst, + void *data ATTRIBUTE_UNUSED); /* The static variables defined within the compilation unit that are loaded or stored directly by function that owns this structure. */ @@ -578,6 +587,13 @@ propagate_bits (ipa_reference_global_vars_info_t x_global, struct cgraph_node *x static void ipa_init (void) { + static bool init_p = false; + + if (init_p) + return; + + init_p = true; + memory_identifier_string = build_string(7, "memory"); reference_vars_to_consider = @@ -594,6 +610,13 @@ ipa_init (void) since all we would be interested in are the addressof operations. */ visited_nodes = pointer_set_create (); + + function_insertion_hook_holder = + cgraph_add_function_insertion_hook (&add_new_function, NULL); + node_removal_hook_holder = + cgraph_add_node_removal_hook (&remove_node_data, NULL); + node_duplication_hook_holder = + cgraph_add_node_duplication_hook (&duplicate_node_data, NULL); } /* Check out the rhs of a static or global initialization VNODE to see @@ -614,6 +637,7 @@ analyze_variable (struct varpool_node *vnode) &wi, wi.pset); } + /* Set up the persistent info for FN. */ static ipa_reference_local_vars_info_t @@ -634,9 +658,10 @@ init_function_info (struct cgraph_node *fn) return l; } + /* This is the main routine for finding the reference patterns for global variables within a function FN. */ - + static void analyze_function (struct cgraph_node *fn) { @@ -845,12 +870,6 @@ generate_summary (void) bitmap module_statics_readonly; bitmap bm_temp; - function_insertion_hook_holder = - cgraph_add_function_insertion_hook (&add_new_function, NULL); - node_removal_hook_holder = - cgraph_add_node_removal_hook (&remove_node_data, NULL); - node_duplication_hook_holder = - cgraph_add_node_duplication_hook (&duplicate_node_data, NULL); ipa_init (); module_statics_readonly = BITMAP_ALLOC (&local_info_obstack); bm_temp = BITMAP_ALLOC (&local_info_obstack); @@ -986,6 +1005,141 @@ generate_summary (void) fprintf (dump_file, "\n calls read all: "); } } + + +/* Return true if we need to write summary of NODE. */ + +static bool +write_node_summary_p (struct cgraph_node *node) +{ + return (node->analyzed + && node->global.inlined_to == NULL + && cgraph_function_body_availability (node) == AVAIL_OVERWRITABLE + && get_reference_vars_info (node) != NULL); +} + +/* Serialize the ipa info for lto. */ + +static void +ipa_reference_write_summary (cgraph_node_set set) +{ + struct cgraph_node *node; + struct lto_simple_output_block *ob + = lto_create_simple_output_block (LTO_section_ipa_reference); + unsigned int count = 0; + cgraph_node_set_iterator csi; + + for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi)) + if (write_node_summary_p (csi_node (csi))) + count++; + + lto_output_uleb128_stream (ob->main_stream, count); + + /* Process all of the functions. */ + for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi)) + { + node = csi_node (csi); + if (write_node_summary_p (node)) + { + ipa_reference_local_vars_info_t l + = get_reference_vars_info (node)->local; + unsigned int index; + bitmap_iterator bi; + lto_cgraph_encoder_t encoder; + int node_ref; + + encoder = ob->decl_state->cgraph_node_encoder; + node_ref = lto_cgraph_encoder_encode (encoder, node); + lto_output_uleb128_stream (ob->main_stream, node_ref); + + /* Stream out the statics read. */ + lto_output_uleb128_stream (ob->main_stream, + bitmap_count_bits (l->statics_read)); + EXECUTE_IF_SET_IN_BITMAP (l->statics_read, 0, index, bi) + lto_output_var_decl_index(ob->decl_state, ob->main_stream, + get_static_decl (index)); + + /* Stream out the statics written. */ + lto_output_uleb128_stream (ob->main_stream, + bitmap_count_bits (l->statics_written)); + EXECUTE_IF_SET_IN_BITMAP (l->statics_written, 0, index, bi) + lto_output_var_decl_index(ob->decl_state, ob->main_stream, + get_static_decl (index)); + } + } + lto_destroy_simple_output_block (ob); +} + + +/* Deserialize the ipa info for lto. */ + +static void +ipa_reference_read_summary (void) +{ + struct lto_file_decl_data ** file_data_vec + = lto_get_file_decl_data (); + struct lto_file_decl_data * file_data; + unsigned int j = 0; + + ipa_init (); + + while ((file_data = file_data_vec[j++])) + { + const char *data; + size_t len; + struct lto_input_block *ib + = lto_create_simple_input_block (file_data, + LTO_section_ipa_reference, + &data, &len); + if (ib) + { + unsigned int i; + unsigned int f_count = lto_input_uleb128 (ib); + + for (i = 0; i < f_count; i++) + { + unsigned int j, index; + struct cgraph_node *node; + ipa_reference_local_vars_info_t l; + unsigned int v_count; + lto_cgraph_encoder_t encoder; + + index = lto_input_uleb128 (ib); + encoder = file_data->cgraph_node_encoder; + node = lto_cgraph_encoder_deref (encoder, index); + l = init_function_info (node); + + /* Set the statics read. */ + v_count = lto_input_uleb128 (ib); + for (j = 0; j < v_count; j++) + { + unsigned int var_index = lto_input_uleb128 (ib); + tree v_decl = lto_file_decl_data_get_var_decl (file_data, + var_index); + add_static_var (v_decl); + bitmap_set_bit (l->statics_read, DECL_UID (v_decl)); + } + + /* Set the statics written. */ + v_count = lto_input_uleb128 (ib); + for (j = 0; j < v_count; j++) + { + unsigned int var_index = lto_input_uleb128 (ib); + tree v_decl = lto_file_decl_data_get_var_decl (file_data, + var_index); + add_static_var (v_decl); + bitmap_set_bit (l->statics_written, DECL_UID (v_decl)); + } + } + + lto_destroy_simple_input_block (file_data, + LTO_section_ipa_reference, + ib, data, len); + } + } +} + + /* Produce the global information by preforming a transitive closure on the local information that was produced by ipa_analyze_function @@ -1271,8 +1425,8 @@ struct ipa_opt_pass_d pass_ipa_reference = 0 /* todo_flags_finish */ }, generate_summary, /* generate_summary */ - NULL, /* write_summary */ - NULL, /* read_summary */ + ipa_reference_write_summary, /* write_summary */ + ipa_reference_read_summary, /* read_summary */ NULL, /* function_read_summary */ 0, /* TODOs */ NULL, /* function_transform */ diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 5a9f1d6e010..6ce9d58b0e0 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,7 @@ +2009-10-03 Simon Baldwin + + * config-lang.in (lang_dirs): Remove zlib. + 2009-09-28 Richard Henderson * builtins.c (initialize_builtins): Update call to diff --git a/gcc/java/config-lang.in b/gcc/java/config-lang.in index d3a4d4dbbe5..29ee3fd8547 100644 --- a/gcc/java/config-lang.in +++ b/gcc/java/config-lang.in @@ -35,6 +35,6 @@ compilers="jc1\$(exeext) jvgenmain\$(exeext)" gtfiles="\$(srcdir)/java/java-tree.h \$(srcdir)/java/jcf.h \$(srcdir)/java/parse.h \$(srcdir)/java/builtins.c \$(srcdir)/java/class.c \$(srcdir)/java/constants.c \$(srcdir)/java/decl.c \$(srcdir)/java/expr.c \$(srcdir)/java/jcf-parse.c \$(srcdir)/java/lang.c \$(srcdir)/java/mangle.c \$(srcdir)/java/resource.c" target_libs=${libgcj_saved} -lang_dirs="zlib fastjar" +lang_dirs="fastjar" #build_by_default=no lang_requires=c++ diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h index 40a4de93d6d..4f01483846b 100644 --- a/gcc/langhooks-def.h +++ b/gcc/langhooks-def.h @@ -62,7 +62,7 @@ extern bool lhd_decl_ok_for_sibcall (const_tree); extern size_t lhd_tree_size (enum tree_code); extern HOST_WIDE_INT lhd_to_target_charset (HOST_WIDE_INT); extern tree lhd_expr_to_decl (tree, bool *, bool *); -extern tree lhd_builtin_function (tree decl); +extern tree lhd_builtin_function (tree); /* Declarations of default tree inlining hooks. */ extern void lhd_initialize_diagnostics (struct diagnostic_context *); @@ -236,6 +236,21 @@ extern tree lhd_make_node (enum tree_code); LANG_HOOKS_OMP_FINISH_CLAUSE \ } +/* LTO hooks. */ +extern void lhd_begin_section (const char *); +extern void lhd_append_data (const void *, size_t, void *); +extern void lhd_end_section (void); + +#define LANG_HOOKS_BEGIN_SECTION lhd_begin_section +#define LANG_HOOKS_APPEND_DATA lhd_append_data +#define LANG_HOOKS_END_SECTION lhd_end_section + +#define LANG_HOOKS_LTO { \ + LANG_HOOKS_BEGIN_SECTION, \ + LANG_HOOKS_APPEND_DATA, \ + LANG_HOOKS_END_SECTION \ +} + /* The whole thing. The structure is defined in langhooks.h. */ #define LANG_HOOKS_INITIALIZER { \ LANG_HOOKS_NAME, \ @@ -273,6 +288,7 @@ extern tree lhd_make_node (enum tree_code); LANG_HOOKS_TREE_DUMP_INITIALIZER, \ LANG_HOOKS_DECLS, \ LANG_HOOKS_FOR_TYPES_INITIALIZER, \ + LANG_HOOKS_LTO, \ LANG_HOOKS_GET_INNERMOST_GENERIC_PARMS, \ LANG_HOOKS_GET_INNERMOST_GENERIC_ARGS, \ LANG_HOOKS_FUNCTION_PARAMETER_PACK_P, \ diff --git a/gcc/langhooks.c b/gcc/langhooks.c index 092a3238592..633caf58c53 100644 --- a/gcc/langhooks.c +++ b/gcc/langhooks.c @@ -38,6 +38,7 @@ along with GCC; see the file COPYING3. If not see #include "ggc.h" #include "diagnostic.h" #include "cgraph.h" +#include "output.h" /* Do nothing; in many cases the default hook. */ @@ -584,3 +585,54 @@ lhd_builtin_function (tree decl) lang_hooks.decls.pushdecl (decl); return decl; } + +/* LTO hooks. */ + +/* Used to save and restore any previously active section. */ +static section *saved_section; + + +/* Begin a new LTO output section named NAME. This default implementation + saves the old section and emits assembly code to switch to the new + section. */ + +void +lhd_begin_section (const char *name) +{ + section *section; + + /* Save the old section so we can restore it in lto_end_asm_section. */ + gcc_assert (!saved_section); + saved_section = in_section; + + /* Create a new section and switch to it. */ + section = get_section (name, SECTION_DEBUG, NULL); + switch_to_section (section); +} + + +/* Write DATA of length LEN to the current LTO output section. This default + implementation just calls assemble_string and frees BLOCK. */ + +void +lhd_append_data (const void *data, size_t len, void *block) +{ + if (data) + assemble_string ((const char *)data, len); + free (block); +} + + +/* Finish the current LTO output section. This default implementation emits + assembly code to switch to any section previously saved by + lhd_begin_section. */ + +void +lhd_end_section (void) +{ + if (saved_section) + { + switch_to_section (saved_section); + saved_section = NULL; + } +} diff --git a/gcc/langhooks.h b/gcc/langhooks.h index b133ea05763..81f24366234 100644 --- a/gcc/langhooks.h +++ b/gcc/langhooks.h @@ -231,6 +231,23 @@ struct lang_hooks_for_decls void (*omp_finish_clause) (tree clause); }; +/* Language hooks related to LTO serialization. */ + +struct lang_hooks_for_lto +{ + /* Begin a new LTO section named NAME. */ + void (*begin_section) (const char *name); + + /* Write DATA of length LEN to the currently open LTO section. BLOCK is a + pointer to the dynamically allocated memory containing DATA. The + append_data function is responsible for freeing it when it is no longer + needed. */ + void (*append_data) (const void *data, size_t len, void *block); + + /* End the previously begun LTO section. */ + void (*end_section) (void); +}; + /* Language-specific hooks. See langhooks-def.h for defaults. */ struct lang_hooks @@ -386,6 +403,8 @@ struct lang_hooks struct lang_hooks_for_types types; + struct lang_hooks_for_lto lto; + /* Returns the generic parameters of an instantiation of a generic type or decl, e.g. C++ template instantiation. */ tree (*get_innermost_generic_parms) (const_tree); diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c new file mode 100644 index 00000000000..b11483c9c81 --- /dev/null +++ b/gcc/lto-cgraph.c @@ -0,0 +1,693 @@ +/* Write and read the cgraph to the memory mapped representation of a + .o file. + + Copyright 2009 Free Software Foundation, Inc. + Contributed by Kenneth Zadeck + +This file is part of GCC. + +GCC 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. + +GCC 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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "toplev.h" +#include "tree.h" +#include "expr.h" +#include "flags.h" +#include "params.h" +#include "input.h" +#include "varray.h" +#include "hashtab.h" +#include "langhooks.h" +#include "basic-block.h" +#include "tree-flow.h" +#include "cgraph.h" +#include "function.h" +#include "ggc.h" +#include "diagnostic.h" +#include "except.h" +#include "vec.h" +#include "timevar.h" +#include "output.h" +#include "pointer-set.h" +#include "lto-streamer.h" + +/* Create a new cgraph encoder. */ + +lto_cgraph_encoder_t +lto_cgraph_encoder_new (void) +{ + lto_cgraph_encoder_t encoder = XCNEW (struct lto_cgraph_encoder_d); + encoder->map = pointer_map_create (); + encoder->nodes = NULL; + return encoder; +} + + +/* Delete ENCODER and its components. */ + +void +lto_cgraph_encoder_delete (lto_cgraph_encoder_t encoder) +{ + VEC_free (cgraph_node_ptr, heap, encoder->nodes); + pointer_map_destroy (encoder->map); + free (encoder); +} + + +/* Return the existing reference number of NODE in the cgraph encoder in + output block OB. Assign a new reference if this is the first time + NODE is encoded. */ + +int +lto_cgraph_encoder_encode (lto_cgraph_encoder_t encoder, + struct cgraph_node *node) +{ + int ref; + void **slot; + + slot = pointer_map_contains (encoder->map, node); + if (!slot) + { + ref = VEC_length (cgraph_node_ptr, encoder->nodes); + slot = pointer_map_insert (encoder->map, node); + *slot = (void *) (intptr_t) ref; + VEC_safe_push (cgraph_node_ptr, heap, encoder->nodes, node); + } + else + ref = (int) (intptr_t) *slot; + + return ref; +} + + +/* Look up NODE in encoder. Return NODE's reference if it has been encoded + or LCC_NOT_FOUND if it is not there. */ + +int +lto_cgraph_encoder_lookup (lto_cgraph_encoder_t encoder, + struct cgraph_node *node) +{ + void **slot = pointer_map_contains (encoder->map, node); + return (slot ? (int) (intptr_t) *slot : LCC_NOT_FOUND); +} + + +/* Return the cgraph node corresponding to REF using ENCODER. */ + +struct cgraph_node * +lto_cgraph_encoder_deref (lto_cgraph_encoder_t encoder, int ref) +{ + if (ref == LCC_NOT_FOUND) + return NULL; + + return VEC_index (cgraph_node_ptr, encoder->nodes, ref); +} + + +/* Return number of encoded nodes in ENCODER. */ + +static int +lto_cgraph_encoder_size (lto_cgraph_encoder_t encoder) +{ + return VEC_length (cgraph_node_ptr, encoder->nodes); +} + + +/* Output the cgraph EDGE to OB using ENCODER. */ + +static void +lto_output_edge (struct lto_simple_output_block *ob, struct cgraph_edge *edge, + lto_cgraph_encoder_t encoder) +{ + unsigned int uid; + intptr_t ref; + struct bitpack_d *bp; + + lto_output_uleb128_stream (ob->main_stream, LTO_cgraph_edge); + + ref = lto_cgraph_encoder_lookup (encoder, edge->caller); + gcc_assert (ref != LCC_NOT_FOUND); + lto_output_sleb128_stream (ob->main_stream, ref); + + ref = lto_cgraph_encoder_lookup (encoder, edge->callee); + gcc_assert (ref != LCC_NOT_FOUND); + lto_output_sleb128_stream (ob->main_stream, ref); + + lto_output_sleb128_stream (ob->main_stream, edge->count); + + bp = bitpack_create (); + uid = flag_wpa ? edge->lto_stmt_uid : gimple_uid (edge->call_stmt); + bp_pack_value (bp, uid, HOST_BITS_PER_INT); + bp_pack_value (bp, edge->inline_failed, HOST_BITS_PER_INT); + bp_pack_value (bp, edge->frequency, HOST_BITS_PER_INT); + bp_pack_value (bp, edge->loop_nest, 30); + bp_pack_value (bp, edge->indirect_call, 1); + bp_pack_value (bp, edge->call_stmt_cannot_inline_p, 1); + bp_pack_value (bp, edge->can_throw_external, 1); + lto_output_bitpack (ob->main_stream, bp); + bitpack_delete (bp); +} + + +/* Output the cgraph NODE to OB. ENCODER is used to find the + reference number of NODE->inlined_to. SET is the set of nodes we + are writing to the current file. If NODE is not in SET, then NODE + is a boundary of a cgraph_node_set and we pretend NODE just has a + decl and no callees. WRITTEN_DECLS is the set of FUNCTION_DECLs + that have had their callgraph node written so far. This is used to + determine if NODE is a clone of a previously written node. */ + +static void +lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node, + lto_cgraph_encoder_t encoder, cgraph_node_set set, + bitmap written_decls) +{ + unsigned int tag; + struct bitpack_d *bp; + unsigned local, externally_visible, inlinable, analyzed; + bool boundary_p, wrote_decl_p; + intptr_t ref; + + boundary_p = !cgraph_node_in_set_p (node, set); + wrote_decl_p = bitmap_bit_p (written_decls, DECL_UID (node->decl)); + + switch (cgraph_function_body_availability (node)) + { + case AVAIL_NOT_AVAILABLE: + tag = LTO_cgraph_unavail_node; + break; + + case AVAIL_AVAILABLE: + case AVAIL_LOCAL: + tag = LTO_cgraph_avail_node; + break; + + case AVAIL_OVERWRITABLE: + tag = LTO_cgraph_overwritable_node; + break; + + default: + gcc_unreachable (); + } + + if (boundary_p) + tag = LTO_cgraph_unavail_node; + + lto_output_uleb128_stream (ob->main_stream, tag); + + local = node->local.local; + externally_visible = node->local.externally_visible; + inlinable = node->local.inlinable; + analyzed = node->analyzed; + + /* In WPA mode, we only output part of the call-graph. Also, we + fake cgraph node attributes. There are two cases that we care. + + Boundary nodes: There are nodes that are not part of SET but are + called from within SET. We artificially make them look like + externally visible nodes with no function body. + + Cherry-picked nodes: These are nodes we pulled from other + translation units into SET during IPA-inlining. We make them as + local static nodes to prevent clashes with other local statics. */ + if (boundary_p) + { + local = 0; + externally_visible = 1; + inlinable = 0; + analyzed = 0; + } + else if (lto_forced_extern_inline_p (node->decl)) + { + local = 1; + externally_visible = 0; + inlinable = 1; + } + + lto_output_uleb128_stream (ob->main_stream, wrote_decl_p); + + if (!wrote_decl_p) + bitmap_set_bit (written_decls, DECL_UID (node->decl)); + + lto_output_fn_decl_index (ob->decl_state, ob->main_stream, node->decl); + lto_output_sleb128_stream (ob->main_stream, node->count); + + bp = bitpack_create (); + bp_pack_value (bp, local, 1); + bp_pack_value (bp, externally_visible, 1); + bp_pack_value (bp, node->local.finalized, 1); + bp_pack_value (bp, inlinable, 1); + bp_pack_value (bp, node->local.disregard_inline_limits, 1); + bp_pack_value (bp, node->local.redefined_extern_inline, 1); + bp_pack_value (bp, node->local.for_functions_valid, 1); + bp_pack_value (bp, node->local.vtable_method, 1); + bp_pack_value (bp, node->needed, 1); + bp_pack_value (bp, node->address_taken, 1); + bp_pack_value (bp, node->abstract_and_needed, 1); + bp_pack_value (bp, node->reachable, 1); + bp_pack_value (bp, node->lowered, 1); + bp_pack_value (bp, analyzed, 1); + bp_pack_value (bp, node->process, 1); + bp_pack_value (bp, node->alias, 1); + bp_pack_value (bp, node->finalized_by_frontend, 1); + lto_output_bitpack (ob->main_stream, bp); + bitpack_delete (bp); + + if (tag != LTO_cgraph_unavail_node) + { + lto_output_sleb128_stream (ob->main_stream, + node->local.inline_summary.estimated_self_stack_size); + lto_output_sleb128_stream (ob->main_stream, + node->local.inline_summary.self_size); + lto_output_sleb128_stream (ob->main_stream, + node->local.inline_summary.size_inlining_benefit); + lto_output_sleb128_stream (ob->main_stream, + node->local.inline_summary.self_time); + lto_output_sleb128_stream (ob->main_stream, + node->local.inline_summary.time_inlining_benefit); + } + + /* FIXME lto: Outputting global info is not neccesary until after + inliner was run. Global structure holds results of propagation + done by inliner. */ + lto_output_sleb128_stream (ob->main_stream, + node->global.estimated_stack_size); + lto_output_sleb128_stream (ob->main_stream, + node->global.stack_frame_offset); + if (node->global.inlined_to && !boundary_p) + { + ref = lto_cgraph_encoder_lookup (encoder, node->global.inlined_to); + gcc_assert (ref != LCC_NOT_FOUND); + } + else + ref = LCC_NOT_FOUND; + lto_output_sleb128_stream (ob->main_stream, ref); + + lto_output_sleb128_stream (ob->main_stream, node->global.time); + lto_output_sleb128_stream (ob->main_stream, node->global.size); + lto_output_sleb128_stream (ob->main_stream, + node->global.estimated_growth); + lto_output_uleb128_stream (ob->main_stream, node->global.inlined); +} + + +/* Output the part of the cgraph in SET. */ + +void +output_cgraph (cgraph_node_set set) +{ + struct cgraph_node *node; + struct lto_simple_output_block *ob; + cgraph_node_set_iterator csi; + struct cgraph_edge *edge; + int i, n_nodes; + bitmap written_decls; + lto_cgraph_encoder_t encoder; + + ob = lto_create_simple_output_block (LTO_section_cgraph); + + /* An encoder for cgraph nodes should have been created by + ipa_write_summaries_1. */ + gcc_assert (ob->decl_state->cgraph_node_encoder); + encoder = ob->decl_state->cgraph_node_encoder; + + /* The FUNCTION_DECLs for which we have written a node. The first + node found is written as the "original" node, the remaining nodes + are considered its clones. */ + written_decls = lto_bitmap_alloc (); + + /* Go over all the nodes in SET and assign references. */ + for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi)) + { + node = csi_node (csi); + lto_cgraph_encoder_encode (encoder, node); + } + + /* Go over all the nodes again to include callees that are not in + SET. */ + for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi)) + { + node = csi_node (csi); + for (edge = node->callees; edge; edge = edge->next_callee) + { + struct cgraph_node *callee = edge->callee; + if (!cgraph_node_in_set_p (callee, set)) + { + /* We should have moved all the inlines. */ + gcc_assert (!callee->global.inlined_to); + lto_cgraph_encoder_encode (encoder, callee); + } + } + } + + /* Write out the nodes. */ + n_nodes = lto_cgraph_encoder_size (encoder); + for (i = 0; i < n_nodes; i++) + { + node = lto_cgraph_encoder_deref (encoder, i); + lto_output_node (ob, node, encoder, set, written_decls); + } + + lto_bitmap_free (written_decls); + + /* Go over the nodes in SET again to write edges. */ + for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi)) + { + node = csi_node (csi); + for (edge = node->callees; edge; edge = edge->next_callee) + lto_output_edge (ob, edge, encoder); + } + + lto_output_uleb128_stream (ob->main_stream, 0); + + lto_destroy_simple_output_block (ob); +} + + +/* Overwrite the information in NODE based on FILE_DATA, TAG, FLAGS, + STACK_SIZE, SELF_TIME and SELF_SIZE. This is called either to initialize + NODE or to replace the values in it, for instance because the first + time we saw it, the function body was not available but now it + is. BP is a bitpack with all the bitflags for NODE read from the + stream. */ + +static void +input_overwrite_node (struct lto_file_decl_data *file_data, + struct cgraph_node *node, + enum LTO_cgraph_tags tag, + struct bitpack_d *bp, + unsigned int stack_size, + unsigned int self_time, + unsigned int time_inlining_benefit, + unsigned int self_size, + unsigned int size_inlining_benefit) +{ + node->aux = (void *) tag; + node->local.inline_summary.estimated_self_stack_size = stack_size; + node->local.inline_summary.self_time = self_time; + node->local.inline_summary.time_inlining_benefit = time_inlining_benefit; + node->local.inline_summary.self_size = self_size; + node->local.inline_summary.size_inlining_benefit = size_inlining_benefit; + node->global.time = self_time; + node->global.size = self_size; + node->local.lto_file_data = file_data; + + node->local.local = bp_unpack_value (bp, 1); + node->local.externally_visible = bp_unpack_value (bp, 1); + node->local.finalized = bp_unpack_value (bp, 1); + node->local.inlinable = bp_unpack_value (bp, 1); + node->local.disregard_inline_limits = bp_unpack_value (bp, 1); + node->local.redefined_extern_inline = bp_unpack_value (bp, 1); + node->local.for_functions_valid = bp_unpack_value (bp, 1); + node->local.vtable_method = bp_unpack_value (bp, 1); + node->needed = bp_unpack_value (bp, 1); + node->address_taken = bp_unpack_value (bp, 1); + node->abstract_and_needed = bp_unpack_value (bp, 1); + node->reachable = bp_unpack_value (bp, 1); + node->lowered = bp_unpack_value (bp, 1); + node->analyzed = bp_unpack_value (bp, 1); + node->process = bp_unpack_value (bp, 1); + node->alias = bp_unpack_value (bp, 1); + node->finalized_by_frontend = bp_unpack_value (bp, 1); +} + + +/* Read a node from input_block IB. TAG is the node's tag just read. + Return the node read or overwriten. */ + +static struct cgraph_node * +input_node (struct lto_file_decl_data *file_data, + struct lto_input_block *ib, + enum LTO_cgraph_tags tag) +{ + tree fn_decl; + struct cgraph_node *node; + struct bitpack_d *bp; + int stack_size = 0; + unsigned decl_index; + bool clone_p; + int estimated_stack_size = 0; + int stack_frame_offset = 0; + int ref = LCC_NOT_FOUND; + int estimated_growth = 0; + int time = 0; + int size = 0; + int self_time = 0; + int self_size = 0; + int time_inlining_benefit = 0; + int size_inlining_benefit = 0; + bool inlined = false; + + clone_p = (lto_input_uleb128 (ib) != 0); + + decl_index = lto_input_uleb128 (ib); + fn_decl = lto_file_decl_data_get_fn_decl (file_data, decl_index); + + if (clone_p) + node = cgraph_clone_node (cgraph_node (fn_decl), 0, + CGRAPH_FREQ_BASE, 0, false, NULL); + + else + node = cgraph_node (fn_decl); + + node->count = lto_input_sleb128 (ib); + bp = lto_input_bitpack (ib); + + if (tag != LTO_cgraph_unavail_node) + { + stack_size = lto_input_sleb128 (ib); + self_size = lto_input_sleb128 (ib); + size_inlining_benefit = lto_input_sleb128 (ib); + self_time = lto_input_sleb128 (ib); + time_inlining_benefit = lto_input_sleb128 (ib); + } + + estimated_stack_size = lto_input_sleb128 (ib); + stack_frame_offset = lto_input_sleb128 (ib); + ref = lto_input_sleb128 (ib); + time = lto_input_sleb128 (ib); + size = lto_input_sleb128 (ib); + estimated_growth = lto_input_sleb128 (ib); + inlined = lto_input_uleb128 (ib); + + /* Make sure that we have not read this node before. Nodes that + have already been read will have their tag stored in the 'aux' + field. Since built-in functions can be referenced in multiple + functions, they are expected to be read more than once. */ + if (node->aux && !DECL_IS_BUILTIN (node->decl)) + internal_error ("bytecode stream: found multiple instances of cgraph " + "node %d", node->uid); + + input_overwrite_node (file_data, node, tag, bp, stack_size, self_time, + time_inlining_benefit, self_size, + size_inlining_benefit); + bitpack_delete (bp); + + node->global.estimated_stack_size = estimated_stack_size; + node->global.stack_frame_offset = stack_frame_offset; + node->global.time = time; + node->global.size = size; + + /* Store a reference for now, and fix up later to be a pointer. */ + node->global.inlined_to = (cgraph_node_ptr) (intptr_t) ref; + + node->global.estimated_growth = estimated_growth; + node->global.inlined = inlined; + + return node; +} + + +/* Read an edge from IB. NODES points to a vector of previously read + nodes for decoding caller and callee of the edge to be read. */ + +static void +input_edge (struct lto_input_block *ib, VEC(cgraph_node_ptr, heap) *nodes) +{ + struct cgraph_node *caller, *callee; + struct cgraph_edge *edge; + unsigned int stmt_id; + gcov_type count; + int freq; + unsigned int nest; + cgraph_inline_failed_t inline_failed; + struct bitpack_d *bp; + tree prevailing_callee; + tree prevailing_caller; + enum ld_plugin_symbol_resolution caller_resolution; + + caller = VEC_index (cgraph_node_ptr, nodes, lto_input_sleb128 (ib)); + if (caller == NULL || caller->decl == NULL_TREE) + internal_error ("bytecode stream: no caller found while reading edge"); + + callee = VEC_index (cgraph_node_ptr, nodes, lto_input_sleb128 (ib)); + if (callee == NULL || callee->decl == NULL_TREE) + internal_error ("bytecode stream: no callee found while reading edge"); + + caller_resolution = lto_symtab_get_resolution (caller->decl); + + count = (gcov_type) lto_input_sleb128 (ib); + + bp = lto_input_bitpack (ib); + stmt_id = (unsigned int) bp_unpack_value (bp, HOST_BITS_PER_INT); + inline_failed = (cgraph_inline_failed_t) bp_unpack_value (bp, + HOST_BITS_PER_INT); + freq = (int) bp_unpack_value (bp, HOST_BITS_PER_INT); + nest = (unsigned) bp_unpack_value (bp, 30); + + /* If the caller was preempted, don't create the edge. */ + if (caller_resolution == LDPR_PREEMPTED_REG + || caller_resolution == LDPR_PREEMPTED_IR) + return; + + prevailing_callee = lto_symtab_prevailing_decl (callee->decl); + + /* Make sure the caller is the prevailing decl. */ + prevailing_caller = lto_symtab_prevailing_decl (caller->decl); + + if (prevailing_callee != callee->decl) + { + struct lto_file_decl_data *file_data; + + /* We cannot replace a clone! */ + gcc_assert (callee == cgraph_node (callee->decl)); + + callee = cgraph_node (prevailing_callee); + gcc_assert (callee); + + /* If LGEN (cc1 or cc1plus) had nothing to do with the node, it + might not have created it. In this case, we just created a + new node in the above call to cgraph_node. Mark the file it + came from. */ + file_data = lto_symtab_get_file_data (prevailing_callee); + if (callee->local.lto_file_data) + gcc_assert (callee->local.lto_file_data == file_data); + else + callee->local.lto_file_data = file_data; + } + + edge = cgraph_create_edge (caller, callee, NULL, count, freq, nest); + edge->lto_stmt_uid = stmt_id; + edge->inline_failed = inline_failed; + edge->indirect_call = bp_unpack_value (bp, 1); + edge->call_stmt_cannot_inline_p = bp_unpack_value (bp, 1); + edge->can_throw_external = bp_unpack_value (bp, 1); + bitpack_delete (bp); +} + + +/* Read a cgraph from IB using the info in FILE_DATA. */ + +static void +input_cgraph_1 (struct lto_file_decl_data *file_data, + struct lto_input_block *ib) +{ + enum LTO_cgraph_tags tag; + VEC(cgraph_node_ptr, heap) *nodes = NULL; + struct cgraph_node *node; + unsigned i; + + tag = (enum LTO_cgraph_tags) lto_input_uleb128 (ib); + while (tag) + { + if (tag == LTO_cgraph_edge) + input_edge (ib, nodes); + else + { + node = input_node (file_data, ib, tag); + if (node == NULL || node->decl == NULL_TREE) + internal_error ("bytecode stream: found empty cgraph node"); + VEC_safe_push (cgraph_node_ptr, heap, nodes, node); + lto_cgraph_encoder_encode (file_data->cgraph_node_encoder, node); + } + + tag = (enum LTO_cgraph_tags) lto_input_uleb128 (ib); + } + + for (i = 0; VEC_iterate (cgraph_node_ptr, nodes, i, node); i++) + { + const int ref = (int) (intptr_t) node->global.inlined_to; + + /* Fixup inlined_to from reference to pointer. */ + if (ref != LCC_NOT_FOUND) + node->global.inlined_to = VEC_index (cgraph_node_ptr, nodes, ref); + else + node->global.inlined_to = NULL; + } + + for (i = 0; VEC_iterate (cgraph_node_ptr, nodes, i, node); i++) + { + tree prevailing = lto_symtab_prevailing_decl (node->decl); + + if (prevailing != node->decl) + { + cgraph_remove_node (node); + VEC_replace (cgraph_node_ptr, nodes, i, NULL); + } + } + + for (i = 0; VEC_iterate (cgraph_node_ptr, nodes, i, node); i++) + if (node && cgraph_decide_is_function_needed (node, node->decl)) + cgraph_mark_needed_node (node); + + VEC_free (cgraph_node_ptr, heap, nodes); +} + + +/* Input and merge the cgraph from each of the .o files passed to + lto1. */ + +void +input_cgraph (void) +{ + struct lto_file_decl_data **file_data_vec = lto_get_file_decl_data (); + struct lto_file_decl_data *file_data; + unsigned int j = 0; + struct cgraph_node *node; + + while ((file_data = file_data_vec[j++])) + { + const char *data; + size_t len; + struct lto_input_block *ib; + + ib = lto_create_simple_input_block (file_data, LTO_section_cgraph, + &data, &len); + file_data->cgraph_node_encoder = lto_cgraph_encoder_new (); + input_cgraph_1 (file_data, ib); + lto_destroy_simple_input_block (file_data, LTO_section_cgraph, + ib, data, len); + + /* Assume that every file read needs to be processed by LTRANS. */ + if (flag_wpa) + lto_mark_file_for_ltrans (file_data); + } + + /* Clear out the aux field that was used to store enough state to + tell which nodes should be overwritten. */ + for (node = cgraph_nodes; node; node = node->next) + { + /* Some nodes may have been created by cgraph_node. This + happens when the callgraph contains nested functions. If the + node for the parent function was never emitted to the gimple + file, cgraph_node will create a node for it when setting the + context of the nested function. */ + if (node->local.lto_file_data) + node->aux = NULL; + } +} diff --git a/gcc/lto-compress.c b/gcc/lto-compress.c new file mode 100644 index 00000000000..8d745f6a047 --- /dev/null +++ b/gcc/lto-compress.c @@ -0,0 +1,314 @@ +/* LTO IL compression streams. + + Copyright 2009 Free Software Foundation, Inc. + Contributed by Simon Baldwin + +This file is part of GCC. + +GCC 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. + +GCC 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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#include "config.h" +#include "system.h" +/* zlib.h includes other system headers. Those headers may test feature + test macros. config.h may define feature test macros. For this reason, + zlib.h needs to be included after, rather than before, config.h and + system.h. */ +#include +#include "coretypes.h" +#include "tree.h" +#include "diagnostic.h" +#include "errors.h" +#include "langhooks.h" +#include "lto-streamer.h" +#include "lto-compress.h" + +/* Compression stream structure, holds the flush callback and opaque token, + the buffered data, and a note of whether compressing or uncompressing. */ + +struct lto_compression_stream +{ + void (*callback) (const char *, unsigned, void *); + void *opaque; + char *buffer; + size_t bytes; + size_t allocation; + bool is_compression; +}; + +/* Overall compression constants for zlib. */ + +static const size_t Z_BUFFER_LENGTH = 4096; +static const size_t MIN_STREAM_ALLOCATION = 1024; + +/* For zlib, allocate SIZE count of ITEMS and return the address, OPAQUE + is unused. */ + +static void * +lto_zalloc (void *opaque, unsigned items, unsigned size) +{ + gcc_assert (opaque == Z_NULL); + return xmalloc (items * size); +} + +/* For zlib, free memory at ADDRESS, OPAQUE is unused. */ + +static void +lto_zfree (void *opaque, void *address) +{ + gcc_assert (opaque == Z_NULL); + free (address); +} + +/* Return a zlib compression level that zlib will not reject. Normalizes + the compression level from the command line flag, clamping non-default + values to the appropriate end of their valid range. */ + +static int +lto_normalized_zlib_level (void) +{ + int level = flag_lto_compression_level; + + if (level != Z_DEFAULT_COMPRESSION) + { + if (level < Z_NO_COMPRESSION) + level = Z_NO_COMPRESSION; + else if (level > Z_BEST_COMPRESSION) + level = Z_BEST_COMPRESSION; + } + + return level; +} + +/* Create a new compression stream, with CALLBACK flush function passed + OPAQUE token, IS_COMPRESSION indicates if compressing or uncompressing. */ + +static struct lto_compression_stream * +lto_new_compression_stream (void (*callback) (const char *, unsigned, void *), + void *opaque, bool is_compression) +{ + struct lto_compression_stream *stream + = (struct lto_compression_stream *) xmalloc (sizeof (*stream)); + + memset (stream, 0, sizeof (*stream)); + stream->callback = callback; + stream->opaque = opaque; + stream->is_compression = is_compression; + + return stream; +} + +/* Append NUM_CHARS from address BASE to STREAM. */ + +static void +lto_append_to_compression_stream (struct lto_compression_stream *stream, + const char *base, size_t num_chars) +{ + size_t required = stream->bytes + num_chars; + + if (stream->allocation < required) + { + if (stream->allocation == 0) + stream->allocation = MIN_STREAM_ALLOCATION; + while (stream->allocation < required) + stream->allocation *= 2; + + stream->buffer = (char *) xrealloc (stream->buffer, stream->allocation); + } + + memcpy (stream->buffer + stream->bytes, base, num_chars); + stream->bytes += num_chars; +} + +/* Free the buffer and memory associated with STREAM. */ + +static void +lto_destroy_compression_stream (struct lto_compression_stream *stream) +{ + free (stream->buffer); + free (stream); +} + +/* Return a new compression stream, with CALLBACK flush function passed + OPAQUE token. */ + +struct lto_compression_stream * +lto_start_compression (void (*callback) (const char *, unsigned, void *), + void *opaque) +{ + return lto_new_compression_stream (callback, opaque, true); +} + +/* Append NUM_CHARS from address BASE to STREAM. */ + +void +lto_compress_block (struct lto_compression_stream *stream, + const char *base, size_t num_chars) +{ + gcc_assert (stream->is_compression); + + lto_append_to_compression_stream (stream, base, num_chars); + lto_stats.num_output_il_bytes += num_chars; +} + +/* Finalize STREAM compression, and free stream allocations. */ + +void +lto_end_compression (struct lto_compression_stream *stream) +{ + unsigned char *cursor = (unsigned char *) stream->buffer; + size_t remaining = stream->bytes; + const size_t outbuf_length = Z_BUFFER_LENGTH; + unsigned char *outbuf = (unsigned char *) xmalloc (outbuf_length); + z_stream out_stream; + size_t compressed_bytes = 0; + int status; + + gcc_assert (stream->is_compression); + + out_stream.next_out = outbuf; + out_stream.avail_out = outbuf_length; + out_stream.next_in = cursor; + out_stream.avail_in = remaining; + out_stream.zalloc = lto_zalloc; + out_stream.zfree = lto_zfree; + out_stream.opaque = Z_NULL; + + status = deflateInit (&out_stream, lto_normalized_zlib_level ()); + if (status != Z_OK) + internal_error ("compressed stream: %s", zError (status)); + + do + { + size_t in_bytes, out_bytes; + + status = deflate (&out_stream, Z_FINISH); + if (status != Z_OK && status != Z_STREAM_END) + internal_error ("compressed stream: %s", zError (status)); + + in_bytes = remaining - out_stream.avail_in; + out_bytes = outbuf_length - out_stream.avail_out; + + stream->callback ((const char *) outbuf, out_bytes, stream->opaque); + lto_stats.num_compressed_il_bytes += out_bytes; + compressed_bytes += out_bytes; + + cursor += in_bytes; + remaining -= in_bytes; + + out_stream.next_out = outbuf; + out_stream.avail_out = outbuf_length; + out_stream.next_in = cursor; + out_stream.avail_in = remaining; + } + while (status != Z_STREAM_END); + + status = deflateEnd (&out_stream); + if (status != Z_OK) + internal_error ("compressed stream: %s", zError (status)); + + lto_destroy_compression_stream (stream); + free (outbuf); +} + +/* Return a new uncompression stream, with CALLBACK flush function passed + OPAQUE token. */ + +struct lto_compression_stream * +lto_start_uncompression (void (*callback) (const char *, unsigned, void *), + void *opaque) +{ + return lto_new_compression_stream (callback, opaque, false); +} + +/* Append NUM_CHARS from address BASE to STREAM. */ + +void +lto_uncompress_block (struct lto_compression_stream *stream, + const char *base, size_t num_chars) +{ + gcc_assert (!stream->is_compression); + + lto_append_to_compression_stream (stream, base, num_chars); + lto_stats.num_input_il_bytes += num_chars; +} + +/* Finalize STREAM uncompression, and free stream allocations. + + Because of the way LTO IL streams are compressed, there may be several + concatenated compressed segments in the accumulated data, so for this + function we iterate decompressions until no data remains. */ + +void +lto_end_uncompression (struct lto_compression_stream *stream) +{ + unsigned char *cursor = (unsigned char *) stream->buffer; + size_t remaining = stream->bytes; + const size_t outbuf_length = Z_BUFFER_LENGTH; + unsigned char *outbuf = (unsigned char *) xmalloc (outbuf_length); + size_t uncompressed_bytes = 0; + + gcc_assert (!stream->is_compression); + + while (remaining > 0) + { + z_stream in_stream; + size_t out_bytes; + int status; + + in_stream.next_out = outbuf; + in_stream.avail_out = outbuf_length; + in_stream.next_in = cursor; + in_stream.avail_in = remaining; + in_stream.zalloc = lto_zalloc; + in_stream.zfree = lto_zfree; + in_stream.opaque = Z_NULL; + + status = inflateInit (&in_stream); + if (status != Z_OK) + internal_error ("compressed stream: %s", zError (status)); + + do + { + size_t in_bytes; + + status = inflate (&in_stream, Z_SYNC_FLUSH); + if (status != Z_OK && status != Z_STREAM_END) + internal_error ("compressed stream: %s", zError (status)); + + in_bytes = remaining - in_stream.avail_in; + out_bytes = outbuf_length - in_stream.avail_out; + + stream->callback ((const char *) outbuf, out_bytes, stream->opaque); + lto_stats.num_uncompressed_il_bytes += out_bytes; + uncompressed_bytes += out_bytes; + + cursor += in_bytes; + remaining -= in_bytes; + + in_stream.next_out = outbuf; + in_stream.avail_out = outbuf_length; + in_stream.next_in = cursor; + in_stream.avail_in = remaining; + } + while (!(status == Z_STREAM_END && out_bytes == 0)); + + status = inflateEnd (&in_stream); + if (status != Z_OK) + internal_error ("compressed stream: %s", zError (status)); + } + + lto_destroy_compression_stream (stream); + free (outbuf); +} diff --git a/gcc/lto-compress.h b/gcc/lto-compress.h new file mode 100644 index 00000000000..566a73498d2 --- /dev/null +++ b/gcc/lto-compress.h @@ -0,0 +1,42 @@ +/* LTO IL compression streams. + + Copyright 2009 Free Software Foundation, Inc. + Contributed by Simon Baldwin + +This file is part of GCC. + +GCC 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. + +GCC 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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_LTO_COMPRESS_H +#define GCC_LTO_COMPRESS_H + +struct lto_compression_stream; + +/* In lto-compress.c. */ +extern struct lto_compression_stream + *lto_start_compression (void (*callback) (const char *, unsigned, void *), + void *opaque); +extern void lto_compress_block (struct lto_compression_stream *stream, + const char *base, size_t num_chars); +extern void lto_end_compression (struct lto_compression_stream *stream); + +extern struct lto_compression_stream + *lto_start_uncompression (void (*callback) (const char *, unsigned, void *), + void *opaque); +extern void lto_uncompress_block (struct lto_compression_stream *stream, + const char *base, size_t num_chars); +extern void lto_end_uncompression (struct lto_compression_stream *stream); + +#endif /* GCC_LTO_COMPRESS_H */ diff --git a/gcc/lto-opts.c b/gcc/lto-opts.c new file mode 100644 index 00000000000..2a379f40fdc --- /dev/null +++ b/gcc/lto-opts.c @@ -0,0 +1,409 @@ +/* LTO IL options. + + Copyright 2009 Free Software Foundation, Inc. + Contributed by Simon Baldwin + +This file is part of GCC. + +GCC 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. + +GCC 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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tree.h" +#include "hashtab.h" +#include "ggc.h" +#include "vec.h" +#include "bitmap.h" +#include "flags.h" +#include "opts.h" +#include "options.h" +#include "target.h" +#include "toplev.h" +#include "lto-streamer.h" + +/* When a file is initially compiled, the options used when generating + the IL are not necessarily the same as those used when linking the + objects into the final executable. In general, most build systems + will proceed with something along the lines of: + + $ gcc -flto -c f1.c -o f1.o + $ gcc -flto -c f2.c -o f2.o + ... + $ gcc -flto -c fN.c -o fN.o + + And the final link may or may not include the same used + to generate the initial object files: + + $ gcc -flto -o prog f1.o ... fN.o + + Since we will be generating final code during the link step, some + of the flags used during the compile step need to be re-applied + during the link step. For instance, flags in the -m family. + + The idea is to save a selected set of in a special + section of the initial object files. This section is then read + during linking and the options re-applied. + + FIXME lto. Currently the scheme is limited in that only the + options saved on the first object file (f1.o) are read back during + the link step. This means that the options used to compile f1.o + will be applied to ALL the object files in the final link step. + More work needs to be done to implement a merging and validation + mechanism, as this will not be enough for all cases. */ + +/* Saved options hold the type of the option (currently CL_TARGET or + CL_COMMON), and the code, argument, and value. */ + +typedef struct GTY(()) opt_d +{ + unsigned int type; + size_t code; + char *arg; + int value; +} opt_t; + +DEF_VEC_O (opt_t); +DEF_VEC_ALLOC_O (opt_t, heap); + + +/* Options are held in two vectors, one for those registered by + command line handling code, and the other for those read in from + any LTO IL input. */ +static VEC(opt_t, heap) *user_options = NULL; +static VEC(opt_t, heap) *file_options = NULL; + +/* Iterate FROM in reverse, writing option codes not yet in CODES into *TO. + Mark each new option code encountered in CODES. */ + +static void +reverse_iterate_options (VEC(opt_t, heap) *from, VEC(opt_t, heap) **to, + bitmap codes) +{ + int i; + + for (i = VEC_length (opt_t, from); i > 0; i--) + { + const opt_t *const o = VEC_index (opt_t, from, i - 1); + + if (bitmap_set_bit (codes, o->code)) + VEC_safe_push (opt_t, heap, *to, o); + } +} + +/* Concatenate options vectors FIRST and SECOND, rationalize so that only the + final of any given option remains, and return the result. */ + +static VEC(opt_t, heap) * +concatenate_options (VEC(opt_t, heap) *first, VEC(opt_t, heap) *second) +{ + VEC(opt_t, heap) *results = NULL; + bitmap codes = lto_bitmap_alloc (); + + reverse_iterate_options (second, &results, codes); + reverse_iterate_options (first, &results, codes); + + lto_bitmap_free (codes); + return results; +} + +/* Clear the options vector in *OPTS_P and set it to NULL. */ + +static void +clear_options (VEC(opt_t, heap) **opts_p) +{ + int i; + opt_t *o; + + for (i = 0; VEC_iterate (opt_t, *opts_p, i, o); i++) + free (o->arg); + + VEC_free (opt_t, heap, *opts_p); +} + +/* Write LENGTH bytes from ADDR to STREAM. */ + +static void +output_data_stream (struct lto_output_stream *stream, + const void *addr, size_t length) +{ + lto_output_data_stream (stream, addr, length); +} + +/* Write string STRING to STREAM. */ + +static void +output_string_stream (struct lto_output_stream *stream, const char *string) +{ + bool flag = false; + + if (string != NULL) + { + const size_t length = strlen (string); + + flag = true; + output_data_stream (stream, &flag, sizeof (flag)); + output_data_stream (stream, &length, sizeof (length)); + output_data_stream (stream, string, length); + } + else + output_data_stream (stream, &flag, sizeof (flag)); +} + +/* Read LENGTH bytes from STREAM to ADDR. */ + +static void +input_data_block (struct lto_input_block *ib, void *addr, size_t length) +{ + size_t i; + unsigned char *const buffer = (unsigned char *const) addr; + + for (i = 0; i < length; i++) + buffer[i] = lto_input_1_unsigned (ib); +} + +/* Return a string from IB. The string is allocated, and the caller is + responsible for freeing it. */ + +static char * +input_string_block (struct lto_input_block *ib) +{ + bool flag; + + input_data_block (ib, &flag, sizeof (flag)); + if (flag) + { + size_t length; + char *string; + + input_data_block (ib, &length, sizeof (length)); + string = (char *) xcalloc (1, length + 1); + input_data_block (ib, string, length); + + return string; + } + else + return NULL; +} + +/* Return true if this option is one we need to save in LTO output files. + At present, we pass along all target options, and common options that + involve position independent code. + + TODO This list of options requires expansion and rationalization. + Among others, optimization options may well be appropriate here. */ + +static bool +register_user_option_p (size_t code, int type) +{ + return type == CL_TARGET + || (type == CL_COMMON + && (code == OPT_fPIC + || code == OPT_fcommon)); +} + +/* Note command line option with the given TYPE and CODE, ARG, and VALUE. + If relevant to LTO, save it in the user options vector. */ + +void +lto_register_user_option (size_t code, const char *arg, int value, int type) +{ + if (register_user_option_p (code, type)) + { + opt_t o; + + o.type = type; + o.code = code; + if (arg != NULL) + { + o.arg = (char *) xmalloc (strlen (arg) + 1); + strcpy (o.arg, arg); + } + else + o.arg = NULL; + o.value = value; + VEC_safe_push (opt_t, heap, user_options, &o); + } +} + +/* Empty the saved user options vector. */ + +void +lto_clear_user_options (void) +{ + clear_options (&user_options); +} + +/* Empty the saved file options vector. */ + +void +lto_clear_file_options (void) +{ + clear_options (&file_options); +} + +/* Concatenate the user options and any file options read from an LTO IL + file, and serialize them to STREAM. File options precede user options + so that the latter override the former when reissued. */ + +static void +output_options (struct lto_output_stream *stream) +{ + VEC(opt_t, heap) *opts = concatenate_options (file_options, user_options); + const size_t length = VEC_length (opt_t, opts); + int i; + opt_t *o; + + output_data_stream (stream, &length, sizeof (length)); + + for (i = 0; VEC_iterate (opt_t, opts, i, o); i++) + { + output_data_stream (stream, &o->type, sizeof (o->type)); + output_data_stream (stream, &o->code, sizeof (o->code)); + output_string_stream (stream, o->arg); + output_data_stream (stream, &o->value, sizeof (o->value)); + } + + VEC_free (opt_t, heap, opts); +} + +/* Write currently held options to an LTO IL section. */ + +void +lto_write_options (void) +{ + char *const section_name = lto_get_section_name (LTO_section_opts, NULL); + struct lto_output_stream stream; + struct lto_simple_header header; + struct lto_output_stream *header_stream; + + lto_begin_section (section_name, !flag_wpa); + free (section_name); + + memset (&stream, 0, sizeof (stream)); + output_options (&stream); + + memset (&header, 0, sizeof (header)); + header.lto_header.major_version = LTO_major_version; + header.lto_header.minor_version = LTO_minor_version; + header.lto_header.section_type = LTO_section_opts; + + header.compressed_size = 0; + header.main_size = stream.total_size; + + header_stream = ((struct lto_output_stream *) + xcalloc (1, sizeof (*header_stream))); + lto_output_data_stream (header_stream, &header, sizeof (header)); + lto_write_stream (header_stream); + free (header_stream); + + lto_write_stream (&stream); + lto_end_section (); +} + +/* Unserialize an options vector from IB, and append to file_options. */ + +static void +input_options (struct lto_input_block *ib) +{ + size_t length, i; + + input_data_block (ib, &length, sizeof (length)); + + for (i = 0; i < length; i++) + { + opt_t o; + + input_data_block (ib, &o.type, sizeof (o.type)); + input_data_block (ib, &o.code, sizeof (o.code)); + o.arg = input_string_block (ib); + input_data_block (ib, &o.value, sizeof (o.value)); + VEC_safe_push (opt_t, heap, file_options, &o); + } +} + +/* Read options from an LTO IL section. */ + +void +lto_read_file_options (struct lto_file_decl_data *file_data) +{ + size_t len; + const char *data; + const struct lto_simple_header *header; + int32_t opts_offset; + struct lto_input_block ib; + + data = lto_get_section_data (file_data, LTO_section_opts, NULL, &len); + header = (const struct lto_simple_header *) data; + opts_offset = sizeof (*header); + + lto_check_version (header->lto_header.major_version, + header->lto_header.minor_version); + + LTO_INIT_INPUT_BLOCK (ib, data + opts_offset, 0, header->main_size); + input_options (&ib); + + lto_free_section_data (file_data, LTO_section_opts, 0, data, len); +} + +/* Re-handle option with type TYPE and CODE, ARG, and VALUE. Logic extracted + from common_handle_option() in opts.c. + + FIXME lto. This section is not complete. If extended to handle + optimization options, note that changing these after opts.c prescan may + involve also adjusting other options that were defaulted from initial + optimization option values. */ + +static void +handle_common_option (size_t code, const char *arg ATTRIBUTE_UNUSED, int value) +{ + switch (code) + { + case OPT_fPIC: + flag_pic = !!value; + break; + + case OPT_fcommon: + flag_no_common = !value; + break; + + default: + gcc_unreachable (); + } +} + +/* Concatenate the user options and any file options read from an LTO IL + file, and reissue them as if all had just been read in from the command + line. As with serialization, file options precede user options. */ + +void +lto_reissue_options (void) +{ + VEC(opt_t, heap) *opts = concatenate_options (file_options, user_options); + int i; + opt_t *o; + + for (i = 0; VEC_iterate (opt_t, opts, i, o); i++) + { + if (o->type == CL_TARGET) + targetm.handle_option (o->code, o->arg, o->value); + else if (o->type == CL_COMMON) + handle_common_option (o->code, o->arg, o->value); + else + gcc_unreachable (); + } + + VEC_free (opt_t, heap, opts); +} diff --git a/gcc/lto-section-in.c b/gcc/lto-section-in.c new file mode 100644 index 00000000000..da2384e0839 --- /dev/null +++ b/gcc/lto-section-in.c @@ -0,0 +1,489 @@ +/* Input functions for reading LTO sections. + + Copyright 2009 Free Software Foundation, Inc. + Contributed by Kenneth Zadeck + +This file is part of GCC. + +GCC 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. + +GCC 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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "toplev.h" +#include "tree.h" +#include "expr.h" +#include "flags.h" +#include "params.h" +#include "input.h" +#include "varray.h" +#include "hashtab.h" +#include "basic-block.h" +#include "tree-flow.h" +#include "cgraph.h" +#include "function.h" +#include "ggc.h" +#include "diagnostic.h" +#include "except.h" +#include "vec.h" +#include "timevar.h" +#include "output.h" +#include "lto-streamer.h" +#include "lto-compress.h" + +/* Section names. These must correspond to the values of + enum lto_section_type. */ +const char *lto_section_name[LTO_N_SECTION_TYPES] = +{ + "decls", + "function_body", + "static_initializer", + "cgraph", + "ipa_pure_const", + "ipa_reference", + "symtab", + "wpa_fixup", + "opts" +}; + +unsigned char +lto_input_1_unsigned (struct lto_input_block *ib) +{ + if (ib->p >= ib->len) + internal_error ("bytecode stream: trying to read %d bytes " + "after the end of the input buffer", ib->p - ib->len); + + return (ib->data[ib->p++]); +} + + +/* Read an ULEB128 Number of IB. */ + +unsigned HOST_WIDE_INT +lto_input_uleb128 (struct lto_input_block *ib) +{ + unsigned HOST_WIDE_INT result = 0; + int shift = 0; + unsigned HOST_WIDE_INT byte; + + while (true) + { + byte = lto_input_1_unsigned (ib); + result |= (byte & 0x7f) << shift; + shift += 7; + if ((byte & 0x80) == 0) + return result; + } +} + +/* HOST_WIDEST_INT version of lto_input_uleb128. IB is as in + lto_input_uleb128. */ + +unsigned HOST_WIDEST_INT +lto_input_widest_uint_uleb128 (struct lto_input_block *ib) +{ + unsigned HOST_WIDEST_INT result = 0; + int shift = 0; + unsigned HOST_WIDEST_INT byte; + + while (true) + { + byte = lto_input_1_unsigned (ib); + result |= (byte & 0x7f) << shift; + shift += 7; + if ((byte & 0x80) == 0) + return result; + } +} + +/* Read an SLEB128 Number of IB. */ + +HOST_WIDE_INT +lto_input_sleb128 (struct lto_input_block *ib) +{ + HOST_WIDE_INT result = 0; + int shift = 0; + unsigned HOST_WIDE_INT byte; + + while (true) + { + byte = lto_input_1_unsigned (ib); + result |= (byte & 0x7f) << shift; + shift += 7; + if ((byte & 0x80) == 0) + { + if ((shift < HOST_BITS_PER_WIDE_INT) && (byte & 0x40)) + result |= - ((HOST_WIDE_INT)1 << shift); + + return result; + } + } +} + + +/* Hooks so that the ipa passes can call into the lto front end to get + sections. */ + +static struct lto_file_decl_data ** file_decl_data; +static lto_get_section_data_f* get_section_f; +static lto_free_section_data_f* free_section_f; + + +/* This is called from the lto front end to set up the hooks that are + used by the ipa passes to get the data that they will + deserialize. */ + +void +lto_set_in_hooks (struct lto_file_decl_data ** data, + lto_get_section_data_f* get_f, + lto_free_section_data_f* free_f) +{ + file_decl_data = data; + get_section_f = get_f; + free_section_f = free_f; +} + + +/* Return an array of file decl datas for all of the files passed to + this compilation. */ + +struct lto_file_decl_data ** +lto_get_file_decl_data (void) +{ + gcc_assert (file_decl_data); + return file_decl_data; +} + +/* Buffer structure for accumulating data from compression callbacks. */ + +struct lto_buffer +{ + char *data; + size_t length; +}; + +/* Compression callback, append LENGTH bytes from DATA to the buffer pointed + to by OPAQUE. */ + +static void +lto_append_data (const char *data, unsigned length, void *opaque) +{ + struct lto_buffer *buffer = (struct lto_buffer *) opaque; + + buffer->data = (char *) xrealloc (buffer->data, buffer->length + length); + memcpy (buffer->data + buffer->length, data, length); + buffer->length += length; +} + +/* Header placed in returned uncompressed data streams. Allows the + uncompressed allocated data to be mapped back to the underlying + compressed data for use with free_section_f. */ + +struct lto_data_header +{ + const char *data; + size_t len; +}; + +/* Return a char pointer to the start of a data stream for an LTO pass + or function. FILE_DATA indicates where to obtain the data. + SECTION_TYPE is the type of information to be obtained. NAME is + the name of the function and is only used when finding a function + body; otherwise it is NULL. LEN is the size of the data + returned. */ + +const char * +lto_get_section_data (struct lto_file_decl_data *file_data, + enum lto_section_type section_type, + const char *name, + size_t *len) +{ + const char *data = (get_section_f) (file_data, section_type, name, len); + const size_t header_length = sizeof (struct lto_data_header); + struct lto_data_header *header; + struct lto_buffer buffer; + struct lto_compression_stream *stream; + lto_stats.section_size[section_type] += *len; + + if (data == NULL) + return NULL; + + /* FIXME lto: WPA mode does not write compressed sections, so for now + suppress uncompression if flag_ltrans. */ + if (flag_ltrans) + return data; + + /* Create a mapping header containing the underlying data and length, + and prepend this to the uncompression buffer. The uncompressed data + then follows, and a pointer to the start of the uncompressed data is + returned. */ + header = (struct lto_data_header *) xmalloc (header_length); + header->data = data; + header->len = *len; + + buffer.data = (char *) header; + buffer.length = header_length; + + stream = lto_start_uncompression (lto_append_data, &buffer); + lto_uncompress_block (stream, data, *len); + lto_end_uncompression (stream); + + *len = buffer.length - header_length; + return buffer.data + header_length; +} + + +/* Free the data found from the above call. The first three + parameters are the same as above. DATA is the data to be freed and + LEN is the length of that data. */ + +void +lto_free_section_data (struct lto_file_decl_data *file_data, + enum lto_section_type section_type, + const char *name, + const char *data, + size_t len) +{ + const size_t header_length = sizeof (struct lto_data_header); + const char *real_data = data - header_length; + const struct lto_data_header *header + = (const struct lto_data_header *) real_data; + + gcc_assert (free_section_f); + + /* FIXME lto: WPA mode does not write compressed sections, so for now + suppress uncompression mapping if flag_ltrans. */ + if (flag_ltrans) + { + (free_section_f) (file_data, section_type, name, data, len); + return; + } + + /* The underlying data address has been extracted from the mapping header. + Free that, then free the allocated uncompression buffer. */ + (free_section_f) (file_data, section_type, name, header->data, header->len); + free (CONST_CAST (char *, real_data)); +} + + +/* Load a section of type SECTION_TYPE from FILE_DATA, parse the + header and then return an input block pointing to the section. The + raw pointer to the section is returned in DATAR and LEN. These are + used to free the section. Return NULL if the section is not present. */ + +struct lto_input_block * +lto_create_simple_input_block (struct lto_file_decl_data *file_data, + enum lto_section_type section_type, + const char **datar, size_t *len) +{ + const char *data = lto_get_section_data (file_data, section_type, NULL, len); + const struct lto_simple_header * header + = (const struct lto_simple_header *) data; + + struct lto_input_block* ib_main; + int32_t main_offset = sizeof (struct lto_simple_header); + + if (!data) + return NULL; + + ib_main = XNEW (struct lto_input_block); + + *datar = data; + LTO_INIT_INPUT_BLOCK_PTR (ib_main, data + main_offset, + 0, header->main_size); + + return ib_main; +} + + +/* Close the section returned from a call to + LTO_CREATE_SIMPLE_INPUT_BLOCK. IB is the input block returned from + that call. The FILE_DATA and SECTION_TYPE are the same as what was + passed to that call and the DATA and LEN are what was returned from + that call. */ + +void +lto_destroy_simple_input_block (struct lto_file_decl_data *file_data, + enum lto_section_type section_type, + struct lto_input_block *ib, + const char *data, size_t len) +{ + free (ib); + lto_free_section_data (file_data, section_type, NULL, data, len); +} + +/*****************************************************************************/ +/* Record renamings of static declarations */ +/*****************************************************************************/ + +struct lto_renaming_slot +{ + const char *old_name; + const char *new_name; +}; + +/* Returns a hash code for P. */ + +static hashval_t +hash_name (const void *p) +{ + const struct lto_renaming_slot *ds = (const struct lto_renaming_slot *) p; + return (hashval_t) htab_hash_string (ds->new_name); +} + +/* Returns nonzero if P1 and P2 are equal. */ + +static int +eq_name (const void *p1, const void *p2) +{ + const struct lto_renaming_slot *s1 = + (const struct lto_renaming_slot *) p1; + const struct lto_renaming_slot *s2 = + (const struct lto_renaming_slot *) p2; + + return strcmp (s1->new_name, s2->new_name) == 0; +} + +/* Free a renaming table entry. */ + +static void +renaming_slot_free (void *slot) +{ + struct lto_renaming_slot *s = (struct lto_renaming_slot *) slot; + + free (CONST_CAST (void *, (const void *) s->old_name)); + free (CONST_CAST (void *, (const void *) s->new_name)); + free ((void *) s); +} + +/* Create an empty hash table for recording declaration renamings. */ + +htab_t +lto_create_renaming_table (void) +{ + return htab_create (37, hash_name, eq_name, renaming_slot_free); +} + +/* Record a declaration name mapping OLD_NAME -> NEW_NAME. DECL_DATA + holds the renaming hash table to use. */ + +void +lto_record_renamed_decl (struct lto_file_decl_data *decl_data, + const char *old_name, const char *new_name) +{ + void **slot; + struct lto_renaming_slot r_slot; + + r_slot.new_name = new_name; + slot = htab_find_slot (decl_data->renaming_hash_table, &r_slot, INSERT); + if (*slot == NULL) + { + struct lto_renaming_slot *new_slot = XNEW (struct lto_renaming_slot); + new_slot->old_name = xstrdup (old_name); + new_slot->new_name = xstrdup (new_name); + *slot = new_slot; + } + else + gcc_unreachable (); +} + + +/* Given a string NAME, return the string that it has been mapped to + by lto_record_renamed_decl. If NAME was not renamed, it is + returned unchanged. DECL_DATA holds the renaming hash table to use. */ + +const char * +lto_get_decl_name_mapping (struct lto_file_decl_data *decl_data, + const char *name) +{ + htab_t renaming_hash_table = decl_data->renaming_hash_table; + struct lto_renaming_slot *slot; + struct lto_renaming_slot r_slot; + + r_slot.new_name = name; + slot = (struct lto_renaming_slot *) htab_find (renaming_hash_table, &r_slot); + if (slot) + return slot->old_name; + else + return name; +} + +/*****************************************************************************/ +/* Input decl state object. */ +/*****************************************************************************/ + +/* Return a newly created in-decl state object. */ + +struct lto_in_decl_state * +lto_new_in_decl_state (void) +{ + struct lto_in_decl_state *state; + + state = ((struct lto_in_decl_state *) xmalloc (sizeof (*state))); + memset (state, 0, sizeof (*state)); + return state; +} + +/* Delete STATE and its components. */ + +void +lto_delete_in_decl_state (struct lto_in_decl_state *state) +{ + int i; + + for (i = 0; i < LTO_N_DECL_STREAMS; i++) + if (state->streams[i].trees) + free (state->streams[i].trees); + free (state); +} + +/* Hashtable helpers. lto_in_decl_states are hash by their function decls. */ + +hashval_t +lto_hash_in_decl_state (const void *p) +{ + const struct lto_in_decl_state *state = (const struct lto_in_decl_state *) p; + return htab_hash_pointer (state->fn_decl); +} + +/* Return true if the fn_decl field of the lto_in_decl_state pointed to by + P1 equals to the function decl P2. */ + +int +lto_eq_in_decl_state (const void *p1, const void *p2) +{ + const struct lto_in_decl_state *state1 = + (const struct lto_in_decl_state *) p1; + const struct lto_in_decl_state *state2 = + (const struct lto_in_decl_state *) p2; + return state1->fn_decl == state2->fn_decl; +} + + +/* Search the in-decl state of a function FUNC contained in the file + associated with FILE_DATA. Return NULL if not found. */ + +struct lto_in_decl_state* +lto_get_function_in_decl_state (struct lto_file_decl_data *file_data, + tree func) +{ + struct lto_in_decl_state temp; + void **slot; + + temp.fn_decl = func; + slot = htab_find_slot (file_data->function_decl_states, &temp, NO_INSERT); + return slot? ((struct lto_in_decl_state*) *slot) : NULL; +} diff --git a/gcc/lto-section-out.c b/gcc/lto-section-out.c new file mode 100644 index 00000000000..e347027c709 --- /dev/null +++ b/gcc/lto-section-out.c @@ -0,0 +1,652 @@ +/* Functions for writing LTO sections. + + Copyright (C) 2009 Free Software Foundation, Inc. + Contributed by Kenneth Zadeck + +This file is part of GCC. + +GCC 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. + +GCC 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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "toplev.h" +#include "tree.h" +#include "expr.h" +#include "params.h" +#include "input.h" +#include "varray.h" +#include "hashtab.h" +#include "basic-block.h" +#include "tree-flow.h" +#include "tree-pass.h" +#include "cgraph.h" +#include "function.h" +#include "ggc.h" +#include "except.h" +#include "vec.h" +#include "pointer-set.h" +#include "bitmap.h" +#include "langhooks.h" +#include "lto-streamer.h" +#include "lto-compress.h" + +static VEC(lto_out_decl_state_ptr, heap) *decl_state_stack; + +/* List of out decl states used by functions. We use this to + generate the decl directory later. */ + +VEC(lto_out_decl_state_ptr, heap) *lto_function_decl_states; + +/* Bitmap indexed by DECL_UID to indicate if a function needs to be + forced extern inline. */ +static bitmap forced_extern_inline; + +/* Initialize states for determining which function decls to be ouput + as extern inline, regardless of the decls' own attributes. */ + +void +lto_new_extern_inline_states (void) +{ + forced_extern_inline = lto_bitmap_alloc (); +} + +/* Releasing resources use for states to determine which function decls + to be ouput as extern inline */ + +void +lto_delete_extern_inline_states (void) +{ + lto_bitmap_free (forced_extern_inline); + forced_extern_inline = NULL; +} + +/* Force all the functions in DECLS to be output as extern inline. + DECLS is a bitmap indexed by DECL_UID. */ + +void +lto_force_functions_extern_inline (bitmap decls) +{ + bitmap_ior_into (forced_extern_inline, decls); +} + +/* Return true if FN_DECL is a function which should be emitted as + extern inline. */ + +bool +lto_forced_extern_inline_p (tree fn_decl) +{ + return bitmap_bit_p (forced_extern_inline, DECL_UID (fn_decl)); +} + +/* Returns a hash code for P. */ + +hashval_t +lto_hash_decl_slot_node (const void *p) +{ + const struct lto_decl_slot *ds = (const struct lto_decl_slot *) p; + + /* + return (hashval_t) DECL_UID (ds->t); + */ + return (hashval_t) TREE_HASH (ds->t); +} + + +/* Returns nonzero if P1 and P2 are equal. */ + +int +lto_eq_decl_slot_node (const void *p1, const void *p2) +{ + const struct lto_decl_slot *ds1 = + (const struct lto_decl_slot *) p1; + const struct lto_decl_slot *ds2 = + (const struct lto_decl_slot *) p2; + + /* + return DECL_UID (ds1->t) == DECL_UID (ds2->t); + */ + return ds1->t == ds2->t; +} + + +/* Returns a hash code for P. */ + +hashval_t +lto_hash_type_slot_node (const void *p) +{ + const struct lto_decl_slot *ds = (const struct lto_decl_slot *) p; + return (hashval_t) TYPE_UID (ds->t); +} + + +/* Returns nonzero if P1 and P2 are equal. */ + +int +lto_eq_type_slot_node (const void *p1, const void *p2) +{ + const struct lto_decl_slot *ds1 = + (const struct lto_decl_slot *) p1; + const struct lto_decl_slot *ds2 = + (const struct lto_decl_slot *) p2; + + return TYPE_UID (ds1->t) == TYPE_UID (ds2->t); +} + +/***************************************************************************** + Output routines shared by all of the serialization passes. +*****************************************************************************/ + + +/* Flush compressed stream data function, sends NUM_CHARS from CHARS + to the append lang hook, OPAQUE is currently always NULL. */ + +static void +lto_append_data (const char *chars, unsigned int num_chars, void *opaque) +{ + gcc_assert (opaque == NULL); + lang_hooks.lto.append_data (chars, num_chars, opaque); +} + +/* Pointer to the current compression stream. */ + +static struct lto_compression_stream *compression_stream = NULL; + +/* Begin a new output section named NAME. If COMPRESS is true, zlib compress + the section. */ + +void +lto_begin_section (const char *name, bool compress) +{ + lang_hooks.lto.begin_section (name); + + /* FIXME lto: for now, suppress compression if the lang_hook that appends + data is anything other than assembler output. The effect here is that + we get compression of IL only in non-ltrans object files. */ + gcc_assert (compression_stream == NULL); + if (compress) + compression_stream = lto_start_compression (lto_append_data, NULL); +} + + +/* End the current output section. */ + +void +lto_end_section (void) +{ + if (compression_stream) + { + lto_end_compression (compression_stream); + compression_stream = NULL; + } + lang_hooks.lto.end_section (); +} + + +/* Write all of the chars in OBS to the assembler. Recycle the blocks + in obs as this is being done. */ + +void +lto_write_stream (struct lto_output_stream *obs) +{ + unsigned int block_size = 1024; + struct lto_char_ptr_base *block; + struct lto_char_ptr_base *next_block; + if (!obs->first_block) + return; + + for (block = obs->first_block; block; block = next_block) + { + const char *base = ((char *)block) + sizeof (struct lto_char_ptr_base); + unsigned int num_chars = block_size - sizeof (struct lto_char_ptr_base); + + /* If this is not the last block, it is full. If it is the last + block, left_in_block indicates how many chars are unoccupied in + this block; subtract from num_chars to obtain occupancy. */ + next_block = (struct lto_char_ptr_base *) block->ptr; + if (!next_block) + num_chars -= obs->left_in_block; + + /* FIXME lto: WPA mode uses an ELF function as a lang_hook to append + output data. This hook is not happy with the way that compression + blocks up output differently to the way it's blocked here. So for + now, we don't compress WPA output. */ + if (compression_stream) + { + lto_compress_block (compression_stream, base, num_chars); + lang_hooks.lto.append_data (NULL, 0, block); + } + else + lang_hooks.lto.append_data (base, num_chars, block); + block_size *= 2; + } +} + + +/* Adds a new block to output stream OBS. */ + +static void +append_block (struct lto_output_stream *obs) +{ + struct lto_char_ptr_base *new_block; + + gcc_assert (obs->left_in_block == 0); + + if (obs->first_block == NULL) + { + /* This is the first time the stream has been written + into. */ + obs->block_size = 1024; + new_block = (struct lto_char_ptr_base*) xmalloc (obs->block_size); + obs->first_block = new_block; + } + else + { + struct lto_char_ptr_base *tptr; + /* Get a new block that is twice as big as the last block + and link it into the list. */ + obs->block_size *= 2; + new_block = (struct lto_char_ptr_base*) xmalloc (obs->block_size); + /* The first bytes of the block are reserved as a pointer to + the next block. Set the chain of the full block to the + pointer to the new block. */ + tptr = obs->current_block; + tptr->ptr = (char *) new_block; + } + + /* Set the place for the next char at the first position after the + chain to the next block. */ + obs->current_pointer + = ((char *) new_block) + sizeof (struct lto_char_ptr_base); + obs->current_block = new_block; + /* Null out the newly allocated block's pointer to the next block. */ + new_block->ptr = NULL; + obs->left_in_block = obs->block_size - sizeof (struct lto_char_ptr_base); +} + + +/* Write a character to the output block. */ + +void +lto_output_1_stream (struct lto_output_stream *obs, char c) +{ + /* No space left. */ + if (obs->left_in_block == 0) + append_block (obs); + + /* Write the actual character. */ + *obs->current_pointer = c; + obs->current_pointer++; + obs->total_size++; + obs->left_in_block--; +} + + +/* Write raw DATA of length LEN to the output block OB. */ + +void +lto_output_data_stream (struct lto_output_stream *obs, const void *data, + size_t len) +{ + while (len) + { + size_t copy; + + /* No space left. */ + if (obs->left_in_block == 0) + append_block (obs); + + /* Determine how many bytes to copy in this loop. */ + if (len <= obs->left_in_block) + copy = len; + else + copy = obs->left_in_block; + + /* Copy the data and do bookkeeping. */ + memcpy (obs->current_pointer, data, copy); + obs->current_pointer += copy; + obs->total_size += copy; + obs->left_in_block -= copy; + data = (const char *) data + copy; + len -= copy; + } +} + + +/* Output an unsigned LEB128 quantity to OBS. */ + +void +lto_output_uleb128_stream (struct lto_output_stream *obs, + unsigned HOST_WIDE_INT work) +{ + do + { + unsigned int byte = (work & 0x7f); + work >>= 7; + if (work != 0) + /* More bytes to follow. */ + byte |= 0x80; + + lto_output_1_stream (obs, byte); + } + while (work != 0); +} + +/* Identical to output_uleb128_stream above except using unsigned + HOST_WIDEST_INT type. For efficiency on host where unsigned HOST_WIDEST_INT + is not native, we only use this if we know that HOST_WIDE_INT is not wide + enough. */ + +void +lto_output_widest_uint_uleb128_stream (struct lto_output_stream *obs, + unsigned HOST_WIDEST_INT work) +{ + do + { + unsigned int byte = (work & 0x7f); + work >>= 7; + if (work != 0) + /* More bytes to follow. */ + byte |= 0x80; + + lto_output_1_stream (obs, byte); + } + while (work != 0); +} + + +/* Output a signed LEB128 quantity. */ + +void +lto_output_sleb128_stream (struct lto_output_stream *obs, HOST_WIDE_INT work) +{ + int more, byte; + + do + { + byte = (work & 0x7f); + /* arithmetic shift */ + work >>= 7; + more = !((work == 0 && (byte & 0x40) == 0) + || (work == -1 && (byte & 0x40) != 0)); + if (more) + byte |= 0x80; + + lto_output_1_stream (obs, byte); + } + while (more); +} + + +/* Lookup NAME in ENCODER. If NAME is not found, create a new entry in + ENCODER for NAME with the next available index of ENCODER, then + print the index to OBS. True is returned if NAME was added to + ENCODER. The resulting index is stored in THIS_INDEX. + + If OBS is NULL, the only action is to add NAME to the encoder. */ + +bool +lto_output_decl_index (struct lto_output_stream *obs, + struct lto_tree_ref_encoder *encoder, + tree name, unsigned int *this_index) +{ + void **slot; + struct lto_decl_slot d_slot; + int index; + bool new_entry_p = FALSE; + + d_slot.t = name; + slot = htab_find_slot (encoder->tree_hash_table, &d_slot, INSERT); + if (*slot == NULL) + { + struct lto_decl_slot *new_slot + = (struct lto_decl_slot *) xmalloc (sizeof (struct lto_decl_slot)); + index = encoder->next_index++; + + new_slot->t = name; + new_slot->slot_num = index; + *slot = new_slot; + VEC_safe_push (tree, heap, encoder->trees, name); + new_entry_p = TRUE; + } + else + { + struct lto_decl_slot *old_slot = (struct lto_decl_slot *)*slot; + index = old_slot->slot_num; + } + + if (obs) + lto_output_uleb128_stream (obs, index); + *this_index = index; + return new_entry_p; +} + +/* Output a field DECL to OBS. */ + +void +lto_output_field_decl_index (struct lto_out_decl_state *decl_state, + struct lto_output_stream * obs, tree decl) +{ + unsigned int index; + lto_output_decl_index (obs, &decl_state->streams[LTO_DECL_STREAM_FIELD_DECL], + decl, &index); +} + +/* Output a function DECL to OBS. */ + +void +lto_output_fn_decl_index (struct lto_out_decl_state *decl_state, + struct lto_output_stream * obs, tree decl) +{ + unsigned int index; + lto_output_decl_index (obs, &decl_state->streams[LTO_DECL_STREAM_FN_DECL], + decl, &index); +} + +/* Output a namespace DECL to OBS. */ + +void +lto_output_namespace_decl_index (struct lto_out_decl_state *decl_state, + struct lto_output_stream * obs, tree decl) +{ + unsigned int index; + lto_output_decl_index (obs, + &decl_state->streams[LTO_DECL_STREAM_NAMESPACE_DECL], + decl, &index); +} + +/* Output a static or extern var DECL to OBS. */ + +void +lto_output_var_decl_index (struct lto_out_decl_state *decl_state, + struct lto_output_stream * obs, tree decl) +{ + unsigned int index; + lto_output_decl_index (obs, &decl_state->streams[LTO_DECL_STREAM_VAR_DECL], + decl, &index); +} + +/* Output a type DECL to OBS. */ + +void +lto_output_type_decl_index (struct lto_out_decl_state *decl_state, + struct lto_output_stream * obs, tree decl) +{ + unsigned int index; + lto_output_decl_index (obs, &decl_state->streams[LTO_DECL_STREAM_TYPE_DECL], + decl, &index); +} + +/* Output a type REF to OBS. */ + +void +lto_output_type_ref_index (struct lto_out_decl_state *decl_state, + struct lto_output_stream *obs, tree ref) +{ + unsigned int index; + lto_output_decl_index (obs, &decl_state->streams[LTO_DECL_STREAM_TYPE], + ref, &index); +} + + +/* Create the output block and return it. */ + +struct lto_simple_output_block * +lto_create_simple_output_block (enum lto_section_type section_type) +{ + struct lto_simple_output_block *ob + = ((struct lto_simple_output_block *) + xcalloc (1, sizeof (struct lto_simple_output_block))); + + ob->section_type = section_type; + ob->decl_state = lto_get_out_decl_state (); + ob->main_stream = ((struct lto_output_stream *) + xcalloc (1, sizeof (struct lto_output_stream))); + + return ob; +} + + +/* Produce a simple section for one of the ipa passes. */ + +void +lto_destroy_simple_output_block (struct lto_simple_output_block *ob) +{ + char *section_name; + struct lto_simple_header header; + struct lto_output_stream *header_stream; + + section_name = lto_get_section_name (ob->section_type, NULL); + lto_begin_section (section_name, !flag_wpa); + free (section_name); + + /* Write the header which says how to decode the pieces of the + t. */ + memset (&header, 0, sizeof (struct lto_simple_header)); + header.lto_header.major_version = LTO_major_version; + header.lto_header.minor_version = LTO_minor_version; + header.lto_header.section_type = LTO_section_cgraph; + + header.compressed_size = 0; + + header.main_size = ob->main_stream->total_size; + + header_stream = XCNEW (struct lto_output_stream); + lto_output_data_stream (header_stream, &header, sizeof header); + lto_write_stream (header_stream); + free (header_stream); + + lto_write_stream (ob->main_stream); + + /* Put back the assembly section that was there before we started + writing lto info. */ + lto_end_section (); + + free (ob->main_stream); + free (ob); +} + + +/* Return a new lto_out_decl_state. */ + +struct lto_out_decl_state * +lto_new_out_decl_state (void) +{ + struct lto_out_decl_state *state = XCNEW (struct lto_out_decl_state); + int i; + htab_hash hash_fn; + htab_eq eq_fn; + + for (i = 0; i < LTO_N_DECL_STREAMS; i++) + { + if (i == LTO_DECL_STREAM_TYPE) + { + hash_fn = lto_hash_type_slot_node; + eq_fn = lto_eq_type_slot_node; + } + else + { + hash_fn = lto_hash_decl_slot_node; + eq_fn = lto_eq_decl_slot_node; + } + lto_init_tree_ref_encoder (&state->streams[i], hash_fn, eq_fn); + } + + state->cgraph_node_encoder = lto_cgraph_encoder_new (); + + return state; +} + + +/* Delete STATE and components. */ + +void +lto_delete_out_decl_state (struct lto_out_decl_state *state) +{ + int i; + + for (i = 0; i < LTO_N_DECL_STREAMS; i++) + lto_destroy_tree_ref_encoder (&state->streams[i]); + + free (state); +} + + +/* Get the currently used lto_out_decl_state structure. */ + +struct lto_out_decl_state * +lto_get_out_decl_state (void) +{ + return VEC_last (lto_out_decl_state_ptr, decl_state_stack); +} + +/* Push STATE to top of out decl stack. */ + +void +lto_push_out_decl_state (struct lto_out_decl_state *state) +{ + VEC_safe_push (lto_out_decl_state_ptr, heap, decl_state_stack, state); +} + +/* Pop the currently used out-decl state from top of stack. */ + +struct lto_out_decl_state * +lto_pop_out_decl_state (void) +{ + return VEC_pop (lto_out_decl_state_ptr, decl_state_stack); +} + +/* Record STATE after it has been used in serializing the body of + FN_DECL. STATE should no longer be used by the caller. The ownership + of it is taken over from this point. */ + +void +lto_record_function_out_decl_state (tree fn_decl, + struct lto_out_decl_state *state) +{ + int i; + + /* Strip all hash tables to save some memory. */ + for (i = 0; i < LTO_N_DECL_STREAMS; i++) + if (state->streams[i].tree_hash_table) + { + htab_delete (state->streams[i].tree_hash_table); + state->streams[i].tree_hash_table = NULL; + } + state->fn_decl = fn_decl; + VEC_safe_push (lto_out_decl_state_ptr, heap, lto_function_decl_states, + state); +} diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c new file mode 100644 index 00000000000..a8d237959c3 --- /dev/null +++ b/gcc/lto-streamer-in.c @@ -0,0 +1,2624 @@ +/* Read the GIMPLE representation from a file stream. + + Copyright 2009 Free Software Foundation, Inc. + Contributed by Kenneth Zadeck + Re-implemented by Diego Novillo + +This file is part of GCC. + +GCC 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. + +GCC 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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "toplev.h" +#include "tree.h" +#include "expr.h" +#include "flags.h" +#include "params.h" +#include "input.h" +#include "varray.h" +#include "hashtab.h" +#include "basic-block.h" +#include "tree-flow.h" +#include "tree-pass.h" +#include "cgraph.h" +#include "function.h" +#include "ggc.h" +#include "diagnostic.h" +#include "libfuncs.h" +#include "except.h" +#include "debug.h" +#include "vec.h" +#include "timevar.h" +#include "output.h" +#include "ipa-utils.h" +#include "lto-streamer.h" + +/* Data structure used to hash file names in the source_location field. */ +struct string_slot +{ + const char *s; + unsigned int slot_num; +}; + +/* The table to hold the file names. */ +static htab_t file_name_hash_table; + + +/* Check that tag ACTUAL has one of the given values. NUM_TAGS is the + number of valid tag values to check. */ + +static void +lto_tag_check_set (enum LTO_tags actual, int ntags, ...) +{ + va_list ap; + int i; + + va_start (ap, ntags); + for (i = 0; i < ntags; i++) + if ((unsigned) actual == va_arg (ap, unsigned)) + { + va_end (ap); + return; + } + + va_end (ap); + internal_error ("bytecode stream: unexpected tag %s", lto_tag_name (actual)); +} + + +/* Check that tag ACTUAL is in the range [TAG1, TAG2]. */ + +static void +lto_tag_check_range (enum LTO_tags actual, enum LTO_tags tag1, + enum LTO_tags tag2) +{ + if (actual < tag1 || actual > tag2) + internal_error ("bytecode stream: tag %s is not in the expected range " + "[%s, %s]", + lto_tag_name (actual), + lto_tag_name (tag1), + lto_tag_name (tag2)); +} + + +/* Check that tag ACTUAL == EXPECTED. */ + +static void +lto_tag_check (enum LTO_tags actual, enum LTO_tags expected) +{ + if (actual != expected) + internal_error ("bytecode stream: expected tag %s instead of %s", + lto_tag_name (expected), lto_tag_name (actual)); +} + + +/* Return a hash code for P. */ + +static hashval_t +hash_string_slot_node (const void *p) +{ + const struct string_slot *ds = (const struct string_slot *) p; + return (hashval_t) htab_hash_string (ds->s); +} + + +/* Returns nonzero if P1 and P2 are equal. */ + +static int +eq_string_slot_node (const void *p1, const void *p2) +{ + const struct string_slot *ds1 = (const struct string_slot *) p1; + const struct string_slot *ds2 = (const struct string_slot *) p2; + return strcmp (ds1->s, ds2->s) == 0; +} + + +/* Read a string from the string table in DATA_IN using input block + IB. Write the length to RLEN. */ + +static const char * +input_string_internal (struct data_in *data_in, struct lto_input_block *ib, + unsigned int *rlen) +{ + struct lto_input_block str_tab; + unsigned int len; + unsigned int loc; + const char *result; + + loc = lto_input_uleb128 (ib); + LTO_INIT_INPUT_BLOCK (str_tab, data_in->strings, loc, data_in->strings_len); + len = lto_input_uleb128 (&str_tab); + *rlen = len; + + if (str_tab.p + len > data_in->strings_len) + internal_error ("bytecode stream: string too long for the string table"); + + result = (const char *)(data_in->strings + str_tab.p); + + return result; +} + + +/* Read a STRING_CST from the string table in DATA_IN using input + block IB. */ + +static tree +input_string_cst (struct data_in *data_in, struct lto_input_block *ib) +{ + unsigned int len; + const char * ptr; + unsigned int is_null; + + is_null = lto_input_uleb128 (ib); + if (is_null) + return NULL; + + ptr = input_string_internal (data_in, ib, &len); + return build_string (len, ptr); +} + + +/* Read an IDENTIFIER from the string table in DATA_IN using input + block IB. */ + +static tree +input_identifier (struct data_in *data_in, struct lto_input_block *ib) +{ + unsigned int len; + const char *ptr; + unsigned int is_null; + + is_null = lto_input_uleb128 (ib); + if (is_null) + return NULL; + + ptr = input_string_internal (data_in, ib, &len); + return get_identifier_with_length (ptr, len); +} + +/* Read a NULL terminated string from the string table in DATA_IN. */ + +static const char * +input_string (struct data_in *data_in, struct lto_input_block *ib) +{ + unsigned int len; + const char *ptr; + unsigned int is_null; + + is_null = lto_input_uleb128 (ib); + if (is_null) + return NULL; + + ptr = input_string_internal (data_in, ib, &len); + if (ptr[len - 1] != '\0') + internal_error ("bytecode stream: found non-null terminated string"); + + return ptr; +} + + +/* Return the next tag in the input block IB. */ + +static enum LTO_tags +input_record_start (struct lto_input_block *ib) +{ + enum LTO_tags tag = (enum LTO_tags) lto_input_uleb128 (ib); + return tag; +} + + +/* Lookup STRING in file_name_hash_table. If found, return the existing + string, otherwise insert STRING as the canonical version. */ + +static const char * +canon_file_name (const char *string) +{ + void **slot; + struct string_slot s_slot; + s_slot.s = string; + + slot = htab_find_slot (file_name_hash_table, &s_slot, INSERT); + if (*slot == NULL) + { + size_t len; + char *saved_string; + struct string_slot *new_slot; + + len = strlen (string); + saved_string = (char *) xmalloc (len + 1); + new_slot = XCNEW (struct string_slot); + strcpy (saved_string, string); + new_slot->s = saved_string; + *slot = new_slot; + return saved_string; + } + else + { + struct string_slot *old_slot = (struct string_slot *) *slot; + return old_slot->s; + } +} + + +/* Clear the line info stored in DATA_IN. */ + +static void +clear_line_info (struct data_in *data_in) +{ + if (data_in->current_file) + linemap_add (line_table, LC_LEAVE, false, NULL, 0); + data_in->current_file = NULL; + data_in->current_line = 0; + data_in->current_col = 0; +} + + +/* Read a location from input block IB. */ + +static location_t +lto_input_location (struct lto_input_block *ib, struct data_in *data_in) +{ + expanded_location xloc; + location_t loc; + + xloc.file = input_string (data_in, ib); + if (xloc.file == NULL) + return UNKNOWN_LOCATION; + + xloc.line = lto_input_sleb128 (ib); + xloc.column = lto_input_sleb128 (ib); + + if (data_in->current_file) + linemap_add (line_table, LC_LEAVE, false, NULL, 0); + + data_in->current_file = canon_file_name (xloc.file); + data_in->current_line = xloc.line; + data_in->current_col = xloc.column; + + linemap_add (line_table, LC_ENTER, false, data_in->current_file, xloc.line); + LINEMAP_POSITION_FOR_COLUMN (loc, line_table, xloc.column); + + return loc; +} + + +/* Read a reference to a tree node from DATA_IN using input block IB. + TAG is the expected node that should be found in IB, if TAG belongs + to one of the indexable trees, expect to read a reference index to + be looked up in one of the symbol tables, otherwise read the pysical + representation of the tree using lto_input_tree. FN is the + function scope for the read tree. */ + +static tree +lto_input_tree_ref (struct lto_input_block *ib, struct data_in *data_in, + struct function *fn, enum LTO_tags tag) +{ + unsigned HOST_WIDE_INT ix_u; + tree result = NULL_TREE; + + lto_tag_check_range (tag, LTO_field_decl_ref, LTO_global_decl_ref); + + switch (tag) + { + case LTO_type_ref: + ix_u = lto_input_uleb128 (ib); + result = lto_file_decl_data_get_type (data_in->file_data, ix_u); + break; + + case LTO_ssa_name_ref: + ix_u = lto_input_uleb128 (ib); + result = VEC_index (tree, SSANAMES (fn), ix_u); + break; + + case LTO_field_decl_ref: + ix_u = lto_input_uleb128 (ib); + result = lto_file_decl_data_get_field_decl (data_in->file_data, ix_u); + break; + + case LTO_function_decl_ref: + ix_u = lto_input_uleb128 (ib); + result = lto_file_decl_data_get_fn_decl (data_in->file_data, ix_u); + break; + + case LTO_type_decl_ref: + ix_u = lto_input_uleb128 (ib); + result = lto_file_decl_data_get_type_decl (data_in->file_data, ix_u); + break; + + case LTO_namespace_decl_ref: + ix_u = lto_input_uleb128 (ib); + result = lto_file_decl_data_get_namespace_decl (data_in->file_data, ix_u); + break; + + case LTO_global_decl_ref: + case LTO_result_decl_ref: + case LTO_const_decl_ref: + case LTO_imported_decl_ref: + case LTO_label_decl_ref: + ix_u = lto_input_uleb128 (ib); + result = lto_file_decl_data_get_var_decl (data_in->file_data, ix_u); + if (tag == LTO_global_decl_ref) + varpool_mark_needed_node (varpool_node (result)); + break; + + default: + gcc_unreachable (); + } + + gcc_assert (result); + + return result; +} + + +/* Read and return a double-linked list of catch handlers from input + block IB, using descriptors in DATA_IN. */ + +static struct eh_catch_d * +lto_input_eh_catch_list (struct lto_input_block *ib, struct data_in *data_in, + eh_catch *last_p) +{ + eh_catch first; + enum LTO_tags tag; + + *last_p = first = NULL; + tag = input_record_start (ib); + while (tag) + { + tree list; + eh_catch n; + + lto_tag_check_range (tag, LTO_eh_catch, LTO_eh_catch); + + /* Read the catch node. */ + n = GGC_CNEW (struct eh_catch_d); + n->type_list = lto_input_tree (ib, data_in); + n->filter_list = lto_input_tree (ib, data_in); + n->label = lto_input_tree (ib, data_in); + + /* Register all the types in N->FILTER_LIST. */ + for (list = n->filter_list; list; list = TREE_CHAIN (list)) + add_type_for_runtime (TREE_VALUE (list)); + + /* Chain N to the end of the list. */ + if (*last_p) + (*last_p)->next_catch = n; + n->prev_catch = *last_p; + *last_p = n; + + /* Set the head of the list the first time through the loop. */ + if (first == NULL) + first = n; + + tag = input_record_start (ib); + } + + return first; +} + + +/* Read and return EH region IX from input block IB, using descriptors + in DATA_IN. */ + +static eh_region +input_eh_region (struct lto_input_block *ib, struct data_in *data_in, int ix) +{ + enum LTO_tags tag; + eh_region r; + + /* Read the region header. */ + tag = input_record_start (ib); + if (tag == LTO_null) + return NULL; + + r = GGC_CNEW (struct eh_region_d); + r->index = lto_input_sleb128 (ib); + + gcc_assert (r->index == ix); + + /* Read all the region pointers as region numbers. We'll fix up + the pointers once the whole array has been read. */ + r->outer = (eh_region) (intptr_t) lto_input_sleb128 (ib); + r->inner = (eh_region) (intptr_t) lto_input_sleb128 (ib); + r->next_peer = (eh_region) (intptr_t) lto_input_sleb128 (ib); + + switch (tag) + { + case LTO_ert_cleanup: + r->type = ERT_CLEANUP; + break; + + case LTO_ert_try: + { + struct eh_catch_d *last_catch; + r->type = ERT_TRY; + r->u.eh_try.first_catch = lto_input_eh_catch_list (ib, data_in, + &last_catch); + r->u.eh_try.last_catch = last_catch; + break; + } + + case LTO_ert_allowed_exceptions: + { + tree l; + + r->type = ERT_ALLOWED_EXCEPTIONS; + r->u.allowed.type_list = lto_input_tree (ib, data_in); + r->u.allowed.label = lto_input_tree (ib, data_in); + r->u.allowed.filter = lto_input_uleb128 (ib); + + for (l = r->u.allowed.type_list; l ; l = TREE_CHAIN (l)) + add_type_for_runtime (TREE_VALUE (l)); + } + break; + + case LTO_ert_must_not_throw: + r->type = ERT_MUST_NOT_THROW; + r->u.must_not_throw.failure_decl = lto_input_tree (ib, data_in); + r->u.must_not_throw.failure_loc = lto_input_location (ib, data_in); + break; + + default: + gcc_unreachable (); + } + + r->landing_pads = (eh_landing_pad) (intptr_t) lto_input_sleb128 (ib); + + return r; +} + + +/* Read and return EH landing pad IX from input block IB, using descriptors + in DATA_IN. */ + +static eh_landing_pad +input_eh_lp (struct lto_input_block *ib, struct data_in *data_in, int ix) +{ + enum LTO_tags tag; + eh_landing_pad lp; + + /* Read the landing pad header. */ + tag = input_record_start (ib); + if (tag == LTO_null) + return NULL; + + lto_tag_check_range (tag, LTO_eh_landing_pad, LTO_eh_landing_pad); + + lp = GGC_CNEW (struct eh_landing_pad_d); + lp->index = lto_input_sleb128 (ib); + gcc_assert (lp->index == ix); + lp->next_lp = (eh_landing_pad) (intptr_t) lto_input_sleb128 (ib); + lp->region = (eh_region) (intptr_t) lto_input_sleb128 (ib); + lp->post_landing_pad = lto_input_tree (ib, data_in); + + return lp; +} + + +/* After reading the EH regions, pointers to peer and children regions + are region numbers. This converts all these region numbers into + real pointers into the rematerialized regions for FN. ROOT_REGION + is the region number for the root EH region in FN. */ + +static void +fixup_eh_region_pointers (struct function *fn, HOST_WIDE_INT root_region) +{ + unsigned i; + VEC(eh_region,gc) *eh_array = fn->eh->region_array; + VEC(eh_landing_pad,gc) *lp_array = fn->eh->lp_array; + eh_region r; + eh_landing_pad lp; + + gcc_assert (eh_array && lp_array); + + gcc_assert (root_region >= 0); + fn->eh->region_tree = VEC_index (eh_region, eh_array, root_region); + +#define FIXUP_EH_REGION(r) (r) = VEC_index (eh_region, eh_array, \ + (HOST_WIDE_INT) (intptr_t) (r)) +#define FIXUP_EH_LP(p) (p) = VEC_index (eh_landing_pad, lp_array, \ + (HOST_WIDE_INT) (intptr_t) (p)) + + /* Convert all the index numbers stored in pointer fields into + pointers to the corresponding slots in the EH region array. */ + for (i = 0; VEC_iterate (eh_region, eh_array, i, r); i++) + { + /* The array may contain NULL regions. */ + if (r == NULL) + continue; + + gcc_assert (i == (unsigned) r->index); + FIXUP_EH_REGION (r->outer); + FIXUP_EH_REGION (r->inner); + FIXUP_EH_REGION (r->next_peer); + FIXUP_EH_LP (r->landing_pads); + } + + /* Convert all the index numbers stored in pointer fields into + pointers to the corresponding slots in the EH landing pad array. */ + for (i = 0; VEC_iterate (eh_landing_pad, lp_array, i, lp); i++) + { + /* The array may contain NULL landing pads. */ + if (lp == NULL) + continue; + + gcc_assert (i == (unsigned) lp->index); + FIXUP_EH_LP (lp->next_lp); + FIXUP_EH_REGION (lp->region); + } + +#undef FIXUP_EH_REGION +#undef FIXUP_EH_LP +} + + +/* Initialize EH support. */ + +static void +lto_init_eh (void) +{ + /* Contrary to most other FEs, we only initialize EH support when at + least one of the files in the set contains exception regions in + it. Since this happens much later than the call to init_eh in + lang_dependent_init, we have to set flag_exceptions and call + init_eh again to initialize the EH tables. */ + flag_exceptions = 1; + init_eh (); + + /* Initialize dwarf2 tables. Since dwarf2out_do_frame() returns + true only when exceptions are enabled, this initialization is + never done during lang_dependent_init. */ +#if defined DWARF2_DEBUGGING_INFO || defined DWARF2_UNWIND_INFO + if (dwarf2out_do_frame ()) + dwarf2out_frame_init (); +#endif +} + + +/* Read the exception table for FN from IB using the data descriptors + in DATA_IN. */ + +static void +input_eh_regions (struct lto_input_block *ib, struct data_in *data_in, + struct function *fn) +{ + HOST_WIDE_INT i, root_region, len; + enum LTO_tags tag; + static bool eh_initialized_p = false; + + tag = input_record_start (ib); + if (tag == LTO_null) + return; + + lto_tag_check_range (tag, LTO_eh_table, LTO_eh_table); + + /* If the file contains EH regions, then it was compiled with + -fexceptions. In that case, initialize the backend EH + machinery. */ + if (!eh_initialized_p) + { + lto_init_eh (); + eh_initialized_p = true; + } + + gcc_assert (fn->eh); + + root_region = lto_input_sleb128 (ib); + gcc_assert (root_region == (int) root_region); + + /* Read the EH region array. */ + len = lto_input_sleb128 (ib); + gcc_assert (len == (int) len); + if (len > 0) + { + VEC_safe_grow (eh_region, gc, fn->eh->region_array, len); + for (i = 0; i < len; i++) + { + eh_region r = input_eh_region (ib, data_in, i); + VEC_replace (eh_region, fn->eh->region_array, i, r); + } + } + + /* Read the landing pads. */ + len = lto_input_sleb128 (ib); + gcc_assert (len == (int) len); + if (len > 0) + { + VEC_safe_grow (eh_landing_pad, gc, fn->eh->lp_array, len); + for (i = 0; i < len; i++) + { + eh_landing_pad lp = input_eh_lp (ib, data_in, i); + VEC_replace (eh_landing_pad, fn->eh->lp_array, i, lp); + } + } + + /* Read the runtime type data. */ + len = lto_input_sleb128 (ib); + gcc_assert (len == (int) len); + if (len > 0) + { + VEC_safe_grow (tree, gc, fn->eh->ttype_data, len); + for (i = 0; i < len; i++) + { + tree ttype = lto_input_tree (ib, data_in); + VEC_replace (tree, fn->eh->ttype_data, i, ttype); + } + } + + /* Read the table of action chains. */ + len = lto_input_sleb128 (ib); + gcc_assert (len == (int) len); + if (len > 0) + { + if (targetm.arm_eabi_unwinder) + { + VEC_safe_grow (tree, gc, fn->eh->ehspec_data.arm_eabi, len); + for (i = 0; i < len; i++) + { + tree t = lto_input_tree (ib, data_in); + VEC_replace (tree, fn->eh->ehspec_data.arm_eabi, i, t); + } + } + else + { + VEC_safe_grow (uchar, gc, fn->eh->ehspec_data.other, len); + for (i = 0; i < len; i++) + { + uchar c = lto_input_1_unsigned (ib); + VEC_replace (uchar, fn->eh->ehspec_data.other, i, c); + } + } + } + + /* Reconstruct the EH region tree by fixing up the peer/children + pointers. */ + fixup_eh_region_pointers (fn, root_region); + + tag = input_record_start (ib); + lto_tag_check_range (tag, LTO_null, LTO_null); +} + + +/* Make a new basic block with index INDEX in function FN. */ + +static basic_block +make_new_block (struct function *fn, unsigned int index) +{ + basic_block bb = alloc_block (); + bb->index = index; + SET_BASIC_BLOCK_FOR_FUNCTION (fn, index, bb); + bb->il.gimple = GGC_CNEW (struct gimple_bb_info); + n_basic_blocks_for_function (fn)++; + bb->flags = 0; + set_bb_seq (bb, gimple_seq_alloc ()); + return bb; +} + + +/* Read the CFG for function FN from input block IB. */ + +static void +input_cfg (struct lto_input_block *ib, struct function *fn) +{ + unsigned int bb_count; + basic_block p_bb; + unsigned int i; + int index; + + init_empty_tree_cfg_for_function (fn); + init_ssa_operands (); + + profile_status_for_function (fn) = + (enum profile_status_d) lto_input_uleb128 (ib); + + bb_count = lto_input_uleb128 (ib); + + last_basic_block_for_function (fn) = bb_count; + if (bb_count > VEC_length (basic_block, basic_block_info_for_function (fn))) + VEC_safe_grow_cleared (basic_block, gc, + basic_block_info_for_function (fn), bb_count); + + if (bb_count > VEC_length (basic_block, label_to_block_map_for_function (fn))) + VEC_safe_grow_cleared (basic_block, gc, + label_to_block_map_for_function (fn), bb_count); + + index = lto_input_sleb128 (ib); + while (index != -1) + { + basic_block bb = BASIC_BLOCK_FOR_FUNCTION (fn, index); + unsigned int edge_count; + + if (bb == NULL) + bb = make_new_block (fn, index); + + edge_count = lto_input_uleb128 (ib); + + /* Connect up the CFG. */ + for (i = 0; i < edge_count; i++) + { + unsigned int dest_index; + unsigned int edge_flags; + basic_block dest; + int probability; + gcov_type count; + edge e; + + dest_index = lto_input_uleb128 (ib); + probability = (int) lto_input_sleb128 (ib); + count = (gcov_type) lto_input_sleb128 (ib); + edge_flags = lto_input_uleb128 (ib); + + dest = BASIC_BLOCK_FOR_FUNCTION (fn, dest_index); + + if (dest == NULL) + dest = make_new_block (fn, dest_index); + + e = make_edge (bb, dest, edge_flags); + e->probability = probability; + e->count = count; + } + + index = lto_input_sleb128 (ib); + } + + p_bb = ENTRY_BLOCK_PTR_FOR_FUNCTION(fn); + index = lto_input_sleb128 (ib); + while (index != -1) + { + basic_block bb = BASIC_BLOCK_FOR_FUNCTION (fn, index); + bb->prev_bb = p_bb; + p_bb->next_bb = bb; + p_bb = bb; + index = lto_input_sleb128 (ib); + } +} + + +/* Read a PHI function for basic block BB in function FN. DATA_IN is + the file being read. IB is the input block to use for reading. */ + +static gimple +input_phi (struct lto_input_block *ib, basic_block bb, struct data_in *data_in, + struct function *fn) +{ + unsigned HOST_WIDE_INT ix; + tree phi_result; + int i, len; + gimple result; + + ix = lto_input_uleb128 (ib); + phi_result = VEC_index (tree, SSANAMES (fn), ix); + len = EDGE_COUNT (bb->preds); + result = create_phi_node (phi_result, bb); + SSA_NAME_DEF_STMT (phi_result) = result; + + /* We have to go through a lookup process here because the preds in the + reconstructed graph are generally in a different order than they + were in the original program. */ + for (i = 0; i < len; i++) + { + tree def = lto_input_tree (ib, data_in); + int src_index = lto_input_uleb128 (ib); + location_t arg_loc = lto_input_location (ib, data_in); + basic_block sbb = BASIC_BLOCK_FOR_FUNCTION (fn, src_index); + + edge e = NULL; + int j; + + for (j = 0; j < len; j++) + if (EDGE_PRED (bb, j)->src == sbb) + { + e = EDGE_PRED (bb, j); + break; + } + + add_phi_arg (result, def, e, arg_loc); + } + + return result; +} + + +/* Read the SSA names array for function FN from DATA_IN using input + block IB. */ + +static void +input_ssa_names (struct lto_input_block *ib, struct data_in *data_in, + struct function *fn) +{ + unsigned int i, size; + + size = lto_input_uleb128 (ib); + init_ssanames (fn, size); + + i = lto_input_uleb128 (ib); + while (i) + { + tree ssa_name, name; + bool is_default_def; + + /* Skip over the elements that had been freed. */ + while (VEC_length (tree, SSANAMES (fn)) < i) + VEC_quick_push (tree, SSANAMES (fn), NULL_TREE); + + is_default_def = (lto_input_1_unsigned (ib) != 0); + name = lto_input_tree (ib, data_in); + ssa_name = make_ssa_name_fn (fn, name, gimple_build_nop ()); + + if (is_default_def) + set_default_def (SSA_NAME_VAR (ssa_name), ssa_name); + + i = lto_input_uleb128 (ib); + } +} + + +/* Read a statement with tag TAG in function FN from block IB using + descriptors in DATA_IN. */ + +static gimple +input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in, + struct function *fn, enum LTO_tags tag) +{ + gimple stmt; + enum gimple_code code; + unsigned HOST_WIDE_INT num_ops; + size_t i; + struct bitpack_d *bp; + + code = lto_tag_to_gimple_code (tag); + + /* Read the tuple header. */ + bp = lto_input_bitpack (ib); + num_ops = bp_unpack_value (bp, sizeof (unsigned) * 8); + stmt = gimple_alloc (code, num_ops); + stmt->gsbase.no_warning = bp_unpack_value (bp, 1); + if (is_gimple_assign (stmt)) + stmt->gsbase.nontemporal_move = bp_unpack_value (bp, 1); + stmt->gsbase.has_volatile_ops = bp_unpack_value (bp, 1); + stmt->gsbase.subcode = bp_unpack_value (bp, 16); + bitpack_delete (bp); + + /* Read location information. */ + gimple_set_location (stmt, lto_input_location (ib, data_in)); + + /* Read lexical block reference. */ + gimple_set_block (stmt, lto_input_tree (ib, data_in)); + + /* Read in all the operands. */ + switch (code) + { + case GIMPLE_RESX: + gimple_resx_set_region (stmt, lto_input_sleb128 (ib)); + break; + + case GIMPLE_EH_MUST_NOT_THROW: + gimple_eh_must_not_throw_set_fndecl (stmt, lto_input_tree (ib, data_in)); + break; + + case GIMPLE_EH_DISPATCH: + gimple_eh_dispatch_set_region (stmt, lto_input_sleb128 (ib)); + break; + + case GIMPLE_ASM: + { + /* FIXME lto. Move most of this into a new gimple_asm_set_string(). */ + tree str; + stmt->gimple_asm.ni = lto_input_uleb128 (ib); + stmt->gimple_asm.no = lto_input_uleb128 (ib); + stmt->gimple_asm.nc = lto_input_uleb128 (ib); + str = input_string_cst (data_in, ib); + stmt->gimple_asm.string = TREE_STRING_POINTER (str); + } + /* Fallthru */ + + case GIMPLE_ASSIGN: + case GIMPLE_CALL: + case GIMPLE_RETURN: + case GIMPLE_SWITCH: + case GIMPLE_LABEL: + case GIMPLE_COND: + case GIMPLE_GOTO: + case GIMPLE_DEBUG: + for (i = 0; i < num_ops; i++) + { + tree op = lto_input_tree (ib, data_in); + gimple_set_op (stmt, i, op); + } + break; + + case GIMPLE_PREDICT: + break; + + default: + internal_error ("bytecode stream: unknown GIMPLE statement tag %s", + lto_tag_name (tag)); + } + + /* Update the properties of symbols, SSA names and labels associated + with STMT. */ + if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL) + { + tree lhs = gimple_get_lhs (stmt); + if (lhs && TREE_CODE (lhs) == SSA_NAME) + SSA_NAME_DEF_STMT (lhs) = stmt; + } + else if (code == GIMPLE_LABEL) + gcc_assert (emit_label_in_global_context_p (gimple_label_label (stmt)) + || DECL_CONTEXT (gimple_label_label (stmt)) == fn->decl); + else if (code == GIMPLE_ASM) + { + unsigned i; + + for (i = 0; i < gimple_asm_noutputs (stmt); i++) + { + tree op = TREE_VALUE (gimple_asm_output_op (stmt, i)); + if (TREE_CODE (op) == SSA_NAME) + SSA_NAME_DEF_STMT (op) = stmt; + } + } + + /* Mark the statement modified so its operand vectors can be filled in. */ + gimple_set_modified (stmt, true); + + return stmt; +} + + +/* Read a basic block with tag TAG from DATA_IN using input block IB. + FN is the function being processed. */ + +static void +input_bb (struct lto_input_block *ib, enum LTO_tags tag, + struct data_in *data_in, struct function *fn) +{ + unsigned int index; + basic_block bb; + gimple_stmt_iterator bsi; + + /* This routine assumes that CFUN is set to FN, as it needs to call + basic GIMPLE routines that use CFUN. */ + gcc_assert (cfun == fn); + + index = lto_input_uleb128 (ib); + bb = BASIC_BLOCK_FOR_FUNCTION (fn, index); + + bb->count = lto_input_sleb128 (ib); + bb->loop_depth = lto_input_sleb128 (ib); + bb->frequency = lto_input_sleb128 (ib); + bb->flags = lto_input_sleb128 (ib); + + /* LTO_bb1 has statements. LTO_bb0 does not. */ + if (tag == LTO_bb0) + return; + + bsi = gsi_start_bb (bb); + tag = input_record_start (ib); + while (tag) + { + gimple stmt = input_gimple_stmt (ib, data_in, fn, tag); + + /* Drop debug stmts on-the-fly if we do not have VTA enabled. + This allows us to build for example static libs with debugging + enabled and do the final link without. */ + if (MAY_HAVE_DEBUG_STMTS + || !is_gimple_debug (stmt)) + { + find_referenced_vars_in (stmt); + gsi_insert_after (&bsi, stmt, GSI_NEW_STMT); + } + + /* After the statement, expect a 0 delimiter or the EH region + that the previous statement belongs to. */ + tag = input_record_start (ib); + lto_tag_check_set (tag, 2, LTO_eh_region, LTO_null); + + if (tag == LTO_eh_region) + { + HOST_WIDE_INT region = lto_input_sleb128 (ib); + gcc_assert (region == (int) region); + if (MAY_HAVE_DEBUG_STMTS || !is_gimple_debug (stmt)) + add_stmt_to_eh_lp (stmt, region); + } + + tag = input_record_start (ib); + } + + tag = input_record_start (ib); + while (tag) + { + gimple phi = input_phi (ib, bb, data_in, fn); + find_referenced_vars_in (phi); + tag = input_record_start (ib); + } +} + +/* Go through all NODE edges and fixup call_stmt pointers + so they point to STMTS. */ + +static void +fixup_call_stmt_edges_1 (struct cgraph_node *node, gimple *stmts) +{ + struct cgraph_edge *cedge; + for (cedge = node->callees; cedge; cedge = cedge->next_callee) + cedge->call_stmt = stmts[cedge->lto_stmt_uid]; +} + +/* Fixup call_stmt pointers in NODE and all clones. */ + +static void +fixup_call_stmt_edges (struct cgraph_node *orig, gimple *stmts) +{ + struct cgraph_node *node; + + while (orig->clone_of) + orig = orig->clone_of; + + fixup_call_stmt_edges_1 (orig, stmts); + if (orig->clones) + for (node = orig->clones; node != orig;) + { + fixup_call_stmt_edges_1 (node, stmts); + if (node->clones) + node = node->clones; + else if (node->next_sibling_clone) + node = node->next_sibling_clone; + else + { + while (node != orig && !node->next_sibling_clone) + node = node->clone_of; + if (node != orig) + node = node->next_sibling_clone; + } + } +} + +/* Read the body of function FN_DECL from DATA_IN using input block IB. */ + +static void +input_function (tree fn_decl, struct data_in *data_in, + struct lto_input_block *ib) +{ + struct function *fn; + enum LTO_tags tag; + gimple *stmts; + basic_block bb; + struct bitpack_d *bp; + + fn = DECL_STRUCT_FUNCTION (fn_decl); + tag = input_record_start (ib); + clear_line_info (data_in); + + gimple_register_cfg_hooks (); + lto_tag_check (tag, LTO_function); + + /* Read all the attributes for FN. */ + bp = lto_input_bitpack (ib); + fn->is_thunk = bp_unpack_value (bp, 1); + fn->has_local_explicit_reg_vars = bp_unpack_value (bp, 1); + fn->after_tree_profile = bp_unpack_value (bp, 1); + fn->returns_pcc_struct = bp_unpack_value (bp, 1); + fn->returns_struct = bp_unpack_value (bp, 1); + fn->always_inline_functions_inlined = bp_unpack_value (bp, 1); + fn->after_inlining = bp_unpack_value (bp, 1); + fn->dont_save_pending_sizes_p = bp_unpack_value (bp, 1); + fn->stdarg = bp_unpack_value (bp, 1); + fn->has_nonlocal_label = bp_unpack_value (bp, 1); + fn->calls_alloca = bp_unpack_value (bp, 1); + fn->calls_setjmp = bp_unpack_value (bp, 1); + fn->function_frequency = (enum function_frequency) bp_unpack_value (bp, 2); + fn->va_list_fpr_size = bp_unpack_value (bp, 8); + fn->va_list_gpr_size = bp_unpack_value (bp, 8); + bitpack_delete (bp); + + /* Read the static chain and non-local goto save area. */ + fn->static_chain_decl = lto_input_tree (ib, data_in); + fn->nonlocal_goto_save_area = lto_input_tree (ib, data_in); + + /* Read all the local symbols. */ + fn->local_decls = lto_input_tree (ib, data_in); + + /* Read all the SSA names. */ + input_ssa_names (ib, data_in, fn); + + /* Read the exception handling regions in the function. */ + input_eh_regions (ib, data_in, fn); + + /* Read the tree of lexical scopes for the function. */ + DECL_INITIAL (fn_decl) = lto_input_tree (ib, data_in); + gcc_assert (DECL_INITIAL (fn_decl)); + DECL_SAVED_TREE (fn_decl) = NULL_TREE; + + /* Read all function arguments. */ + DECL_ARGUMENTS (fn_decl) = lto_input_tree (ib, data_in); + + /* Read all the basic blocks. */ + tag = input_record_start (ib); + while (tag) + { + input_bb (ib, tag, data_in, fn); + tag = input_record_start (ib); + } + + /* Fix up the call statements that are mentioned in the callgraph + edges. */ + renumber_gimple_stmt_uids (); + stmts = (gimple *) xcalloc (gimple_stmt_max_uid (fn), sizeof (gimple)); + FOR_ALL_BB (bb) + { + gimple_stmt_iterator bsi; + for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi)) + { + gimple stmt = gsi_stmt (bsi); + stmts[gimple_uid (stmt)] = stmt; + } + } + + /* Set the gimple body to the statement sequence in the entry + basic block. FIXME lto, this is fairly hacky. The existence + of a gimple body is used by the cgraph routines, but we should + really use the presence of the CFG. */ + { + edge_iterator ei = ei_start (ENTRY_BLOCK_PTR->succs); + gimple_set_body (fn_decl, bb_seq (ei_edge (ei)->dest)); + } + + fixup_call_stmt_edges (cgraph_node (fn_decl), stmts); + + update_ssa (TODO_update_ssa_only_virtuals); + free (stmts); +} + + +/* Read initializer expressions for public statics. DATA_IN is the + file being read. IB is the input block used for reading. */ + +static void +input_alias_pairs (struct lto_input_block *ib, struct data_in *data_in) +{ + tree var; + + clear_line_info (data_in); + + /* Skip over all the unreferenced globals. */ + do + var = lto_input_tree (ib, data_in); + while (var); + + var = lto_input_tree (ib, data_in); + while (var) + { + const char *orig_name, *new_name; + alias_pair *p; + + p = VEC_safe_push (alias_pair, gc, alias_pairs, NULL); + p->decl = var; + p->target = lto_input_tree (ib, data_in); + + /* If the target is a static object, we may have registered a + new name for it to avoid clashes between statics coming from + different files. In that case, use the new name. */ + orig_name = IDENTIFIER_POINTER (p->target); + new_name = lto_get_decl_name_mapping (data_in->file_data, orig_name); + if (strcmp (orig_name, new_name) != 0) + p->target = get_identifier (new_name); + + var = lto_input_tree (ib, data_in); + } +} + + +/* Read the body from DATA for function FN_DECL and fill it in. + FILE_DATA are the global decls and types. SECTION_TYPE is either + LTO_section_function_body or LTO_section_static_initializer. If + section type is LTO_section_function_body, FN must be the decl for + that function. */ + +static void +lto_read_body (struct lto_file_decl_data *file_data, tree fn_decl, + const char *data, enum lto_section_type section_type) +{ + const struct lto_function_header *header; + struct data_in *data_in; + int32_t cfg_offset; + int32_t main_offset; + int32_t string_offset; + struct lto_input_block ib_cfg; + struct lto_input_block ib_main; + + header = (const struct lto_function_header *) data; + cfg_offset = sizeof (struct lto_function_header); + main_offset = cfg_offset + header->cfg_size; + string_offset = main_offset + header->main_size; + + LTO_INIT_INPUT_BLOCK (ib_cfg, + data + cfg_offset, + 0, + header->cfg_size); + + LTO_INIT_INPUT_BLOCK (ib_main, + data + main_offset, + 0, + header->main_size); + + data_in = lto_data_in_create (file_data, data + string_offset, + header->string_size, NULL); + + /* Make sure the file was generated by the exact same compiler. */ + lto_check_version (header->lto_header.major_version, + header->lto_header.minor_version); + + if (section_type == LTO_section_function_body) + { + struct function *fn = DECL_STRUCT_FUNCTION (fn_decl); + struct lto_in_decl_state *decl_state; + + push_cfun (fn); + init_tree_ssa (fn); + + /* Use the function's decl state. */ + decl_state = lto_get_function_in_decl_state (file_data, fn_decl); + gcc_assert (decl_state); + file_data->current_decl_state = decl_state; + + input_cfg (&ib_cfg, fn); + + /* Set up the struct function. */ + input_function (fn_decl, data_in, &ib_main); + + /* We should now be in SSA. */ + cfun->gimple_df->in_ssa_p = true; + + /* Fill in properties we know hold for the rebuilt CFG. */ + cfun->curr_properties = PROP_ssa + | PROP_cfg + | PROP_gimple_any + | PROP_gimple_lcf + | PROP_gimple_leh + | PROP_referenced_vars; + + /* Restore decl state */ + file_data->current_decl_state = file_data->global_decl_state; + + pop_cfun (); + } + else + { + input_alias_pairs (&ib_main, data_in); + } + + clear_line_info (data_in); + lto_data_in_delete (data_in); +} + + +/* Read the body of FN_DECL using DATA. FILE_DATA holds the global + decls and types. */ + +void +lto_input_function_body (struct lto_file_decl_data *file_data, + tree fn_decl, const char *data) +{ + current_function_decl = fn_decl; + lto_read_body (file_data, fn_decl, data, LTO_section_function_body); +} + + +/* Read in VAR_DECL using DATA. FILE_DATA holds the global decls and + types. */ + +void +lto_input_constructors_and_inits (struct lto_file_decl_data *file_data, + const char *data) +{ + lto_read_body (file_data, NULL, data, LTO_section_static_initializer); +} + + +/* Return the resolution for the decl with index INDEX from DATA_IN. */ + +static enum ld_plugin_symbol_resolution +get_resolution (struct data_in *data_in, unsigned index) +{ + if (data_in->globals_resolution) + { + ld_plugin_symbol_resolution_t ret; + gcc_assert (index < VEC_length (ld_plugin_symbol_resolution_t, + data_in->globals_resolution)); + ret = VEC_index (ld_plugin_symbol_resolution_t, + data_in->globals_resolution, + index); + gcc_assert (ret != LDPR_UNKNOWN); + return ret; + } + else + { + /* Fake symbol resolution if no resolution file was provided. */ + tree t = lto_streamer_cache_get (data_in->reader_cache, index); + + gcc_assert (TREE_PUBLIC (t)); + + /* There should be no DECL_ABSTRACT in the middle end. */ + gcc_assert (!DECL_ABSTRACT (t)); + + /* If T is a weak definition, we select the first one we see to + be the prevailing definition. */ + if (DECL_WEAK (t)) + { + tree prevailing_decl; + if (DECL_EXTERNAL (t)) + return LDPR_RESOLVED_IR; + + /* If this is the first time we see T, it won't have a + prevailing definition yet. */ + prevailing_decl = lto_symtab_prevailing_decl (t); + if (prevailing_decl == t + || prevailing_decl == NULL_TREE + || DECL_EXTERNAL (prevailing_decl)) + return LDPR_PREVAILING_DEF; + else + return LDPR_PREEMPTED_IR; + } + else + { + /* For non-weak definitions, extern declarations are assumed + to be resolved elsewhere (LDPR_RESOLVED_IR), otherwise T + is a prevailing definition. */ + if (DECL_EXTERNAL (t)) + return LDPR_RESOLVED_IR; + else + return LDPR_PREVAILING_DEF; + } + } +} + + +/* Unpack all the non-pointer fields of the TS_BASE structure of + expression EXPR from bitpack BP. */ + +static void +unpack_ts_base_value_fields (struct bitpack_d *bp, tree expr) +{ + /* Note that the code for EXPR has already been unpacked to create EXPR in + lto_materialize_tree. */ + if (!TYPE_P (expr)) + { + TREE_SIDE_EFFECTS (expr) = (unsigned) bp_unpack_value (bp, 1); + TREE_CONSTANT (expr) = (unsigned) bp_unpack_value (bp, 1); + TREE_READONLY (expr) = (unsigned) bp_unpack_value (bp, 1); + + /* TREE_PUBLIC is used on types to indicate that the type + has a TYPE_CACHED_VALUES vector. This is not streamed out, + so we skip it here. */ + TREE_PUBLIC (expr) = (unsigned) bp_unpack_value (bp, 1); + } + TREE_ADDRESSABLE (expr) = (unsigned) bp_unpack_value (bp, 1); + TREE_THIS_VOLATILE (expr) = (unsigned) bp_unpack_value (bp, 1); + if (DECL_P (expr)) + DECL_UNSIGNED (expr) = (unsigned) bp_unpack_value (bp, 1); + else if (TYPE_P (expr)) + TYPE_UNSIGNED (expr) = (unsigned) bp_unpack_value (bp, 1); + TREE_ASM_WRITTEN (expr) = (unsigned) bp_unpack_value (bp, 1); + TREE_NO_WARNING (expr) = (unsigned) bp_unpack_value (bp, 1); + TREE_USED (expr) = (unsigned) bp_unpack_value (bp, 1); + TREE_NOTHROW (expr) = (unsigned) bp_unpack_value (bp, 1); + TREE_STATIC (expr) = (unsigned) bp_unpack_value (bp, 1); + TREE_PRIVATE (expr) = (unsigned) bp_unpack_value (bp, 1); + TREE_PROTECTED (expr) = (unsigned) bp_unpack_value (bp, 1); + TREE_DEPRECATED (expr) = (unsigned) bp_unpack_value (bp, 1); + if (TYPE_P (expr)) + TYPE_SATURATING (expr) = (unsigned) bp_unpack_value (bp, 1); + if (TREE_CODE (expr) == SSA_NAME) + SSA_NAME_IS_DEFAULT_DEF (expr) = (unsigned) bp_unpack_value (bp, 1); +} + + +/* Unpack all the non-pointer fields of the TS_REAL_CST structure of + expression EXPR from bitpack BP. */ + +static void +unpack_ts_real_cst_value_fields (struct bitpack_d *bp, tree expr) +{ + unsigned i; + REAL_VALUE_TYPE r; + REAL_VALUE_TYPE *rp; + + r.cl = (unsigned) bp_unpack_value (bp, 2); + r.decimal = (unsigned) bp_unpack_value (bp, 1); + r.sign = (unsigned) bp_unpack_value (bp, 1); + r.signalling = (unsigned) bp_unpack_value (bp, 1); + r.canonical = (unsigned) bp_unpack_value (bp, 1); + r.uexp = (unsigned) bp_unpack_value (bp, EXP_BITS); + for (i = 0; i < SIGSZ; i++) + r.sig[i] = (unsigned long) bp_unpack_value (bp, HOST_BITS_PER_LONG); + + rp = GGC_NEW (REAL_VALUE_TYPE); + memcpy (rp, &r, sizeof (REAL_VALUE_TYPE)); + TREE_REAL_CST_PTR (expr) = rp; +} + + +/* Unpack all the non-pointer fields of the TS_FIXED_CST structure of + expression EXPR from bitpack BP. */ + +static void +unpack_ts_fixed_cst_value_fields (struct bitpack_d *bp, tree expr) +{ + struct fixed_value fv; + + fv.data.low = (HOST_WIDE_INT) bp_unpack_value (bp, HOST_BITS_PER_WIDE_INT); + fv.data.high = (HOST_WIDE_INT) bp_unpack_value (bp, HOST_BITS_PER_WIDE_INT); + TREE_FIXED_CST (expr) = fv; +} + + +/* Unpack all the non-pointer fields of the TS_DECL_COMMON structure + of expression EXPR from bitpack BP. */ + +static void +unpack_ts_decl_common_value_fields (struct bitpack_d *bp, tree expr) +{ + DECL_MODE (expr) = (enum machine_mode) bp_unpack_value (bp, 8); + DECL_NONLOCAL (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_VIRTUAL_P (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_IGNORED_P (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_ABSTRACT (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_ARTIFICIAL (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_USER_ALIGN (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_PRESERVE_P (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_DEBUG_EXPR_IS_FROM (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_EXTERNAL (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_GIMPLE_REG_P (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_ALIGN (expr) = (unsigned) bp_unpack_value (bp, HOST_BITS_PER_INT); + + if (TREE_CODE (expr) == LABEL_DECL) + { + DECL_ERROR_ISSUED (expr) = (unsigned) bp_unpack_value (bp, 1); + EH_LANDING_PAD_NR (expr) = (int) bp_unpack_value (bp, HOST_BITS_PER_INT); + + /* Always assume an initial value of -1 for LABEL_DECL_UID to + force gimple_set_bb to recreate label_to_block_map. */ + LABEL_DECL_UID (expr) = -1; + } + + if (TREE_CODE (expr) == FIELD_DECL) + { + unsigned HOST_WIDE_INT off_align; + DECL_PACKED (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_NONADDRESSABLE_P (expr) = (unsigned) bp_unpack_value (bp, 1); + off_align = (unsigned HOST_WIDE_INT) bp_unpack_value (bp, 8); + SET_DECL_OFFSET_ALIGN (expr, off_align); + } + + if (TREE_CODE (expr) == RESULT_DECL + || TREE_CODE (expr) == PARM_DECL + || TREE_CODE (expr) == VAR_DECL) + { + DECL_BY_REFERENCE (expr) = (unsigned) bp_unpack_value (bp, 1); + if (TREE_CODE (expr) == VAR_DECL + || TREE_CODE (expr) == PARM_DECL) + DECL_HAS_VALUE_EXPR_P (expr) = (unsigned) bp_unpack_value (bp, 1); + } +} + + +/* Unpack all the non-pointer fields of the TS_DECL_WRTL structure + of expression EXPR from bitpack BP. */ + +static void +unpack_ts_decl_wrtl_value_fields (struct bitpack_d *bp, tree expr) +{ + DECL_REGISTER (expr) = (unsigned) bp_unpack_value (bp, 1); +} + + +/* Unpack all the non-pointer fields of the TS_DECL_WITH_VIS structure + of expression EXPR from bitpack BP. */ + +static void +unpack_ts_decl_with_vis_value_fields (struct bitpack_d *bp, tree expr) +{ + DECL_DEFER_OUTPUT (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_COMMON (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_DLLIMPORT_P (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_WEAK (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_SEEN_IN_BIND_EXPR_P (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_COMDAT (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_VISIBILITY (expr) = (enum symbol_visibility) bp_unpack_value (bp, 2); + DECL_VISIBILITY_SPECIFIED (expr) = (unsigned) bp_unpack_value (bp, 1); + + if (TREE_CODE (expr) == VAR_DECL) + { + DECL_HARD_REGISTER (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_IN_TEXT_SECTION (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_TLS_MODEL (expr) = (enum tls_model) bp_unpack_value (bp, 3); + } + + if (VAR_OR_FUNCTION_DECL_P (expr)) + { + priority_type p; + p = (priority_type) bp_unpack_value (bp, HOST_BITS_PER_SHORT); + SET_DECL_INIT_PRIORITY (expr, p); + } +} + + +/* Unpack all the non-pointer fields of the TS_FUNCTION_DECL structure + of expression EXPR from bitpack BP. */ + +static void +unpack_ts_function_decl_value_fields (struct bitpack_d *bp, tree expr) +{ + DECL_FUNCTION_CODE (expr) = (enum built_in_function) bp_unpack_value (bp, 11); + DECL_BUILT_IN_CLASS (expr) = (enum built_in_class) bp_unpack_value (bp, 2); + DECL_STATIC_CONSTRUCTOR (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_STATIC_DESTRUCTOR (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_UNINLINABLE (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_POSSIBLY_INLINED (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_IS_NOVOPS (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_IS_RETURNS_TWICE (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_IS_MALLOC (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_IS_OPERATOR_NEW (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_DECLARED_INLINE_P (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_STATIC_CHAIN (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_NO_INLINE_WARNING_P (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (expr) + = (unsigned) bp_unpack_value (bp, 1); + DECL_NO_LIMIT_STACK (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_DISREGARD_INLINE_LIMITS (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_PURE_P (expr) = (unsigned) bp_unpack_value (bp, 1); + DECL_LOOPING_CONST_OR_PURE_P (expr) = (unsigned) bp_unpack_value (bp, 1); +} + + +/* Unpack all the non-pointer fields of the TS_TYPE structure + of expression EXPR from bitpack BP. */ + +static void +unpack_ts_type_value_fields (struct bitpack_d *bp, tree expr) +{ + enum machine_mode mode; + + TYPE_PRECISION (expr) = (unsigned) bp_unpack_value (bp, 9); + mode = (enum machine_mode) bp_unpack_value (bp, 7); + SET_TYPE_MODE (expr, mode); + TYPE_STRING_FLAG (expr) = (unsigned) bp_unpack_value (bp, 1); + TYPE_NO_FORCE_BLK (expr) = (unsigned) bp_unpack_value (bp, 1); + TYPE_NEEDS_CONSTRUCTING(expr) = (unsigned) bp_unpack_value (bp, 1); + if (TREE_CODE (expr) == UNION_TYPE) + TYPE_TRANSPARENT_UNION (expr) = (unsigned) bp_unpack_value (bp, 1); + TYPE_PACKED (expr) = (unsigned) bp_unpack_value (bp, 1); + TYPE_RESTRICT (expr) = (unsigned) bp_unpack_value (bp, 1); + TYPE_CONTAINS_PLACEHOLDER_INTERNAL (expr) + = (unsigned) bp_unpack_value (bp, 2); + TYPE_USER_ALIGN (expr) = (unsigned) bp_unpack_value (bp, 1); + TYPE_READONLY (expr) = (unsigned) bp_unpack_value (bp, 1); + TYPE_ALIGN (expr) = (unsigned) bp_unpack_value (bp, HOST_BITS_PER_INT); + TYPE_ALIAS_SET (expr) = bp_unpack_value (bp, HOST_BITS_PER_INT); +} + + +/* Unpack all the non-pointer fields of the TS_BLOCK structure + of expression EXPR from bitpack BP. */ + +static void +unpack_ts_block_value_fields (struct bitpack_d *bp, tree expr) +{ + BLOCK_ABSTRACT (expr) = (unsigned) bp_unpack_value (bp, 1); + BLOCK_NUMBER (expr) = (unsigned) bp_unpack_value (bp, 31); +} + + +/* Unpack all the non-pointer fields in EXPR into a bit pack. */ + +static void +unpack_value_fields (struct bitpack_d *bp, tree expr) +{ + enum tree_code code; + + code = TREE_CODE (expr); + + /* Note that all these functions are highly sensitive to changes in + the types and sizes of each of the fields being packed. */ + unpack_ts_base_value_fields (bp, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_REAL_CST)) + unpack_ts_real_cst_value_fields (bp, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_FIXED_CST)) + unpack_ts_fixed_cst_value_fields (bp, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON)) + unpack_ts_decl_common_value_fields (bp, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_DECL_WRTL)) + unpack_ts_decl_wrtl_value_fields (bp, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS)) + unpack_ts_decl_with_vis_value_fields (bp, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_FUNCTION_DECL)) + unpack_ts_function_decl_value_fields (bp, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_TYPE)) + unpack_ts_type_value_fields (bp, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_BLOCK)) + unpack_ts_block_value_fields (bp, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_SSA_NAME)) + { + /* We only stream the version number of SSA names. */ + gcc_unreachable (); + } + + if (CODE_CONTAINS_STRUCT (code, TS_STATEMENT_LIST)) + { + /* This is only used by GENERIC. */ + gcc_unreachable (); + } + + if (CODE_CONTAINS_STRUCT (code, TS_OMP_CLAUSE)) + { + /* This is only used by High GIMPLE. */ + gcc_unreachable (); + } +} + + +/* Read a bitpack from input block IB. */ + +struct bitpack_d * +lto_input_bitpack (struct lto_input_block *ib) +{ + unsigned i, num_words; + struct bitpack_d *bp; + + bp = bitpack_create (); + + /* If we are about to read more than a handful of words, something + is wrong. This check is overly strict, but it acts as an early + warning. No streamed object has hundreds of bits in its fields. */ + num_words = lto_input_uleb128 (ib); + gcc_assert (num_words < 20); + + for (i = 0; i < num_words; i++) + { + bitpack_word_t w = lto_input_uleb128 (ib); + VEC_safe_push (bitpack_word_t, heap, bp->values, w); + } + + return bp; +} + + +/* Materialize a new tree from input block IB using descriptors in + DATA_IN. The code for the new tree should match TAG. Store in + *IX_P the index into the reader cache where the new tree is stored. */ + +static tree +lto_materialize_tree (struct lto_input_block *ib, struct data_in *data_in, + enum LTO_tags tag, int *ix_p) +{ + struct bitpack_d *bp; + enum tree_code code; + tree result; +#ifdef LTO_STREAMER_DEBUG + HOST_WIDEST_INT orig_address_in_writer; +#endif + HOST_WIDE_INT ix; + + result = NULL_TREE; + + /* Read the header of the node we are about to create. */ + ix = lto_input_sleb128 (ib); + gcc_assert ((int) ix == ix); + *ix_p = (int) ix; + +#ifdef LTO_STREAMER_DEBUG + /* Read the word representing the memory address for the tree + as it was written by the writer. This is useful when + debugging differences between the writer and reader. */ + orig_address_in_writer = lto_input_sleb128 (ib); + gcc_assert ((intptr_t) orig_address_in_writer == orig_address_in_writer); +#endif + + code = lto_tag_to_tree_code (tag); + + /* We should never see an SSA_NAME tree. Only the version numbers of + SSA names are ever written out. See input_ssa_names. */ + gcc_assert (code != SSA_NAME); + + /* Instantiate a new tree using the header data. */ + if (CODE_CONTAINS_STRUCT (code, TS_STRING)) + result = input_string_cst (data_in, ib); + else if (CODE_CONTAINS_STRUCT (code, TS_IDENTIFIER)) + result = input_identifier (data_in, ib); + else if (CODE_CONTAINS_STRUCT (code, TS_VEC)) + { + HOST_WIDE_INT len = lto_input_sleb128 (ib); + result = make_tree_vec (len); + } + else if (CODE_CONTAINS_STRUCT (code, TS_BINFO)) + { + unsigned HOST_WIDE_INT len = lto_input_uleb128 (ib); + result = make_tree_binfo (len); + } + else + { + /* All other nodes can be materialized with a raw make_node + call. */ + result = make_node (code); + } + +#ifdef LTO_STREAMER_DEBUG + /* Store the original address of the tree as seen by the writer + in RESULT's aux field. This is useful when debugging streaming + problems. This way, a debugging session can be started on + both writer and reader with a breakpoint using this address + value in both. */ + lto_orig_address_map (result, (intptr_t) orig_address_in_writer); +#endif + + /* Read the bitpack of non-pointer values from IB. */ + bp = lto_input_bitpack (ib); + + /* The first word in BP contains the code of the tree that we + are about to read. */ + code = (enum tree_code) bp_unpack_value (bp, 16); + lto_tag_check (lto_tree_code_to_tag (code), tag); + + /* Unpack all the value fields from BP. */ + unpack_value_fields (bp, result); + bitpack_delete (bp); + + /* Enter RESULT in the reader cache. This will make RESULT + available so that circular references in the rest of the tree + structure can be resolved in subsequent calls to lto_input_tree. */ + lto_streamer_cache_insert_at (data_in->reader_cache, result, ix); + + return result; +} + + +/* Read a chain of tree nodes from input block IB. DATA_IN contains + tables and descriptors for the file being read. */ + +static tree +lto_input_chain (struct lto_input_block *ib, struct data_in *data_in) +{ + int i, count; + tree first, prev, curr; + + first = prev = NULL_TREE; + count = lto_input_sleb128 (ib); + for (i = 0; i < count; i++) + { + curr = lto_input_tree (ib, data_in); + if (prev) + TREE_CHAIN (prev) = curr; + else + first = curr; + + TREE_CHAIN (curr) = NULL_TREE; + prev = curr; + } + + return first; +} + + +/* Read all pointer fields in the TS_COMMON structure of EXPR from input + block IB. DATA_IN contains tables and descriptors for the + file being read. */ + + +static void +lto_input_ts_common_tree_pointers (struct lto_input_block *ib, + struct data_in *data_in, tree expr) +{ + TREE_TYPE (expr) = lto_input_tree (ib, data_in); +} + + +/* Read all pointer fields in the TS_VECTOR structure of EXPR from input + block IB. DATA_IN contains tables and descriptors for the + file being read. */ + +static void +lto_input_ts_vector_tree_pointers (struct lto_input_block *ib, + struct data_in *data_in, tree expr) +{ + TREE_VECTOR_CST_ELTS (expr) = lto_input_chain (ib, data_in); +} + + +/* Read all pointer fields in the TS_COMPLEX structure of EXPR from input + block IB. DATA_IN contains tables and descriptors for the + file being read. */ + +static void +lto_input_ts_complex_tree_pointers (struct lto_input_block *ib, + struct data_in *data_in, tree expr) +{ + TREE_REALPART (expr) = lto_input_tree (ib, data_in); + TREE_IMAGPART (expr) = lto_input_tree (ib, data_in); +} + + +/* Read all pointer fields in the TS_DECL_MINIMAL structure of EXPR + from input block IB. DATA_IN contains tables and descriptors for the + file being read. */ + +static void +lto_input_ts_decl_minimal_tree_pointers (struct lto_input_block *ib, + struct data_in *data_in, tree expr) +{ + DECL_NAME (expr) = lto_input_tree (ib, data_in); + DECL_CONTEXT (expr) = lto_input_tree (ib, data_in); + DECL_SOURCE_LOCATION (expr) = lto_input_location (ib, data_in); +} + + +/* Read all pointer fields in the TS_DECL_COMMON structure of EXPR from + input block IB. DATA_IN contains tables and descriptors for the + file being read. */ + +static void +lto_input_ts_decl_common_tree_pointers (struct lto_input_block *ib, + struct data_in *data_in, tree expr) +{ + DECL_SIZE (expr) = lto_input_tree (ib, data_in); + DECL_SIZE_UNIT (expr) = lto_input_tree (ib, data_in); + + if (TREE_CODE (expr) != FUNCTION_DECL) + DECL_INITIAL (expr) = lto_input_tree (ib, data_in); + + DECL_ATTRIBUTES (expr) = lto_input_tree (ib, data_in); + DECL_ABSTRACT_ORIGIN (expr) = lto_input_tree (ib, data_in); + + if (TREE_CODE (expr) == PARM_DECL) + TREE_CHAIN (expr) = lto_input_chain (ib, data_in); +} + + +/* Read all pointer fields in the TS_DECL_NON_COMMON structure of + EXPR from input block IB. DATA_IN contains tables and descriptors for the + file being read. */ + +static void +lto_input_ts_decl_non_common_tree_pointers (struct lto_input_block *ib, + struct data_in *data_in, tree expr) +{ + if (TREE_CODE (expr) == FUNCTION_DECL) + { + DECL_ARGUMENTS (expr) = lto_input_tree (ib, data_in); + DECL_RESULT (expr) = lto_input_tree (ib, data_in); + } + DECL_VINDEX (expr) = lto_input_tree (ib, data_in); +} + + +/* Read all pointer fields in the TS_DECL_WITH_VIS structure of EXPR + from input block IB. DATA_IN contains tables and descriptors for the + file being read. */ + +static void +lto_input_ts_decl_with_vis_tree_pointers (struct lto_input_block *ib, + struct data_in *data_in, tree expr) +{ + tree id; + + id = lto_input_tree (ib, data_in); + if (id) + { + gcc_assert (TREE_CODE (id) == IDENTIFIER_NODE); + SET_DECL_ASSEMBLER_NAME (expr, id); + } + + DECL_SECTION_NAME (expr) = lto_input_tree (ib, data_in); + DECL_COMDAT_GROUP (expr) = lto_input_tree (ib, data_in); +} + + +/* Read all pointer fields in the TS_FIELD_DECL structure of EXPR from + input block IB. DATA_IN contains tables and descriptors for the + file being read. */ + +static void +lto_input_ts_field_decl_tree_pointers (struct lto_input_block *ib, + struct data_in *data_in, tree expr) +{ + DECL_FIELD_OFFSET (expr) = lto_input_tree (ib, data_in); + DECL_BIT_FIELD_TYPE (expr) = lto_input_tree (ib, data_in); + DECL_QUALIFIER (expr) = lto_input_tree (ib, data_in); + DECL_FIELD_BIT_OFFSET (expr) = lto_input_tree (ib, data_in); + DECL_FCONTEXT (expr) = lto_input_tree (ib, data_in); + TREE_CHAIN (expr) = lto_input_chain (ib, data_in); +} + + +/* Read all pointer fields in the TS_FUNCTION_DECL structure of EXPR + from input block IB. DATA_IN contains tables and descriptors for the + file being read. */ + +static void +lto_input_ts_function_decl_tree_pointers (struct lto_input_block *ib, + struct data_in *data_in, tree expr) +{ + /* DECL_STRUCT_FUNCTION is handled by lto_input_function. FIXME lto, + maybe it should be handled here? */ + DECL_FUNCTION_PERSONALITY (expr) = lto_input_tree (ib, data_in); + DECL_FUNCTION_SPECIFIC_TARGET (expr) = lto_input_tree (ib, data_in); + DECL_FUNCTION_SPECIFIC_OPTIMIZATION (expr) = lto_input_tree (ib, data_in); +} + + +/* Read all pointer fields in the TS_TYPE structure of EXPR from input + block IB. DATA_IN contains tables and descriptors for the + file being read. */ + +static void +lto_input_ts_type_tree_pointers (struct lto_input_block *ib, + struct data_in *data_in, tree expr) +{ + if (TREE_CODE (expr) == ENUMERAL_TYPE) + TYPE_VALUES (expr) = lto_input_tree (ib, data_in); + else if (TREE_CODE (expr) == ARRAY_TYPE) + TYPE_DOMAIN (expr) = lto_input_tree (ib, data_in); + else if (TREE_CODE (expr) == RECORD_TYPE || TREE_CODE (expr) == UNION_TYPE) + TYPE_FIELDS (expr) = lto_input_tree (ib, data_in); + else if (TREE_CODE (expr) == FUNCTION_TYPE || TREE_CODE (expr) == METHOD_TYPE) + TYPE_ARG_TYPES (expr) = lto_input_tree (ib, data_in); + else if (TREE_CODE (expr) == VECTOR_TYPE) + TYPE_DEBUG_REPRESENTATION_TYPE (expr) = lto_input_tree (ib, data_in); + + TYPE_SIZE (expr) = lto_input_tree (ib, data_in); + TYPE_SIZE_UNIT (expr) = lto_input_tree (ib, data_in); + TYPE_ATTRIBUTES (expr) = lto_input_tree (ib, data_in); + TYPE_NAME (expr) = lto_input_tree (ib, data_in); + /* Do not stream TYPE_POINTER_TO or TYPE_REFERENCE_TO nor + TYPE_NEXT_PTR_TO or TYPE_NEXT_REF_TO. */ + if (!POINTER_TYPE_P (expr)) + TYPE_MINVAL (expr) = lto_input_tree (ib, data_in); + TYPE_MAXVAL (expr) = lto_input_tree (ib, data_in); + TYPE_MAIN_VARIANT (expr) = lto_input_tree (ib, data_in); + /* Do not stream TYPE_NEXT_VARIANT, we reconstruct the variant lists + during fixup. */ + if (RECORD_OR_UNION_TYPE_P (expr)) + TYPE_BINFO (expr) = lto_input_tree (ib, data_in); + TYPE_CONTEXT (expr) = lto_input_tree (ib, data_in); + TYPE_CANONICAL (expr) = lto_input_tree (ib, data_in); +} + + +/* Read all pointer fields in the TS_LIST structure of EXPR from input + block IB. DATA_IN contains tables and descriptors for the + file being read. */ + +static void +lto_input_ts_list_tree_pointers (struct lto_input_block *ib, + struct data_in *data_in, tree expr) +{ + TREE_PURPOSE (expr) = lto_input_tree (ib, data_in); + TREE_VALUE (expr) = lto_input_tree (ib, data_in); + TREE_CHAIN (expr) = lto_input_chain (ib, data_in); +} + + +/* Read all pointer fields in the TS_VEC structure of EXPR from input + block IB. DATA_IN contains tables and descriptors for the + file being read. */ + +static void +lto_input_ts_vec_tree_pointers (struct lto_input_block *ib, + struct data_in *data_in, tree expr) +{ + int i; + + /* Note that TREE_VEC_LENGTH was read by lto_materialize_tree to + instantiate EXPR. */ + for (i = 0; i < TREE_VEC_LENGTH (expr); i++) + TREE_VEC_ELT (expr, i) = lto_input_tree (ib, data_in); +} + + +/* Read all pointer fields in the TS_EXP structure of EXPR from input + block IB. DATA_IN contains tables and descriptors for the + file being read. */ + + +static void +lto_input_ts_exp_tree_pointers (struct lto_input_block *ib, + struct data_in *data_in, tree expr) +{ + int i, length; + location_t loc; + + length = lto_input_sleb128 (ib); + gcc_assert (length == TREE_OPERAND_LENGTH (expr)); + + for (i = 0; i < length; i++) + TREE_OPERAND (expr, i) = lto_input_tree (ib, data_in); + + loc = lto_input_location (ib, data_in); + SET_EXPR_LOCATION (expr, loc); + TREE_BLOCK (expr) = lto_input_tree (ib, data_in); +} + + +/* Read all pointer fields in the TS_BLOCK structure of EXPR from input + block IB. DATA_IN contains tables and descriptors for the + file being read. */ + +static void +lto_input_ts_block_tree_pointers (struct lto_input_block *ib, + struct data_in *data_in, tree expr) +{ + unsigned i, len; + + BLOCK_SOURCE_LOCATION (expr) = lto_input_location (ib, data_in); + BLOCK_VARS (expr) = lto_input_chain (ib, data_in); + + len = lto_input_uleb128 (ib); + for (i = 0; i < len; i++) + { + tree t = lto_input_tree (ib, data_in); + VEC_safe_push (tree, gc, BLOCK_NONLOCALIZED_VARS (expr), t); + } + + BLOCK_SUPERCONTEXT (expr) = lto_input_tree (ib, data_in); + BLOCK_ABSTRACT_ORIGIN (expr) = lto_input_tree (ib, data_in); + BLOCK_FRAGMENT_ORIGIN (expr) = lto_input_tree (ib, data_in); + BLOCK_FRAGMENT_CHAIN (expr) = lto_input_tree (ib, data_in); + BLOCK_SUBBLOCKS (expr) = lto_input_chain (ib, data_in); +} + + +/* Read all pointer fields in the TS_BINFO structure of EXPR from input + block IB. DATA_IN contains tables and descriptors for the + file being read. */ + +static void +lto_input_ts_binfo_tree_pointers (struct lto_input_block *ib, + struct data_in *data_in, tree expr) +{ + unsigned i, len; + tree t; + + /* Note that the number of slots in EXPR was read in + lto_materialize_tree when instantiating EXPR. However, the + vector is empty so we cannot rely on VEC_length to know how many + elements to read. So, this list is emitted as a 0-terminated + list on the writer side. */ + do + { + t = lto_input_tree (ib, data_in); + if (t) + VEC_quick_push (tree, BINFO_BASE_BINFOS (expr), t); + } + while (t); + + BINFO_OFFSET (expr) = lto_input_tree (ib, data_in); + BINFO_VTABLE (expr) = lto_input_tree (ib, data_in); + BINFO_VIRTUALS (expr) = lto_input_tree (ib, data_in); + BINFO_VPTR_FIELD (expr) = lto_input_tree (ib, data_in); + + len = lto_input_uleb128 (ib); + for (i = 0; i < len; i++) + { + tree a = lto_input_tree (ib, data_in); + VEC_safe_push (tree, gc, BINFO_BASE_ACCESSES (expr), a); + } + + BINFO_INHERITANCE_CHAIN (expr) = lto_input_tree (ib, data_in); + BINFO_SUBVTT_INDEX (expr) = lto_input_tree (ib, data_in); + BINFO_VPTR_INDEX (expr) = lto_input_tree (ib, data_in); +} + + +/* Read all pointer fields in the TS_CONSTRUCTOR structure of EXPR from + input block IB. DATA_IN contains tables and descriptors for the + file being read. */ + +static void +lto_input_ts_constructor_tree_pointers (struct lto_input_block *ib, + struct data_in *data_in, tree expr) +{ + unsigned i, len; + + len = lto_input_uleb128 (ib); + for (i = 0; i < len; i++) + { + tree index, value; + + index = lto_input_tree (ib, data_in); + value = lto_input_tree (ib, data_in); + CONSTRUCTOR_APPEND_ELT (CONSTRUCTOR_ELTS (expr), index, value); + } +} + + +/* Helper for lto_input_tree. Read all pointer fields in EXPR from + input block IB. DATA_IN contains tables and descriptors for the + file being read. */ + +static void +lto_input_tree_pointers (struct lto_input_block *ib, struct data_in *data_in, + tree expr) +{ + enum tree_code code; + + code = TREE_CODE (expr); + + if (CODE_CONTAINS_STRUCT (code, TS_COMMON)) + lto_input_ts_common_tree_pointers (ib, data_in, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_VECTOR)) + lto_input_ts_vector_tree_pointers (ib, data_in, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_COMPLEX)) + lto_input_ts_complex_tree_pointers (ib, data_in, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_DECL_MINIMAL)) + lto_input_ts_decl_minimal_tree_pointers (ib, data_in, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON)) + lto_input_ts_decl_common_tree_pointers (ib, data_in, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_DECL_NON_COMMON)) + lto_input_ts_decl_non_common_tree_pointers (ib, data_in, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS)) + lto_input_ts_decl_with_vis_tree_pointers (ib, data_in, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_FIELD_DECL)) + lto_input_ts_field_decl_tree_pointers (ib, data_in, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_FUNCTION_DECL)) + lto_input_ts_function_decl_tree_pointers (ib, data_in, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_TYPE)) + lto_input_ts_type_tree_pointers (ib, data_in, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_LIST)) + lto_input_ts_list_tree_pointers (ib, data_in, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_VEC)) + lto_input_ts_vec_tree_pointers (ib, data_in, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_EXP)) + lto_input_ts_exp_tree_pointers (ib, data_in, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_SSA_NAME)) + { + /* We only stream the version number of SSA names. */ + gcc_unreachable (); + } + + if (CODE_CONTAINS_STRUCT (code, TS_BLOCK)) + lto_input_ts_block_tree_pointers (ib, data_in, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_BINFO)) + lto_input_ts_binfo_tree_pointers (ib, data_in, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_STATEMENT_LIST)) + { + /* This should only appear in GENERIC. */ + gcc_unreachable (); + } + + if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR)) + lto_input_ts_constructor_tree_pointers (ib, data_in, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_OMP_CLAUSE)) + { + /* This should only appear in High GIMPLE. */ + gcc_unreachable (); + } + + if (CODE_CONTAINS_STRUCT (code, TS_OPTIMIZATION)) + { + sorry ("optimization options not supported yet"); + } + + if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION)) + { + sorry ("target optimization options not supported yet"); + } +} + +static VEC(tree, heap) *deferred_global_decls; + +/* Register the queued global decls with the symtab. DATA_IN contains + tables and descriptors for the file being read.*/ + +void +lto_register_deferred_decls_in_symtab (struct data_in *data_in) +{ + unsigned i; + tree decl; + + for (i = 0; VEC_iterate (tree, deferred_global_decls, i, decl); ++i) + { + enum ld_plugin_symbol_resolution resolution; + int ix; + + if (!lto_streamer_cache_lookup (data_in->reader_cache, decl, &ix)) + gcc_unreachable (); + + /* Register and adjust the decls type. */ + TREE_TYPE (decl) = gimple_register_type (TREE_TYPE (decl)); + + if (TREE_CODE (decl) == VAR_DECL) + { + gcc_assert (TREE_PUBLIC (decl)); + resolution = get_resolution (data_in, ix); + lto_symtab_merge_var (decl, resolution); + } + else if (TREE_CODE (decl) == FUNCTION_DECL) + { + gcc_assert (TREE_PUBLIC (decl) && !DECL_ABSTRACT (decl)); + resolution = get_resolution (data_in, ix); + lto_symtab_merge_fn (decl, resolution, data_in->file_data); + } + else + gcc_unreachable (); + } + + VEC_free (tree, heap, deferred_global_decls); + deferred_global_decls = NULL; +} + + +/* Register DECL with the global symbol table and change its + name if necessary to avoid name clashes for static globals across + different files. */ + +static void +lto_register_var_decl_in_symtab (tree decl) +{ + /* Register symbols with file or global scope to mark what input + file has their definition. */ + if (decl_function_context (decl) == NULL_TREE) + { + /* Variable has file scope, not local. Need to ensure static variables + between different files don't clash unexpectedly. */ + if (!TREE_PUBLIC (decl)) + { + /* ??? We normally pre-mangle names before we serialize them + out. Here, in lto1, we do not know the language, and + thus cannot do the mangling again. Instead, we just + append a suffix to the mangled name. The resulting name, + however, is not a properly-formed mangled name, and will + confuse any attempt to unmangle it. */ + const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); + char *label; + + ASM_FORMAT_PRIVATE_NAME (label, name, DECL_UID (decl)); + SET_DECL_ASSEMBLER_NAME (decl, get_identifier (label)); + rest_of_decl_compilation (decl, 1, 0); + } + } + + /* If this variable has already been declared, queue the + declaration for merging. */ + if (TREE_PUBLIC (decl)) + VEC_safe_push (tree, heap, deferred_global_decls, decl); +} + + + +/* Register DECL with the global symbol table and change its + name if necessary to avoid name clashes for static globals across + different files. DATA_IN contains descriptors and tables for the + file being read. */ + +static void +lto_register_function_decl_in_symtab (struct data_in *data_in, tree decl) +{ + /* Need to ensure static entities between different files + don't clash unexpectedly. */ + if (!TREE_PUBLIC (decl)) + { + /* We must not use the DECL_ASSEMBLER_NAME macro here, as it + may set the assembler name where it was previously empty. */ + tree old_assembler_name = decl->decl_with_vis.assembler_name; + + /* FIXME lto: We normally pre-mangle names before we serialize + them out. Here, in lto1, we do not know the language, and + thus cannot do the mangling again. Instead, we just append a + suffix to the mangled name. The resulting name, however, is + not a properly-formed mangled name, and will confuse any + attempt to unmangle it. */ + const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); + char *label; + + ASM_FORMAT_PRIVATE_NAME (label, name, DECL_UID (decl)); + SET_DECL_ASSEMBLER_NAME (decl, get_identifier (label)); + + /* We may arrive here with the old assembler name not set + if the function body is not needed, e.g., it has been + inlined away and does not appear in the cgraph. */ + if (old_assembler_name) + { + tree new_assembler_name = DECL_ASSEMBLER_NAME (decl); + + /* Make the original assembler name available for later use. + We may have used it to indicate the section within its + object file where the function body may be found. + FIXME lto: Find a better way to maintain the function decl + to body section mapping so we don't need this hack. */ + lto_record_renamed_decl (data_in->file_data, + IDENTIFIER_POINTER (old_assembler_name), + IDENTIFIER_POINTER (new_assembler_name)); + + /* Also register the reverse mapping so that we can find the + new name given to an existing assembler name (used when + restoring alias pairs in input_constructors_or_inits. */ + lto_record_renamed_decl (data_in->file_data, + IDENTIFIER_POINTER (new_assembler_name), + IDENTIFIER_POINTER (old_assembler_name)); + } + } + + /* If this variable has already been declared, queue the + declaration for merging. */ + if (TREE_PUBLIC (decl) && !DECL_ABSTRACT (decl)) + VEC_safe_push (tree, heap, deferred_global_decls, decl); +} + + +/* Read an index IX from input block IB and return the tree node at + DATA_IN->FILE_DATA->GLOBALS_INDEX[IX]. */ + +static tree +lto_get_pickled_tree (struct lto_input_block *ib, struct data_in *data_in) +{ + HOST_WIDE_INT ix; + tree result; + enum LTO_tags expected_tag; + unsigned HOST_WIDE_INT orig_offset; + + ix = lto_input_sleb128 (ib); + expected_tag = (enum LTO_tags) lto_input_uleb128 (ib); + + orig_offset = lto_input_uleb128 (ib); + gcc_assert (orig_offset == (unsigned) orig_offset); + + result = lto_streamer_cache_get (data_in->reader_cache, ix); + if (result == NULL_TREE) + { + /* We have not yet read the cache slot IX. Go to the offset + in the stream where the physical tree node is, and materialize + it from there. */ + struct lto_input_block fwd_ib; + + /* If we are trying to go back in the stream, something is wrong. + We should've read the node at the earlier position already. */ + if (ib->p >= orig_offset) + internal_error ("bytecode stream: tried to jump backwards in the " + "stream"); + + LTO_INIT_INPUT_BLOCK (fwd_ib, ib->data, orig_offset, ib->len); + result = lto_input_tree (&fwd_ib, data_in); + } + + gcc_assert (result + && TREE_CODE (result) == lto_tag_to_tree_code (expected_tag)); + + return result; +} + + +/* Read a code and class from input block IB and return the + corresponding builtin. DATA_IN is as in lto_input_tree. */ + +static tree +lto_get_builtin_tree (struct lto_input_block *ib, struct data_in *data_in) +{ + enum built_in_class fclass; + enum built_in_function fcode; + const char *asmname; + tree result; + int ix; + + fclass = (enum built_in_class) lto_input_uleb128 (ib); + gcc_assert (fclass == BUILT_IN_NORMAL || fclass == BUILT_IN_MD); + + fcode = (enum built_in_function) lto_input_uleb128 (ib); + gcc_assert (fcode < END_BUILTINS); + + ix = lto_input_sleb128 (ib); + gcc_assert (ix == (int) ix); + + result = built_in_decls[fcode]; + gcc_assert (result); + + asmname = input_string (data_in, ib); + if (asmname) + set_builtin_user_assembler_name (result, asmname); + + lto_streamer_cache_insert_at (data_in->reader_cache, result, ix); + + return result; +} + + +/* Read the physical representation of a tree node with tag TAG from + input block IB using the per-file context in DATA_IN. */ + +static tree +lto_read_tree (struct lto_input_block *ib, struct data_in *data_in, + enum LTO_tags tag) +{ + tree result; + char end_marker; + int ix; + + result = lto_materialize_tree (ib, data_in, tag, &ix); + + /* Read all the pointer fields in RESULT. */ + lto_input_tree_pointers (ib, data_in, result); + + /* We should never try to instantiate an MD or NORMAL builtin here. */ + if (TREE_CODE (result) == FUNCTION_DECL) + gcc_assert (!lto_stream_as_builtin_p (result)); + + if (TREE_CODE (result) == VAR_DECL) + lto_register_var_decl_in_symtab (result); + else if (TREE_CODE (result) == FUNCTION_DECL && !DECL_BUILT_IN (result)) + lto_register_function_decl_in_symtab (data_in, result); + + end_marker = lto_input_1_unsigned (ib); + +#ifdef LTO_STREAMER_DEBUG + /* Remove the mapping to RESULT's original address set by + lto_materialize_tree. */ + lto_orig_address_remove (result); +#endif + + return result; +} + + +/* Read and INTEGER_CST node from input block IB using the per-file + context in DATA_IN. */ + +static tree +lto_input_integer_cst (struct lto_input_block *ib, struct data_in *data_in) +{ + tree result, type; + HOST_WIDE_INT low, high; + bool overflow_p; + + type = lto_input_tree (ib, data_in); + overflow_p = (lto_input_1_unsigned (ib) != 0); + low = lto_input_uleb128 (ib); + high = lto_input_uleb128 (ib); + result = build_int_cst_wide (type, low, high); + + /* If the original constant had overflown, build a replica of RESULT to + avoid modifying the shared constant returned by build_int_cst_wide. */ + if (overflow_p) + { + result = copy_node (result); + TREE_OVERFLOW (result) = 1; + } + + return result; +} + + +/* Read a tree from input block IB using the per-file context in + DATA_IN. This context is used, for example, to resolve references + to previously read nodes. */ + +tree +lto_input_tree (struct lto_input_block *ib, struct data_in *data_in) +{ + enum LTO_tags tag; + tree result; + + tag = input_record_start (ib); + gcc_assert ((unsigned) tag < (unsigned) LTO_NUM_TAGS); + + if (tag == LTO_null) + result = NULL_TREE; + else if (tag >= LTO_field_decl_ref && tag <= LTO_global_decl_ref) + { + /* If TAG is a reference to an indexable tree, the next value + in IB is the index into the table where we expect to find + that tree. */ + result = lto_input_tree_ref (ib, data_in, cfun, tag); + } + else if (tag == LTO_tree_pickle_reference) + { + /* If TAG is a reference to a previously read tree, look it up in + the reader cache. */ + result = lto_get_pickled_tree (ib, data_in); + } + else if (tag == LTO_builtin_decl) + { + /* If we are going to read a built-in function, all we need is + the code and class. */ + result = lto_get_builtin_tree (ib, data_in); + } + else if (tag == lto_tree_code_to_tag (INTEGER_CST)) + { + /* For integer constants we only need the type and its hi/low + words. */ + result = lto_input_integer_cst (ib, data_in); + } + else + { + /* Otherwise, materialize a new node from IB. */ + result = lto_read_tree (ib, data_in, tag); + } + + return result; +} + + +/* Initialization for the LTO reader. */ + +void +lto_init_reader (void) +{ + lto_streamer_init (); + + memset (<o_stats, 0, sizeof (lto_stats)); + bitmap_obstack_initialize (NULL); + + file_name_hash_table = htab_create (37, hash_string_slot_node, + eq_string_slot_node, free); + + gimple_register_cfg_hooks (); +} + + +/* Create a new data_in object for FILE_DATA. STRINGS is the string + table to use with LEN strings. RESOLUTIONS is the vector of linker + resolutions (NULL if not using a linker plugin). */ + +struct data_in * +lto_data_in_create (struct lto_file_decl_data *file_data, const char *strings, + unsigned len, + VEC(ld_plugin_symbol_resolution_t,heap) *resolutions) +{ + struct data_in *data_in = XCNEW (struct data_in); + data_in->file_data = file_data; + data_in->strings = strings; + data_in->strings_len = len; + data_in->globals_resolution = resolutions; + data_in->reader_cache = lto_streamer_cache_create (); + + return data_in; +} + + +/* Remove DATA_IN. */ + +void +lto_data_in_delete (struct data_in *data_in) +{ + VEC_free (ld_plugin_symbol_resolution_t, heap, data_in->globals_resolution); + lto_streamer_cache_delete (data_in->reader_cache); + free (data_in->labels); + free (data_in); +} diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c new file mode 100644 index 00000000000..616486762c4 --- /dev/null +++ b/gcc/lto-streamer-out.c @@ -0,0 +1,2548 @@ +/* Write the GIMPLE representation to a file stream. + + Copyright 2009 Free Software Foundation, Inc. + Contributed by Kenneth Zadeck + Re-implemented by Diego Novillo + +This file is part of GCC. + +GCC 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. + +GCC 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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "toplev.h" +#include "tree.h" +#include "expr.h" +#include "flags.h" +#include "params.h" +#include "input.h" +#include "varray.h" +#include "hashtab.h" +#include "basic-block.h" +#include "tree-flow.h" +#include "tree-pass.h" +#include "cgraph.h" +#include "function.h" +#include "ggc.h" +#include "diagnostic.h" +#include "except.h" +#include "vec.h" +#include "lto-symtab.h" +#include "lto-streamer.h" + + +struct string_slot +{ + const char *s; + int len; + unsigned int slot_num; +}; + + +/* Returns a hash code for P. */ + +static hashval_t +hash_string_slot_node (const void *p) +{ + const struct string_slot *ds = (const struct string_slot *) p; + return (hashval_t) htab_hash_string (ds->s); +} + + +/* Returns nonzero if P1 and P2 are equal. */ + +static int +eq_string_slot_node (const void *p1, const void *p2) +{ + const struct string_slot *ds1 = (const struct string_slot *) p1; + const struct string_slot *ds2 = (const struct string_slot *) p2; + + if (ds1->len == ds2->len) + { + int i; + for (i = 0; i < ds1->len; i++) + if (ds1->s[i] != ds2->s[i]) + return 0; + return 1; + } + + return 0; +} + + +/* Free the string slot pointed-to by P. */ + +static void +string_slot_free (void *p) +{ + struct string_slot *slot = (struct string_slot *) p; + free (CONST_CAST (void *, (const void *) slot->s)); + free (slot); +} + + +/* Clear the line info stored in DATA_IN. */ + +static void +clear_line_info (struct output_block *ob) +{ + ob->current_file = NULL; + ob->current_line = 0; + ob->current_col = 0; +} + + +/* Create the output block and return it. SECTION_TYPE is + LTO_section_function_body or LTO_static_initializer. */ + +struct output_block * +create_output_block (enum lto_section_type section_type) +{ + struct output_block *ob = XCNEW (struct output_block); + + ob->section_type = section_type; + ob->decl_state = lto_get_out_decl_state (); + ob->main_stream = XCNEW (struct lto_output_stream); + ob->string_stream = XCNEW (struct lto_output_stream); + ob->writer_cache = lto_streamer_cache_create (); + + if (section_type == LTO_section_function_body) + ob->cfg_stream = XCNEW (struct lto_output_stream); + + clear_line_info (ob); + + ob->string_hash_table = htab_create (37, hash_string_slot_node, + eq_string_slot_node, string_slot_free); + + return ob; +} + + +/* Destroy the output block OB. */ + +void +destroy_output_block (struct output_block *ob) +{ + enum lto_section_type section_type = ob->section_type; + + htab_delete (ob->string_hash_table); + + free (ob->main_stream); + free (ob->string_stream); + if (section_type == LTO_section_function_body) + free (ob->cfg_stream); + + lto_streamer_cache_delete (ob->writer_cache); + + free (ob); +} + + +/* Output bitpack BP to output stream S. */ + +void +lto_output_bitpack (struct lto_output_stream *s, struct bitpack_d *bp) +{ + unsigned i; + bitpack_word_t v; + + lto_output_uleb128_stream (s, VEC_length (bitpack_word_t, bp->values)); + for (i = 0; VEC_iterate (bitpack_word_t, bp->values, i, v); i++) + lto_output_uleb128_stream (s, v); +} + + +/* Output STRING of LEN characters to the string + table in OB. The string might or might not include a trailing '\0'. + Then put the index onto the INDEX_STREAM. */ + +static void +output_string_with_length (struct output_block *ob, + struct lto_output_stream *index_stream, + const char *s, + unsigned int len) +{ + struct string_slot **slot; + struct string_slot s_slot; + char *string = (char *) xmalloc (len + 1); + memcpy (string, s, len); + string[len] = '\0'; + + s_slot.s = string; + s_slot.len = len; + s_slot.slot_num = 0; + + slot = (struct string_slot **) htab_find_slot (ob->string_hash_table, + &s_slot, INSERT); + if (*slot == NULL) + { + struct lto_output_stream *string_stream = ob->string_stream; + unsigned int start = string_stream->total_size; + struct string_slot *new_slot + = (struct string_slot *) xmalloc (sizeof (struct string_slot)); + unsigned int i; + + new_slot->s = string; + new_slot->len = len; + new_slot->slot_num = start; + *slot = new_slot; + lto_output_uleb128_stream (index_stream, start); + lto_output_uleb128_stream (string_stream, len); + for (i = 0; i < len; i++) + lto_output_1_stream (string_stream, string[i]); + } + else + { + struct string_slot *old_slot = (struct string_slot *)*slot; + lto_output_uleb128_stream (index_stream, old_slot->slot_num); + free (string); + } +} + +/* Output the '\0' terminated STRING to the string + table in OB. Then put the index onto the INDEX_STREAM. */ + +static void +output_string (struct output_block *ob, + struct lto_output_stream *index_stream, + const char *string) +{ + if (string) + { + lto_output_uleb128_stream (index_stream, 0); + output_string_with_length (ob, index_stream, string, strlen (string) + 1); + } + else + lto_output_uleb128_stream (index_stream, 1); +} + + +/* Output the STRING constant to the string + table in OB. Then put the index onto the INDEX_STREAM. */ + +static void +output_string_cst (struct output_block *ob, + struct lto_output_stream *index_stream, + tree string) +{ + if (string) + { + lto_output_uleb128_stream (index_stream, 0); + output_string_with_length (ob, index_stream, + TREE_STRING_POINTER (string), + TREE_STRING_LENGTH (string)); + } + else + lto_output_uleb128_stream (index_stream, 1); +} + + +/* Output the identifier ID to the string + table in OB. Then put the index onto the INDEX_STREAM. */ + +static void +output_identifier (struct output_block *ob, + struct lto_output_stream *index_stream, + tree id) +{ + if (id) + { + lto_output_uleb128_stream (index_stream, 0); + output_string_with_length (ob, index_stream, + IDENTIFIER_POINTER (id), + IDENTIFIER_LENGTH (id)); + } + else + lto_output_uleb128_stream (index_stream, 1); +} + +/* Write a zero to the output stream. */ + +static void +output_zero (struct output_block *ob) +{ + lto_output_1_stream (ob->main_stream, 0); +} + + +/* Output an unsigned LEB128 quantity to OB->main_stream. */ + +static void +output_uleb128 (struct output_block *ob, unsigned HOST_WIDE_INT work) +{ + lto_output_uleb128_stream (ob->main_stream, work); +} + + +/* Output a signed LEB128 quantity to OB->main_stream. */ + +static void +output_sleb128 (struct output_block *ob, HOST_WIDE_INT work) +{ + lto_output_sleb128_stream (ob->main_stream, work); +} + + +/* Output the start of a record with TAG to output block OB. */ + +static void +output_record_start (struct output_block *ob, enum LTO_tags tag) +{ + /* Make sure TAG fits inside an unsigned int. */ + gcc_assert (tag == (enum LTO_tags) (unsigned) tag); + output_uleb128 (ob, tag); +} + + +/* Look up NODE in the type table and write the index for it to OB. */ + +static void +output_type_ref (struct output_block *ob, tree node) +{ + output_record_start (ob, LTO_type_ref); + lto_output_type_ref_index (ob->decl_state, ob->main_stream, node); +} + + +/* Pack all the non-pointer fields of the TS_BASE structure of + expression EXPR into bitpack BP. */ + +static void +pack_ts_base_value_fields (struct bitpack_d *bp, tree expr) +{ + bp_pack_value (bp, TREE_CODE (expr), 16); + if (!TYPE_P (expr)) + { + bp_pack_value (bp, TREE_SIDE_EFFECTS (expr), 1); + bp_pack_value (bp, TREE_CONSTANT (expr), 1); + bp_pack_value (bp, TREE_READONLY (expr), 1); + + /* TREE_PUBLIC is used on types to indicate that the type + has a TYPE_CACHED_VALUES vector. This is not streamed out, + so we skip it here. */ + bp_pack_value (bp, TREE_PUBLIC (expr), 1); + } + bp_pack_value (bp, TREE_ADDRESSABLE (expr), 1); + bp_pack_value (bp, TREE_THIS_VOLATILE (expr), 1); + if (DECL_P (expr)) + bp_pack_value (bp, DECL_UNSIGNED (expr), 1); + else if (TYPE_P (expr)) + bp_pack_value (bp, TYPE_UNSIGNED (expr), 1); + bp_pack_value (bp, TREE_ASM_WRITTEN (expr), 1); + bp_pack_value (bp, TREE_NO_WARNING (expr), 1); + bp_pack_value (bp, TREE_USED (expr), 1); + bp_pack_value (bp, TREE_NOTHROW (expr), 1); + bp_pack_value (bp, TREE_STATIC (expr), 1); + bp_pack_value (bp, TREE_PRIVATE (expr), 1); + bp_pack_value (bp, TREE_PROTECTED (expr), 1); + bp_pack_value (bp, TREE_DEPRECATED (expr), 1); + if (TYPE_P (expr)) + bp_pack_value (bp, TYPE_SATURATING (expr), 1); + if (TREE_CODE (expr) == SSA_NAME) + bp_pack_value (bp, SSA_NAME_IS_DEFAULT_DEF (expr), 1); +} + + +/* Pack all the non-pointer fields of the TS_REAL_CST structure of + expression EXPR into bitpack BP. */ + +static void +pack_ts_real_cst_value_fields (struct bitpack_d *bp, tree expr) +{ + unsigned i; + REAL_VALUE_TYPE r; + + r = TREE_REAL_CST (expr); + bp_pack_value (bp, r.cl, 2); + bp_pack_value (bp, r.decimal, 1); + bp_pack_value (bp, r.sign, 1); + bp_pack_value (bp, r.signalling, 1); + bp_pack_value (bp, r.canonical, 1); + bp_pack_value (bp, r.uexp, EXP_BITS); + for (i = 0; i < SIGSZ; i++) + bp_pack_value (bp, r.sig[i], HOST_BITS_PER_LONG); +} + + +/* Pack all the non-pointer fields of the TS_FIXED_CST structure of + expression EXPR into bitpack BP. */ + +static void +pack_ts_fixed_cst_value_fields (struct bitpack_d *bp, tree expr) +{ + struct fixed_value fv = TREE_FIXED_CST (expr); + bp_pack_value (bp, fv.data.low, HOST_BITS_PER_WIDE_INT); + bp_pack_value (bp, fv.data.high, HOST_BITS_PER_WIDE_INT); +} + + +/* Pack all the non-pointer fields of the TS_DECL_COMMON structure + of expression EXPR into bitpack BP. */ + +static void +pack_ts_decl_common_value_fields (struct bitpack_d *bp, tree expr) +{ + bp_pack_value (bp, DECL_MODE (expr), 8); + bp_pack_value (bp, DECL_NONLOCAL (expr), 1); + bp_pack_value (bp, DECL_VIRTUAL_P (expr), 1); + bp_pack_value (bp, DECL_IGNORED_P (expr), 1); + bp_pack_value (bp, DECL_ABSTRACT (expr), 1); + bp_pack_value (bp, DECL_ARTIFICIAL (expr), 1); + bp_pack_value (bp, DECL_USER_ALIGN (expr), 1); + bp_pack_value (bp, DECL_PRESERVE_P (expr), 1); + bp_pack_value (bp, DECL_DEBUG_EXPR_IS_FROM (expr), 1); + bp_pack_value (bp, DECL_EXTERNAL (expr), 1); + bp_pack_value (bp, DECL_GIMPLE_REG_P (expr), 1); + bp_pack_value (bp, DECL_ALIGN (expr), HOST_BITS_PER_INT); + + if (TREE_CODE (expr) == LABEL_DECL) + { + /* Note that we do not write LABEL_DECL_UID. The reader will + always assume an initial value of -1 so that the + label_to_block_map is recreated by gimple_set_bb. */ + bp_pack_value (bp, DECL_ERROR_ISSUED (expr), 1); + bp_pack_value (bp, EH_LANDING_PAD_NR (expr), HOST_BITS_PER_INT); + } + + if (TREE_CODE (expr) == FIELD_DECL) + { + bp_pack_value (bp, DECL_PACKED (expr), 1); + bp_pack_value (bp, DECL_NONADDRESSABLE_P (expr), 1); + bp_pack_value (bp, DECL_OFFSET_ALIGN (expr), 8); + } + + if (TREE_CODE (expr) == RESULT_DECL + || TREE_CODE (expr) == PARM_DECL + || TREE_CODE (expr) == VAR_DECL) + { + bp_pack_value (bp, DECL_BY_REFERENCE (expr), 1); + if (TREE_CODE (expr) == VAR_DECL + || TREE_CODE (expr) == PARM_DECL) + bp_pack_value (bp, DECL_HAS_VALUE_EXPR_P (expr), 1); + } +} + + +/* Pack all the non-pointer fields of the TS_DECL_WRTL structure + of expression EXPR into bitpack BP. */ + +static void +pack_ts_decl_wrtl_value_fields (struct bitpack_d *bp, tree expr) +{ + bp_pack_value (bp, DECL_REGISTER (expr), 1); +} + + +/* Pack all the non-pointer fields of the TS_DECL_WITH_VIS structure + of expression EXPR into bitpack BP. */ + +static void +pack_ts_decl_with_vis_value_fields (struct bitpack_d *bp, tree expr) +{ + bp_pack_value (bp, DECL_DEFER_OUTPUT (expr), 1); + bp_pack_value (bp, DECL_COMMON (expr), 1); + bp_pack_value (bp, DECL_DLLIMPORT_P (expr), 1); + bp_pack_value (bp, DECL_WEAK (expr), 1); + bp_pack_value (bp, DECL_SEEN_IN_BIND_EXPR_P (expr), 1); + bp_pack_value (bp, DECL_COMDAT (expr), 1); + bp_pack_value (bp, DECL_VISIBILITY (expr), 2); + bp_pack_value (bp, DECL_VISIBILITY_SPECIFIED (expr), 1); + + if (TREE_CODE (expr) == VAR_DECL) + { + bp_pack_value (bp, DECL_HARD_REGISTER (expr), 1); + bp_pack_value (bp, DECL_IN_TEXT_SECTION (expr), 1); + bp_pack_value (bp, DECL_TLS_MODEL (expr), 3); + } + + if (VAR_OR_FUNCTION_DECL_P (expr)) + bp_pack_value (bp, DECL_INIT_PRIORITY (expr), HOST_BITS_PER_SHORT); +} + + +/* Pack all the non-pointer fields of the TS_FUNCTION_DECL structure + of expression EXPR into bitpack BP. */ + +static void +pack_ts_function_decl_value_fields (struct bitpack_d *bp, tree expr) +{ + /* For normal/md builtins we only write the class and code, so they + should never be handled here. */ + gcc_assert (!lto_stream_as_builtin_p (expr)); + + bp_pack_value (bp, DECL_FUNCTION_CODE (expr), 11); + bp_pack_value (bp, DECL_BUILT_IN_CLASS (expr), 2); + bp_pack_value (bp, DECL_STATIC_CONSTRUCTOR (expr), 1); + bp_pack_value (bp, DECL_STATIC_DESTRUCTOR (expr), 1); + bp_pack_value (bp, DECL_UNINLINABLE (expr), 1); + bp_pack_value (bp, DECL_POSSIBLY_INLINED (expr), 1); + bp_pack_value (bp, DECL_IS_NOVOPS (expr), 1); + bp_pack_value (bp, DECL_IS_RETURNS_TWICE (expr), 1); + bp_pack_value (bp, DECL_IS_MALLOC (expr), 1); + bp_pack_value (bp, DECL_IS_OPERATOR_NEW (expr), 1); + bp_pack_value (bp, DECL_DECLARED_INLINE_P (expr), 1); + bp_pack_value (bp, DECL_STATIC_CHAIN (expr), 1); + bp_pack_value (bp, DECL_NO_INLINE_WARNING_P (expr), 1); + bp_pack_value (bp, DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (expr), 1); + bp_pack_value (bp, DECL_NO_LIMIT_STACK (expr), 1); + bp_pack_value (bp, DECL_DISREGARD_INLINE_LIMITS (expr), 1); + bp_pack_value (bp, DECL_PURE_P (expr), 1); + bp_pack_value (bp, DECL_LOOPING_CONST_OR_PURE_P (expr), 1); +} + + +/* Pack all the non-pointer fields of the TS_TYPE structure + of expression EXPR into bitpack BP. */ + +static void +pack_ts_type_value_fields (struct bitpack_d *bp, tree expr) +{ + bp_pack_value (bp, TYPE_PRECISION (expr), 9); + bp_pack_value (bp, TYPE_MODE (expr), 7); + bp_pack_value (bp, TYPE_STRING_FLAG (expr), 1); + bp_pack_value (bp, TYPE_NO_FORCE_BLK (expr), 1); + bp_pack_value (bp, TYPE_NEEDS_CONSTRUCTING(expr), 1); + if (TREE_CODE (expr) == UNION_TYPE) + bp_pack_value (bp, TYPE_TRANSPARENT_UNION (expr), 1); + bp_pack_value (bp, TYPE_PACKED (expr), 1); + bp_pack_value (bp, TYPE_RESTRICT (expr), 1); + bp_pack_value (bp, TYPE_CONTAINS_PLACEHOLDER_INTERNAL (expr), 2); + bp_pack_value (bp, TYPE_USER_ALIGN (expr), 1); + bp_pack_value (bp, TYPE_READONLY (expr), 1); + bp_pack_value (bp, TYPE_ALIGN (expr), HOST_BITS_PER_INT); + bp_pack_value (bp, TYPE_ALIAS_SET (expr) == 0 ? 0 : -1, HOST_BITS_PER_INT); +} + + +/* Pack all the non-pointer fields of the TS_BLOCK structure + of expression EXPR into bitpack BP. */ + +static void +pack_ts_block_value_fields (struct bitpack_d *bp, tree expr) +{ + bp_pack_value (bp, BLOCK_ABSTRACT (expr), 1); + bp_pack_value (bp, BLOCK_NUMBER (expr), 31); +} + + +/* Pack all the non-pointer fields in EXPR into a bit pack. */ + +static struct bitpack_d * +pack_value_fields (tree expr) +{ + enum tree_code code; + struct bitpack_d *bp; + + code = TREE_CODE (expr); + bp = bitpack_create (); + + /* Note that all these functions are highly sensitive to changes in + the types and sizes of each of the fields being packed. */ + pack_ts_base_value_fields (bp, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_REAL_CST)) + pack_ts_real_cst_value_fields (bp, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_FIXED_CST)) + pack_ts_fixed_cst_value_fields (bp, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON)) + pack_ts_decl_common_value_fields (bp, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_DECL_WRTL)) + pack_ts_decl_wrtl_value_fields (bp, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS)) + pack_ts_decl_with_vis_value_fields (bp, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_FUNCTION_DECL)) + pack_ts_function_decl_value_fields (bp, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_TYPE)) + pack_ts_type_value_fields (bp, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_BLOCK)) + pack_ts_block_value_fields (bp, expr); + + if (CODE_CONTAINS_STRUCT (code, TS_SSA_NAME)) + { + /* We only stream the version number of SSA names. */ + gcc_unreachable (); + } + + if (CODE_CONTAINS_STRUCT (code, TS_STATEMENT_LIST)) + { + /* This is only used by GENERIC. */ + gcc_unreachable (); + } + + if (CODE_CONTAINS_STRUCT (code, TS_OMP_CLAUSE)) + { + /* This is only used by High GIMPLE. */ + gcc_unreachable (); + } + + return bp; +} + + +/* Emit location LOC to output block OB. */ + +static void +lto_output_location (struct output_block *ob, location_t loc) +{ + expanded_location xloc; + + if (loc == UNKNOWN_LOCATION) + { + output_string (ob, ob->main_stream, NULL); + return; + } + + xloc = expand_location (loc); + + output_string (ob, ob->main_stream, xloc.file); + output_sleb128 (ob, xloc.line); + output_sleb128 (ob, xloc.column); + + ob->current_file = xloc.file; + ob->current_line = xloc.line; + ob->current_col = xloc.column; +} + + +/* Return true if tree node T is written to various tables. For these + nodes, we sometimes want to write their phyiscal representation + (via lto_output_tree), and sometimes we need to emit an index + reference into a table (via lto_output_tree_ref). */ + +static bool +tree_is_indexable (tree t) +{ + if (TREE_CODE (t) == PARM_DECL) + return false; + else if (TREE_CODE (t) == VAR_DECL && decl_function_context (t)) + return false; + else + return (TYPE_P (t) || DECL_P (t) || TREE_CODE (t) == SSA_NAME); +} + + +/* If EXPR is an indexable tree node, output a reference to it to + output block OB. Otherwise, output the physical representation of + EXPR to OB. */ + +static void +lto_output_tree_ref (struct output_block *ob, tree expr) +{ + enum tree_code code; + + if (expr == NULL_TREE) + { + output_zero (ob); + return; + } + + if (!tree_is_indexable (expr)) + { + /* Even though we are emitting the physical representation of + EXPR, its leaves must be emitted as references. */ + lto_output_tree (ob, expr, true); + return; + } + + if (TYPE_P (expr)) + { + output_type_ref (ob, expr); + return; + } + + code = TREE_CODE (expr); + switch (code) + { + case SSA_NAME: + output_record_start (ob, LTO_ssa_name_ref); + output_uleb128 (ob, SSA_NAME_VERSION (expr)); + break; + + case FIELD_DECL: + output_record_start (ob, LTO_field_decl_ref); + lto_output_field_decl_index (ob->decl_state, ob->main_stream, expr); + break; + + case FUNCTION_DECL: + output_record_start (ob, LTO_function_decl_ref); + lto_output_fn_decl_index (ob->decl_state, ob->main_stream, expr); + break; + + case VAR_DECL: + gcc_assert (decl_function_context (expr) == NULL); + output_record_start (ob, LTO_global_decl_ref); + lto_output_var_decl_index (ob->decl_state, ob->main_stream, expr); + break; + + case CONST_DECL: + output_record_start (ob, LTO_const_decl_ref); + lto_output_var_decl_index (ob->decl_state, ob->main_stream, expr); + break; + + case IMPORTED_DECL: + gcc_assert (decl_function_context (expr) == NULL); + output_record_start (ob, LTO_imported_decl_ref); + lto_output_var_decl_index (ob->decl_state, ob->main_stream, expr); + break; + + case TYPE_DECL: + output_record_start (ob, LTO_type_decl_ref); + lto_output_type_decl_index (ob->decl_state, ob->main_stream, expr); + break; + + case NAMESPACE_DECL: + output_record_start (ob, LTO_namespace_decl_ref); + lto_output_namespace_decl_index (ob->decl_state, ob->main_stream, expr); + break; + + case LABEL_DECL: + output_record_start (ob, LTO_label_decl_ref); + lto_output_var_decl_index (ob->decl_state, ob->main_stream, expr); + break; + + case RESULT_DECL: + output_record_start (ob, LTO_result_decl_ref); + lto_output_var_decl_index (ob->decl_state, ob->main_stream, expr); + break; + + default: + /* No other node is indexable, so it should have been handled + by lto_output_tree. */ + gcc_unreachable (); + } +} + + +/* If REF_P is true, emit a reference to EXPR in output block OB, + otherwise emit the physical representation of EXPR in OB. */ + +static inline void +lto_output_tree_or_ref (struct output_block *ob, tree expr, bool ref_p) +{ + if (ref_p) + lto_output_tree_ref (ob, expr); + else + lto_output_tree (ob, expr, false); +} + + +/* Emit the chain of tree nodes starting at T. OB is the output block + to write to. REF_P is true if chain elements should be emitted + as references. */ + +static void +lto_output_chain (struct output_block *ob, tree t, bool ref_p) +{ + int i, count; + + count = list_length (t); + output_sleb128 (ob, count); + for (i = 0; i < count; i++) + { + tree saved_chain; + + /* Clear TREE_CHAIN to avoid blindly recursing into the rest + of the list. */ + saved_chain = TREE_CHAIN (t); + TREE_CHAIN (t) = NULL_TREE; + + lto_output_tree_or_ref (ob, t, ref_p); + + TREE_CHAIN (t) = saved_chain; + t = TREE_CHAIN (t); + } +} + + +/* Write all pointer fields in the TS_COMMON structure of EXPR to output + block OB. If REF_P is true, write a reference to EXPR's pointer + fields. */ + +static void +lto_output_ts_common_tree_pointers (struct output_block *ob, tree expr, + bool ref_p) +{ + lto_output_tree_or_ref (ob, TREE_TYPE (expr), ref_p); +} + + +/* Write all pointer fields in the TS_VECTOR structure of EXPR to output + block OB. If REF_P is true, write a reference to EXPR's pointer + fields. */ + +static void +lto_output_ts_vector_tree_pointers (struct output_block *ob, tree expr, + bool ref_p) +{ + lto_output_chain (ob, TREE_VECTOR_CST_ELTS (expr), ref_p); +} + + +/* Write all pointer fields in the TS_COMPLEX structure of EXPR to output + block OB. If REF_P is true, write a reference to EXPR's pointer + fields. */ + +static void +lto_output_ts_complex_tree_pointers (struct output_block *ob, tree expr, + bool ref_p) +{ + lto_output_tree_or_ref (ob, TREE_REALPART (expr), ref_p); + lto_output_tree_or_ref (ob, TREE_IMAGPART (expr), ref_p); +} + + +/* Write all pointer fields in the TS_DECL_MINIMAL structure of EXPR + to output block OB. If REF_P is true, write a reference to EXPR's + pointer fields. */ + +static void +lto_output_ts_decl_minimal_tree_pointers (struct output_block *ob, tree expr, + bool ref_p) +{ + lto_output_tree_or_ref (ob, DECL_NAME (expr), ref_p); + lto_output_tree_or_ref (ob, DECL_CONTEXT (expr), ref_p); + lto_output_location (ob, DECL_SOURCE_LOCATION (expr)); +} + + +/* Write all pointer fields in the TS_DECL_COMMON structure of EXPR to + output block OB. If REF_P is true, write a reference to EXPR's + pointer fields. */ + +static void +lto_output_ts_decl_common_tree_pointers (struct output_block *ob, tree expr, + bool ref_p) +{ + lto_output_tree_or_ref (ob, DECL_SIZE (expr), ref_p); + lto_output_tree_or_ref (ob, DECL_SIZE_UNIT (expr), ref_p); + + if (TREE_CODE (expr) != FUNCTION_DECL) + lto_output_tree_or_ref (ob, DECL_INITIAL (expr), ref_p); + + lto_output_tree_or_ref (ob, DECL_ATTRIBUTES (expr), ref_p); + lto_output_tree_or_ref (ob, DECL_ABSTRACT_ORIGIN (expr), ref_p); + + if (TREE_CODE (expr) == PARM_DECL) + lto_output_chain (ob, TREE_CHAIN (expr), ref_p); +} + + +/* Write all pointer fields in the TS_DECL_NON_COMMON structure of + EXPR to output block OB. If REF_P is true, write a reference to EXPR's + pointer fields. */ + +static void +lto_output_ts_decl_non_common_tree_pointers (struct output_block *ob, + tree expr, bool ref_p) +{ + if (TREE_CODE (expr) == FUNCTION_DECL) + { + /* DECL_SAVED_TREE holds the GENERIC representation for DECL. + At this point, it should not exist. Either because it was + converted to gimple or because DECL didn't have a GENERIC + representation in this TU. */ + gcc_assert (DECL_SAVED_TREE (expr) == NULL_TREE); + lto_output_tree_or_ref (ob, DECL_ARGUMENTS (expr), ref_p); + lto_output_tree_or_ref (ob, DECL_RESULT (expr), ref_p); + } + lto_output_tree_or_ref (ob, DECL_VINDEX (expr), ref_p); +} + + +/* Write all pointer fields in the TS_DECL_WITH_VIS structure of EXPR + to output block OB. If REF_P is true, write a reference to EXPR's + pointer fields. */ + +static void +lto_output_ts_decl_with_vis_tree_pointers (struct output_block *ob, tree expr, + bool ref_p) +{ + /* Make sure we don't inadvertently set the assembler name. */ + if (DECL_ASSEMBLER_NAME_SET_P (expr)) + lto_output_tree_or_ref (ob, DECL_ASSEMBLER_NAME (expr), ref_p); + else + output_zero (ob); + + lto_output_tree_or_ref (ob, DECL_SECTION_NAME (expr), ref_p); + lto_output_tree_or_ref (ob, DECL_COMDAT_GROUP (expr), ref_p); +} + + +/* Write all pointer fields in the TS_FIELD_DECL structure of EXPR to + output block OB. If REF_P is true, write a reference to EXPR's + pointer fields. */ + +static void +lto_output_ts_field_decl_tree_pointers (struct output_block *ob, tree expr, + bool ref_p) +{ + lto_output_tree_or_ref (ob, DECL_FIELD_OFFSET (expr), ref_p); + lto_output_tree_or_ref (ob, DECL_BIT_FIELD_TYPE (expr), ref_p); + lto_output_tree_or_ref (ob, DECL_QUALIFIER (expr), ref_p); + lto_output_tree_or_ref (ob, DECL_FIELD_BIT_OFFSET (expr), ref_p); + lto_output_tree_or_ref (ob, DECL_FCONTEXT (expr), ref_p); + lto_output_chain (ob, TREE_CHAIN (expr), ref_p); +} + + +/* Write all pointer fields in the TS_FUNCTION_DECL structure of EXPR + to output block OB. If REF_P is true, write a reference to EXPR's + pointer fields. */ + +static void +lto_output_ts_function_decl_tree_pointers (struct output_block *ob, tree expr, + bool ref_p) +{ + /* DECL_STRUCT_FUNCTION is handled by lto_output_function. FIXME lto, + maybe it should be handled here? */ + lto_output_tree_or_ref (ob, DECL_FUNCTION_PERSONALITY (expr), ref_p); + lto_output_tree_or_ref (ob, DECL_FUNCTION_SPECIFIC_TARGET (expr), ref_p); + lto_output_tree_or_ref (ob, DECL_FUNCTION_SPECIFIC_OPTIMIZATION (expr), + ref_p); +} + + +/* Write all pointer fields in the TS_TYPE structure of EXPR to output + block OB. If REF_P is true, write a reference to EXPR's pointer + fields. */ + +static void +lto_output_ts_type_tree_pointers (struct output_block *ob, tree expr, + bool ref_p) +{ + if (TREE_CODE (expr) == ENUMERAL_TYPE) + lto_output_tree_or_ref (ob, TYPE_VALUES (expr), ref_p); + else if (TREE_CODE (expr) == ARRAY_TYPE) + lto_output_tree_or_ref (ob, TYPE_DOMAIN (expr), ref_p); + else if (TREE_CODE (expr) == RECORD_TYPE || TREE_CODE (expr) == UNION_TYPE) + lto_output_tree_or_ref (ob, TYPE_FIELDS (expr), ref_p); + else if (TREE_CODE (expr) == FUNCTION_TYPE || TREE_CODE (expr) == METHOD_TYPE) + lto_output_tree_or_ref (ob, TYPE_ARG_TYPES (expr), ref_p); + else if (TREE_CODE (expr) == VECTOR_TYPE) + lto_output_tree_or_ref (ob, TYPE_DEBUG_REPRESENTATION_TYPE (expr), ref_p); + + lto_output_tree_or_ref (ob, TYPE_SIZE (expr), ref_p); + lto_output_tree_or_ref (ob, TYPE_SIZE_UNIT (expr), ref_p); + lto_output_tree_or_ref (ob, TYPE_ATTRIBUTES (expr), ref_p); + lto_output_tree_or_ref (ob, TYPE_NAME (expr), ref_p); + /* Do not stream TYPE_POINTER_TO or TYPE_REFERENCE_TO nor + TYPE_NEXT_PTR_TO or TYPE_NEXT_REF_TO. */ + if (!POINTER_TYPE_P (expr)) + lto_output_tree_or_ref (ob, TYPE_MINVAL (expr), ref_p); + lto_output_tree_or_ref (ob, TYPE_MAXVAL (expr), ref_p); + lto_output_tree_or_ref (ob, TYPE_MAIN_VARIANT (expr), ref_p); + /* Do not stream TYPE_NEXT_VARIANT, we reconstruct the variant lists + during fixup. */ + if (TREE_CODE (expr) == RECORD_TYPE || TREE_CODE (expr) == UNION_TYPE) + lto_output_tree_or_ref (ob, TYPE_BINFO (expr), ref_p); + lto_output_tree_or_ref (ob, TYPE_CONTEXT (expr), ref_p); + lto_output_tree_or_ref (ob, TYPE_CANONICAL (expr), ref_p); +} + + +/* Write all pointer fields in the TS_LIST structure of EXPR to output + block OB. If REF_P is true, write a reference to EXPR's pointer + fields. */ + +static void +lto_output_ts_list_tree_pointers (struct output_block *ob, tree expr, + bool ref_p) +{ + lto_output_tree_or_ref (ob, TREE_PURPOSE (expr), ref_p); + lto_output_tree_or_ref (ob, TREE_VALUE (expr), ref_p); + lto_output_chain (ob, TREE_CHAIN (expr), ref_p); +} + + +/* Write all pointer fields in the TS_VEC structure of EXPR to output + block OB. If REF_P is true, write a reference to EXPR's pointer + fields. */ + +static void +lto_output_ts_vec_tree_pointers (struct output_block *ob, tree expr, bool ref_p) +{ + int i; + + /* Note that the number of slots for EXPR has already been emitted + in EXPR's header (see lto_output_tree_header). */ + for (i = 0; i < TREE_VEC_LENGTH (expr); i++) + lto_output_tree_or_ref (ob, TREE_VEC_ELT (expr, i), ref_p); +} + + +/* Write all pointer fields in the TS_EXP structure of EXPR to output + block OB. If REF_P is true, write a reference to EXPR's pointer + fields. */ + +static void +lto_output_ts_exp_tree_pointers (struct output_block *ob, tree expr, bool ref_p) +{ + int i; + + output_sleb128 (ob, TREE_OPERAND_LENGTH (expr)); + for (i = 0; i < TREE_OPERAND_LENGTH (expr); i++) + lto_output_tree_or_ref (ob, TREE_OPERAND (expr, i), ref_p); + lto_output_location (ob, EXPR_LOCATION (expr)); + lto_output_tree_or_ref (ob, TREE_BLOCK (expr), ref_p); +} + + +/* Write all pointer fields in the TS_BLOCK structure of EXPR to output + block OB. If REF_P is true, write a reference to EXPR's pointer + fields. */ + +static void +lto_output_ts_block_tree_pointers (struct output_block *ob, tree expr, + bool ref_p) +{ + unsigned i; + tree t; + + lto_output_location (ob, BLOCK_SOURCE_LOCATION (expr)); + lto_output_chain (ob, BLOCK_VARS (expr), ref_p); + + output_uleb128 (ob, VEC_length (tree, BLOCK_NONLOCALIZED_VARS (expr))); + for (i = 0; VEC_iterate (tree, BLOCK_NONLOCALIZED_VARS (expr), i, t); i++) + lto_output_tree_or_ref (ob, t, ref_p); + + lto_output_tree_or_ref (ob, BLOCK_SUPERCONTEXT (expr), ref_p); + lto_output_tree_or_ref (ob, BLOCK_ABSTRACT_ORIGIN (expr), ref_p); + lto_output_tree_or_ref (ob, BLOCK_FRAGMENT_ORIGIN (expr), ref_p); + lto_output_tree_or_ref (ob, BLOCK_FRAGMENT_CHAIN (expr), ref_p); + lto_output_chain (ob, BLOCK_SUBBLOCKS (expr), ref_p); +} + + +/* Write all pointer fields in the TS_BINFO structure of EXPR to output + block OB. If REF_P is true, write a reference to EXPR's pointer + fields. */ + +static void +lto_output_ts_binfo_tree_pointers (struct output_block *ob, tree expr, + bool ref_p) +{ + unsigned i; + tree t; + + /* Note that the number of BINFO slots has already been emitted in + EXPR's header (see lto_output_tree_header) because this length + is needed to build the empty BINFO node on the reader side. */ + for (i = 0; VEC_iterate (tree, BINFO_BASE_BINFOS (expr), i, t); i++) + lto_output_tree_or_ref (ob, t, ref_p); + output_zero (ob); + + lto_output_tree_or_ref (ob, BINFO_OFFSET (expr), ref_p); + lto_output_tree_or_ref (ob, BINFO_VTABLE (expr), ref_p); + lto_output_tree_or_ref (ob, BINFO_VIRTUALS (expr), ref_p); + lto_output_tree_or_ref (ob, BINFO_VPTR_FIELD (expr), ref_p); + + output_uleb128 (ob, VEC_length (tree, BINFO_BASE_ACCESSES (expr))); + for (i = 0; VEC_iterate (tree, BINFO_BASE_ACCESSES (expr), i, t); i++) + lto_output_tree_or_ref (ob, t, ref_p); + + lto_output_tree_or_ref (ob, BINFO_INHERITANCE_CHAIN (expr), ref_p); + lto_output_tree_or_ref (ob, BINFO_SUBVTT_INDEX (expr), ref_p); + lto_output_tree_or_ref (ob, BINFO_VPTR_INDEX (expr), ref_p); +} + + +/* Write all pointer fields in the TS_CONSTRUCTOR structure of EXPR to + output block OB. If REF_P is true, write a reference to EXPR's + pointer fields. */ + +static void +lto_output_ts_constructor_tree_pointers (struct output_block *ob, tree expr, + bool ref_p) +{ + unsigned i; + tree index, value; + + output_uleb128 (ob, CONSTRUCTOR_NELTS (expr)); + FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (expr), i, index, value) + { + lto_output_tree_or_ref (ob, index, ref_p); + lto_output_tree_or_ref (ob, value, ref_p); + } +} + + +/* Helper for lto_output_tree. Write all pointer fields in EXPR to output + block OB. If REF_P is true, the leaves of EXPR are emitted as + references. */ + +static void +lto_output_tree_pointers (struct output_block *ob, tree expr, bool ref_p) +{ + enum tree_code code; + + code = TREE_CODE (expr); + + if (CODE_CONTAINS_STRUCT (code, TS_COMMON)) + lto_output_ts_common_tree_pointers (ob, expr, ref_p); + + if (CODE_CONTAINS_STRUCT (code, TS_VECTOR)) + lto_output_ts_vector_tree_pointers (ob, expr, ref_p); + + if (CODE_CONTAINS_STRUCT (code, TS_COMPLEX)) + lto_output_ts_complex_tree_pointers (ob, expr, ref_p); + + if (CODE_CONTAINS_STRUCT (code, TS_DECL_MINIMAL)) + lto_output_ts_decl_minimal_tree_pointers (ob, expr, ref_p); + + if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON)) + lto_output_ts_decl_common_tree_pointers (ob, expr, ref_p); + + if (CODE_CONTAINS_STRUCT (code, TS_DECL_NON_COMMON)) + lto_output_ts_decl_non_common_tree_pointers (ob, expr, ref_p); + + if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS)) + lto_output_ts_decl_with_vis_tree_pointers (ob, expr, ref_p); + + if (CODE_CONTAINS_STRUCT (code, TS_FIELD_DECL)) + lto_output_ts_field_decl_tree_pointers (ob, expr, ref_p); + + if (CODE_CONTAINS_STRUCT (code, TS_FUNCTION_DECL)) + lto_output_ts_function_decl_tree_pointers (ob, expr, ref_p); + + if (CODE_CONTAINS_STRUCT (code, TS_TYPE)) + lto_output_ts_type_tree_pointers (ob, expr, ref_p); + + if (CODE_CONTAINS_STRUCT (code, TS_LIST)) + lto_output_ts_list_tree_pointers (ob, expr, ref_p); + + if (CODE_CONTAINS_STRUCT (code, TS_VEC)) + lto_output_ts_vec_tree_pointers (ob, expr, ref_p); + + if (CODE_CONTAINS_STRUCT (code, TS_EXP)) + lto_output_ts_exp_tree_pointers (ob, expr, ref_p); + + if (CODE_CONTAINS_STRUCT (code, TS_SSA_NAME)) + { + /* We only stream the version number of SSA names. */ + gcc_unreachable (); + } + + if (CODE_CONTAINS_STRUCT (code, TS_BLOCK)) + lto_output_ts_block_tree_pointers (ob, expr, ref_p); + + if (CODE_CONTAINS_STRUCT (code, TS_BINFO)) + lto_output_ts_binfo_tree_pointers (ob, expr, ref_p); + + if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR)) + lto_output_ts_constructor_tree_pointers (ob, expr, ref_p); + + if (CODE_CONTAINS_STRUCT (code, TS_STATEMENT_LIST)) + { + /* This should only appear in GENERIC. */ + gcc_unreachable (); + } + + if (CODE_CONTAINS_STRUCT (code, TS_OMP_CLAUSE)) + { + /* This should only appear in High GIMPLE. */ + gcc_unreachable (); + } + + if (CODE_CONTAINS_STRUCT (code, TS_OPTIMIZATION)) + { + /* FIXME lto. Not handled yet. */ + gcc_unreachable (); + } + + if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION)) + { + /* FIXME lto. Not handled yet. */ + gcc_unreachable (); + } +} + + +/* Emit header information for tree EXPR to output block OB. The header + contains everything needed to instantiate an empty skeleton for + EXPR on the reading side. IX is the index into the streamer cache + where EXPR is stored. REF_P is as in lto_output_tree. */ + +static void +lto_output_tree_header (struct output_block *ob, tree expr, int ix) +{ + enum LTO_tags tag; + enum tree_code code; + + /* We should not see any non-GIMPLE tree nodes here. */ + code = TREE_CODE (expr); + if (!lto_is_streamable (expr)) + internal_error ("tree code %qs is not supported in gimple streams", + tree_code_name[code]); + + /* The header of a tree node consists of its tag, the size of + the node, and any other information needed to instantiate + EXPR on the reading side (such as the number of slots in + variable sized nodes). */ + tag = lto_tree_code_to_tag (code); + output_record_start (ob, tag); + output_sleb128 (ob, ix); + + /* The following will cause bootstrap miscomparisons. Enable with care. */ +#ifdef LTO_STREAMER_DEBUG + /* This is used mainly for debugging purposes. When the reader + and the writer do not agree on a streamed node, the pointer + value for EXPR can be used to track down the differences in + the debugger. */ + gcc_assert ((HOST_WIDEST_INT) (intptr_t) expr == (intptr_t) expr); + output_sleb128 (ob, (HOST_WIDEST_INT) (intptr_t) expr); +#endif + + /* The text in strings and identifiers are completely emitted in + the header. */ + if (CODE_CONTAINS_STRUCT (code, TS_STRING)) + output_string_cst (ob, ob->main_stream, expr); + else if (CODE_CONTAINS_STRUCT (code, TS_IDENTIFIER)) + output_identifier (ob, ob->main_stream, expr); + else if (CODE_CONTAINS_STRUCT (code, TS_VEC)) + output_sleb128 (ob, TREE_VEC_LENGTH (expr)); + else if (CODE_CONTAINS_STRUCT (code, TS_BINFO)) + output_uleb128 (ob, BINFO_N_BASE_BINFOS (expr)); +} + + +/* Write the code and class of builtin EXPR to output block OB. IX is + the index into the streamer cache where EXPR is stored.*/ + +static void +lto_output_builtin_tree (struct output_block *ob, tree expr, int ix) +{ + gcc_assert (lto_stream_as_builtin_p (expr)); + + output_record_start (ob, LTO_builtin_decl); + output_uleb128 (ob, DECL_BUILT_IN_CLASS (expr)); + output_uleb128 (ob, DECL_FUNCTION_CODE (expr)); + output_sleb128 (ob, ix); + + if (DECL_ASSEMBLER_NAME_SET_P (expr)) + { + /* When the assembler name of a builtin gets a user name, + the new name is always prefixed with '*' by + set_builtin_user_assembler_name. So, to prevent the + reader side from adding a second '*', we omit it here. */ + const char *str = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (expr)); + if (strlen (str) > 1 && str[0] == '*') + output_string (ob, ob->main_stream, &str[1]); + else + output_string (ob, ob->main_stream, NULL); + } + else + output_string (ob, ob->main_stream, NULL); +} + + +/* Write a physical representation of tree node EXPR to output block + OB. If REF_P is true, the leaves of EXPR are emitted as references + via lto_output_tree_ref. IX is the index into the streamer cache + where EXPR is stored. */ + +static void +lto_write_tree (struct output_block *ob, tree expr, bool ref_p, int ix) +{ + struct bitpack_d *bp; + + /* Write the header, containing everything needed to materialize + EXPR on the reading side. */ + lto_output_tree_header (ob, expr, ix); + + /* Pack all the non-pointer fields in EXPR into a bitpack and write + the resulting bitpack. */ + bp = pack_value_fields (expr); + lto_output_bitpack (ob->main_stream, bp); + bitpack_delete (bp); + + /* Write all the pointer fields in EXPR. */ + lto_output_tree_pointers (ob, expr, ref_p); + + /* Mark the end of EXPR. */ + output_zero (ob); +} + + +/* Emit the integer constant CST to output block OB. If REF_P is true, + CST's type will be emitted as a reference. */ + +static void +lto_output_integer_cst (struct output_block *ob, tree cst, bool ref_p) +{ + output_record_start (ob, lto_tree_code_to_tag (INTEGER_CST)); + lto_output_tree_or_ref (ob, TREE_TYPE (cst), ref_p); + lto_output_1_stream (ob->main_stream, TREE_OVERFLOW_P (cst)); + output_uleb128 (ob, TREE_INT_CST_LOW (cst)); + output_uleb128 (ob, TREE_INT_CST_HIGH (cst)); +} + + +/* Emit the physical representation of tree node EXPR to output block + OB. If REF_P is true, the leaves of EXPR are emitted as references + via lto_output_tree_ref. */ + +void +lto_output_tree (struct output_block *ob, tree expr, bool ref_p) +{ + int ix; + bool existed_p; + unsigned offset; + + if (expr == NULL_TREE) + { + output_zero (ob); + return; + } + + /* INTEGER_CST nodes are special because they need their original type + to be materialized by the reader (to implement TYPE_CACHED_VALUES). */ + if (TREE_CODE (expr) == INTEGER_CST) + { + lto_output_integer_cst (ob, expr, ref_p); + return; + } + + /* Determine the offset in the stream where EXPR will be written. + This is used when emitting pickle references so the reader knows + where to reconstruct the pickled object from. This allows + circular and forward references within the same stream. */ + offset = ob->main_stream->total_size; + + existed_p = lto_streamer_cache_insert (ob->writer_cache, expr, &ix, &offset); + if (existed_p) + { + /* If a node has already been streamed out, make sure that + we don't write it more than once. Otherwise, the reader + will instantiate two different nodes for the same object. */ + output_record_start (ob, LTO_tree_pickle_reference); + output_sleb128 (ob, ix); + output_uleb128 (ob, lto_tree_code_to_tag (TREE_CODE (expr))); + output_uleb128 (ob, offset); + } + else if (lto_stream_as_builtin_p (expr)) + { + /* MD and NORMAL builtins do not need to be written out + completely as they are always instantiated by the + compiler on startup. The only builtins that need to + be written out are BUILT_IN_FRONTEND. For all other + builtins, we simply write the class and code. */ + lto_output_builtin_tree (ob, expr, ix); + } + else + { + /* This is the first time we see EXPR, write its fields + to OB. */ + lto_write_tree (ob, expr, ref_p, ix); + } +} + + +/* Output to OB a list of try/catch handlers starting with FIRST. */ + +static void +output_eh_try_list (struct output_block *ob, eh_catch first) +{ + eh_catch n; + + for (n = first; n; n = n->next_catch) + { + output_record_start (ob, LTO_eh_catch); + lto_output_tree_ref (ob, n->type_list); + lto_output_tree_ref (ob, n->filter_list); + lto_output_tree_ref (ob, n->label); + } + + output_zero (ob); +} + + +/* Output EH region R in function FN to OB. CURR_RN is the slot index + that is being emitted in FN->EH->REGION_ARRAY. This is used to + detect EH region sharing. */ + +static void +output_eh_region (struct output_block *ob, eh_region r) +{ + enum LTO_tags tag; + + if (r == NULL) + { + output_zero (ob); + return; + } + + if (r->type == ERT_CLEANUP) + tag = LTO_ert_cleanup; + else if (r->type == ERT_TRY) + tag = LTO_ert_try; + else if (r->type == ERT_ALLOWED_EXCEPTIONS) + tag = LTO_ert_allowed_exceptions; + else if (r->type == ERT_MUST_NOT_THROW) + tag = LTO_ert_must_not_throw; + else + gcc_unreachable (); + + output_record_start (ob, tag); + output_sleb128 (ob, r->index); + + if (r->outer) + output_sleb128 (ob, r->outer->index); + else + output_zero (ob); + + if (r->inner) + output_sleb128 (ob, r->inner->index); + else + output_zero (ob); + + if (r->next_peer) + output_sleb128 (ob, r->next_peer->index); + else + output_zero (ob); + + if (r->type == ERT_TRY) + { + output_eh_try_list (ob, r->u.eh_try.first_catch); + } + else if (r->type == ERT_ALLOWED_EXCEPTIONS) + { + lto_output_tree_ref (ob, r->u.allowed.type_list); + lto_output_tree_ref (ob, r->u.allowed.label); + output_uleb128 (ob, r->u.allowed.filter); + } + else if (r->type == ERT_MUST_NOT_THROW) + { + lto_output_tree_ref (ob, r->u.must_not_throw.failure_decl); + lto_output_location (ob, r->u.must_not_throw.failure_loc); + } + + if (r->landing_pads) + output_sleb128 (ob, r->landing_pads->index); + else + output_zero (ob); +} + + +/* Output landing pad LP to OB. */ + +static void +output_eh_lp (struct output_block *ob, eh_landing_pad lp) +{ + if (lp == NULL) + { + output_zero (ob); + return; + } + + output_record_start (ob, LTO_eh_landing_pad); + output_sleb128 (ob, lp->index); + if (lp->next_lp) + output_sleb128 (ob, lp->next_lp->index); + else + output_zero (ob); + + if (lp->region) + output_sleb128 (ob, lp->region->index); + else + output_zero (ob); + + lto_output_tree_ref (ob, lp->post_landing_pad); +} + + +/* Output the existing eh_table to OB. */ + +static void +output_eh_regions (struct output_block *ob, struct function *fn) +{ + if (fn->eh && fn->eh->region_tree) + { + unsigned i; + eh_region eh; + eh_landing_pad lp; + tree ttype; + + output_record_start (ob, LTO_eh_table); + + /* Emit the index of the root of the EH region tree. */ + output_sleb128 (ob, fn->eh->region_tree->index); + + /* Emit all the EH regions in the region array. */ + output_sleb128 (ob, VEC_length (eh_region, fn->eh->region_array)); + for (i = 0; VEC_iterate (eh_region, fn->eh->region_array, i, eh); i++) + output_eh_region (ob, eh); + + /* Emit all landing pads. */ + output_sleb128 (ob, VEC_length (eh_landing_pad, fn->eh->lp_array)); + for (i = 0; VEC_iterate (eh_landing_pad, fn->eh->lp_array, i, lp); i++) + output_eh_lp (ob, lp); + + /* Emit all the runtime type data. */ + output_sleb128 (ob, VEC_length (tree, fn->eh->ttype_data)); + for (i = 0; VEC_iterate (tree, fn->eh->ttype_data, i, ttype); i++) + lto_output_tree_ref (ob, ttype); + + /* Emit the table of action chains. */ + if (targetm.arm_eabi_unwinder) + { + tree t; + output_sleb128 (ob, VEC_length (tree, fn->eh->ehspec_data.arm_eabi)); + for (i = 0; + VEC_iterate (tree, fn->eh->ehspec_data.arm_eabi, i, t); + i++) + lto_output_tree_ref (ob, t); + } + else + { + uchar c; + output_sleb128 (ob, VEC_length (uchar, fn->eh->ehspec_data.other)); + for (i = 0; VEC_iterate (uchar, fn->eh->ehspec_data.other, i, c); i++) + lto_output_1_stream (ob->main_stream, c); + } + } + + /* The 0 either terminates the record or indicates that there are no + eh_records at all. */ + output_zero (ob); +} + + +/* Output all of the active ssa names to the ssa_names stream. */ + +static void +output_ssa_names (struct output_block *ob, struct function *fn) +{ + unsigned int i, len; + + len = VEC_length (tree, SSANAMES (fn)); + output_uleb128 (ob, len); + + for (i = 1; i < len; i++) + { + tree ptr = VEC_index (tree, SSANAMES (fn), i); + + if (ptr == NULL_TREE + || SSA_NAME_IN_FREE_LIST (ptr) + || !is_gimple_reg (ptr)) + continue; + + output_uleb128 (ob, i); + lto_output_1_stream (ob->main_stream, SSA_NAME_IS_DEFAULT_DEF (ptr)); + lto_output_tree_ref (ob, SSA_NAME_VAR (ptr)); + } + + output_zero (ob); +} + + +/* Output the cfg. */ + +static void +output_cfg (struct output_block *ob, struct function *fn) +{ + struct lto_output_stream *tmp_stream = ob->main_stream; + basic_block bb; + + ob->main_stream = ob->cfg_stream; + + output_uleb128 (ob, profile_status_for_function (fn)); + + /* Output the number of the highest basic block. */ + output_uleb128 (ob, last_basic_block_for_function (fn)); + + FOR_ALL_BB_FN (bb, fn) + { + edge_iterator ei; + edge e; + + output_sleb128 (ob, bb->index); + + /* Output the successors and the edge flags. */ + output_uleb128 (ob, EDGE_COUNT (bb->succs)); + FOR_EACH_EDGE (e, ei, bb->succs) + { + output_uleb128 (ob, e->dest->index); + output_sleb128 (ob, e->probability); + output_sleb128 (ob, e->count); + output_uleb128 (ob, e->flags); + } + } + + output_sleb128 (ob, -1); + + bb = ENTRY_BLOCK_PTR; + while (bb->next_bb) + { + output_sleb128 (ob, bb->next_bb->index); + bb = bb->next_bb; + } + + output_sleb128 (ob, -1); + + ob->main_stream = tmp_stream; +} + + +/* Output PHI function PHI to the main stream in OB. */ + +static void +output_phi (struct output_block *ob, gimple phi) +{ + unsigned i, len = gimple_phi_num_args (phi); + + output_record_start (ob, lto_gimple_code_to_tag (GIMPLE_PHI)); + output_uleb128 (ob, SSA_NAME_VERSION (PHI_RESULT (phi))); + + for (i = 0; i < len; i++) + { + lto_output_tree_ref (ob, gimple_phi_arg_def (phi, i)); + output_uleb128 (ob, gimple_phi_arg_edge (phi, i)->src->index); + lto_output_location (ob, gimple_phi_arg_location (phi, i)); + } +} + + +/* Emit statement STMT on the main stream of output block OB. */ + +static void +output_gimple_stmt (struct output_block *ob, gimple stmt) +{ + unsigned i; + enum gimple_code code; + enum LTO_tags tag; + struct bitpack_d *bp; + + /* Emit identifying tag. */ + code = gimple_code (stmt); + tag = lto_gimple_code_to_tag (code); + output_record_start (ob, tag); + + /* Emit the tuple header. */ + bp = bitpack_create (); + bp_pack_value (bp, gimple_num_ops (stmt), sizeof (unsigned) * 8); + bp_pack_value (bp, gimple_no_warning_p (stmt), 1); + if (is_gimple_assign (stmt)) + bp_pack_value (bp, gimple_assign_nontemporal_move_p (stmt), 1); + bp_pack_value (bp, gimple_has_volatile_ops (stmt), 1); + bp_pack_value (bp, stmt->gsbase.subcode, 16); + lto_output_bitpack (ob->main_stream, bp); + bitpack_delete (bp); + + /* Emit location information for the statement. */ + lto_output_location (ob, gimple_location (stmt)); + + /* Emit the lexical block holding STMT. */ + lto_output_tree (ob, gimple_block (stmt), true); + + /* Emit the operands. */ + switch (gimple_code (stmt)) + { + case GIMPLE_RESX: + output_sleb128 (ob, gimple_resx_region (stmt)); + break; + + case GIMPLE_EH_MUST_NOT_THROW: + lto_output_tree_ref (ob, gimple_eh_must_not_throw_fndecl (stmt)); + break; + + case GIMPLE_EH_DISPATCH: + output_sleb128 (ob, gimple_eh_dispatch_region (stmt)); + break; + + case GIMPLE_ASM: + lto_output_uleb128_stream (ob->main_stream, gimple_asm_ninputs (stmt)); + lto_output_uleb128_stream (ob->main_stream, gimple_asm_noutputs (stmt)); + lto_output_uleb128_stream (ob->main_stream, gimple_asm_nclobbers (stmt)); + output_string (ob, ob->main_stream, gimple_asm_string (stmt)); + /* Fallthru */ + + case GIMPLE_ASSIGN: + case GIMPLE_CALL: + case GIMPLE_RETURN: + case GIMPLE_SWITCH: + case GIMPLE_LABEL: + case GIMPLE_COND: + case GIMPLE_GOTO: + case GIMPLE_DEBUG: + for (i = 0; i < gimple_num_ops (stmt); i++) + { + tree op = gimple_op (stmt, i); + lto_output_tree_ref (ob, op); + } + break; + + case GIMPLE_PREDICT: + break; + + default: + gcc_unreachable (); + } +} + + +/* Output a basic block BB to the main stream in OB for this FN. */ + +static void +output_bb (struct output_block *ob, basic_block bb, struct function *fn) +{ + gimple_stmt_iterator bsi = gsi_start_bb (bb); + + output_record_start (ob, + (!gsi_end_p (bsi)) || phi_nodes (bb) + ? LTO_bb1 + : LTO_bb0); + + output_uleb128 (ob, bb->index); + output_sleb128 (ob, bb->count); + output_sleb128 (ob, bb->loop_depth); + output_sleb128 (ob, bb->frequency); + output_sleb128 (ob, bb->flags); + + if (!gsi_end_p (bsi) || phi_nodes (bb)) + { + /* Output the statements. The list of statements is terminated + with a zero. */ + for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi)) + { + int region; + gimple stmt = gsi_stmt (bsi); + + output_gimple_stmt (ob, stmt); + + /* Emit the EH region holding STMT. */ + region = lookup_stmt_eh_lp_fn (fn, stmt); + if (region != 0) + { + output_record_start (ob, LTO_eh_region); + output_sleb128 (ob, region); + } + else + output_zero (ob); + } + + output_zero (ob); + + for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi)) + { + gimple phi = gsi_stmt (bsi); + + /* Only emit PHIs for gimple registers. PHI nodes for .MEM + will be filled in on reading when the SSA form is + updated. */ + if (is_gimple_reg (gimple_phi_result (phi))) + output_phi (ob, phi); + } + + output_zero (ob); + } +} + +/* Create the header in the file using OB. If the section type is for + a function, set FN to the decl for that function. */ + +static void +produce_asm (struct output_block *ob, tree fn) +{ + enum lto_section_type section_type = ob->section_type; + struct lto_function_header header; + char *section_name; + struct lto_output_stream *header_stream; + + if (section_type == LTO_section_function_body) + { + const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (fn)); + section_name = lto_get_section_name (section_type, name); + } + else + section_name = lto_get_section_name (section_type, NULL); + + lto_begin_section (section_name, !flag_wpa); + free (section_name); + + /* The entire header is stream computed here. */ + memset (&header, 0, sizeof (struct lto_function_header)); + + /* Write the header. */ + header.lto_header.major_version = LTO_major_version; + header.lto_header.minor_version = LTO_minor_version; + header.lto_header.section_type = section_type; + + header.compressed_size = 0; + + if (section_type == LTO_section_function_body) + header.cfg_size = ob->cfg_stream->total_size; + header.main_size = ob->main_stream->total_size; + header.string_size = ob->string_stream->total_size; + + header_stream = XCNEW (struct lto_output_stream); + lto_output_data_stream (header_stream, &header, sizeof header); + lto_write_stream (header_stream); + free (header_stream); + + /* Put all of the gimple and the string table out the asm file as a + block of text. */ + if (section_type == LTO_section_function_body) + lto_write_stream (ob->cfg_stream); + lto_write_stream (ob->main_stream); + lto_write_stream (ob->string_stream); + + lto_end_section (); +} + + +/* Output the body of function NODE->DECL. */ + +static void +output_function (struct cgraph_node *node) +{ + struct bitpack_d *bp; + tree function; + struct function *fn; + basic_block bb; + struct output_block *ob; + + function = node->decl; + fn = DECL_STRUCT_FUNCTION (function); + ob = create_output_block (LTO_section_function_body); + + clear_line_info (ob); + ob->cgraph_node = node; + + gcc_assert (current_function_decl == NULL_TREE && cfun == NULL); + + /* Set current_function_decl and cfun. */ + current_function_decl = function; + push_cfun (fn); + + /* Make string 0 be a NULL string. */ + lto_output_1_stream (ob->string_stream, 0); + + output_record_start (ob, LTO_function); + + /* Write all the attributes for FN. */ + bp = bitpack_create (); + bp_pack_value (bp, fn->is_thunk, 1); + bp_pack_value (bp, fn->has_local_explicit_reg_vars, 1); + bp_pack_value (bp, fn->after_tree_profile, 1); + bp_pack_value (bp, fn->returns_pcc_struct, 1); + bp_pack_value (bp, fn->returns_struct, 1); + bp_pack_value (bp, fn->always_inline_functions_inlined, 1); + bp_pack_value (bp, fn->after_inlining, 1); + bp_pack_value (bp, fn->dont_save_pending_sizes_p, 1); + bp_pack_value (bp, fn->stdarg, 1); + bp_pack_value (bp, fn->has_nonlocal_label, 1); + bp_pack_value (bp, fn->calls_alloca, 1); + bp_pack_value (bp, fn->calls_setjmp, 1); + bp_pack_value (bp, fn->function_frequency, 2); + bp_pack_value (bp, fn->va_list_fpr_size, 8); + bp_pack_value (bp, fn->va_list_gpr_size, 8); + lto_output_bitpack (ob->main_stream, bp); + bitpack_delete (bp); + + /* Output the static chain and non-local goto save area. */ + lto_output_tree_ref (ob, fn->static_chain_decl); + lto_output_tree_ref (ob, fn->nonlocal_goto_save_area); + + /* Output all the local variables in the function. */ + lto_output_tree_ref (ob, fn->local_decls); + + /* Output all the SSA names used in the function. */ + output_ssa_names (ob, fn); + + /* Output any exception handling regions. */ + output_eh_regions (ob, fn); + + /* Output DECL_INITIAL for the function, which contains the tree of + lexical scopes. */ + lto_output_tree (ob, DECL_INITIAL (function), true); + + /* Output the head of the arguments list. */ + lto_output_tree_ref (ob, DECL_ARGUMENTS (function)); + + /* We will renumber the statements. The code that does this uses + the same ordering that we use for serializing them so we can use + the same code on the other end and not have to write out the + statement numbers. */ + renumber_gimple_stmt_uids (); + + /* Output the code for the function. */ + FOR_ALL_BB_FN (bb, fn) + output_bb (ob, bb, fn); + + /* The terminator for this function. */ + output_zero (ob); + + output_cfg (ob, fn); + + /* Create a section to hold the pickled output of this function. */ + produce_asm (ob, function); + + destroy_output_block (ob); + + current_function_decl = NULL; + pop_cfun (); +} + + +/* Return true if alias pair P belongs to the set of cgraph nodes in + SET. If P is a an alias for a VAR_DECL, it can always be emitted. + However, for FUNCTION_DECL aliases, we should only output the pair + if it belongs to a function whose cgraph node is in SET. + Otherwise, the LTRANS phase will get into trouble when finalizing + aliases because the alias will refer to a function not defined in + the file processed by LTRANS. */ + +static bool +output_alias_pair_p (alias_pair *p, cgraph_node_set set) +{ + cgraph_node_set_iterator csi; + struct cgraph_node *target_node; + + /* Always emit VAR_DECLs. FIXME lto, we should probably only emit + those VAR_DECLs that are instantiated in this file partition, but + we have no easy way of knowing this based on SET. */ + if (TREE_CODE (p->decl) == VAR_DECL) + return true; + + /* Check if the assembler name for P->TARGET has its cgraph node in SET. */ + gcc_assert (TREE_CODE (p->decl) == FUNCTION_DECL); + target_node = cgraph_node_for_asm (p->target); + csi = cgraph_node_set_find (set, target_node); + return (!csi_end_p (csi)); +} + + +/* Output any unreferenced global symbol defined in SET, alias pairs + and labels. */ + +static void +output_unreferenced_globals (cgraph_node_set set) +{ + struct output_block *ob; + alias_pair *p; + unsigned i; + struct varpool_node *vnode; + + ob = create_output_block (LTO_section_static_initializer); + ob->cgraph_node = NULL; + + clear_line_info (ob); + + /* Make string 0 be a NULL string. */ + lto_output_1_stream (ob->string_stream, 0); + + /* Emit references for all the global symbols. If a global symbol + was never referenced in any of the functions of this file, it + would not be emitted otherwise. This will result in unreferenced + symbols at link time if a file defines a global symbol but + never references it. */ + FOR_EACH_STATIC_VARIABLE (vnode) + { + tree var = vnode->decl; + + if (TREE_CODE (var) == VAR_DECL && TREE_PUBLIC (var)) + lto_output_tree_ref (ob, var); + } + + output_zero (ob); + + /* Emit the alias pairs for the nodes in SET. */ + for (i = 0; VEC_iterate (alias_pair, alias_pairs, i, p); i++) + { + if (output_alias_pair_p (p, set)) + { + lto_output_tree_ref (ob, p->decl); + lto_output_tree_ref (ob, p->target); + } + } + + output_zero (ob); + + produce_asm (ob, NULL); + destroy_output_block (ob); +} + + +/* Copy the function body of NODE without deserializing. */ + +static void +copy_function (struct cgraph_node *node) +{ + tree function = node->decl; + struct lto_file_decl_data *file_data = node->local.lto_file_data; + struct lto_output_stream *output_stream = XCNEW (struct lto_output_stream); + const char *data; + size_t len; + const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (function)); + char *section_name = + lto_get_section_name (LTO_section_function_body, name); + size_t i, j; + struct lto_in_decl_state *in_state; + struct lto_out_decl_state *out_state = lto_get_out_decl_state (); + + lto_begin_section (section_name, !flag_wpa); + free (section_name); + + /* We may have renamed the declaration, e.g., a static function. */ + name = lto_get_decl_name_mapping (file_data, name); + + data = lto_get_section_data (file_data, LTO_section_function_body, + name, &len); + gcc_assert (data); + + /* Do a bit copy of the function body. */ + lto_output_data_stream (output_stream, data, len); + lto_write_stream (output_stream); + + /* Copy decls. */ + in_state = + lto_get_function_in_decl_state (node->local.lto_file_data, function); + gcc_assert (in_state); + + for (i = 0; i < LTO_N_DECL_STREAMS; i++) + { + size_t n = in_state->streams[i].size; + tree *trees = in_state->streams[i].trees; + struct lto_tree_ref_encoder *encoder = &(out_state->streams[i]); + + /* The out state must have the same indices and the in state. + So just copy the vector. All the encoders in the in state + must be empty where we reach here. */ + gcc_assert (lto_tree_ref_encoder_size (encoder) == 0); + for (j = 0; j < n; j++) + VEC_safe_push (tree, heap, encoder->trees, trees[j]); + encoder->next_index = n; + } + + lto_free_section_data (file_data, LTO_section_function_body, name, + data, len); + free (output_stream); + lto_end_section (); +} + + +/* Initialize the LTO writer. */ + +static void +lto_writer_init (void) +{ + lto_streamer_init (); +} + + +/* Main entry point from the pass manager. */ + +static void +lto_output (cgraph_node_set set) +{ + struct cgraph_node *node; + struct lto_out_decl_state *decl_state; + cgraph_node_set_iterator csi; + bitmap output = lto_bitmap_alloc (); + + lto_writer_init (); + + /* Process only the functions with bodies. */ + for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi)) + { + node = csi_node (csi); + if (node->analyzed && !bitmap_bit_p (output, DECL_UID (node->decl))) + { + bitmap_set_bit (output, DECL_UID (node->decl)); + decl_state = lto_new_out_decl_state (); + lto_push_out_decl_state (decl_state); + if (!flag_wpa) + output_function (node); + else + copy_function (node); + gcc_assert (lto_get_out_decl_state () == decl_state); + lto_pop_out_decl_state (); + lto_record_function_out_decl_state (node->decl, decl_state); + } + } + + /* Emit the callgraph after emitting function bodies. This needs to + be done now to make sure that all the statements in every function + have been renumbered so that edges can be associated with call + statements using the statement UIDs. */ + output_cgraph (set); + + lto_bitmap_free (output); +} + +struct ipa_opt_pass_d pass_ipa_lto_gimple_out = +{ + { + IPA_PASS, + "lto_gimple_out", /* name */ + gate_lto_out, /* gate */ + NULL, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_IPA_LTO_GIMPLE_IO, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func /* todo_flags_finish */ + }, + NULL, /* generate_summary */ + lto_output, /* write_summary */ + NULL, /* read_summary */ + NULL, /* function_read_summary */ + 0, /* TODOs */ + NULL, /* function_transform */ + NULL /* variable_transform */ +}; + + +/* Write each node in encoded by ENCODER to OB, as well as those reachable + from it and required for correct representation of its semantics. + Each node in ENCODER must be a global declaration or a type. A node + is written only once, even if it appears multiple times in the + vector. Certain transitively-reachable nodes, such as those + representing expressions, may be duplicated, but such nodes + must not appear in ENCODER itself. */ + +static void +write_global_stream (struct output_block *ob, + struct lto_tree_ref_encoder *encoder) +{ + tree t; + size_t index; + const size_t size = lto_tree_ref_encoder_size (encoder); + + for (index = 0; index < size; index++) + { + t = lto_tree_ref_encoder_get_tree (encoder, index); + if (!lto_streamer_cache_lookup (ob->writer_cache, t, NULL)) + { + if (flag_wpa) + { + /* In WPA we should not emit multiple definitions of the + same symbol to all the files in the link set. If + T had already been emitted as the pervailing definition + in one file, emit it as an external reference in the + others. */ + /* FIXME lto. We should check if T belongs to the + file we are writing to. */ + if (TREE_CODE (t) == VAR_DECL + && TREE_PUBLIC (t) + && !DECL_EXTERNAL (t)) + { + /* FIXME lto. Make DECLS_ALREADY_EMITTED an argument + to this function so it can be freed up afterwards. + Alternately, assign global symbols to cgraph + node sets. */ + static struct pointer_set_t *decls_already_emitted = NULL; + + if (decls_already_emitted == NULL) + decls_already_emitted = pointer_set_create (); + + if (pointer_set_insert (decls_already_emitted, t)) + make_decl_one_only (t, DECL_ASSEMBLER_NAME (t)); + } + } + + lto_output_tree (ob, t, false); + } + } +} + + +/* Write a sequence of indices into the globals vector corresponding + to the trees in ENCODER. These are used by the reader to map the + indices used to refer to global entities within function bodies to + their referents. */ + +static void +write_global_references (struct output_block *ob, + struct lto_output_stream *ref_stream, + struct lto_tree_ref_encoder *encoder) +{ + tree t; + int32_t index; + const int32_t size = lto_tree_ref_encoder_size (encoder); + + /* Write size as 32-bit unsigned. */ + lto_output_data_stream (ref_stream, &size, sizeof (int32_t)); + + for (index = 0; index < size; index++) + { + int32_t slot_num; + + t = lto_tree_ref_encoder_get_tree (encoder, index); + lto_streamer_cache_lookup (ob->writer_cache, t, &slot_num); + gcc_assert (slot_num >= 0); + lto_output_data_stream (ref_stream, &slot_num, sizeof slot_num); + } +} + + +/* Write all the streams in an lto_out_decl_state STATE using + output block OB and output stream OUT_STREAM. */ + +static void +lto_output_decl_state_streams (struct output_block *ob, + struct lto_out_decl_state *state) +{ + int i; + + for (i = 0; i < LTO_N_DECL_STREAMS; i++) + write_global_stream (ob, &state->streams[i]); +} + + +/* Write all the references in an lto_out_decl_state STATE using + output block OB and output stream OUT_STREAM. */ + +static void +lto_output_decl_state_refs (struct output_block *ob, + struct lto_output_stream *out_stream, + struct lto_out_decl_state *state) +{ + unsigned i; + int32_t ref; + tree decl; + + /* Write reference to FUNCTION_DECL. If there is not function, + write reference to void_type_node. */ + decl = (state->fn_decl) ? state->fn_decl : void_type_node; + lto_streamer_cache_lookup (ob->writer_cache, decl, &ref); + gcc_assert (ref >= 0); + lto_output_data_stream (out_stream, &ref, sizeof (int32_t)); + + for (i = 0; i < LTO_N_DECL_STREAMS; i++) + write_global_references (ob, out_stream, &state->streams[i]); +} + + +/* Return the written size of STATE. */ + +static size_t +lto_out_decl_state_written_size (struct lto_out_decl_state *state) +{ + int i; + size_t size; + + size = sizeof (int32_t); /* fn_ref. */ + for (i = 0; i < LTO_N_DECL_STREAMS; i++) + { + size += sizeof (int32_t); /* vector size. */ + size += (lto_tree_ref_encoder_size (&state->streams[i]) + * sizeof (int32_t)); + } + return size; +} + + +/* Helper function of write_symbols_of_kind. CACHE is the streamer + cache with all the pickled nodes. STREAM is the stream where to + write the table. V is a vector with the DECLs that should be on + the table. SEEN is a bitmap of symbols written so far. */ + +static void +write_symbol_vec (struct lto_streamer_cache_d *cache, + struct lto_output_stream *stream, + VEC(tree,heap) *v, bitmap seen) +{ + tree t; + int index; + + for (index = 0; VEC_iterate(tree, v, index, t); index++) + { + const char *name; + enum gcc_plugin_symbol_kind kind; + enum gcc_plugin_symbol_visibility visibility; + int slot_num; + uint64_t size; + const char *comdat; + + /* None of the following kinds of symbols are needed in the + symbol table. */ + if (!TREE_PUBLIC (t) + || is_builtin_fn (t) + || DECL_ABSTRACT (t) + || TREE_CODE (t) == RESULT_DECL) + continue; + + gcc_assert (TREE_CODE (t) == VAR_DECL + || TREE_CODE (t) == FUNCTION_DECL); + + name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (t)); + + /* FIXME lto: this is from assemble_name_raw in varasm.c. For some + architectures we might have to do the same name manipulations that + ASM_OUTPUT_LABELREF does. */ + if (name[0] == '*') + name = &name[1]; + + lto_streamer_cache_lookup (cache, t, &slot_num); + gcc_assert (slot_num >= 0); + + /* Avoid duplicate symbols. */ + if (bitmap_bit_p (seen, slot_num)) + continue; + else + bitmap_set_bit (seen, slot_num); + + if (DECL_EXTERNAL (t)) + { + if (DECL_WEAK (t)) + kind = GCCPK_WEAKUNDEF; + else + kind = GCCPK_UNDEF; + } + else + { + if (DECL_WEAK (t)) + kind = GCCPK_WEAKDEF; + else if (DECL_COMMON (t)) + kind = GCCPK_COMMON; + else + kind = GCCPK_DEF; + } + + switch (DECL_VISIBILITY(t)) + { + case VISIBILITY_DEFAULT: + visibility = GCCPV_DEFAULT; + break; + case VISIBILITY_PROTECTED: + visibility = GCCPV_PROTECTED; + break; + case VISIBILITY_HIDDEN: + visibility = GCCPV_HIDDEN; + break; + case VISIBILITY_INTERNAL: + visibility = GCCPV_INTERNAL; + break; + } + + if (kind == GCCPK_COMMON && DECL_SIZE (t)) + size = (((uint64_t) TREE_INT_CST_HIGH (DECL_SIZE (t))) << 32) + | TREE_INT_CST_LOW (DECL_SIZE (t)); + else + size = 0; + + if (DECL_ONE_ONLY (t)) + comdat = IDENTIFIER_POINTER (DECL_COMDAT_GROUP (t)); + else + comdat = ""; + + lto_output_data_stream (stream, name, strlen (name) + 1); + lto_output_data_stream (stream, comdat, strlen (comdat) + 1); + lto_output_data_stream (stream, &kind, 1); + lto_output_data_stream (stream, &visibility, 1); + lto_output_data_stream (stream, &size, 8); + lto_output_data_stream (stream, &slot_num, 4); + } +} + + +/* Write IL symbols of KIND. CACHE is the streamer cache with all the + pickled nodes. SEEN is a bitmap of symbols written so far. */ + +static void +write_symbols_of_kind (lto_decl_stream_e_t kind, + struct lto_streamer_cache_d *cache, bitmap seen) +{ + struct lto_out_decl_state *out_state; + struct lto_output_stream stream; + unsigned num_fns = + VEC_length (lto_out_decl_state_ptr, lto_function_decl_states); + unsigned idx; + + memset (&stream, 0, sizeof (stream)); + out_state = lto_get_out_decl_state (); + write_symbol_vec (cache, &stream, out_state->streams[kind].trees, seen); + + for (idx = 0; idx < num_fns; idx++) + { + out_state = + VEC_index (lto_out_decl_state_ptr, lto_function_decl_states, idx); + write_symbol_vec (cache, &stream, out_state->streams[kind].trees, seen); + } + + lto_write_stream (&stream); +} + + +/* Write an IL symbol table. CACHE is the streamer cache with all the + pickled nodes. */ + +static void +produce_symtab (struct lto_streamer_cache_d *cache) +{ + char *section_name = lto_get_section_name (LTO_section_symtab, NULL); + bitmap seen; + + lto_begin_section (section_name, false); + free (section_name); + + seen = lto_bitmap_alloc (); + write_symbols_of_kind (LTO_DECL_STREAM_FN_DECL, cache, seen); + write_symbols_of_kind (LTO_DECL_STREAM_VAR_DECL, cache, seen); + lto_bitmap_free (seen); + + lto_end_section (); +} + + +/* This pass is run after all of the functions are serialized and all + of the IPA passes have written their serialized forms. This pass + causes the vector of all of the global decls and types used from + this file to be written in to a section that can then be read in to + recover these on other side. */ + +static void +produce_asm_for_decls (cgraph_node_set set) +{ + struct lto_out_decl_state *out_state; + struct lto_out_decl_state *fn_out_state; + struct lto_decl_header header; + char *section_name; + struct output_block *ob; + struct lto_output_stream *header_stream, *decl_state_stream; + unsigned idx, num_fns; + size_t decl_state_size; + int32_t num_decl_states; + + ob = create_output_block (LTO_section_decls); + ob->global = true; + + /* Write out unreferenced globals, alias pairs and labels. We defer + doing this until now so that we can write out only what is + needed. */ + output_unreferenced_globals (set); + + memset (&header, 0, sizeof (struct lto_decl_header)); + + section_name = lto_get_section_name (LTO_section_decls, NULL); + lto_begin_section (section_name, !flag_wpa); + free (section_name); + + /* Make string 0 be a NULL string. */ + lto_output_1_stream (ob->string_stream, 0); + + /* Write the global symbols. */ + out_state = lto_get_out_decl_state (); + num_fns = VEC_length (lto_out_decl_state_ptr, lto_function_decl_states); + lto_output_decl_state_streams (ob, out_state); + for (idx = 0; idx < num_fns; idx++) + { + fn_out_state = + VEC_index (lto_out_decl_state_ptr, lto_function_decl_states, idx); + lto_output_decl_state_streams (ob, fn_out_state); + } + + header.lto_header.major_version = LTO_major_version; + header.lto_header.minor_version = LTO_minor_version; + header.lto_header.section_type = LTO_section_decls; + + /* Currently not used. This field would allow us to preallocate + the globals vector, so that it need not be resized as it is extended. */ + header.num_nodes = -1; + + /* Compute the total size of all decl out states. */ + decl_state_size = sizeof (int32_t); + decl_state_size += lto_out_decl_state_written_size (out_state); + for (idx = 0; idx < num_fns; idx++) + { + fn_out_state = + VEC_index (lto_out_decl_state_ptr, lto_function_decl_states, idx); + decl_state_size += lto_out_decl_state_written_size (fn_out_state); + } + header.decl_state_size = decl_state_size; + + header.main_size = ob->main_stream->total_size; + header.string_size = ob->string_stream->total_size; + + header_stream = XCNEW (struct lto_output_stream); + lto_output_data_stream (header_stream, &header, sizeof header); + lto_write_stream (header_stream); + free (header_stream); + + /* Write the main out-decl state, followed by out-decl states of + functions. */ + decl_state_stream = ((struct lto_output_stream *) + xcalloc (1, sizeof (struct lto_output_stream))); + num_decl_states = num_fns + 1; + lto_output_data_stream (decl_state_stream, &num_decl_states, + sizeof (num_decl_states)); + lto_output_decl_state_refs (ob, decl_state_stream, out_state); + for (idx = 0; idx < num_fns; idx++) + { + fn_out_state = + VEC_index (lto_out_decl_state_ptr, lto_function_decl_states, idx); + lto_output_decl_state_refs (ob, decl_state_stream, fn_out_state); + } + lto_write_stream (decl_state_stream); + free(decl_state_stream); + + lto_write_stream (ob->main_stream); + lto_write_stream (ob->string_stream); + + lto_end_section (); + + /* Write the symbol table. */ + produce_symtab (ob->writer_cache); + + /* Write command line opts. */ + lto_write_options (); + + /* Deallocate memory and clean up. */ + lto_cgraph_encoder_delete (ob->decl_state->cgraph_node_encoder); + VEC_free (lto_out_decl_state_ptr, heap, lto_function_decl_states); + lto_function_decl_states = NULL; + destroy_output_block (ob); +} + + +struct ipa_opt_pass_d pass_ipa_lto_finish_out = +{ + { + IPA_PASS, + "lto_decls_out", /* name */ + gate_lto_out, /* gate */ + NULL, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_IPA_LTO_DECL_IO, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0 /* todo_flags_finish */ + }, + NULL, /* generate_summary */ + produce_asm_for_decls, /* write_summary */ + NULL, /* read_summary */ + NULL, /* function_read_summary */ + 0, /* TODOs */ + NULL, /* function_transform */ + NULL /* variable_transform */ +}; diff --git a/gcc/lto-streamer.c b/gcc/lto-streamer.c new file mode 100644 index 00000000000..36172c03131 --- /dev/null +++ b/gcc/lto-streamer.c @@ -0,0 +1,860 @@ +/* Miscellaneous utilities for GIMPLE streaming. Things that are used + in both input and output are here. + + Copyright 2009 Free Software Foundation, Inc. + Contributed by Doug Kwan + +This file is part of GCC. + +GCC 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. + +GCC 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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "toplev.h" +#include "flags.h" +#include "tree.h" +#include "gimple.h" +#include "tree-flow.h" +#include "diagnostic.h" +#include "bitmap.h" +#include "vec.h" +#include "lto-streamer.h" + +/* Statistics gathered during LTO, WPA and LTRANS. */ +struct lto_stats_d lto_stats; + +/* LTO uses bitmaps with different life-times. So use a seperate + obstack for all LTO bitmaps. */ +static bitmap_obstack lto_obstack; +static bool lto_obstack_initialized; + + +/* Return a string representing LTO tag TAG. */ + +const char * +lto_tag_name (enum LTO_tags tag) +{ + if (lto_tag_is_tree_code_p (tag)) + { + /* For tags representing tree nodes, return the name of the + associated tree code. */ + return tree_code_name[lto_tag_to_tree_code (tag)]; + } + + if (lto_tag_is_gimple_code_p (tag)) + { + /* For tags representing gimple statements, return the name of + the associated gimple code. */ + return gimple_code_name[lto_tag_to_gimple_code (tag)]; + } + + switch (tag) + { + case LTO_null: + return "LTO_null"; + case LTO_bb0: + return "LTO_bb0"; + case LTO_bb1: + return "LTO_bb1"; + case LTO_eh_region: + return "LTO_eh_region"; + case LTO_function: + return "LTO_function"; + case LTO_eh_table: + return "LTO_eh_table"; + case LTO_ert_cleanup: + return "LTO_ert_cleanup"; + case LTO_ert_try: + return "LTO_ert_try"; + case LTO_ert_allowed_exceptions: + return "LTO_ert_allowed_exceptions"; + case LTO_ert_must_not_throw: + return "LTO_ert_must_not_throw"; + case LTO_tree_pickle_reference: + return "LTO_tree_pickle_reference"; + case LTO_field_decl_ref: + return "LTO_field_decl_ref"; + case LTO_function_decl_ref: + return "LTO_function_decl_ref"; + case LTO_label_decl_ref: + return "LTO_label_decl_ref"; + case LTO_namespace_decl_ref: + return "LTO_namespace_decl_ref"; + case LTO_result_decl_ref: + return "LTO_result_decl_ref"; + case LTO_ssa_name_ref: + return "LTO_ssa_name_ref"; + case LTO_type_decl_ref: + return "LTO_type_decl_ref"; + case LTO_type_ref: + return "LTO_type_ref"; + case LTO_global_decl_ref: + return "LTO_global_decl_ref"; + default: + return "LTO_UNKNOWN"; + } +} + + +/* Allocate a bitmap from heap. Initializes the LTO obstack if necessary. */ + +bitmap +lto_bitmap_alloc (void) +{ + if (!lto_obstack_initialized) + { + bitmap_obstack_initialize (<o_obstack); + lto_obstack_initialized = true; + } + return BITMAP_ALLOC (<o_obstack); +} + +/* Free bitmap B. */ + +void +lto_bitmap_free (bitmap b) +{ + BITMAP_FREE (b); +} + + +/* Get a section name for a particular type or name. The NAME field + is only used if SECTION_TYPE is LTO_section_function_body or + LTO_static_initializer. For all others it is ignored. The callee + of this function is responcible to free the returned name. */ + +char * +lto_get_section_name (int section_type, const char *name) +{ + switch (section_type) + { + case LTO_section_function_body: + return concat (LTO_SECTION_NAME_PREFIX, name, NULL); + + case LTO_section_static_initializer: + return concat (LTO_SECTION_NAME_PREFIX, ".statics", NULL); + + case LTO_section_symtab: + return concat (LTO_SECTION_NAME_PREFIX, ".symtab", NULL); + + case LTO_section_decls: + return concat (LTO_SECTION_NAME_PREFIX, ".decls", NULL); + + case LTO_section_cgraph: + return concat (LTO_SECTION_NAME_PREFIX, ".cgraph", NULL); + + case LTO_section_ipa_pure_const: + return concat (LTO_SECTION_NAME_PREFIX, ".pureconst", NULL); + + case LTO_section_ipa_reference: + return concat (LTO_SECTION_NAME_PREFIX, ".reference", NULL); + + case LTO_section_wpa_fixup: + return concat (LTO_SECTION_NAME_PREFIX, ".wpa_fixup", NULL); + + case LTO_section_opts: + return concat (LTO_SECTION_NAME_PREFIX, ".opts", NULL); + + default: + internal_error ("bytecode stream: unexpected LTO section %s", name); + } +} + + +/* Show various memory usage statistics related to LTO. */ + +void +print_lto_report (void) +{ + const char *s = (flag_lto) ? "LTO" : (flag_wpa) ? "WPA" : "LTRANS"; + unsigned i; + + fprintf (stderr, "%s statistics\n", s); + fprintf (stderr, "[%s] # of input files: " + HOST_WIDE_INT_PRINT_UNSIGNED "\n", s, lto_stats.num_input_files); + + fprintf (stderr, "[%s] # of input cgraph nodes: " + HOST_WIDE_INT_PRINT_UNSIGNED "\n", s, + lto_stats.num_input_cgraph_nodes); + + fprintf (stderr, "[%s] # of function bodies: " + HOST_WIDE_INT_PRINT_UNSIGNED "\n", s, + lto_stats.num_function_bodies); + + fprintf (stderr, "[%s] ", s); + print_gimple_types_stats (); + + for (i = 0; i < NUM_TREE_CODES; i++) + if (lto_stats.num_trees[i]) + fprintf (stderr, "[%s] # of '%s' objects read: " + HOST_WIDE_INT_PRINT_UNSIGNED "\n", s, + tree_code_name[i], lto_stats.num_trees[i]); + + if (flag_lto) + { + fprintf (stderr, "[%s] Compression: " + HOST_WIDE_INT_PRINT_UNSIGNED " output bytes, " + HOST_WIDE_INT_PRINT_UNSIGNED " compressed bytes", s, + lto_stats.num_output_il_bytes, + lto_stats.num_compressed_il_bytes); + if (lto_stats.num_output_il_bytes > 0) + { + const float dividend = (float) lto_stats.num_compressed_il_bytes; + const float divisor = (float) lto_stats.num_output_il_bytes; + fprintf (stderr, " (ratio: %f)", dividend / divisor); + } + fprintf (stderr, "\n"); + } + + if (flag_wpa) + { + fprintf (stderr, "[%s] # of output files: " + HOST_WIDE_INT_PRINT_UNSIGNED "\n", s, + lto_stats.num_output_files); + + fprintf (stderr, "[%s] # of output cgraph nodes: " + HOST_WIDE_INT_PRINT_UNSIGNED "\n", s, + lto_stats.num_output_cgraph_nodes); + + fprintf (stderr, "[%s] # callgraph partitions: " + HOST_WIDE_INT_PRINT_UNSIGNED "\n", s, + lto_stats.num_cgraph_partitions); + + fprintf (stderr, "[%s] Compression: " + HOST_WIDE_INT_PRINT_UNSIGNED " input bytes, " + HOST_WIDE_INT_PRINT_UNSIGNED " uncompressed bytes", s, + lto_stats.num_input_il_bytes, + lto_stats.num_uncompressed_il_bytes); + if (lto_stats.num_input_il_bytes > 0) + { + const float dividend = (float) lto_stats.num_uncompressed_il_bytes; + const float divisor = (float) lto_stats.num_input_il_bytes; + fprintf (stderr, " (ratio: %f)", dividend / divisor); + } + fprintf (stderr, "\n"); + } + + for (i = 0; i < LTO_N_SECTION_TYPES; i++) + fprintf (stderr, "[%s] Size of mmap'd section %s: " + HOST_WIDE_INT_PRINT_UNSIGNED " bytes\n", s, + lto_section_name[i], lto_stats.section_size[i]); +} + + +/* Create a new bitpack. */ + +struct bitpack_d * +bitpack_create (void) +{ + return XCNEW (struct bitpack_d); +} + + +/* Free the memory used by bitpack BP. */ + +void +bitpack_delete (struct bitpack_d *bp) +{ + VEC_free (bitpack_word_t, heap, bp->values); + free (bp); +} + + +/* Return an index to the word in bitpack BP that contains the + next NBITS. */ + +static inline unsigned +bp_get_next_word (struct bitpack_d *bp, unsigned nbits) +{ + unsigned last, ix; + + /* In principle, the next word to use is determined by the + number of bits already processed in BP. */ + ix = bp->num_bits / BITS_PER_BITPACK_WORD; + + /* All the encoded bit patterns in BP are contiguous, therefore if + the next NBITS would straddle over two different words, move the + index to the next word and update the number of encoded bits + by adding up the hole of unused bits created by this move. */ + bp->first_unused_bit %= BITS_PER_BITPACK_WORD; + last = bp->first_unused_bit + nbits - 1; + if (last >= BITS_PER_BITPACK_WORD) + { + ix++; + bp->num_bits += (BITS_PER_BITPACK_WORD - bp->first_unused_bit); + bp->first_unused_bit = 0; + } + + return ix; +} + + +/* Pack NBITS of value VAL into bitpack BP. */ + +void +bp_pack_value (struct bitpack_d *bp, bitpack_word_t val, unsigned nbits) +{ + unsigned ix; + bitpack_word_t word; + + /* We cannot encode more bits than BITS_PER_BITPACK_WORD. */ + gcc_assert (nbits > 0 && nbits <= BITS_PER_BITPACK_WORD); + + /* Compute which word will contain the next NBITS. */ + ix = bp_get_next_word (bp, nbits); + if (ix >= VEC_length (bitpack_word_t, bp->values)) + { + /* If there is no room left in the last word of the values + array, add a new word. Additionally, we should only + need to add a single word, since every pack operation cannot + use more bits than fit in a single word. */ + gcc_assert (ix < VEC_length (bitpack_word_t, bp->values) + 1); + VEC_safe_push (bitpack_word_t, heap, bp->values, 0); + } + + /* Grab the last word to pack VAL into. */ + word = VEC_index (bitpack_word_t, bp->values, ix); + + /* To fit VAL in WORD, we need to shift VAL to the left to + skip the bottom BP->FIRST_UNUSED_BIT bits. */ + gcc_assert (BITS_PER_BITPACK_WORD >= bp->first_unused_bit + nbits); + val <<= bp->first_unused_bit; + + /* Update WORD with VAL. */ + word |= val; + + /* Update BP. */ + VEC_replace (bitpack_word_t, bp->values, ix, word); + bp->num_bits += nbits; + bp->first_unused_bit += nbits; +} + + +/* Unpack the next NBITS from bitpack BP. */ + +bitpack_word_t +bp_unpack_value (struct bitpack_d *bp, unsigned nbits) +{ + bitpack_word_t val, word, mask; + unsigned ix; + + /* We cannot decode more bits than BITS_PER_BITPACK_WORD. */ + gcc_assert (nbits > 0 && nbits <= BITS_PER_BITPACK_WORD); + + /* Compute which word contains the next NBITS. */ + ix = bp_get_next_word (bp, nbits); + word = VEC_index (bitpack_word_t, bp->values, ix); + + /* Compute the mask to get NBITS from WORD. */ + mask = (nbits == BITS_PER_BITPACK_WORD) + ? (bitpack_word_t) -1 + : ((bitpack_word_t) 1 << nbits) - 1; + + /* Shift WORD to the right to skip over the bits already decoded + in word. */ + word >>= bp->first_unused_bit; + + /* Apply the mask to obtain the requested value. */ + val = word & mask; + + /* Update BP->NUM_BITS for the next unpack operation. */ + bp->num_bits += nbits; + bp->first_unused_bit += nbits; + + return val; +} + + +/* Check that all the TS_* structures handled by the lto_output_* and + lto_input_* routines are exactly ALL the structures defined in + treestruct.def. */ + +static void +check_handled_ts_structures (void) +{ + bool handled_p[LAST_TS_ENUM]; + unsigned i; + + memset (&handled_p, 0, sizeof (handled_p)); + + /* These are the TS_* structures that are either handled or + explicitly ignored by the streamer routines. */ + handled_p[TS_BASE] = true; + handled_p[TS_COMMON] = true; + handled_p[TS_INT_CST] = true; + handled_p[TS_REAL_CST] = true; + handled_p[TS_FIXED_CST] = true; + handled_p[TS_VECTOR] = true; + handled_p[TS_STRING] = true; + handled_p[TS_COMPLEX] = true; + handled_p[TS_IDENTIFIER] = true; + handled_p[TS_DECL_MINIMAL] = true; + handled_p[TS_DECL_COMMON] = true; + handled_p[TS_DECL_WRTL] = true; + handled_p[TS_DECL_NON_COMMON] = true; + handled_p[TS_DECL_WITH_VIS] = true; + handled_p[TS_FIELD_DECL] = true; + handled_p[TS_VAR_DECL] = true; + handled_p[TS_PARM_DECL] = true; + handled_p[TS_LABEL_DECL] = true; + handled_p[TS_RESULT_DECL] = true; + handled_p[TS_CONST_DECL] = true; + handled_p[TS_TYPE_DECL] = true; + handled_p[TS_FUNCTION_DECL] = true; + handled_p[TS_TYPE] = true; + handled_p[TS_LIST] = true; + handled_p[TS_VEC] = true; + handled_p[TS_EXP] = true; + handled_p[TS_SSA_NAME] = true; + handled_p[TS_BLOCK] = true; + handled_p[TS_BINFO] = true; + handled_p[TS_STATEMENT_LIST] = true; + handled_p[TS_CONSTRUCTOR] = true; + handled_p[TS_OMP_CLAUSE] = true; + handled_p[TS_OPTIMIZATION] = true; + handled_p[TS_TARGET_OPTION] = true; + + /* Anything not marked above will trigger the following assertion. + If this assertion triggers, it means that there is a new TS_* + structure that should be handled by the streamer. */ + for (i = 0; i < LAST_TS_ENUM; i++) + gcc_assert (handled_p[i]); +} + + +/* Helper for lto_streamer_cache_insert_1. Add T to CACHE->NODES at + slot IX. Add OFFSET to CACHE->OFFSETS at slot IX. */ + +static void +lto_streamer_cache_add_to_node_array (struct lto_streamer_cache_d *cache, + int ix, tree t, unsigned offset) +{ + gcc_assert (ix >= 0); + + /* Grow the array of nodes and offsets to accomodate T at IX. */ + if (ix >= (int) VEC_length (tree, cache->nodes)) + { + size_t sz = ix + (20 + ix) / 4; + VEC_safe_grow_cleared (tree, gc, cache->nodes, sz); + VEC_safe_grow_cleared (unsigned, heap, cache->offsets, sz); + } + + VEC_replace (tree, cache->nodes, ix, t); + VEC_replace (unsigned, cache->offsets, ix, offset); +} + + +/* Helper for lto_streamer_cache_insert and lto_streamer_cache_insert_at. + CACHE, T, IX_P and OFFSET_P are as in lto_streamer_cache_insert. + + If INSERT_AT_NEXT_SLOT_P is true, T is inserted at the next available + slot in the cache. Otherwise, T is inserted at the position indicated + in *IX_P. + + If T already existed in CACHE, return true. Otherwise, + return false. */ + +static bool +lto_streamer_cache_insert_1 (struct lto_streamer_cache_d *cache, + tree t, int *ix_p, unsigned *offset_p, + bool insert_at_next_slot_p) +{ + void **slot; + struct tree_int_map d_entry, *entry; + int ix; + unsigned offset; + bool existed_p; + + gcc_assert (t); + + d_entry.base.from = t; + slot = htab_find_slot (cache->node_map, &d_entry, INSERT); + if (*slot == NULL) + { + /* Determine the next slot to use in the cache. */ + if (insert_at_next_slot_p) + ix = cache->next_slot++; + else + ix = *ix_p; + + entry = XCNEW (struct tree_int_map); + entry->base.from = t; + entry->to = (unsigned) ix; + *slot = entry; + + /* If no offset was given, store the invalid offset -1. */ + offset = (offset_p) ? *offset_p : (unsigned) -1; + + lto_streamer_cache_add_to_node_array (cache, ix, t, offset); + + /* Indicate that the item was not present in the cache. */ + existed_p = false; + } + else + { + entry = (struct tree_int_map *) *slot; + ix = (int) entry->to; + offset = VEC_index (unsigned, cache->offsets, ix); + + if (!insert_at_next_slot_p && ix != *ix_p) + { + /* If the caller wants to insert T at a specific slot + location, and ENTRY->TO does not match *IX_P, add T to + the requested location slot. This situation arises when + streaming builtin functions. + + For instance, on the writer side we could have two + FUNCTION_DECLS T1 and T2 that are represented by the same + builtin function. The reader will only instantiate the + canonical builtin, but since T1 and T2 had been + originally stored in different cache slots (S1 and S2), + the reader must be able to find the canonical builtin + function at slots S1 and S2. */ + gcc_assert (lto_stream_as_builtin_p (t)); + ix = *ix_p; + + /* Since we are storing a builtin, the offset into the + stream is not necessary as we will not need to read + forward in the stream. */ + lto_streamer_cache_add_to_node_array (cache, ix, t, -1); + } + + /* Indicate that T was already in the cache. */ + existed_p = true; + } + + if (ix_p) + *ix_p = ix; + + if (offset_p) + *offset_p = offset; + + return existed_p; +} + + +/* Insert tree node T in CACHE. If T already existed in the cache + return true. Otherwise, return false. + + If IX_P is non-null, update it with the index into the cache where + T has been stored. + + *OFFSET_P represents the offset in the stream where T is physically + written out. The first time T is added to the cache, *OFFSET_P is + recorded in the cache together with T. But if T already existed + in the cache, *OFFSET_P is updated with the value that was recorded + the first time T was added to the cache. + + If OFFSET_P is NULL, it is ignored. */ + +bool +lto_streamer_cache_insert (struct lto_streamer_cache_d *cache, tree t, + int *ix_p, unsigned *offset_p) +{ + return lto_streamer_cache_insert_1 (cache, t, ix_p, offset_p, true); +} + + +/* Insert tree node T in CACHE at slot IX. If T already + existed in the cache return true. Otherwise, return false. */ + +bool +lto_streamer_cache_insert_at (struct lto_streamer_cache_d *cache, + tree t, int ix) +{ + return lto_streamer_cache_insert_1 (cache, t, &ix, NULL, false); +} + + +/* Return true if tree node T exists in CACHE. If IX_P is + not NULL, write to *IX_P the index into the cache where T is stored + (-1 if T is not found). */ + +bool +lto_streamer_cache_lookup (struct lto_streamer_cache_d *cache, tree t, + int *ix_p) +{ + void **slot; + struct tree_int_map d_slot; + bool retval; + int ix; + + gcc_assert (t); + + d_slot.base.from = t; + slot = htab_find_slot (cache->node_map, &d_slot, NO_INSERT); + if (slot == NULL) + { + retval = false; + ix = -1; + } + else + { + retval = true; + ix = (int) ((struct tree_int_map *) *slot)->to; + } + + if (ix_p) + *ix_p = ix; + + return retval; +} + + +/* Return the tree node at slot IX in CACHE. */ + +tree +lto_streamer_cache_get (struct lto_streamer_cache_d *cache, int ix) +{ + gcc_assert (cache); + + /* If the reader is requesting an index beyond the length of the + cache, it will need to read ahead. Return NULL_TREE to indicate + that. */ + if ((unsigned) ix >= VEC_length (tree, cache->nodes)) + return NULL_TREE; + + return VEC_index (tree, cache->nodes, (unsigned) ix); +} + + +/* Record NODE in COMMON_NODES if it is not NULL and is not already in + SEEN_NODES. */ + +static void +lto_record_common_node (tree *nodep, VEC(tree, heap) **common_nodes, + struct pointer_set_t *seen_nodes) +{ + tree node = *nodep; + + if (node == NULL_TREE) + return; + + if (TYPE_P (node)) + *nodep = node = gimple_register_type (node); + + /* Return if node is already seen. */ + if (pointer_set_insert (seen_nodes, node)) + return; + + VEC_safe_push (tree, heap, *common_nodes, node); + + if (tree_node_can_be_shared (node)) + { + if (POINTER_TYPE_P (node) + || TREE_CODE (node) == COMPLEX_TYPE + || TREE_CODE (node) == ARRAY_TYPE) + lto_record_common_node (&TREE_TYPE (node), common_nodes, seen_nodes); + } +} + + +/* Generate a vector of common nodes and make sure they are merged + properly according to the the gimple type table. */ + +static VEC(tree,heap) * +lto_get_common_nodes (void) +{ + unsigned i; + VEC(tree,heap) *common_nodes = NULL; + struct pointer_set_t *seen_nodes; + + /* The MAIN_IDENTIFIER_NODE is normally set up by the front-end, but the + LTO back-end must agree. Currently, the only languages that set this + use the name "main". */ + if (main_identifier_node) + { + const char *main_name = IDENTIFIER_POINTER (main_identifier_node); + gcc_assert (strcmp (main_name, "main") == 0); + } + else + main_identifier_node = get_identifier ("main"); + + gcc_assert (ptrdiff_type_node == integer_type_node); + + /* FIXME lto. In the C++ front-end, fileptr_type_node is defined as a + variant copy of of ptr_type_node, rather than ptr_node itself. The + distinction should only be relevant to the front-end, so we always + use the C definition here in lto1. + + These should be assured in pass_ipa_free_lang_data. */ + gcc_assert (fileptr_type_node == ptr_type_node); + gcc_assert (TYPE_MAIN_VARIANT (fileptr_type_node) == ptr_type_node); + + seen_nodes = pointer_set_create (); + + /* Skip itk_char. char_type_node is shared with the appropriately + signed variant. */ + for (i = itk_signed_char; i < itk_none; i++) + lto_record_common_node (&integer_types[i], &common_nodes, seen_nodes); + + for (i = 0; i < TYPE_KIND_LAST; i++) + lto_record_common_node (&sizetype_tab[i], &common_nodes, seen_nodes); + + for (i = 0; i < TI_MAX; i++) + lto_record_common_node (&global_trees[i], &common_nodes, seen_nodes); + + pointer_set_destroy (seen_nodes); + + return common_nodes; +} + + +/* Assign an index to tree node T and enter it in the streamer cache + CACHE. */ + +static void +preload_common_node (struct lto_streamer_cache_d *cache, tree t) +{ + gcc_assert (t); + + lto_streamer_cache_insert (cache, t, NULL, NULL); + + /* The FIELD_DECLs of structures should be shared, so that every + COMPONENT_REF uses the same tree node when referencing a field. + Pointer equality between FIELD_DECLs is used by the alias + machinery to compute overlapping memory references (See + nonoverlapping_component_refs_p). */ + if (TREE_CODE (t) == RECORD_TYPE) + { + tree f; + + for (f = TYPE_FIELDS (t); f; f = TREE_CHAIN (f)) + preload_common_node (cache, f); + } +} + + +/* Create a cache of pickled nodes. */ + +struct lto_streamer_cache_d * +lto_streamer_cache_create (void) +{ + struct lto_streamer_cache_d *cache; + VEC(tree, heap) *common_nodes; + unsigned i; + tree node; + + cache = XCNEW (struct lto_streamer_cache_d); + + cache->node_map = htab_create (101, tree_int_map_hash, tree_int_map_eq, NULL); + + /* Load all the well-known tree nodes that are always created by + the compiler on startup. This prevents writing them out + unnecessarily. */ + common_nodes = lto_get_common_nodes (); + + for (i = 0; VEC_iterate (tree, common_nodes, i, node); i++) + preload_common_node (cache, node); + + VEC_free(tree, heap, common_nodes); + + return cache; +} + + +/* Delete the streamer cache C. */ + +void +lto_streamer_cache_delete (struct lto_streamer_cache_d *c) +{ + if (c == NULL) + return; + + htab_delete (c->node_map); + VEC_free (tree, gc, c->nodes); + VEC_free (unsigned, heap, c->offsets); + free (c); +} + + +/* Initialization common to the LTO reader and writer. */ + +void +lto_streamer_init (void) +{ + /* Check that all the TS_* handled by the reader and writer routines + match exactly the structures defined in treestruct.def. When a + new TS_* astructure is added, the streamer should be updated to + handle it. */ + check_handled_ts_structures (); +} + + +/* Gate function for all LTO streaming passes. */ + +bool +gate_lto_out (void) +{ + return ((flag_generate_lto || in_lto_p) + /* Don't bother doing anything if the program has errors. */ + && !(errorcount || sorrycount)); +} + + +#ifdef LTO_STREAMER_DEBUG +/* Add a mapping between T and ORIG_T, which is the numeric value of + the original address of T as it was seen by the LTO writer. This + mapping is useful when debugging streaming problems. A debugging + session can be started on both reader and writer using ORIG_T + as a breakpoint value in both sessions. + + Note that this mapping is transient and only valid while T is + being reconstructed. Once T is fully built, the mapping is + removed. */ + +void +lto_orig_address_map (tree t, intptr_t orig_t) +{ + /* FIXME lto. Using the annotation field is quite hacky as it relies + on the GC not running while T is being rematerialized. It would + be cleaner to use a hash table here. */ + t->base.ann = (union tree_ann_d *) orig_t; +} + + +/* Get the original address of T as it was seen by the writer. This + is only valid while T is being reconstructed. */ + +intptr_t +lto_orig_address_get (tree t) +{ + return (intptr_t) t->base.ann; +} + + +/* Clear the mapping of T to its original address. */ + +void +lto_orig_address_remove (tree t) +{ + t->base.ann = NULL; +} +#endif + + +/* Check that the version MAJOR.MINOR is the correct version number. */ + +void +lto_check_version (int major, int minor) +{ + if (major != LTO_major_version || minor != LTO_minor_version) + fatal_error ("bytecode stream generated with LTO version %d.%d instead " + "of the expected %d.%d", + major, minor, + LTO_major_version, LTO_minor_version); +} diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h new file mode 100644 index 00000000000..b156ff42455 --- /dev/null +++ b/gcc/lto-streamer.h @@ -0,0 +1,1054 @@ +/* Data structures and declarations used for reading and writing + GIMPLE to a file stream. + + Copyright (C) 2009 Free Software Foundation, Inc. + Contributed by Doug Kwan + +This file is part of GCC. + +GCC 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. + +GCC 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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_LTO_STREAMER_H +#define GCC_LTO_STREAMER_H + +#include "plugin-api.h" +#include "tree.h" +#include "gimple.h" +#include "target.h" +#include "cgraph.h" +#include "vec.h" +#include "vecprim.h" + +/* Define when debugging the LTO streamer. This causes the writer + to output the numeric value for the memory address of the tree node + being emitted. When debugging a problem in the reader, check the + original address that the writer was emitting using lto_orig_address_get. + With this value, set a breakpoint in the writer (e.g., lto_output_tree) + to trace how the faulty node is being emitted. */ +/* #define LTO_STREAMER_DEBUG 1 */ + +/* The encoding for a function consists of the following sections: + + 1) The header. + 2) FIELD_DECLS. + 3) FUNCTION_DECLS. + 4) global VAR_DECLS. + 5) type_decls + 6) types. + 7) Names for the labels that have names + 8) The SSA names. + 9) The control flow graph. + 10-11)Gimple for local decls. + 12) Gimple for the function. + 13) Strings. + + 1) THE HEADER. + 2-6) THE GLOBAL DECLS AND TYPES. + + The global decls and types are encoded in the same way. For each + entry, there is word with the offset within the section to the + entry. + + 7) THE LABEL NAMES. + + Since most labels do not have names, this section my be of zero + length. It consists of an array of string table references, one + per label. In the lto code, the labels are given either + positive or negative indexes. the positive ones have names and + the negative ones do not. The positive index can be used to + find the name in this array. + + 9) THE CFG. + + 10) Index into the local decls. Since local decls can have local + decls inside them, they must be read in randomly in order to + properly restore them. + + 11-12) GIMPLE FOR THE LOCAL DECLS AND THE FUNCTION BODY. + + The gimple consists of a set of records. + + THE FUNCTION + + At the top level of (8) is the function. It consists of five + pieces: + + LTO_function - The tag. + eh tree - This is all of the exception handling regions + put out in a post order traversial of the + tree. Siblings are output as lists terminated + by a 0. The set of fields matches the fields + defined in except.c. + + last_basic_block - in uleb128 form. + + basic blocks - This is the set of basic blocks. + + zero - The termination of the basic blocks. + + BASIC BLOCKS + + There are two forms of basic blocks depending on if they are + empty or not. + + The basic block consists of: + + LTO_bb1 or LTO_bb0 - The tag. + + bb->index - the index in uleb128 form. + + #succs - The number of successors un uleb128 form. + + the successors - For each edge, a pair. The first of the + pair is the index of the successor in + uleb128 form and the second are the flags in + uleb128 form. + + the statements - A gimple tree, as described above. + These are only present for LTO_BB1. + Following each statement is an optional + exception handling record LTO_eh_region + which contains the region number (for + regions >= 0). + + zero - This is only present for LTO_BB1 and is used + to terminate the statements and exception + regions within this block. + + 12) STRINGS + + String are represented in the table as pairs, a length in ULEB128 + form followed by the data for the string. */ + +/* The string that is the prefix on the section names we make for lto. + For decls the DECL_ASSEMBLER_NAME is appended to make the section + name for the functions and static_initializers. For other types of + sections a '.' and the section type are appended. */ +#define LTO_SECTION_NAME_PREFIX ".gnu.lto_" + +#define LTO_major_version 1 +#define LTO_minor_version 0 + +typedef unsigned char lto_decl_flags_t; + + +/* Data structures used to pack values and bitflags into a vector of + words. Used to stream values of a fixed number of bits in a space + efficient way. */ +static unsigned const BITS_PER_BITPACK_WORD = HOST_BITS_PER_WIDE_INT; + +typedef unsigned HOST_WIDE_INT bitpack_word_t; +DEF_VEC_I(bitpack_word_t); +DEF_VEC_ALLOC_I(bitpack_word_t, heap); + +struct bitpack_d +{ + /* Total number of bits packed/unpacked so far. */ + size_t num_bits; + + /* Values are stored contiguously, so there may be internal + fragmentation (words with unused bits). Therefore, we need to + keep track of the first available bit in the last word of the + bitpack. */ + size_t first_unused_bit; + + /* Vector of words holding the packed values. */ + VEC(bitpack_word_t, heap) *values; +}; + +/* Tags representing the various IL objects written to the bytecode file + (GIMPLE statements, basic blocks, EH regions, tree nodes, etc). + + NOTE, when adding new LTO tags, also update lto_tag_name. */ +enum LTO_tags +{ + LTO_null = 0, + + /* Reserve enough entries to fit all the tree and gimple codes handled + by the streamer. This guarantees that: + + 1- Given a tree code C: + enum LTO_tags tag == C + 1 + + 2- Given a gimple code C: + enum LTO_tags tag == C + NUM_TREE_CODES + 1 + + Conversely, to map between LTO tags and tree/gimple codes, the + reverse operation must be applied. */ + LTO_bb0 = 1 + NUM_TREE_CODES + LAST_AND_UNUSED_GIMPLE_CODE, + LTO_bb1, + + /* EH region holding the previous statement. */ + LTO_eh_region, + + /* An MD or NORMAL builtin. Only the code and class are streamed out. */ + LTO_builtin_decl, + + /* Function body. */ + LTO_function, + + /* EH table. */ + LTO_eh_table, + + /* EH region types. These mirror enum eh_region_type. */ + LTO_ert_cleanup, + LTO_ert_try, + LTO_ert_allowed_exceptions, + LTO_ert_must_not_throw, + + /* EH landing pad. */ + LTO_eh_landing_pad, + + /* EH try/catch node. */ + LTO_eh_catch, + + /* Special for global streamer. Reference to previously-streamed node. */ + LTO_tree_pickle_reference, + + /* References to indexable tree nodes. These objects are stored in + tables that are written separately from the function bodies that + reference them. This way they can be instantiated even when the + referencing functions aren't (e.g., during WPA) and it also allows + functions to be copied from one file to another without having + to unpickle the body first (the references are location + independent). + + NOTE, do not regroup these values as the grouping is exposed + in the range checks done in lto_input_tree. */ + LTO_field_decl_ref, /* Do not change. */ + LTO_function_decl_ref, + LTO_label_decl_ref, + LTO_namespace_decl_ref, + LTO_result_decl_ref, + LTO_ssa_name_ref, + LTO_type_decl_ref, + LTO_type_ref, + LTO_const_decl_ref, + LTO_imported_decl_ref, + LTO_global_decl_ref, /* Do not change. */ + + /* This tag must always be last. */ + LTO_NUM_TAGS +}; + + +/* Set of section types that are in an LTO file. This list will grow + as the number of IPA passes grows since each IPA pass will need its + own section type to store its summary information. + + When adding a new section type, you must also extend the + LTO_SECTION_NAME array in lto-section-in.c. */ +enum lto_section_type +{ + LTO_section_decls = 0, + LTO_section_function_body, + LTO_section_static_initializer, + LTO_section_cgraph, + LTO_section_ipa_pure_const, + LTO_section_ipa_reference, + LTO_section_symtab, + LTO_section_wpa_fixup, + LTO_section_opts, + LTO_N_SECTION_TYPES /* Must be last. */ +}; + +/* Indices to the various function, type and symbol streams. */ +typedef enum +{ + LTO_DECL_STREAM_TYPE = 0, /* Must be first. */ + LTO_DECL_STREAM_FIELD_DECL, + LTO_DECL_STREAM_FN_DECL, + LTO_DECL_STREAM_VAR_DECL, + LTO_DECL_STREAM_TYPE_DECL, + LTO_DECL_STREAM_NAMESPACE_DECL, + LTO_DECL_STREAM_LABEL_DECL, + LTO_N_DECL_STREAMS +} lto_decl_stream_e_t; + +typedef enum ld_plugin_symbol_resolution ld_plugin_symbol_resolution_t; +DEF_VEC_I(ld_plugin_symbol_resolution_t); +DEF_VEC_ALLOC_I(ld_plugin_symbol_resolution_t, heap); + + +/* Macro to define convenience functions for type and decl streams + in lto_file_decl_data. */ +#define DEFINE_DECL_STREAM_FUNCS(UPPER_NAME, name) \ +static inline tree \ +lto_file_decl_data_get_ ## name (struct lto_file_decl_data *data, \ + unsigned int idx) \ +{ \ + struct lto_in_decl_state *state = data->current_decl_state; \ + gcc_assert (idx < state->streams[LTO_DECL_STREAM_## UPPER_NAME].size); \ + return state->streams[LTO_DECL_STREAM_## UPPER_NAME].trees[idx]; \ +} \ +\ +static inline unsigned int \ +lto_file_decl_data_num_ ## name ## s (struct lto_file_decl_data *data) \ +{ \ + struct lto_in_decl_state *state = data->current_decl_state; \ + return state->streams[LTO_DECL_STREAM_## UPPER_NAME].size; \ +} + + +/* Return a char pointer to the start of a data stream for an lto pass + or function. The first parameter is the file data that contains + the information. The second parameter is the type of information + to be obtained. The third parameter is the name of the function + and is only used when finding a function body; otherwise it is + NULL. The fourth parameter is the length of the data returned. */ +typedef const char* (lto_get_section_data_f) (struct lto_file_decl_data *, + enum lto_section_type, + const char *, + size_t *); + +/* Return the data found from the above call. The first three + parameters are the same as above. The fourth parameter is the data + itself and the fifth is the lenght of the data. */ +typedef void (lto_free_section_data_f) (struct lto_file_decl_data *, + enum lto_section_type, + const char *, + const char *, + size_t); + +/* Cache of pickled nodes. Used to avoid writing the same node more + than once. The first time a tree node is streamed out, it is + entered in this cache. Subsequent references to the same node are + resolved by looking it up in this cache. + + This is used in two ways: + + - On the writing side, the first time T is added to STREAMER_CACHE, + a new reference index is created for T and T is emitted on the + stream. If T needs to be emitted again to the stream, instead of + pickling it again, the reference index is emitted. + + - On the reading side, the first time T is read from the stream, it + is reconstructed in memory and a new reference index created for + T. The reconstructed T is inserted in some array so that when + the reference index for T is found in the input stream, it can be + used to look up into the array to get the reconstructed T. */ +struct lto_streamer_cache_d +{ + /* The mapping between tree nodes and slots into the nodes array. */ + htab_t node_map; + + /* Next available slot in the nodes and offsets arrays. */ + unsigned next_slot; + + /* The nodes pickled so far. */ + VEC(tree,gc) *nodes; + + /* Offset into the stream where the nodes have been written. */ + VEC(unsigned,heap) *offsets; +}; + + +/* Structure used as buffer for reading an LTO file. */ +struct lto_input_block +{ + const char *data; + unsigned int p; + unsigned int len; +}; + +#define LTO_INIT_INPUT_BLOCK(BASE,D,P,L) \ + do { \ + BASE.data = D; \ + BASE.p = P; \ + BASE.len = L; \ + } while (0) + +#define LTO_INIT_INPUT_BLOCK_PTR(BASE,D,P,L) \ + do { \ + BASE->data = D; \ + BASE->p = P; \ + BASE->len = L; \ + } while (0) + + +/* The is the first part of the record for a function or constructor + in the .o file. */ +struct lto_header +{ + int16_t major_version; + int16_t minor_version; + enum lto_section_type section_type; +}; + +/* The header for a function body. */ +struct lto_function_header +{ + /* The header for all types of sections. */ + struct lto_header lto_header; + + /* Number of labels with names. */ + int32_t num_named_labels; + + /* Number of labels without names. */ + int32_t num_unnamed_labels; + + /* Size compressed or 0 if not compressed. */ + int32_t compressed_size; + + /* Size of names for named labels. */ + int32_t named_label_size; + + /* Size of the cfg. */ + int32_t cfg_size; + + /* Size of main gimple body of function. */ + int32_t main_size; + + /* Size of the string table. */ + int32_t string_size; +}; + + +/* Structure describing a symbol section. */ +struct lto_decl_header +{ + /* The header for all types of sections. */ + struct lto_header lto_header; + + /* Size of region for decl state. */ + int32_t decl_state_size; + + /* Number of nodes in globals stream. */ + int32_t num_nodes; + + /* Size of region for expressions, decls, types, etc. */ + int32_t main_size; + + /* Size of the string table. */ + int32_t string_size; +}; + + +/* Statistics gathered during LTO, WPA and LTRANS. */ +struct lto_stats_d +{ + unsigned HOST_WIDE_INT num_input_cgraph_nodes; + unsigned HOST_WIDE_INT num_output_cgraph_nodes; + unsigned HOST_WIDE_INT num_input_files; + unsigned HOST_WIDE_INT num_output_files; + unsigned HOST_WIDE_INT num_cgraph_partitions; + unsigned HOST_WIDE_INT section_size[LTO_N_SECTION_TYPES]; + unsigned HOST_WIDE_INT num_function_bodies; + unsigned HOST_WIDE_INT num_trees[NUM_TREE_CODES]; + unsigned HOST_WIDE_INT num_output_il_bytes; + unsigned HOST_WIDE_INT num_compressed_il_bytes; + unsigned HOST_WIDE_INT num_input_il_bytes; + unsigned HOST_WIDE_INT num_uncompressed_il_bytes; +}; + +/* Encoder data structure used to stream callgraph nodes. */ +struct lto_cgraph_encoder_d +{ + /* Map nodes to reference number. */ + struct pointer_map_t *map; + + /* Map reference number to node. */ + VEC(cgraph_node_ptr,heap) *nodes; +}; + +typedef struct lto_cgraph_encoder_d *lto_cgraph_encoder_t; + +/* Mapping from indices to trees. */ +struct lto_tree_ref_table +{ + /* Array of referenced trees . */ + tree *trees; + + /* Size of array. */ + unsigned int size; +}; + + +/* Mapping between trees and slots in an array. */ +struct lto_decl_slot +{ + tree t; + int slot_num; +}; + + +/* The lto_tree_ref_encoder struct is used to encode trees into indices. */ + +struct lto_tree_ref_encoder +{ + htab_t tree_hash_table; /* Maps pointers to indices. */ + unsigned int next_index; /* Next available index. */ + VEC(tree,heap) *trees; /* Maps indices to pointers. */ +}; + + +/* Structure to hold states of input scope. */ +struct lto_in_decl_state +{ + /* Array of lto_in_decl_buffers to store type and decls streams. */ + struct lto_tree_ref_table streams[LTO_N_DECL_STREAMS]; + + /* If this in-decl state is associated with a function. FN_DECL + point to the FUNCTION_DECL. */ + tree fn_decl; +}; + +typedef struct lto_in_decl_state *lto_in_decl_state_ptr; + + +/* The structure that holds all of the vectors of global types, + decls and cgraph nodes used in the serialization of this file. */ +struct lto_out_decl_state +{ + /* The buffers contain the sets of decls of various kinds and types we have + seen so far and the indexes assigned to them. */ + struct lto_tree_ref_encoder streams[LTO_N_DECL_STREAMS]; + + /* Encoder for cgraph nodes. */ + lto_cgraph_encoder_t cgraph_node_encoder; + + /* If this out-decl state belongs to a function, fn_decl points to that + function. Otherwise, it is NULL. */ + tree fn_decl; +}; + +typedef struct lto_out_decl_state *lto_out_decl_state_ptr; + +DEF_VEC_P(lto_out_decl_state_ptr); +DEF_VEC_ALLOC_P(lto_out_decl_state_ptr, heap); + +/* One of these is allocated for each object file that being compiled + by lto. This structure contains the tables that are needed by the + serialized functions and ipa passes to connect themselves to the + global types and decls as they are reconstituted. */ +struct lto_file_decl_data +{ + /* Decl state currently used. */ + struct lto_in_decl_state *current_decl_state; + + /* Decl state corresponding to regions outside of any functions + in the compilation unit. */ + struct lto_in_decl_state *global_decl_state; + + /* Table of cgraph nodes present in this file. */ + lto_cgraph_encoder_t cgraph_node_encoder; + + /* Hash table maps lto-related section names to location in file. */ + htab_t function_decl_states; + + /* The .o file that these offsets relate to. */ + const char *file_name; + + /* Nonzero if this file should be recompiled with LTRANS. */ + unsigned needs_ltrans_p : 1; + + /* If the file is open, this is the fd of the mapped section. This + is -1 if the file has not yet been opened. */ + int fd; + + /* Hash table maps lto-related section names to location in file. */ + htab_t section_hash_table; + + /* Hash new name of renamed global declaration to its original name. */ + htab_t renaming_hash_table; +}; + +struct lto_char_ptr_base +{ + char *ptr; +}; + +/* An incore byte stream to buffer the various parts of the function. + The entire structure should be zeroed when created. The record + consists of a set of blocks. The first sizeof (ptr) bytes are used + as a chain, and the rest store the bytes to be written. */ +struct lto_output_stream +{ + /* The pointer to the first block in the stream. */ + struct lto_char_ptr_base * first_block; + + /* The pointer to the last and current block in the stream. */ + struct lto_char_ptr_base * current_block; + + /* The pointer to where the next char should be written. */ + char * current_pointer; + + /* The number of characters left in the current block. */ + unsigned int left_in_block; + + /* The block size of the last block allocated. */ + unsigned int block_size; + + /* The total number of characters written. */ + unsigned int total_size; +}; + +/* The is the first part of the record in an LTO file for many of the + IPA passes. */ +struct lto_simple_header +{ + /* The header for all types of sections. */ + struct lto_header lto_header; + + /* Size of main gimple body of function. */ + int32_t main_size; + + /* Size of main stream when compressed. */ + int32_t compressed_size; +}; + +/* A simple output block. This can be used for simple IPA passes that + do not need more than one stream. */ +struct lto_simple_output_block +{ + enum lto_section_type section_type; + struct lto_out_decl_state *decl_state; + + /* The stream that the main tree codes are written to. */ + struct lto_output_stream *main_stream; +}; + +/* Data structure holding all the data and descriptors used when writing + an LTO file. */ +struct output_block +{ + enum lto_section_type section_type; + struct lto_out_decl_state *decl_state; + + /* The stream that the main tree codes are written to. */ + struct lto_output_stream *main_stream; + + /* The stream that contains the string table. */ + struct lto_output_stream *string_stream; + + /* The stream that contains the cfg. */ + struct lto_output_stream *cfg_stream; + + /* The hash table that contains the set of strings we have seen so + far and the indexes assigned to them. */ + htab_t string_hash_table; + + /* The current cgraph_node that we are currently serializing. Null + if we are serializing something else. */ + struct cgraph_node *cgraph_node; + + /* These are the last file and line that were seen in the stream. + If the current node differs from these, it needs to insert + something into the stream and fix these up. */ + const char *current_file; + int current_line; + int current_col; + + /* True if writing globals and types. */ + bool global; + + /* Cache of nodes written in this section. */ + struct lto_streamer_cache_d *writer_cache; +}; + + +/* Data and descriptors used when reading from an LTO file. */ +struct data_in +{ + /* The global decls and types. */ + struct lto_file_decl_data *file_data; + + /* All of the labels. */ + tree *labels; + + /* The string table. */ + const char *strings; + + /* The length of the string table. */ + unsigned int strings_len; + + /* Number of named labels. Used to find the index of unnamed labels + since they share space with the named labels. */ + unsigned int num_named_labels; + + /* Number of unnamed labels. */ + unsigned int num_unnamed_labels; + + const char *current_file; + int current_line; + int current_col; + + /* Maps each reference number to the resolution done by the linker. */ + VEC(ld_plugin_symbol_resolution_t,heap) *globals_resolution; + + /* Cache of pickled nodes. */ + struct lto_streamer_cache_d *reader_cache; +}; + + +/* In lto-section-in.c */ +extern struct lto_input_block * lto_create_simple_input_block ( + struct lto_file_decl_data *, + enum lto_section_type, const char **, size_t *); +extern void +lto_destroy_simple_input_block (struct lto_file_decl_data *, + enum lto_section_type, + struct lto_input_block *, const char *, size_t); +extern void lto_set_in_hooks (struct lto_file_decl_data **, + lto_get_section_data_f *, + lto_free_section_data_f *); +extern struct lto_file_decl_data **lto_get_file_decl_data (void); +extern const char *lto_get_section_data (struct lto_file_decl_data *, + enum lto_section_type, + const char *, size_t *); +extern void lto_free_section_data (struct lto_file_decl_data *, + enum lto_section_type, + const char *, const char *, size_t); +extern unsigned char lto_input_1_unsigned (struct lto_input_block *); +extern unsigned HOST_WIDE_INT lto_input_uleb128 (struct lto_input_block *); +extern unsigned HOST_WIDEST_INT lto_input_widest_uint_uleb128 ( + struct lto_input_block *); +extern HOST_WIDE_INT lto_input_sleb128 (struct lto_input_block *); +extern htab_t lto_create_renaming_table (void); +extern void lto_record_renamed_decl (struct lto_file_decl_data *, + const char *, const char *); +extern const char *lto_get_decl_name_mapping (struct lto_file_decl_data *, + const char *); +extern struct lto_in_decl_state *lto_new_in_decl_state (void); +extern void lto_delete_in_decl_state (struct lto_in_decl_state *); +extern hashval_t lto_hash_in_decl_state (const void *); +extern int lto_eq_in_decl_state (const void *, const void *); +extern struct lto_in_decl_state *lto_get_function_in_decl_state ( + struct lto_file_decl_data *, tree); + +/* In lto-section-out.c */ +extern hashval_t lto_hash_decl_slot_node (const void *); +extern int lto_eq_decl_slot_node (const void *, const void *); +extern hashval_t lto_hash_type_slot_node (const void *); +extern int lto_eq_type_slot_node (const void *, const void *); +extern void lto_begin_section (const char *, bool); +extern void lto_end_section (void); +extern void lto_write_stream (struct lto_output_stream *); +extern void lto_output_1_stream (struct lto_output_stream *, char); +extern void lto_output_data_stream (struct lto_output_stream *, const void *, + size_t); +extern void lto_output_uleb128_stream (struct lto_output_stream *, + unsigned HOST_WIDE_INT); +extern void lto_output_widest_uint_uleb128_stream (struct lto_output_stream *, + unsigned HOST_WIDEST_INT); +extern void lto_output_sleb128_stream (struct lto_output_stream *, + HOST_WIDE_INT); +extern bool lto_output_decl_index (struct lto_output_stream *, + struct lto_tree_ref_encoder *, + tree, unsigned int *); +extern void lto_output_field_decl_index (struct lto_out_decl_state *, + struct lto_output_stream *, tree); +extern void lto_output_fn_decl_index (struct lto_out_decl_state *, + struct lto_output_stream *, tree); +extern void lto_output_namespace_decl_index (struct lto_out_decl_state *, + struct lto_output_stream *, tree); +extern void lto_output_var_decl_index (struct lto_out_decl_state *, + struct lto_output_stream *, tree); +extern void lto_output_type_decl_index (struct lto_out_decl_state *, + struct lto_output_stream *, tree); +extern void lto_output_type_ref_index (struct lto_out_decl_state *, + struct lto_output_stream *, tree); +extern struct lto_simple_output_block *lto_create_simple_output_block ( + enum lto_section_type); +extern void lto_destroy_simple_output_block (struct lto_simple_output_block *); +extern struct lto_out_decl_state *lto_new_out_decl_state (void); +extern void lto_delete_out_decl_state (struct lto_out_decl_state *); +extern struct lto_out_decl_state *lto_get_out_decl_state (void); +extern void lto_push_out_decl_state (struct lto_out_decl_state *); +extern struct lto_out_decl_state *lto_pop_out_decl_state (void); +extern void lto_record_function_out_decl_state (tree, + struct lto_out_decl_state *); +extern void lto_new_extern_inline_states (void); +extern void lto_delete_extern_inline_states (void); +extern void lto_force_functions_extern_inline (bitmap decls); +extern bool lto_forced_extern_inline_p (tree fn_decl); + + +/* In lto-streamer.c. */ +extern const char *lto_tag_name (enum LTO_tags); +extern bitmap lto_bitmap_alloc (void); +extern void lto_bitmap_free (bitmap); +extern char *lto_get_section_name (int, const char *); +extern void print_lto_report (void); +extern struct bitpack_d *bitpack_create (void); +extern void bitpack_delete (struct bitpack_d *); +extern void bp_pack_value (struct bitpack_d *, bitpack_word_t, unsigned); +extern bitpack_word_t bp_unpack_value (struct bitpack_d *, unsigned); +extern bool lto_streamer_cache_insert (struct lto_streamer_cache_d *, tree, + int *, unsigned *); +extern bool lto_streamer_cache_insert_at (struct lto_streamer_cache_d *, tree, + int); +extern bool lto_streamer_cache_lookup (struct lto_streamer_cache_d *, tree, + int *); +extern tree lto_streamer_cache_get (struct lto_streamer_cache_d *, int); +extern struct lto_streamer_cache_d *lto_streamer_cache_create (void); +extern void lto_streamer_cache_delete (struct lto_streamer_cache_d *); +extern void lto_streamer_init (void); +extern bool gate_lto_out (void); +#ifdef LTO_STREAMER_DEBUG +extern void lto_orig_address_map (tree, intptr_t); +extern intptr_t lto_orig_address_get (tree); +extern void lto_orig_address_remove (tree); +#endif +extern void lto_check_version (int, int); + + +/* In lto-streamer-in.c */ +extern void lto_input_function_body (struct lto_file_decl_data *, tree, + const char *); +extern void lto_input_constructors_and_inits (struct lto_file_decl_data *, + const char *); +extern void lto_input_cgraph (struct lto_file_decl_data *, const char *); +extern void lto_init_reader (void); +extern tree lto_input_tree (struct lto_input_block *, struct data_in *); +extern void lto_input_function_body (struct lto_file_decl_data *, tree, + const char *); +extern void lto_input_constructors_and_inits (struct lto_file_decl_data *, + const char *); +extern struct bitpack_d *lto_input_bitpack (struct lto_input_block *); +extern void lto_init_reader (void); +extern struct data_in *lto_data_in_create (struct lto_file_decl_data *, + const char *, unsigned, + VEC(ld_plugin_symbol_resolution_t,heap) *); +extern void lto_data_in_delete (struct data_in *); +extern void lto_register_deferred_decls_in_symtab (struct data_in *); + + +/* In lto-streamer-out.c */ +extern void lto_register_decl_definition (tree, struct lto_file_decl_data *); +extern struct output_block *create_output_block (enum lto_section_type); +extern void destroy_output_block (struct output_block *); +extern void lto_output_tree (struct output_block *, tree, bool); +extern void lto_output_bitpack (struct lto_output_stream *, struct bitpack_d *); + + +/* In lto-cgraph.c */ +struct cgraph_node *lto_cgraph_encoder_deref (lto_cgraph_encoder_t, int); +int lto_cgraph_encoder_lookup (lto_cgraph_encoder_t, struct cgraph_node *); +lto_cgraph_encoder_t lto_cgraph_encoder_new (void); +int lto_cgraph_encoder_encode (lto_cgraph_encoder_t, struct cgraph_node *); +void lto_cgraph_encoder_delete (lto_cgraph_encoder_t encoder); +void output_cgraph (cgraph_node_set); +void input_cgraph (void); + + +/* In lto-symtab.c. */ +extern void lto_symtab_merge_var (tree, enum ld_plugin_symbol_resolution); +extern void lto_symtab_merge_fn (tree, enum ld_plugin_symbol_resolution, + struct lto_file_decl_data *); +extern tree lto_symtab_prevailing_decl (tree decl); +extern enum ld_plugin_symbol_resolution lto_symtab_get_resolution (tree decl); +struct lto_file_decl_data *lto_symtab_get_file_data (tree decl); +extern void lto_symtab_clear_resolution (tree decl); + + +/* In lto-opts.c. */ +extern void lto_register_user_option (size_t, const char *, int, int); +extern void lto_read_file_options (struct lto_file_decl_data *); +extern void lto_write_options (void); +extern void lto_reissue_options (void); +void lto_clear_user_options (void); +void lto_clear_file_options (void); + + +/* In lto-wpa-fixup.c */ +void lto_mark_nothrow_fndecl (tree); +void lto_fixup_nothrow_decls (void); + + +/* Statistics gathered during LTO, WPA and LTRANS. */ +extern struct lto_stats_d lto_stats; + +/* Section names corresponding to the values of enum lto_section_type. */ +extern const char *lto_section_name[]; + +/* Holds all the out decl states of functions output so far in the + current output file. */ +extern VEC(lto_out_decl_state_ptr, heap) *lto_function_decl_states; + +/* Return true if LTO tag TAG corresponds to a tree code. */ +static inline bool +lto_tag_is_tree_code_p (enum LTO_tags tag) +{ + return tag > LTO_null && (unsigned) tag <= NUM_TREE_CODES; +} + + +/* Return true if LTO tag TAG corresponds to a gimple code. */ +static inline bool +lto_tag_is_gimple_code_p (enum LTO_tags tag) +{ + return (unsigned) tag >= NUM_TREE_CODES + 1 + && (unsigned) tag < 1 + NUM_TREE_CODES + LAST_AND_UNUSED_GIMPLE_CODE; +} + + +/* Return the LTO tag corresponding to gimple code CODE. See enum + LTO_tags for details on the conversion. */ +static inline enum LTO_tags +lto_gimple_code_to_tag (enum gimple_code code) +{ + return (enum LTO_tags) ((unsigned) code + NUM_TREE_CODES + 1); +} + + +/* Return the GIMPLE code corresponding to TAG. See enum LTO_tags for + details on the conversion. */ +static inline enum gimple_code +lto_tag_to_gimple_code (enum LTO_tags tag) +{ + gcc_assert (lto_tag_is_gimple_code_p (tag)); + return (enum gimple_code) ((unsigned) tag - NUM_TREE_CODES - 1); +} + + +/* Return the LTO tag corresponding to tree code CODE. See enum + LTO_tags for details on the conversion. */ +static inline enum LTO_tags +lto_tree_code_to_tag (enum tree_code code) +{ + return (enum LTO_tags) ((unsigned) code + 1); +} + + +/* Return the tree code corresponding to TAG. See enum LTO_tags for + details on the conversion. */ +static inline enum tree_code +lto_tag_to_tree_code (enum LTO_tags tag) +{ + gcc_assert (lto_tag_is_tree_code_p (tag)); + return (enum tree_code) ((unsigned) tag - 1); +} + + +/* Return true if FILE needs to be compiled with LTRANS. */ +static inline bool +lto_file_needs_ltrans_p (struct lto_file_decl_data *file) +{ + return file->needs_ltrans_p != 0; +} + + +/* Mark FILE to be compiled with LTRANS. */ +static inline void +lto_mark_file_for_ltrans (struct lto_file_decl_data *file) +{ + file->needs_ltrans_p = 1; +} + + +/* Return true if any files in node set SET need to be compiled + with LTRANS. */ +static inline bool +cgraph_node_set_needs_ltrans_p (cgraph_node_set set) +{ + cgraph_node_set_iterator csi; + + for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi)) + if (lto_file_needs_ltrans_p (csi_node (csi)->local.lto_file_data)) + return true; + + return false; +} + + +/* Initialize an lto_out_decl_buffer ENCODER. */ +static inline void +lto_init_tree_ref_encoder (struct lto_tree_ref_encoder *encoder, + htab_hash hash_fn, htab_eq eq_fn) +{ + encoder->tree_hash_table = htab_create (37, hash_fn, eq_fn, free); + encoder->next_index = 0; + encoder->trees = NULL; +} + + +/* Destory an lto_tree_ref_encoder ENCODER by freeing its contents. The + memory used by ENCODER is not freed by this function. */ +static inline void +lto_destroy_tree_ref_encoder (struct lto_tree_ref_encoder *encoder) +{ + /* Hash table may be delete already. */ + if (encoder->tree_hash_table) + htab_delete (encoder->tree_hash_table); + VEC_free (tree, heap, encoder->trees); +} + +/* Return the number of trees encoded in ENCODER. */ +static inline unsigned int +lto_tree_ref_encoder_size (struct lto_tree_ref_encoder *encoder) +{ + return VEC_length (tree, encoder->trees); +} + +/* Return the IDX-th tree in ENCODER. */ +static inline tree +lto_tree_ref_encoder_get_tree (struct lto_tree_ref_encoder *encoder, + unsigned int idx) +{ + return VEC_index (tree, encoder->trees, idx); +} + + +/* Return true if LABEL should be emitted in the global context. */ +static inline bool +emit_label_in_global_context_p (tree label) +{ + return DECL_NONLOCAL (label) || FORCED_LABEL (label); +} + +/* Return true if tree node EXPR should be streamed as a builtin. For + these nodes, we just emit the class and function code. */ +static inline bool +lto_stream_as_builtin_p (tree expr) +{ + return (TREE_CODE (expr) == FUNCTION_DECL + && DECL_IS_BUILTIN (expr) + && (DECL_BUILT_IN_CLASS (expr) == BUILT_IN_NORMAL + || DECL_BUILT_IN_CLASS (expr) == BUILT_IN_MD)); +} + +/* Return true if EXPR is a tree node that can be written to disk. */ +static inline bool +lto_is_streamable (tree expr) +{ + enum tree_code code = TREE_CODE (expr); + + /* Notice that we reject SSA_NAMEs as well. We only emit the SSA + name version in lto_output_tree_ref (see output_ssa_names). */ + return !is_lang_specific (expr) + && code != SSA_NAME + && code != CALL_EXPR + && code != LANG_TYPE + && code != MODIFY_EXPR + && code != INIT_EXPR + && code != TARGET_EXPR + && code != BIND_EXPR + && code != WITH_CLEANUP_EXPR + && code != STATEMENT_LIST + && (code == CASE_LABEL_EXPR + || code == DECL_EXPR + || TREE_CODE_CLASS (code) != tcc_statement); +} + +DEFINE_DECL_STREAM_FUNCS (TYPE, type) +DEFINE_DECL_STREAM_FUNCS (FIELD_DECL, field_decl) +DEFINE_DECL_STREAM_FUNCS (FN_DECL, fn_decl) +DEFINE_DECL_STREAM_FUNCS (VAR_DECL, var_decl) +DEFINE_DECL_STREAM_FUNCS (TYPE_DECL, type_decl) +DEFINE_DECL_STREAM_FUNCS (NAMESPACE_DECL, namespace_decl) +DEFINE_DECL_STREAM_FUNCS (LABEL_DECL, label_decl) + +#endif /* GCC_LTO_STREAMER_H */ diff --git a/gcc/lto-symtab.c b/gcc/lto-symtab.c new file mode 100644 index 00000000000..90a200fc735 --- /dev/null +++ b/gcc/lto-symtab.c @@ -0,0 +1,793 @@ +/* LTO symbol table. + Copyright 2009 Free Software Foundation, Inc. + Contributed by CodeSourcery, Inc. + +This file is part of GCC. + +GCC 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. + +GCC 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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "toplev.h" +#include "tree.h" +#include "gimple.h" +#include "ggc.h" /* lambda.h needs this */ +#include "lambda.h" /* gcd */ +#include "hashtab.h" +#include "plugin-api.h" +#include "lto-streamer.h" + +/* Vector to keep track of external variables we've seen so far. */ +VEC(tree,gc) *lto_global_var_decls; + +/* Base type for resolution map. It maps NODE to resolution. */ + +struct GTY(()) lto_symtab_base_def +{ + /* Key is either an IDENTIFIER or a DECL. */ + tree node; +}; +typedef struct lto_symtab_base_def *lto_symtab_base_t; + +struct GTY(()) lto_symtab_identifier_def +{ + struct lto_symtab_base_def base; + tree decl; +}; +typedef struct lto_symtab_identifier_def *lto_symtab_identifier_t; + +struct GTY(()) lto_symtab_decl_def +{ + struct lto_symtab_base_def base; + enum ld_plugin_symbol_resolution resolution; + struct lto_file_decl_data * GTY((skip (""))) file_data; +}; +typedef struct lto_symtab_decl_def *lto_symtab_decl_t; + +/* A poor man's symbol table. This hashes identifier to prevailing DECL + if there is one. */ + +static GTY ((if_marked ("lto_symtab_identifier_marked_p"), + param_is (struct lto_symtab_identifier_def))) + htab_t lto_symtab_identifiers; + +static GTY ((if_marked ("lto_symtab_decl_marked_p"), + param_is (struct lto_symtab_decl_def))) + htab_t lto_symtab_decls; + +/* Return the hash value of an lto_symtab_base_t object pointed to by P. */ + +static hashval_t +lto_symtab_base_hash (const void *p) +{ + const struct lto_symtab_base_def *base = + (const struct lto_symtab_base_def*) p; + return htab_hash_pointer (base->node); +} + +/* Return non-zero if P1 and P2 points to lto_symtab_base_def structs + corresponding to the same tree node. */ + +static int +lto_symtab_base_eq (const void *p1, const void *p2) +{ + const struct lto_symtab_base_def *base1 = + (const struct lto_symtab_base_def *) p1; + const struct lto_symtab_base_def *base2 = + (const struct lto_symtab_base_def *) p2; + return (base1->node == base2->node); +} + +/* Returns non-zero if P points to an lto_symtab_base_def struct that needs + to be marked for GC. */ + +static int +lto_symtab_base_marked_p (const void *p) +{ + const struct lto_symtab_base_def *base = + (const struct lto_symtab_base_def *) p; + + /* Keep this only if the key node is marked. */ + return ggc_marked_p (base->node); +} + +/* Returns non-zero if P points to an lto_symtab_identifier_def struct that + needs to be marked for GC. */ + +static int +lto_symtab_identifier_marked_p (const void *p) +{ + return lto_symtab_base_marked_p (p); +} + +/* Returns non-zero if P points to an lto_symtab_decl_def struct that needs + to be marked for GC. */ + +static int +lto_symtab_decl_marked_p (const void *p) +{ + return lto_symtab_base_marked_p (p); +} + +#define lto_symtab_identifier_eq lto_symtab_base_eq +#define lto_symtab_identifier_hash lto_symtab_base_hash +#define lto_symtab_decl_eq lto_symtab_base_eq +#define lto_symtab_decl_hash lto_symtab_base_hash + +/* Lazily initialize resolution hash tables. */ + +static void +lto_symtab_maybe_init_hash_tables (void) +{ + if (!lto_symtab_identifiers) + { + lto_symtab_identifiers = + htab_create_ggc (1021, lto_symtab_identifier_hash, + lto_symtab_identifier_eq, NULL); + lto_symtab_decls = + htab_create_ggc (1021, lto_symtab_decl_hash, + lto_symtab_decl_eq, NULL); + } +} + +/* Returns true iff the union of ATTRIBUTES_1 and ATTRIBUTES_2 can be + applied to DECL. */ +static bool +lto_compatible_attributes_p (tree decl ATTRIBUTE_UNUSED, + tree attributes_1, + tree attributes_2) +{ +#if 0 + /* ??? For now, assume two attribute sets are compatible only if they + are both empty. */ + return !attributes_1 && !attributes_2; +#else + /* FIXME. For the moment, live dangerously, and assume the user knows + what he's doing. I don't think the linker would distinguish these cases. */ + return true || (!attributes_1 && !attributes_2); +#endif +} + +/* Helper for lto_symtab_compatible. Return TRUE if DECL is an external + variable declaration of an aggregate type. */ + +static bool +external_aggregate_decl_p (tree decl) +{ + return (TREE_CODE (decl) == VAR_DECL + && DECL_EXTERNAL (decl) + && AGGREGATE_TYPE_P (TREE_TYPE (decl))); +} + +static bool maybe_merge_incomplete_and_complete_type (tree, tree); + +/* Try to merge an incomplete type INCOMPLETE with a complete type + COMPLETE of same kinds. + Return true if they were merged, false otherwise. */ + +static bool +merge_incomplete_and_complete_type (tree incomplete, tree complete) +{ + /* For merging array types do some extra sanity checking. */ + if (TREE_CODE (incomplete) == ARRAY_TYPE + && !maybe_merge_incomplete_and_complete_type (TREE_TYPE (incomplete), + TREE_TYPE (complete)) + && !gimple_types_compatible_p (TREE_TYPE (incomplete), + TREE_TYPE (complete))) + return false; + + /* ??? Ideally we would do this by means of a common canonical type, but + that's difficult as we do not have links from the canonical type + back to all its children. */ + gimple_force_type_merge (incomplete, complete); + + return true; +} + +/* Try to merge a maybe complete / incomplete type pair TYPE1 and TYPE2. + Return true if they were merged, false otherwise. */ + +static bool +maybe_merge_incomplete_and_complete_type (tree type1, tree type2) +{ + bool res = false; + + if (TREE_CODE (type1) != TREE_CODE (type2)) + return false; + + if (!COMPLETE_TYPE_P (type1) && COMPLETE_TYPE_P (type2)) + res = merge_incomplete_and_complete_type (type1, type2); + else if (COMPLETE_TYPE_P (type1) && !COMPLETE_TYPE_P (type2)) + res = merge_incomplete_and_complete_type (type2, type1); + + /* Recurse on pointer targets. */ + if (!res + && POINTER_TYPE_P (type1) + && POINTER_TYPE_P (type2)) + res = maybe_merge_incomplete_and_complete_type (TREE_TYPE (type1), + TREE_TYPE (type2)); + + return res; +} + +/* Check if OLD_DECL and NEW_DECL are compatible. */ + +static bool +lto_symtab_compatible (tree old_decl, tree new_decl) +{ + tree merged_type = NULL_TREE; + + if (TREE_CODE (old_decl) != TREE_CODE (new_decl)) + { + switch (TREE_CODE (new_decl)) + { + case VAR_DECL: + gcc_assert (TREE_CODE (old_decl) == FUNCTION_DECL); + error_at (DECL_SOURCE_LOCATION (new_decl), + "function %qD redeclared as variable", new_decl); + inform (DECL_SOURCE_LOCATION (old_decl), + "previously declared here"); + return false; + + case FUNCTION_DECL: + gcc_assert (TREE_CODE (old_decl) == VAR_DECL); + error_at (DECL_SOURCE_LOCATION (new_decl), + "variable %qD redeclared as function", new_decl); + inform (DECL_SOURCE_LOCATION (old_decl), + "previously declared here"); + return false; + + default: + gcc_unreachable (); + } + } + + /* Handle external declarations with incomplete type or pointed-to + incomplete types by forcefully merging the types. + ??? In principle all types involved in the two decls should + be merged forcefully, for example without considering type or + field names. */ + if (TREE_CODE (old_decl) == VAR_DECL) + { + tree old_type = TREE_TYPE (old_decl); + tree new_type = TREE_TYPE (new_decl); + + if (DECL_EXTERNAL (old_decl) || DECL_EXTERNAL (new_decl)) + maybe_merge_incomplete_and_complete_type (old_type, new_type); + else if (POINTER_TYPE_P (old_type) + && POINTER_TYPE_P (new_type)) + maybe_merge_incomplete_and_complete_type (TREE_TYPE (old_type), + TREE_TYPE (new_type)); + + /* For array types we have to accept external declarations with + different sizes than the actual definition (164.gzip). + ??? We could emit a warning here. */ + if (TREE_CODE (old_type) == TREE_CODE (new_type) + && TREE_CODE (old_type) == ARRAY_TYPE + && COMPLETE_TYPE_P (old_type) + && COMPLETE_TYPE_P (new_type) + && tree_int_cst_compare (TYPE_SIZE (old_type), + TYPE_SIZE (new_type)) != 0 + && gimple_types_compatible_p (TREE_TYPE (old_type), + TREE_TYPE (new_type))) + { + /* If only one is external use the type of the non-external decl. + Else use the larger one and also adjust the decl size. + ??? Directional merging would allow us to simply pick the + larger one instead of rewriting it. */ + if (DECL_EXTERNAL (old_decl) ^ DECL_EXTERNAL (new_decl)) + { + if (DECL_EXTERNAL (old_decl)) + TREE_TYPE (old_decl) = new_type; + else if (DECL_EXTERNAL (new_decl)) + TREE_TYPE (new_decl) = old_type; + } + else + { + if (tree_int_cst_compare (TYPE_SIZE (old_type), + TYPE_SIZE (new_type)) < 0) + { + TREE_TYPE (old_decl) = new_type; + DECL_SIZE (old_decl) = DECL_SIZE (new_decl); + DECL_SIZE_UNIT (old_decl) = DECL_SIZE_UNIT (new_decl); + } + else + { + TREE_TYPE (new_decl) = old_type; + DECL_SIZE (new_decl) = DECL_SIZE (old_decl); + DECL_SIZE_UNIT (new_decl) = DECL_SIZE_UNIT (old_decl); + } + } + } + } + + if (!gimple_types_compatible_p (TREE_TYPE (old_decl), TREE_TYPE (new_decl))) + { + if (TREE_CODE (new_decl) == FUNCTION_DECL) + { + if (!merged_type + /* We want either of the types to have argument types, + but not both. */ + && ((TYPE_ARG_TYPES (TREE_TYPE (old_decl)) != NULL) + ^ (TYPE_ARG_TYPES (TREE_TYPE (new_decl)) != NULL))) + { + /* The situation here is that (in C) somebody was smart + enough to use proper declarations in a header file, but + the actual definition of the function uses + non-ANSI-style argument lists. Or we have a situation + where declarations weren't used anywhere and we're + merging the actual definition with a use. One of the + decls will then have a complete function type, whereas + the other will only have a result type. Assume that + the more complete type is the right one and don't + complain. */ + if (TYPE_ARG_TYPES (TREE_TYPE (old_decl))) + { + merged_type = TREE_TYPE (old_decl); + } + else + { + merged_type = TREE_TYPE (new_decl); + } + } + + /* If we don't have a merged type yet...sigh. The linker + wouldn't complain if the types were mismatched, so we + probably shouldn't either. Just use the type from + whichever decl appears to be associated with the + definition. If for some odd reason neither decl is, the + older one wins. */ + if (!merged_type) + { + if (!DECL_EXTERNAL (new_decl)) + { + merged_type = TREE_TYPE (new_decl); + } + else + { + merged_type = TREE_TYPE (old_decl); + } + } + } + + if (!merged_type) + { + if (warning_at (DECL_SOURCE_LOCATION (new_decl), 0, + "type of %qD does not match original declaration", + new_decl)) + inform (DECL_SOURCE_LOCATION (old_decl), + "previously declared here"); + return false; + } + } + + if (DECL_UNSIGNED (old_decl) != DECL_UNSIGNED (new_decl)) + { + error_at (DECL_SOURCE_LOCATION (new_decl), + "signedness of %qD does not match original declaration", + new_decl); + inform (DECL_SOURCE_LOCATION (old_decl), "previously declared here"); + return false; + } + + if (!tree_int_cst_equal (DECL_SIZE (old_decl), + DECL_SIZE (new_decl)) + || !tree_int_cst_equal (DECL_SIZE_UNIT (old_decl), + DECL_SIZE_UNIT (new_decl))) + { + /* Permit cases where we are declaring aggregates and at least one + of the decls is external and one of the decls has a size whereas + the other one does not. This is perfectly legal in C: + + struct s; + extern struct s x; + + void* + f (void) + { + return &x; + } + + There is no way a compiler can tell the size of x. So we cannot + assume that external aggreates have complete types. */ + + if (!((TREE_CODE (TREE_TYPE (old_decl)) + == TREE_CODE (TREE_TYPE (new_decl))) + && ((external_aggregate_decl_p (old_decl) + && DECL_SIZE (old_decl) == NULL_TREE) + || (external_aggregate_decl_p (new_decl) + && DECL_SIZE (new_decl) == NULL_TREE)))) + { + error_at (DECL_SOURCE_LOCATION (new_decl), + "size of %qD does not match original declaration", + new_decl); + inform (DECL_SOURCE_LOCATION (old_decl), + "previously declared here"); + return false; + } + } + + /* Report an error if user-specified alignments do not match. */ + if ((DECL_USER_ALIGN (old_decl) && DECL_USER_ALIGN (new_decl)) + && DECL_ALIGN (old_decl) != DECL_ALIGN (new_decl)) + { + error_at (DECL_SOURCE_LOCATION (new_decl), + "alignment of %qD does not match original declaration", + new_decl); + inform (DECL_SOURCE_LOCATION (old_decl), "previously declared here"); + return false; + } + + /* Do not compare the modes of the decls. The type compatibility + checks or the completing of types has properly dealt with all issues. */ + + if (!lto_compatible_attributes_p (old_decl, + DECL_ATTRIBUTES (old_decl), + DECL_ATTRIBUTES (new_decl))) + { + error_at (DECL_SOURCE_LOCATION (new_decl), + "attributes applied to %qD are incompatible with original " + "declaration", new_decl); + inform (DECL_SOURCE_LOCATION (old_decl), "previously declared here"); + return false; + } + + /* We do not require matches for: + + - DECL_NAME + + Only the name used in object files matters. + + - DECL_CONTEXT + + An entity might be declared in a C++ namespace in one file and + with a C identifier in another file. + + - TREE_PRIVATE, TREE_PROTECTED + + Access control is the problem of the front end that created the + object file. + + Therefore, at this point we have decided to merge the declarations. */ + return true; +} + + +/* Marks decl DECL as having resolution RESOLUTION. */ + +static void +lto_symtab_set_resolution_and_file_data (tree decl, + ld_plugin_symbol_resolution_t + resolution, + struct lto_file_decl_data *file_data) +{ + lto_symtab_decl_t new_entry; + void **slot; + + gcc_assert (decl); + + gcc_assert (TREE_PUBLIC (decl)); + gcc_assert (TREE_CODE (decl) != FUNCTION_DECL || !DECL_ABSTRACT (decl)); + + new_entry = GGC_CNEW (struct lto_symtab_decl_def); + new_entry->base.node = decl; + new_entry->resolution = resolution; + new_entry->file_data = file_data; + + lto_symtab_maybe_init_hash_tables (); + slot = htab_find_slot (lto_symtab_decls, new_entry, INSERT); + gcc_assert (!*slot); + *slot = new_entry; +} + +/* Get the lto_symtab_identifier_def struct associated with ID + if there is one. If there is none and INSERT_P is true, create + a new one. */ + +static lto_symtab_identifier_t +lto_symtab_get_identifier (tree id, bool insert_p) +{ + struct lto_symtab_identifier_def temp; + lto_symtab_identifier_t symtab_id; + void **slot; + + lto_symtab_maybe_init_hash_tables (); + temp.base.node = id; + slot = htab_find_slot (lto_symtab_identifiers, &temp, + insert_p ? INSERT : NO_INSERT); + if (insert_p) + { + if (*slot) + return (lto_symtab_identifier_t) *slot; + else + { + symtab_id = GGC_CNEW (struct lto_symtab_identifier_def); + symtab_id->base.node = id; + *slot = symtab_id; + return symtab_id; + } + } + else + return slot ? (lto_symtab_identifier_t) *slot : NULL; +} + +/* Return the DECL associated with an IDENTIFIER ID or return NULL_TREE + if there is none. */ + +static tree +lto_symtab_get_identifier_decl (tree id) +{ + lto_symtab_identifier_t symtab_id = lto_symtab_get_identifier (id, false); + return symtab_id ? symtab_id->decl : NULL_TREE; +} + +/* SET the associated DECL of an IDENTIFIER ID to be DECL. */ + +static void +lto_symtab_set_identifier_decl (tree id, tree decl) +{ + lto_symtab_identifier_t symtab_id = lto_symtab_get_identifier (id, true); + symtab_id->decl = decl; +} + +/* Common helper function for merging variable and function declarations. + NEW_DECL is the newly found decl. RESOLUTION is the decl's resolution + provided by the linker. */ + +static void +lto_symtab_merge_decl (tree new_decl, + enum ld_plugin_symbol_resolution resolution, + struct lto_file_decl_data *file_data) +{ + tree old_decl; + tree name; + ld_plugin_symbol_resolution_t old_resolution; + + gcc_assert (TREE_CODE (new_decl) == VAR_DECL + || TREE_CODE (new_decl) == FUNCTION_DECL); + + gcc_assert (TREE_PUBLIC (new_decl)); + + gcc_assert (DECL_LANG_SPECIFIC (new_decl) == NULL); + + /* Check that declarations reaching this function do not have + properties inconsistent with having external linkage. If any of + these asertions fail, then the object file reader has failed to + detect these cases and issue appropriate error messages. */ + if (TREE_CODE (new_decl) == VAR_DECL) + gcc_assert (!(DECL_EXTERNAL (new_decl) && DECL_INITIAL (new_decl))); + + /* Remember the resolution of this symbol. */ + lto_symtab_set_resolution_and_file_data (new_decl, resolution, file_data); + + /* Ensure DECL_ASSEMBLER_NAME will not set assembler name. */ + gcc_assert (DECL_ASSEMBLER_NAME_SET_P (new_decl)); + + /* Retrieve the previous declaration. */ + name = DECL_ASSEMBLER_NAME (new_decl); + old_decl = lto_symtab_get_identifier_decl (name); + + /* If there was no previous declaration, then there is nothing to + merge. */ + if (!old_decl) + { + lto_symtab_set_identifier_decl (name, new_decl); + VEC_safe_push (tree, gc, lto_global_var_decls, new_decl); + return; + } + + /* Give ODR violation errors. */ + old_resolution = lto_symtab_get_resolution (old_decl); + if (resolution == LDPR_PREVAILING_DEF + || resolution == LDPR_PREVAILING_DEF_IRONLY) + { + if ((old_resolution == LDPR_PREVAILING_DEF + || old_resolution == LDPR_PREVAILING_DEF_IRONLY) + && (old_resolution != resolution || flag_no_common)) + { + error_at (DECL_SOURCE_LOCATION (new_decl), + "%qD has already been defined", new_decl); + inform (DECL_SOURCE_LOCATION (old_decl), + "previously defined here"); + return; + } + } + + /* The linker may ask us to combine two incompatible symbols. + Find a decl we can merge with or chain it in the list of decls + for that symbol. */ + while (old_decl + && !lto_symtab_compatible (old_decl, new_decl)) + old_decl = (tree) DECL_LANG_SPECIFIC (old_decl); + if (!old_decl) + { + old_decl = lto_symtab_get_identifier_decl (name); + while (DECL_LANG_SPECIFIC (old_decl) != NULL) + old_decl = (tree) DECL_LANG_SPECIFIC (old_decl); + DECL_LANG_SPECIFIC (old_decl) = (struct lang_decl *) new_decl; + return; + } + + /* Merge decl state in both directions, we may still end up using + the new decl. */ + TREE_ADDRESSABLE (old_decl) |= TREE_ADDRESSABLE (new_decl); + TREE_ADDRESSABLE (new_decl) |= TREE_ADDRESSABLE (old_decl); + + gcc_assert (resolution != LDPR_UNKNOWN + && resolution != LDPR_UNDEF + && old_resolution != LDPR_UNKNOWN + && old_resolution != LDPR_UNDEF); + + if (resolution == LDPR_PREVAILING_DEF + || resolution == LDPR_PREVAILING_DEF_IRONLY) + { + tree decl; + gcc_assert (old_resolution == LDPR_PREEMPTED_IR + || old_resolution == LDPR_RESOLVED_IR + || (old_resolution == resolution && !flag_no_common)); + DECL_LANG_SPECIFIC (new_decl) = DECL_LANG_SPECIFIC (old_decl); + DECL_LANG_SPECIFIC (old_decl) = NULL; + decl = lto_symtab_get_identifier_decl (name); + if (decl == old_decl) + { + lto_symtab_set_identifier_decl (name, new_decl); + return; + } + while ((tree) DECL_LANG_SPECIFIC (decl) != old_decl) + decl = (tree) DECL_LANG_SPECIFIC (decl); + DECL_LANG_SPECIFIC (decl) = (struct lang_decl *) new_decl; + return; + } + + if (resolution == LDPR_PREEMPTED_REG + || resolution == LDPR_RESOLVED_EXEC + || resolution == LDPR_RESOLVED_DYN) + gcc_assert (old_resolution == LDPR_PREEMPTED_REG + || old_resolution == LDPR_RESOLVED_EXEC + || old_resolution == LDPR_RESOLVED_DYN); + + if (resolution == LDPR_PREEMPTED_IR + || resolution == LDPR_RESOLVED_IR) + gcc_assert (old_resolution == LDPR_PREVAILING_DEF + || old_resolution == LDPR_PREVAILING_DEF_IRONLY + || old_resolution == LDPR_PREEMPTED_IR + || old_resolution == LDPR_RESOLVED_IR); + + return; +} + + +/* Merge the VAR_DECL NEW_VAR with resolution RESOLUTION with any previous + declaration with the same name. */ + +void +lto_symtab_merge_var (tree new_var, enum ld_plugin_symbol_resolution resolution) +{ + lto_symtab_merge_decl (new_var, resolution, NULL); +} + +/* Merge the FUNCTION_DECL NEW_FN with resolution RESOLUTION with any previous + declaration with the same name. */ + +void +lto_symtab_merge_fn (tree new_fn, enum ld_plugin_symbol_resolution resolution, + struct lto_file_decl_data *file_data) +{ + lto_symtab_merge_decl (new_fn, resolution, file_data); +} + +/* Given the decl DECL, return the prevailing decl with the same name. */ + +tree +lto_symtab_prevailing_decl (tree decl) +{ + tree ret; + gcc_assert (decl); + + /* Builtins and local symbols are their own prevailing decl. */ + if (!TREE_PUBLIC (decl) || is_builtin_fn (decl)) + return decl; + + /* DECL_ABSTRACTs are their own prevailng decl. */ + if (TREE_CODE (decl) == FUNCTION_DECL && DECL_ABSTRACT (decl)) + return decl; + + /* Ensure DECL_ASSEMBLER_NAME will not set assembler name. */ + gcc_assert (DECL_ASSEMBLER_NAME_SET_P (decl)); + + /* Walk through the list of candidates and return the one we merged to. */ + ret = lto_symtab_get_identifier_decl (DECL_ASSEMBLER_NAME (decl)); + if (!ret + || DECL_LANG_SPECIFIC (ret) == NULL) + return ret; + + /* If there are multiple decls to choose from find the one we merged + with and return that. */ + while (ret) + { + if (gimple_types_compatible_p (TREE_TYPE (decl), TREE_TYPE (ret))) + return ret; + + ret = (tree) DECL_LANG_SPECIFIC (ret); + } + + gcc_unreachable (); +} + +/* Return the hash table entry of DECL. */ + +static struct lto_symtab_decl_def * +lto_symtab_get_symtab_def (tree decl) +{ + struct lto_symtab_decl_def temp, *symtab_decl; + void **slot; + + gcc_assert (decl); + + lto_symtab_maybe_init_hash_tables (); + temp.base.node = decl; + slot = htab_find_slot (lto_symtab_decls, &temp, NO_INSERT); + gcc_assert (slot && *slot); + symtab_decl = (struct lto_symtab_decl_def*) *slot; + return symtab_decl; +} + +/* Return the resolution of DECL. */ + +enum ld_plugin_symbol_resolution +lto_symtab_get_resolution (tree decl) +{ + gcc_assert (decl); + + if (!TREE_PUBLIC (decl) || is_builtin_fn (decl)) + return LDPR_PREVAILING_DEF_IRONLY; + + /* FIXME lto: There should be no DECL_ABSTRACT in the middle end. */ + if (TREE_CODE (decl) == FUNCTION_DECL && DECL_ABSTRACT (decl)) + return LDPR_PREVAILING_DEF_IRONLY; + + return lto_symtab_get_symtab_def (decl)->resolution; +} + +/* Return the file of DECL. */ + +struct lto_file_decl_data * +lto_symtab_get_file_data (tree decl) +{ + return lto_symtab_get_symtab_def (decl)->file_data; +} + +/* Remove any storage used to store resolution of DECL. */ + +void +lto_symtab_clear_resolution (tree decl) +{ + struct lto_symtab_decl_def temp; + gcc_assert (decl); + + if (!TREE_PUBLIC (decl)) + return; + + /* LTO FIXME: There should be no DECL_ABSTRACT in the middle end. */ + if (TREE_CODE (decl) == FUNCTION_DECL && DECL_ABSTRACT (decl)) + return; + + lto_symtab_maybe_init_hash_tables (); + temp.base.node = decl; + htab_remove_elt (lto_symtab_decls, &temp); +} + +#include "gt-lto-symtab.h" diff --git a/gcc/lto-wpa-fixup.c b/gcc/lto-wpa-fixup.c new file mode 100644 index 00000000000..4411588f2f3 --- /dev/null +++ b/gcc/lto-wpa-fixup.c @@ -0,0 +1,281 @@ +/* Write and read any fix-up information generated by the WPA mode. + + Copyright 2009 Free Software Foundation, Inc. + Contributed by Doug Kwan + +This file is part of GCC. + +GCC 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. + +GCC 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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "toplev.h" +#include "tree.h" +#include "expr.h" +#include "flags.h" +#include "cgraph.h" +#include "function.h" +#include "diagnostic.h" +#include "vec.h" +#include "bitmap.h" +#include "timevar.h" +#include "tree-flow.h" +#include "tree-pass.h" +#include "lto-streamer.h" + +/* LTO fix-up. + + In WPA mode, LTO cannot access function bodies. Some modifications in + IR require additional updates in function bodies, which are not possible + in WPA mode. So we write out information about these modifications for + LTRANS to fix up the function bodies accordingly. */ + +/* The vectors records function DECLs having multiple copies with different + exception throwing attributes. We do not mark a DECL if all copies of it + have the same exception throwing attribute. */ +static bitmap lto_nothrow_fndecls; + +/* We need to fix up GIMPLE bodies due to changes in exception setting. + Consider this example: + + a.h: + class a { + public: + a(); + ~a(); + }; + + main.cc: + #include "a.h" + + int + main (int argc, char **argv) + { + a x; + return 0; + } + + a.cc: + #include "a.h" + a::a() {} + a::~a() {} + + When main.cc is compiled, gcc only sees the constructor declaration, so + the constructor and hence the call to it are marked as exception throwing. + When a.cc is compiled, the body of the constructor is available and is + obviously not exception throwing. Thus DECL of a::a in a.o has the NOTHROW + attribute. When LTO runs, two DECLs of a::a with different exception + attributes are merged. We want the merged DECL to be not exception + throwing for better generated code. To do that, we need to fix up any + function calls that have been marked as exception throwing. */ + +/* Fix up all the call statements whose target fndecls might have changed + to NOTHROW. Note that this problem is not WPA specific. We can also + run into this problem in normal LTO with multiple input files. */ + +void +lto_fixup_nothrow_decls (void) +{ + struct cgraph_node *node; + struct cgraph_edge *edge; + struct function *caller_function; + gimple call_stmt; + + /* Quit if we are in WPA mode or have not marked any DECLs. */ + if (flag_wpa || !lto_nothrow_fndecls) + return; + + /* For each node that has been marked, go over all call edges to it. */ + for (node = cgraph_nodes; node; node = node->next) + if (bitmap_bit_p (lto_nothrow_fndecls, DECL_UID (node->decl))) + { + gcc_assert (TREE_NOTHROW (node->decl)); + for (edge = node->callers; edge; edge = edge->next_caller) + { + caller_function = DECL_STRUCT_FUNCTION (edge->caller->decl); + call_stmt = edge->call_stmt; + gcc_assert (call_stmt); + if (lookup_stmt_eh_lp_fn (caller_function, call_stmt) != 0) + remove_stmt_from_eh_lp_fn (caller_function, call_stmt); + } + } +} + +/* Mark FNDECL as becoming not exception throwing. */ + +void +lto_mark_nothrow_fndecl (tree fndecl) +{ + gcc_assert (TREE_CODE (fndecl) == FUNCTION_DECL); + if (!lto_nothrow_fndecls) + lto_nothrow_fndecls = lto_bitmap_alloc (); + + bitmap_set_bit (lto_nothrow_fndecls, DECL_UID (fndecl)); +} + +/* Write out fix-up information. Currently the only WPA fix-up + information is the list of DECLs marked as not exception throwing. SET + is a cgraph node set whose fix-up information is to be written. */ + +static void +lto_output_wpa_fixup (cgraph_node_set set) +{ + struct lto_simple_output_block *ob; + cgraph_node_set_iterator csi; + tree fndecl; + bitmap seen_decls; + VEC(tree, heap) *decls = NULL; + unsigned HOST_WIDE_INT i, count; + + ob = lto_create_simple_output_block (LTO_section_wpa_fixup); + + /* Accumulate the DECLs to be written out. Since we do not want + duplicates, we need to use a bitmap and a vector to save the + DECLs we want. Note that we need to check if lto_nothrow_fndecls + is NULL. This happens when no DECL has been marked. */ + seen_decls = lto_bitmap_alloc (); + if (lto_nothrow_fndecls) + for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi)) + { + struct cgraph_edge *e; + struct cgraph_node *n; + + n = csi_node (csi); + fndecl = n->decl; + + /* Check if the N's function is in the set of nothrow functions. */ + if (!bitmap_bit_p (seen_decls, DECL_UID (fndecl))) + { + bitmap_set_bit (seen_decls, (DECL_UID (fndecl))); + if (bitmap_bit_p (lto_nothrow_fndecls, DECL_UID (fndecl))) + VEC_safe_push (tree, heap, decls, fndecl); + } + + /* Now check the callees and also add them if they are nothrow. This + is needed because node N may end up in a different partition than + its callees. In which case, when the file holding N is compiled, + the calls it makes to nothrow functions will not be fixed up, + causing verification issues. */ + for (e = n->callees; e; e = e->next_callee) + { + fndecl = e->callee->decl; + if (!bitmap_bit_p (seen_decls, DECL_UID (fndecl))) + { + bitmap_set_bit (seen_decls, (DECL_UID (fndecl))); + if (bitmap_bit_p (lto_nothrow_fndecls, DECL_UID (fndecl))) + VEC_safe_push (tree, heap, decls, fndecl); + } + } + } + + /* Write out number of DECLs, followed by the DECLs. */ + count = VEC_length (tree, decls); + lto_output_uleb128_stream (ob->main_stream, count); + for (i = 0; i < count; i++) + { + fndecl = VEC_index (tree, decls, i); + lto_output_fn_decl_index (ob->decl_state, ob->main_stream, fndecl); + } + + /* Release resources. */ + lto_destroy_simple_output_block (ob); + VEC_free(tree, heap, decls); + lto_bitmap_free (seen_decls); +} + +/* Read in WPA fix-up information from one file. FILE_DATA points to + DECL information of the file where as IB is the input block for the + WPA fix-up section. */ + +static void +lto_input_wpa_fixup_1 (struct lto_file_decl_data *file_data, + struct lto_input_block *ib) +{ + unsigned HOST_WIDE_INT i, count, decl_index; + tree fndecl; + + count = lto_input_uleb128 (ib); + for (i = 0; i < count; i++) + { + decl_index = lto_input_uleb128 (ib); + fndecl = lto_file_decl_data_get_fn_decl (file_data, decl_index); + lto_mark_nothrow_fndecl (fndecl); + } +} + +/* Read in WPA fix-up information. */ + +static void +lto_input_wpa_fixup (void) +{ + struct lto_file_decl_data ** file_data_vec + = lto_get_file_decl_data (); + struct lto_file_decl_data * file_data; + int i = 0; + + /* Fix up information is only used in LTRANS mode. */ + if (!flag_ltrans) + return; + + while ((file_data = file_data_vec[i++])) + { + const char *data; + size_t len; + struct lto_input_block *ib + = lto_create_simple_input_block (file_data, LTO_section_wpa_fixup, + &data, &len); + + lto_input_wpa_fixup_1 (file_data, ib); + lto_destroy_simple_input_block (file_data, LTO_section_wpa_fixup, ib, + data, len); + } +} + +/* Gate function for all lto streaming passes. */ + +static bool +gate_wpa_fixup (void) +{ + return (flag_wpa || flag_ltrans) && gate_lto_out (); +} + +struct ipa_opt_pass_d pass_ipa_lto_wpa_fixup = +{ + { + IPA_PASS, + "lto_wpa_fixup", /* name */ + gate_wpa_fixup, /* gate */ + NULL, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_WHOPR_WPA_FIXUP, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func /* todo_flags_finish */ + }, + NULL, /* generate_summary */ + lto_output_wpa_fixup, /* write_summary */ + lto_input_wpa_fixup, /* read_summary */ + NULL, /* function_read_summary */ + 0, /* TODOs */ + NULL, /* function_transform */ + NULL /* variable_transform */ +}; + diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c new file mode 100644 index 00000000000..228a0a4bb10 --- /dev/null +++ b/gcc/lto-wrapper.c @@ -0,0 +1,378 @@ +/* Wrapper to call lto. Used by collect2 and the linker plugin. + Copyright (C) 2009 Free Software Foundation, Inc. + + Factored out of collect2 by Rafael Espindola + +This file is part of GCC. + +GCC 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. + +GCC 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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + + +/* This program is passed a gcc, a list of gcc arguments and a list of + object files containing IL. It scans the argument list to check if + we are in whopr mode or not modifies the arguments and needed and + prints a list of output files on stdout. + + Example: + + $ lto-wrapper gcc/xgcc -B gcc a.o b.o -o test -flto + + The above will print something like + /tmp/ccwbQ8B2.lto.o + + If -fwhopr is used instead, more than one file might be produced + ./ccXj2DTk.lto.ltrans.o + ./ccCJuXGv.lto.ltrans.o +*/ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "intl.h" +#include "libiberty.h" + +int debug; /* true if -debug */ + +enum lto_mode_d { + LTO_MODE_NONE, /* Not doing LTO. */ + LTO_MODE_LTO, /* Normal LTO. */ + LTO_MODE_WHOPR /* WHOPR. */ +}; + +/* Current LTO mode. */ +static enum lto_mode_d lto_mode = LTO_MODE_NONE; + +/* Just die. CMSGID is the error message. */ + +static void __attribute__ ((format (printf, 1, 2))) +fatal (const char * cmsgid, ...) +{ + va_list ap; + + va_start (ap, cmsgid); + fprintf (stderr, "lto-wrapper: "); + vfprintf (stderr, _(cmsgid), ap); + fprintf (stderr, "\n"); + va_end (ap); + + exit (FATAL_EXIT_CODE); +} + + +/* Die when sys call fails. CMSGID is the error message. */ + +static void __attribute__ ((format (printf, 1, 2))) +fatal_perror (const char *cmsgid, ...) +{ + int e = errno; + va_list ap; + + va_start (ap, cmsgid); + fprintf (stderr, "lto-wrapper: "); + vfprintf (stderr, _(cmsgid), ap); + fprintf (stderr, ": %s\n", xstrerror (e)); + va_end (ap); + + exit (FATAL_EXIT_CODE); +} + + +/* Execute a program, and wait for the reply. ARGV are the arguments. The + last one must be NULL. */ + +static struct pex_obj * +collect_execute (char **argv) +{ + struct pex_obj *pex; + const char *errmsg; + int err; + + if (debug) + { + char **p_argv; + const char *str; + + for (p_argv = argv; (str = *p_argv) != (char *) 0; p_argv++) + fprintf (stderr, " %s", str); + + fprintf (stderr, "\n"); + } + + fflush (stdout); + fflush (stderr); + + pex = pex_init (0, "lto-wrapper", NULL); + if (pex == NULL) + fatal_perror ("pex_init failed"); + + errmsg = pex_run (pex, PEX_LAST | PEX_SEARCH, argv[0], argv, NULL, + NULL, &err); + if (errmsg != NULL) + { + if (err != 0) + { + errno = err; + fatal_perror (errmsg); + } + else + fatal (errmsg); + } + + return pex; +} + + +/* Wait for a process to finish, and exit if a nonzero status is found. + PROG is the program name. PEX is the process we should wait for. */ + +static int +collect_wait (const char *prog, struct pex_obj *pex) +{ + int status; + + if (!pex_get_status (pex, 1, &status)) + fatal_perror ("can't get program status"); + pex_free (pex); + + if (status) + { + if (WIFSIGNALED (status)) + { + int sig = WTERMSIG (status); + if (WCOREDUMP (status)) + fatal ("%s terminated with signal %d [%s], core dumped", + prog, sig, strsignal (sig)); + else + fatal ("%s terminated with signal %d [%s]", + prog, sig, strsignal (sig)); + } + + if (WIFEXITED (status)) + fatal ("%s returned %d exit status", prog, WEXITSTATUS (status)); + } + + return 0; +} + + +/* Unlink a temporary LTRANS file unless requested otherwise. */ + +static void +maybe_unlink_file (const char *file) +{ + if (! debug) + { + if (unlink_if_ordinary (file)) + fatal_perror ("deleting LTRANS file %s", file); + } + else + fprintf (stderr, "[Leaving LTRANS %s]\n", file); +} + + +/* Execute program ARGV[0] with arguments ARGV. Wait for it to finish. */ + +static void +fork_execute (char **argv) +{ + struct pex_obj *pex; + char *new_argv[3]; + char *args_name = make_temp_file (".args"); + char *at_args = concat ("@", args_name, NULL); + FILE *args = fopen (args_name, "w"); + int status; + + if (args == NULL) + fatal ("failed to open %s", args_name); + + status = writeargv (&argv[1], args); + + if (status) + fatal ("could not write to temporary file %s", args_name); + + fclose (args); + + new_argv[0] = argv[0]; + new_argv[1] = at_args; + new_argv[2] = NULL; + + pex = collect_execute (new_argv); + collect_wait (new_argv[0], pex); + + maybe_unlink_file (args_name); + free (args_name); + free (at_args); +} + + +/* Execute gcc. ARGC is the number of arguments. ARGV contains the arguments. */ + +static void +run_gcc (unsigned argc, char *argv[]) +{ + unsigned i; + unsigned new_argc = argc; + const char **new_argv; + const char **argv_ptr; + char *ltrans_output_file = NULL; + char *flto_out = NULL; + char *list_option_full = NULL; + + new_argc += 8; + new_argv = (const char **) xcalloc (sizeof (char *), new_argc); + + argv_ptr = new_argv; + + *argv_ptr++ = argv[0]; + *argv_ptr++ = "-combine"; + *argv_ptr++ = "-x"; + *argv_ptr++ = "lto"; + *argv_ptr++ = "-c"; + if (lto_mode == LTO_MODE_LTO) + { + flto_out = make_temp_file (".lto.o"); + *argv_ptr++ = "-o"; + *argv_ptr++ = flto_out; + } + else if (lto_mode == LTO_MODE_WHOPR) + { + const char *list_option = "-fltrans-output-list="; + size_t list_option_len = strlen (list_option); + char *tmp; + + ltrans_output_file = make_temp_file (".ltrans.out"); + list_option_full = (char *) xmalloc (sizeof (char) * + (strlen (ltrans_output_file) + list_option_len + 1)); + tmp = list_option_full; + + *argv_ptr++ = tmp; + strcpy (tmp, list_option); + tmp += list_option_len; + strcpy (tmp, ltrans_output_file); + + *argv_ptr++ = "-fwpa"; + } + else + fatal ("invalid LTO mode"); + + /* Add inherited GCC options to the LTO back end command line. + Filter out some obviously inappropriate options that will + conflict with the options that we force above. We pass + all of the remaining options on to LTO, and let it complain + about any it doesn't like. Note that we invoke LTO via the + `gcc' driver, so the usual option processing takes place. + Except for `-flto' and `-fwhopr', we should only filter options that + are meaningful to `ld', lest an option go silently unclaimed. */ + for (i = 1; i < argc; i++) + { + const char *s = argv[i]; + + if (strcmp (s, "-flto") == 0 || strcmp (s, "-fwhopr") == 0) + /* We've handled this LTO option, don't pass it on. */ + ; + else if (*s == '-' && s[1] == 'o') + { + /* Drop `-o' and its filename argument. We will use a + temporary file for the LTO output. The `-o' option + will be interpreted by the linker. */ + if (s[2] == '\0') + i++; + } + else + /* Pass the option or argument to LTO. */ + *argv_ptr++ = s; + } + + *argv_ptr = NULL; + + fork_execute (CONST_CAST (char **, new_argv)); + free (new_argv); + new_argv = NULL; + + if (lto_mode == LTO_MODE_LTO) + { + printf("%s\n", flto_out); + free (flto_out); + flto_out = NULL; + } + else if (lto_mode == LTO_MODE_WHOPR) + { + FILE *stream = fopen (ltrans_output_file, "r"); + int c; + + if (!stream) + fatal_perror ("fopen: %s", ltrans_output_file); + + while ((c = getc (stream)) != EOF) + putc (c, stdout); + fclose (stream); + maybe_unlink_file (ltrans_output_file); + free (ltrans_output_file); + free (list_option_full); + } + else + fatal ("invalid LTO mode"); +} + + +/* Parse the command line. Copy any unused argument to GCC_ARGV. ARGC is the + number of arguments. ARGV contains the arguments. */ + +static int +process_args (int argc, char *argv[], char *gcc_argv[]) +{ + int i; + int j = 0; + + for (i = 1; i < argc; i ++) + { + if (! strcmp (argv[i], "-debug")) + debug = 1; + else if (! strcmp (argv[i], "-flto")) + lto_mode = LTO_MODE_LTO; + else if (! strcmp (argv[i], "-fwhopr")) + lto_mode = LTO_MODE_WHOPR; + else + { + gcc_argv[j] = argv[i]; + j++; + } + } + + return j; +} + + +/* Entry point. */ + +int +main (int argc, char *argv[]) +{ + char **gcc_argv; + int gcc_argc; + + gcc_init_libintl (); + + /* We may be called with all the arguments stored in some file and + passed with @file. Expand them into argv before processing. */ + expandargv (&argc, &argv); + gcc_argv = (char **) xcalloc (sizeof (char *), argc); + gcc_argc = process_args (argc, argv, gcc_argv); + run_gcc (gcc_argc, gcc_argv); + free (gcc_argv); + + return 0; +} diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog new file mode 100644 index 00000000000..3ccce8fb5cf --- /dev/null +++ b/gcc/lto/ChangeLog @@ -0,0 +1,2543 @@ +2009-10-02 Rafael Avila de Espindola + + * Make-lang.in (lto/lto-lang.o): Don't depend on lto/common.h. + (lto-lang.c): Don't include lto/common.h. + +2009-10-02 Rafael Avila de Espindola + + * Make-lang.in (LTO_OBJS): Remove lto/common.o. + (lto/common.o): Remove. + * common.c: Remove. + * common.h (lto_kind_str): Remove. + (lto_visibility_str): Remove. + (lto_resolution_str): Make it static. + +2009-10-01 Diego Novillo + + * lto.c (lto_read_decls): Add comment. + Call internal_error instead of gcc_assert. + (lto_resolution_read): Likewise. + (lto_add_all_inlinees): Tidy. + * Make-lang.in: Fix copyright boilerplate. + (lto.pdf): New. + (lto.install-pdf): New. + * lto-tree.h: Fix copyright boilerplate. + * lang-specs.h: Likewise. + Remove ".lto" entry from compilers fragment. + * lto-elf.c: Move inclusion of gelf.h after config.h. + Tidy formatting everywhere. + * lto.h: Fix copyright boilerplate. + Tidy formatting everywhere. + * common.c: Likewise. + * config-lang.in: Likewise. + * common.h: Likewise. + * lto-lang.c: Likewise. + +2009-10-01 Richard Guenther + + * lto.c (lto_read_section_data): Use plain lseek/read. + +2009-10-01 Richard Guenther + + * lto.c (LTO_MMAP_IO): Define if we can mmap files and + use sysconf to query the system page size. + (lto_file_read): Implement fallback using stdio. + (free_section_data): Likewise. + +2009-09-29 Diego Novillo + + * lto-lang.c (lto_init): Really fix call to + build_common_builtin_nodes. + +2009-09-29 Diego Novillo + + * lto-lang.c (lto_init): Fix call to + build_common_builtin_nodes. + +2009-09-29 Richard Guenther + + PR lto/40754 + * lto-elf.c (init_shdr##BITS): Properly specify alignment + in bytes. + (first_data_block): New static variable. + (lto_elf_append_data): Align the first data block in each + section. + +2009-09-28 Diego Novillo + + * lto-lang.c: Tidy. Remove stale FIXME lto markers. + * lto.c (strip_extension): New. + (get_filename_for_set): Call it. Do not call make_cwd_temp_file. + (lto_execute_ltrans): Tidy. + Do not pass -fwpa nor -fltrans-* to LTRANS. + * opts.c: Tidy formatting and remove stale FIXME lto markers. + * tree.c (need_assembler_name_p): Call + lang_hooks.decls.may_need_assembler_name_p if set. + * varasm.c (default_binds_local_p_1): Remove check for + flag_ltrans. + * varpool.c (decide_is_variable_needed): Do not test for + in_lto_p. + +2009-09-22 Richard Guenther + + PR lto/39276 + * lto.c (lto_execute_ltrans): Perform ltrans phase manually. + * Make-lang.in: Remove ltrans-driver stuff. + * config-lang.in: Likewise. + * lang.opt (fltrans-driver): Remove. + * lto-lang.c (lto_init_options): Remove code initializing + ltrans_driver. + * ltrans-driver: Remove. + +2009-09-21 Diego Novillo + + * lto-lang.c (lto_define_builtins): Remove superfluous + calls to targetm.init_builtins and build_common_builtin_nodes. + (lto_init): Add targetm.arm_eabi_unwinder as parameter to + build_common_builtin_nodes. + * lto.c (lto_materialize_function): Do nothing if NODE is a + clone. + +2009-09-03 Diego Novillo + + * lto-elf.c (validate_file): Replace call to + elf_getshstrndx with call to elf_getshdrstrndx. + +2009-08-19 Richard Guenther + + * lto-lang.c (lto_init): Merge char_type_node with the + appropriately signed variant. + +2009-08-19 Richard Guenther + + PR lto/41071 + * lto.c (lto_fixup_common): Re-build the pointer-to chain part one. + (lto_fixup_type): Re-build the pointer-to chain part two. + +2009-08-19 Richard Guenther + + PR lto/41071 + * lto.c (lto_fixup_type): Re-build the type variant chain. + +2009-08-19 Richard Guenther + + PR lto/41071 + * lto.c (lto_fixup_constructor): New function. + (lto_fixup_tree): Replace all types. Properly fixup + constructors and constants. + +2009-08-14 Richard Guenther + + * lto.c (read_cgraph_and_symbols): Exchange TREE_CHAIN use + for DECL_LANG_SPECIFIC. + +2009-08-13 Richard Guenther + + PR lto/41032 + * lto-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Define to NULL. + +2009-07-30 Richard Guenther + + PR lto/40903 + * lto.c (read_cgraph_and_symbols): After fixing up decls choose + the largest decl for output and free TREE_CHAIN for further + use. + +2009-07-24 Diego Novillo + + * Make-lang.in: Add empty lto.install-plugin target. + +2009-07-13 Diego Novillo + + * lto.c (lto_fixup_tree): Handle IMPORTED_DECL. + +2009-07-11 Richard Guenther + + * lto-lang.c (lto_write_globals): Wrapup global decls. + +2009-07-10 Richard Guenther + + * lto-lang.c (lto_init): Allocate one more location to make + BUILTINS_LOCATION correct. + +2009-07-09 Rainer Orth + + * lto.c (free_section_data): Cast computed_offset to caddr_t. + +2009-07-06 Diego Novillo + + * lto.c (lto_fixup_type): Fixup TYPE_SIZE and + TYPE_SIZE_UNIT. + +2009-07-06 Diego Novillo + + * lto.c (preload_common_nodes): Remove. + (lto_read_in_decl_state): Call lto_streamer_cache_get. + (lto_read_decls): Call lto_data_in_create and + lto_data_in_delete. + (free_decl): Do not call ggc_free. + (lto_main): Call lto_init_reader. + * lto-lang.c (lto_type_for_size): Handle intTI_type_node. + (lto_init): Initialize main_identifier_node if needed. + Make ptrdiff_type_node be integer_type_node. + +2009-06-19 Diego Novillo + + * lto.c: Remove code guarded by #ifdef LTO_STREAM_DEBUGGING. + Remove code guarded by #ifdef GLOBAL_STREAMER_TRACE. + Remove code guarded by #ifdef LOCAL_TRACE. + +2009-06-18 Diego Novillo + + * lto.c: Update license to GPLv3. + * lto-elf.c: Likewise. + * common.c: Likewise. + * lto-lang.c: Likewise. + * lto.h: Remove superfluous include files. Update all + users. + +2009-06-17 Diego Novillo + + * lto.c (read_cgraph_and_symbols): Call input_cgraph. + +2009-06-02 Diego Novillo + + * lto.c (lto_1_to_1_map): Ignore nodes that have not been + read in. + (materialize_cgraph): Only materialize nodes that have a + representation on file. + +2009-06-01 Diego Novillo + + * lto-lang.c (lto_handle_option): Hanlde OPT_Wabi. + +2009-05-31 Diego Novillo + + * lto-lang.c (lto_type_for_mode): Handle all the modes + handled in c_common_type_for_mode. + +2009-05-21 Diego Novillo + + * lto-elf.c: Always include . + * config-lang.in (target_libs): Remove. + (build_by_default): Set to no. + +2009-05-15 Diego Novillo + + * lto.c (lto_materialize_function): Assert that DECL is + not a builtin. + (materialize_cgraph): Don't try to materialize builtin + functions. + * lto-section-out.c (write_symbol_vec): Do not write + builtin functions. + +2009-05-13 Diego Novillo + + * lto-lang.c (LANG_HOOKS_GET_ALIAS_SET): Define. + +2009-05-07 Diego Novillo + + * lto.c (lto_resolution_read): Add type casts for C++ warnings. + (LTO_REGISTER_TYPE_AND_FIXUP_SUBTREE): Define. + (lto_fixup_type): Call it for TYPE_POINTER_TO, + TYPE_REFERENCE_TO, TYPE_CONTEXT and TYPE_CANONICAL. + (lto_fixup_tree): Call gimple_register_type when *TP is a + type. + (lto_main): Call bitmap_obstack_initialize. + +2009-04-22 Diego Novillo + + * lto.c (free_section_data): Tidy. + (lto_1_to_1_map): Tidy. + (lto_add_all_inlinees): Tidy. + (prefix_name_with_star): New. + (get_filename_for_set): New. + (lto_wpa_write_files): Call cgraph_node_set_needs_ltrans_p + to determine what cgraph node sets to write. + Call get_filename_for_set to compute temporary file + names. + (lto_execute_ltrans): Do not execute LTRANS on files with + names that start with '*'. + Move logic to execute LTRANS together so that LTRANS is + invoked only if there are any files to compile. + (do_whole_program_analysis): Only remove output files + that do not start with '*'. + +2009-04-06 Diego Novillo + + * lto-lang.c (lto_post_options): Set flag_excess_precision_cmdline. + * lto.c (read_cgraph_and_symbols): Set cgraph_function_flags_ready. + (lto_add_all_inlinees): Tidy. + +2009-03-26 Diego Novillo + + * lto.c: Include gimple.h. + (lto_read_in_decl_state): Call gimple_register_type for + every type in every stream. + (lto_fixup_common): Call gimple_register_type if T has a + type. + (do_whole_program_analysis): Call print_lto_report. + (lto_main): Call print_lto_report after cgraph_optimize. + * Make-lang.in (lto.o): Add dependency on GIMPLE_H. + +2009-03-24 Diego Novillo + + * Make-lang.in (lto-lang.o): Add dependency on TARGET_H and EXPR_H. + (lto.o): Add dependency on GIMPLE_H. + +2009-03-10 Simon Baldwin + + * lto.c (lto_read_all_file_options): Close any open file descriptor + contained in file_data before freeing. + +2009-02-24 Rafael Avila de Espindola + + * lto.c (lto_add_inline_clones): Don't add the master clone. Check + for a decl in the original bitmap, not a node. + (lto_add_all_inlinees): Remove original nodes that are not needed. + (lto_scan_statics_in_cgraph_node): Don't care if the node is the master. + +2009-02-24 Diego Novillo + + * lto.c (lto_materialize_function): Update + lto_stats.num_function_bodies. + (get_section_data): Initialize *LEN to 0. + (lto_1_to_1_map): Update lto_stats.num_cgraph_partitions. + (lto_wpa_write_files): Update lto_stats.num_cgraph_nodes. + Update lto_stats.num_output_files. + (read_cgraph_and_symbols): Update lto_stats.num_input_files. + (materialize_cgraph): Update lto_stats.num_input_cgraph_nodes. + (lto_main): Initialize lto_stats. + If flag_lto_report is set, call print_lto_report. + +2009-02-19 Diego Novillo + + Revert + + 2009-02-19 Rafael Avila de Espindola + + * lto.c (lto_add_inline_clones): Don't add the + master clone. Check for a decl in the original + bitmap, not a node. + (lto_add_all_inlinees): Remove original nodes + that are not needed. + (lto_scan_statics_in_cgraph_node): Don't care if + the node is the master. + (lto_promote_cross_file_statics): Use a new + context.seen_node_decls for each set + +2009-02-19 Rafael Avila de Espindola + + * lto.c (lto_add_inline_clones): Don't add the master clone. Check + for a decl in the original bitmap, not a node. + (lto_add_all_inlinees): Remove original nodes that are not needed. + (lto_scan_statics_in_cgraph_node): Don't care if the node is the master. + (lto_promote_cross_file_statics): Use a new context.seen_node_decls + for each set + +2009-02-18 Diego Novillo + + * lto.c (lto_wpa_write_files): Use timers TV_WHOPR_WPA + and TV_WHOPR_WPA_IO. + (lto_execute_ltrans): Use timer TV_WHOPR_WPA_LTRANS_EXEC. + (read_cgraph_and_symbols): Use timer TV_IPA_LTO_DECL_IO. + (materialize_cgraph): Use timer TV_IPA_LTO_GIMPLE_IO. + Use timer TV_WHOPR_WPA or TV_WHOPR_LTRANS or TV_LTO + depending on command line flags. + (do_whole_program_analysis): Use timer TV_WHOPR_WPA. + (lto_main): Remove timer uses. + +2009-02-18 Rafael Avila de Espindola + + * lto.c (lto_materialize_function): Don't set DECL_EXTERN to 0. + (lto_wpa_write_files): Update calls to renamed functions. + +2009-02-17 Diego Novillo + + PR 39203 + * lto-lang.c (lto_post_options): Disable -fwhole-program + when running LTRANS. + +2009-02-10 Diego Novillo + + * lto.c (read_cgraph_and_symbols): Fix comment. + +2009-02-10 Diego Novillo + + * lto.c (read_cgraph_and_symbols): Read options from all + IL files. + +2009-02-10 Diego Novillo + + * lto.c (read_cgraph_and_symbols): Factor out of lto_main. + (materialize_cgraph): Likewise. + (do_whole_program_analysis): Likewise. + (lto_main): Call read_cgraph_and_symbols, + materialize_cgraph and do_whole_program_analysis. + +2009-02-10 Simon Baldwin + + * lto.c: Include lto-opts.h. + * (lto_main): Clear file options at loop start, read any saved + options from the first file handled, and re-issue options. + * Makefile.in (lto.o): Add dependency on lto-opts.h. + +2009-02-02 Diego Novillo + + * lto.c (lto_main): Stop LTO_TIMER and use + TV_WHOPR_WPA_LTRANS_EXEC when launching LTRANS. + +2009-01-30 H.J. Lu + + PR lto/38995 + * lto-elf.c (init_shdr##BITS): Set the sh_addralign field + to POINTER_SIZE. + +2009-01-29 Ramana Radhakrishnan + + * Make-lang.in (LTO_EXE): Link with all + BACKENDLIBS and not only GMPLIBS + +2009-01-28 H.J. Lu + + PR bootstrap/38992 + * lto-elf.c: Include gelf.h instead of libelf.h. + (lto_elf_file_close): Replace elfx_update_shstrndx with + gelf_getehdr, elf_getscn, gelf_getshdr, gelf_update_shdr and + gelf_update_ehdr. + +2009-01-28 H.J. Lu + + PR middle-end/38996 + * lto-elf.c (DEFINE_INIT_EHDR): Initialize e_version. + +2009-01-26 Diego Novillo + + * lto-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Update. + +2009-01-26 Diego Novillo + + * lto-lang.c (lto_types_compatible_p): Move to gimple.c + and rename into gimple_types_compatible_p. + +2009-01-12 Rafael Avila de Espindola + + * lto-lang.c (lang_hooks): Remove the const qualifier. + +2009-01-06 Diego Novillo + + * ltrans-driver: Mark 'all' target as phony. + +2008-12-31 Diego Novillo + + * ltrans-driver: Execute a NOP action for target 'all'. + +2008-12-19 Diego Novillo + + * lto.c (lto_1_to_1_map): Tidy. + +2008-12-19 Diego Novillo + + * lto-elf.c (lto_elf_file_open): When FILENAME cannot + be opened, show its name. + * ltrans-driver: If $verbose is set, do not use parallelism. + +2008-12-17 Rafael Avila de Espindola + + * lto.c (lto_fixup_function): New. + (lto_fixup_tree): Call lto_fixup_function. + +2008-12-14 Doug Kwan + + * lto.c (lto_1_to_1_map): Create a cgraph node set for any global + variables if there is no function. + +2008-12-10 Simon Baldwin + + * ltrans-driver: Always run make in silent mode, to avoid make's + trace on stdout interfering with lto-wrapper output. + +2008-12-10 Doug Kwan + + * lto.c (lto_add_inline_clones): Do not force master clones of + inlined functions already in SET to be static inline. + +2008-12-04 Doug Kwan + + * lto.c (globalize_context_t): New type to store states in + globalization of cross-file statics. + (globalize_cross_file_statics): New. + (lto_scan_statics_in_ref_table): Walk tree to look for reachable + static decls that need to be fixed up. + (lto_scan_statics_in_cgraph_node): Change call interface to use + a globalize_context_t CONTEXT for all states used. + (lto_scan_statics_in_remaining_global_vars): New. + (lto_promote_cross_file_statics): Use new call interface of + LTO_SCAN_STATICS_IN_CGRAPH_NODE. Handle remaining externally + visible vars in the last set. + +2008-12-03 Diego Novillo + + * lto.c (lto_fixup_tree): Do not emit an error when + PREVAILING throw but T doesn't. + +2008-12-02 Doug Kwan + + * lto.c (lto_scan_statics_in_ref_table): New function factored out + from code in ... + (lto_scan_statics_in_cgraph_node): Handle both file-scope static + variables and functions. + (lto_promote_cross_file_statics): Rename bitmaps to SEEN_DECLS + and GLOBAL_DECLS from SEEN_VARS and GLOBAL_VARS. + +2008-11-29 Diego Novillo + + * lto.c: Include timevar.h. + (lto_materialize_function): Tidy. Add comments. + (lto_wpa_write_files): Tidy. + (lto_execute_ltrans): Tidy. + (lto_main): Add local variable LTO_TIMER. Initialize it + to one of TV_WHOPR_WPA, TV_WHOPR_LTRANS or TV_LTO. + Start and stop the timer. + Tidy comments. + * Make-lang.in (lto.o): Add dependency on timevar.h. + * ltrans-driver: React to -v and -save-temps. + Use simple heuristic to determine how much parallelism to + use when executing make. + +2008-11-12 Doug Kwan + + * lto.c (lto_bitmap_obstack): Remove var. + (lto_materialize_function): Do nothing instead of marking function + body in file if flag_wpa is true. + (lto_add_all_inlinees): Use bitmap functions in lto-utils.c. + (lto_scan_statics_in_cgraph_node): New function. + (lto_promote_cross_file_statics): Same. + (lto_wpa_write_files): Call lto_promote_cross_file_statics. + Use bitmap functions in lto-utils.c. Remove unsued label OUT. + * Make-lang.in (lto/lto.o): Add lto-utils.h to dependency list. + +2008-11-09 Diego Novillo + + * lto/lto.c (lto_fixup_tree): Change error message locus + information to include location of mismatching + declaration. + Use TREE_NO_WARNING to avoid repeated messages. + (lto_main): If lto_fixup_decls emitted any errors, exit. + * lto/lto-lang.c: Don't include libfuncs.h and except.h + (lto_init_options): Don't enable exceptions by default. + (lto_eh_runtime_type): Move to lto-function-in.c + (lto_init_eh): Likewise. + (lto_init): Don't call lto_init_eh. + * lto/Make-lang.in (lto-lang.o): Remove dependency on + libfuncs.h and except.h. + +2008-10-30 Diego Novillo + + * lto.c (lto_read_decls): Declare debug_main only if + LTO_STREAM_DEBUGGING is enabled. + +2008-10-30 Simon Baldwin + + * lto.c (lto_wpa_write_files): Create intermediate files with + make_cwd_temp_file(). + (lto_maybe_unlink): New. Delete intermediate WPA files unless + WPA_SAVE_LTRANS is set. + (lto_main): Call lto_maybe_unlink() for intermediate WPA files. + * ltrans-driver: Do not strip directory from output files. + +2008-10-29 Doug Kwan + + * lto.c (free_decl): Call lto_symtab_clear_resolution when freeing + DECL. + * Make-lang.in (LTO_OBJS): Remove lto/lto-symtab.o + (lto/lto-symtab.o): Remove rule. + * lto-tree.h (struct lang_identifier): Remove LTO specific fields. + (struct lang_decl): Remove RESOLUTION and add DUMMY in struct. + (LANG_IDENTIFIER_CAST, LTO_IDENTIFIER_DECL, LTO_DECL_RESOLUTION): + Remove macros. + lto-symtab.c (File): Move up one level. + lto-lang.c (cgraph.h): Remove include. + (input_overwrite_node, input_node, input_edge, input_cgraph_1, + input_cgraph): Move to lto-cgraph.c in gcc directory above. + (LANG_HOOKS_INPUT_CGRAPH): Remove use of macro. + +2008-10-24 Rafael Espindola + + * lto-function-in.c (get_resolution): Return LDPR_PREEMPTED_IR for + non prevailing weak symbols. + +2008-10-24 Rafael Espindola + + * lto-lang.c (input_cgraph_1): Iterate over nodes, not cgraph_nodes. + +2008-10-24 Rafael Espindola + + * lto-lang.c (input_node): Avoid casts from pointers to ints of + different types. + +2008-10-23 Simon Baldwin + + * lto-lang.c (input_node): Save the node reference, rather than the + node pointer, in node->inlined_to. + (input_cgraph_1): Convert node references into node pointers. + +2008-10-22 Diego Novillo + Rafael Espindola + + * lto.c (lto_resolution_read): Tidy. + * lto-symtab.c (lto_symtab_prevailing_decl): Do not + abort if RET is NULL. + +2008-10-22 Doug Kwan + + * lto.c (lto_fixup_tree): Check for NOTHROW conflict only if + exceptions flag is given. + * lto-lang.c: (lto_init_options) Set default exceptions flag. + (lto_init_eh): Remove exceptions flag initialization. + (lto_init): Only call lto_init_eh if exceptions flag is set. + +2008-10-21 Diego Novillo + + * lto.c: Tidy some formatting. + * lto.h: Likewise. + +2008-10-21 Simon Baldwin + + * lto-symtab.c: (lto_same_type_p): Types cannot be equal if one of + them is NULL (but not the other). + +2008-10-17 Diego Novillo + + * ltrans-driver: Divert output from make to a temporary file. + Show it if the call to make failed. + +2008-10-15 Diego Novillo + + * lto.c (lto_wpa_write_files): Reformat do-while loop. + Do not print TEMP_FILENAME + * ltrans-driver: Call make with -s. + +2008-10-15 Diego Novillo + + * lto-symtab.c (lto_symtab_merge_decl): Do not force + TREE_STATIC on global symbols. + +2008-10-14 Ollie Wild + + * Make-lang.in (LTRANS_DRIVER_INSTALL_NAME): Remove. + (LTRANS_DRIVER_EXE): Add. + (lto.all.cross): Add LTRANS_DRIVER_EXE. + (lto.all.encap): Add LTRANS_DRIVER_EXE. + (lto.install.common): Remove ltrans-driver. + (lto.mostlyclean): Add LTRANS_DRIVER_EXE. + (LTRANS_DRIVER_EXE): New build rule. + * config-lang.in (compilers): Add ltrans-driver. + +2008-10-14 Diego Novillo + + * Make-lang.in (LTRANS_DRIVER_INSTALL_NAME): Disable transformation + of program name. + +2008-10-13 Ollie Wild + + * lang-spec.h (@lto): Replace lto1_options with cc1_options. + * lto.c (lto_execute_ltrans): Add "-fno-wpa -fltrans -xlto" to CFLAGS. + * ltrans-driver (LTRANS_FLAGS): Remove. + +2008-10-08 Doug Kwan + + * lto.c (lto_fixup_tree): Remove ATTRIBUTE_UNUSED from DATA. + Handle new tree codes RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE + and TREE_BINFO. Also move code handling FUNCTION_DECL and VAR_DECL + from lto_fixup_state to here. + (lto_fixup_state): Take an lto_fixup_data_t object DATA instead of + just a free-list. Fix up types also. Move decl merging code to + lto_fixup_tree. + (lto_fixup_state_aux): Change AUX to point to an lto_fixup_data_t + object. + (lto_fixup_decls): Use another pointer set to avoid multiple + walking of nodes except for DECLs to be replaced. Pass an + lto_fixup_data_t object to tree-walker. + +2008-10-08 Rafael Espindola + + * lto-symtab.c (lto_symtab_set_resolution): New. + (lto_symtab_merge_decl): Use lto_symtab_set_resolution and + lto_symtab_get_resolution. + (lto_symtab_prevailing_decl): Return decl for non public decls. + (lto_symtab_get_resolution): New. + * lto.c (lto_fixup_tree, lto_fixup_state): Remove unecessary checks. + +2008-10-06 Rafael Espindola + + * lto-lang.c: Include cgraph.h. + (input_overwrite_node, input_node, input_edge, input_cgraph_1, + input_cgraph): Moved from lto-cgraph.c. + (LANG_HOOKS_INPUT_CGRAPH): New. + +2008-10-03 Rafael Espindola + + * lto.c (lto_fixup_tree, lto_fixup_state): Fix the FIXME. + +2008-10-03 Rafael Espindola + + * lto-symtab.c (lto_symtab_overwrite_decl): Remove. Remove all calls. + (lto_symtab_merge_decl): Update LTO_IDENTIFIER_DECL the reflect the + prevailing definition. Don't mark TREE_NOTHROW differences. + * lto.c (lto_fixup_tree): New. + (lto_fixup_state): New. + (lto_fixup_state_aux): New. + (free_decl): New. + (lto_fixup_decls): New. + (lto_main): Call lto_fixup_decls. + +2008-10-02 Ollie Wild + + * lang.opt (fltrans): Moved from common.opt. Remove RejectNegative + and Init. + (fwpa): Moved from common.opt. Remove RejectNegative and Init. + * lto-lang.c (lto_post_options): Add validation and fixups for + -fltrans and -fwpa. + +2008-10-02 Rafael Espindola + + * lto-symtab.c (lto_symtab_merge_var, lto_symtab_merge_fn, + lto_symtab_merge_decl): Return void. + (lto_symtab_prevailing_decl): New. + +2008-09-30 Rafael Espindola + + * lto-symtab.c (lto_symtab_compatible): Remove the check for already + defined symbols. + (lto_symtab_overwrite_decl): Copy LTO_DECL_RESOLUTION. + (lto_symtab_merge_decl): Store symbol resolution in LTO_DECL_RESOLUTION. + Check for already defined symbols. + * lto-tree.h (lang_decl): Remove dummy and add resolution fields. + (LTO_IDENTIFIER_RESOLUTION): Remove. + (LTO_DECL_RESOLUTION): New. + +2008-09-30 Rafael Espindola + + * lto.c (lto_read_decls): Use new input_tree signature. + +2008-09-26 Doug Kwan + + * lto.c (lto_main): Call lto_fixup_nothrow_decls to fix up function + bodies affected by exception attribute merging of DECLs. + * lto-symtab.c (lto_symtab_merge_decl): Handle exception attribute + merging. + +2008-09-25 Rafael Espindola + + * Make-lang.in (PLUGIN_API_H, LTO_TREE_H): New. + (lto/lto-lang.o, lto/lto.o, lto/lto-symtab.o) Use LTO_TREE_H. + * lto-symtab.c (lto_symtab_compatible): New. + (lto_symtab_overwrite_decl): New. + (lto_symtab_merge_decl): Refactor to use the above functions + and the resolution from lang_identifier. + * lto-tree.h: Include plugin-api.h. + (lang_identifier): Add resolution. + (LTO_IDENTIFIER_RESOLUTION): New. + +2008-09-25 Ollie Wild + + * lang.opt (fltrans-output-list=): New option. + * lto.c (lto_execute_ltrans): Output file names to ltrans_output_list. + +2008-09-25 Rafael Espindola + + * lto.c (lto_resolution_read): Initialize ret; + +2008-09-24 Ollie Wild + + * lto.c (sys/mman.h): Move include. + (lto_wpa_write_files): Return a list of written files. + (lto_execute_ltrans): New function. + (lto_main): Call lto_execute_ltrans. + (ltrans-driver): New file. + * lto-lang.c (DEFAULT_LTRANS_DRIVER): New macro. + (DEAULT_LTRANS_DRIVER_LEN): New macro. + (lto_init_options): Initialize ltrans_driver. + (lto_handle_option): Fix incorrect default output value. + * lang.opt (fltrans-driver=): New option. + * Make-lang.in (LTRANS_DRIVER_INSTALL_NAME): New variable. + (lto.install-common): Add lto/ltrans-driver. + +2008-09-24 Rafael Espindola + + * Make-lang.in (LTO_OBJS): Add lto/common.o. + (lto/lto.o): Depend on lto/common.h. + (lto/common.o): New. + * lang.opt (resolution): New. + * lto-lang.c (resolution_file_name): New. + (lto_handle_option): Handle OPT_resolution. + * lto-symtab.c (lto_symtab_merge_decl): Add a resolution argument. + (lto_symtab_merge_var,lto_symtab_merge_fn): Add a resolution argument. + pass it to lto_symtab_merge_decl. + * lto.c: Include common.h. + (lto_read_decls): Add resolutions and resolutions_size arguments. + Initialize data_in.globals_resolution and + data_in.globals_resolution_size. + (index_and_symbol_resolution): New. + (lto_resolution_read): New. + (lto_file_read): Add argument resolution_file. + Read resolution. + * lto.h (resolution_file_name): New. + +2008-09-23 Rafael Espindola + + * common.c: Update description. + * common.h: Update description. + +2008-09-23 Rafael Espindola + + * common.c: Moved from lto-plugin. + * common.h: Moved from lto-plugin. + +2008-09-22 Doug Kwan + + * lto.c (VEC(bitmap,heap)): Declare. + (lto_materialize_function): Handle WAP mode specially. + (lto_add_inline_clones): New. + (lto_add_all_inlinees): Changle algorithm and to use bitmaps. Also + return a bitmap of inlined decls. + (lto_wpa_write_files): Handle all DECLs brought in by inlining. + (lto_main): Call reset_inline_failed to reset inlining states. + Check call-graph after WPA inlining. + * lto-lang.c (lto_init): Do not clear flag_generate_lto + unconditionally. + +2008-09-19 Doug Kwan + + lto.c (lto_main): Remove unsued wrapper code. + lang-specs.h (@lto): Use lto1_options instead of cc1_options. + +2008-09-19 Rafael Espindola + + * lto-symtab.c: Include lto-tree-in.h. + * lto-tree.h (lto_symtab_merge_var, lto_symtab_merge_fn): Remove. + * lto.h (lto_symtab_merge_var, lto_symtab_merge_fn): Remove + * Make-lang.in (lto/lto-symtab.o): Add lto-tree-in.h. + +2008-09-17 Paolo Bonzini + Rafael Avila de Espindola + + * lto-lang.c (COMPOUND_LITERAL_EXPR_DECL_STMT, + COMPOUND_LITERAL_EXPR_DECL): Remove. + (emit_local_var): Remove. + (lto_expand_expr): Remove. + (lto_staticp): Remove. + (LANG_HOOKS_EXPAND_EXPR): Remove. + (LANG_HOOKS_STATICP): Remove. + +2008-09-11 Diego Novillo + + * lto-lang.c: Include except.h and libfuncs.h. + (lto_init_eh): New. + (lto_init): Call it. + Set flag_generate_lto to 0. + * Make-lang.in (lto-lang.o): Add dependency on except.h + and libfuncs.h. + +2008-09-09 Bill Maddox + + * lto-lang.c: Include header file expr.h. + (COMPOUND_LITERAL_EXPR_DECL_STMT, + COMPOUND_LITERAL_EXPR_DECL): Copied from c-common.h. + (emit_local_var): Copied from c-semantics.c. + (lto_expand_expr, lto_staticp): Copied from c_expand_expr + and c_staticp in c-common.c. + (LANG_HOOKS_EXPAND_EXPR,LANG_HOOKS_STATICP): Redefined. + +2008-09-08 Diego Novillo + + * lto-lang.c (lto_global_bindings_p): Return 1 during + IPA passes. + +2008-09-07 Diego Novillo + + * lto.c: Tidy formatting. + +2008-08-04 Bill Maddox + + * lto-symtab.c (lto_symtab_merge_decl): Add comment. + +2008-09-03 Doug Kwan + + lto.c (lto_add_all_inlinees): Reset FAILED_REASON of edges to + CIF_OK instead of NULL. + +2008-09-02 Diego Novillo + Simon Baldwin + + * lto-lang.c (lto_type_for_size): Rewrite. Adapt from + c_common_type_for_size. + (lto_type_for_mode): Remove ATTRIBUTE_UNUSED markers. + (lto_init): Call linemap_add. + (signed_and_unsigned_types): Remove. + +2008-08-29 Diego Novillo + + * lto-lang.c (handle_noreturn_attribute): New local function. + (handle_const_attribute): New local function. + (handle_malloc_attribute): New local function. + (handle_pure_attribute): New local function. + (handle_novops_attribute): New local function. + (handle_nonnull_attribute): New local function. + (handle_nothrow_attribute): New local function. + (handle_sentinel_attribute): New local function. + (handle_type_generic_attribute): New local function. + (handle_format_attribute): New local function. + (handle_format_arg_attribute): New local function. + (lto_attribute_table): Declare. + (lto_format_attribute_table): Declare. + (lto_init_attributes): New local function. + (lto_define_builtins): Call it. + Call targetm.init_builtins and build_common_builtin_nodes. + (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE): Define. + (LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE): Define. + +2008-08-28 Diego Novillo + + * Make-lang.in (lto-lang.o): Replace tree-gimple.h with + $(GIMPLE_H). + (lto-symtab.o): Add dependency on $(GIMPLE_H). + * lto-lang.c: Include gimple.h instead of tree-gimple.h. + * lto-symtab.c: Include gimple.h. + * lto-tree.h (chain_next): Replace GENERIC_NEXT with + TREE_CHAIN. + +2008-08-27 Doug Kwan + + * lto.c (vec.h, bitmap.h, pointer-set.h, ipa-prop.h, ggc.h, + gt-lto-lto.h): New includes. + (lto_materialize_function): Do not read in function body in WPA mode. + Format a line to fit in 80 columns. + (lto_cgraph_node_sets): New garbage collected variable. + (lto_1_to_1_map, lto_add_all_inlinees, lto_wpa_write_files): + New functions. + (lto_main): Initialize bitmap obstack. Add code to handle WPA mode. + * Make-lang.in (LTO_H): Replace filename lto-section-in.h with + variable LTO_SECTION_IN_H. + (lto/lto.o): Include gt-lto-lto-c.h ggc.h ,VEC_H, BITMAP_H, + pointer-set.h and IPA_PROP_H. Also replace filename lto-section-in.h + with variable LTO_SECTION_IN_H. + * config-lang.in (gtfiles): Add lto/lto.c. + * lto-symtab.c (lto_symtab_merge_decl): Set DECL_CONTEXT of + merged DECL_RESULT correctly. + +2008-08-26 Bill Maddox + + * lto-lang.c Include tree-gimple.h. + (lto_mark_addressable): Call mark_addressable rather than + asserting. + (lto_post_options): Suppress debug info generation. + * Make-lang.in: Add dependency of lto-lang.o on tree-gimple.h. + +2008-08-25 Bill Maddox + + * lto-symtab.c (lto_symtab_merge_decl): Remove a suspect + assertion and leave an explanatory comment in its place. + +2008-08-21 Doug Kwan + + * lto.c (preload_common_nodes): Call lto_get_common_nodes to get a list + of common nodes instead of computing locallly. + (lto_read_in_decl_state): New. + (lto_read_decls): Change code for udpate in struct lto_decl_header. + Read global and per-function in-decl states. + * Make-lang.in (LTO_H): Update dependency. + (lto/lto.o): Same. + (lto-symtab.c): Merge (revision 139039) + * lto-symtab.c (lto_symtab_merge_decl): Merge DECL_RESULT. + +2008-08-21 Rafael Espindola + + * config-lang.in (target_libs): New. + +2008-08-20 Bill Maddox + + * lto.c (current_lto_file): Remove GTY marker from static + variable. Remove include of file gt-lto-lto.h. + * Make-lang.in: Remove dependency of lto/lto.o on + gt-lto-lto.h. + * lto-elf.c (lto_file_close): Removed. + (lto_elf_file_open): Use XCNEW instead of GGC_CNEW to + allocate lto_elf_file object. + (lto_elf_file_close): Free lto_elf_file object after close. + * lto.h (struct lto_file_struct): Remove GTY marker. + * config-lang.in: Remove lto/lto.h and lto/lto.c from + gtfiles. + +2008-08-20 Bill Maddox + + * lto.c (lto_read_decls): Provide dummy argument to input_tree + to conform to its new signature. + * lto-symtab.c (lto_symtab_merge_decl): Do not invoke ggc_free + on discarded node here, now called in global_vector_fixup. + +2008-08-09 Bill Maddox + + * lto.c (preload_common_nodes): Verify that fileptr_type_node + has not been set to a front-end-specific value. + +2008-08-05 Doug Kwan + + * Make-lang.in (lto-symtab.o): Add missing dependencies to fix + build breakage. + +2008-07-30 Bill Maddox + + * lto.c (lto_materialize_function): Call lto_original_decl_name. + Remove obsolete comments. + (lto_read_decls): Remove initialization of deleted field data_in.global. + Tidy up comments. + (lto_main): Remove redundant initialization of section_hash_table. + * lto-elf.c: Removed obsolete comments. + * lto.h: Tidy up comments. + * lto-symtab.c (lto_least_common_multiple): New function. + (lto_symtab_merge_decl): Merge variable alignments in some cases. + Tidy up comments. + +2008-07-25 Diego Novillo + Bill Maddox + + * lto.c: Re-order include files. + Include lto-section-out.h. + (preload_common_nodes): Add debugging output. + Add new local INDEX_TABLE. + Call preload_common_node. + * Make-lang.in (lto.o): Add dependency on lto-section-out.h + +2008-07-13 Bill Maddox + + * lto.c (lto_read_decls): Cast pointer to const char * to avoid + unwanted scaling during pointer addition. + +2008-07-11 Bill Maddox + Diego Novillo + + * lto.c (lto_read_decls): Fix C++ compatibility warnings. + Make code const-correct. + (lto_file_read): Fix C++ compatibility warnings. + (lto_read_section_data): Fix C++ compatibility warnings. + (lto_get_section_data): Use CONST_CAST to avoid warning when + const pointer passed to free. + * lto-elf.c (lto_elf_build_section_table): Fix C++ + compatibility warnings. + (lto_elf_append_data): Fix C++ compatibility warnings. Use CONST_CAST + to avoid warning assigning const pointer to d_buf field of Elf_Data. + (lto_get_current_out_file): Fix C++ compatibility warnings. + +2008-07-11 Diego Novillo + + * Make-lang.in (lto-warn): Define. + +2008-07-03 Simon Baldwin + + * lto.c (lto_read_decls): Wrapped debug-only data items within #ifdef + LTO_STREAM_DEBUGGING. + +2008-06-27 Ollie Wild + + * lto-elf.c (lto-section-out.h): New include. + (struct lto_elf_file): Remove bits member. Add scn, shstrtab_stream, + and data members. + (cached_file_attrs): New static variable. + (lto_elf_get_shdr, lto_elf_free_shdr): Remove elf_file parameter. + Use cached_file_attrs for checking bits. + (lto_elf_build_section_table): Remove elf_file argument from + lto_elf_get_shdr and lto_elf_free_shdr calls. + (DEFINE_INIT_SHDR): New macro. + (init_shdr32, init_shdr64): New functions defined via the + DEFINE_INIT_SHDR macro. + (lto_elf_begin_section_with_type): New function. + (lto_elf_begin_section): New function. + (lto_elf_append_data): New function. + (lto_elf_end_section): New function. + (DEFINE_VALIDATE_EHDR): New macro. + (validate_ehdr32, validate_ehdr64): New functions defined via the + DEFINE_VALIDATE_EHDR macro. + (validate_file): New function. + (DEFINE_INIT_EHDR): New macro. + (init_ehdr32, init_ehdr64): New functions defined via the + DEFINE_INIT_EHDR macro. + (init_ehdr): New function. + (lto_elf_file_open): Add support for writable files. Move some + validation logic to validate_file. + (lto_elf_file_close): Add support for writable files. Write file data + and free data blocks. + (current_out_file): New static variable. + (lto_set_current_out_file): New function. + (lto_get_current_out_file): New function. + * lto.c (lto_main): Add writable argument to lto_elf_file_open calls. + Add temporary initialization for testing ELF serialization. + * lto.h (lto-section-out.h): New include. + (struct lto_file_struct): Slight modification to comment. + (lto_elf_file_open): Add writable parameter. + (lto_elf_begin_section): New function declaration. + (lto_elf_append_data): New function declaration. + (lto_elf_end_section): New function declaration. + (lto_set_current_out_file, lto_get_current_out_file): New function + declarations. + * lto-lang.c (LANG_HOOKS_BEGIN_SECTION): Set as lto_elf_begin_section. + (LANG_HOOKS_APPEND_DATA): Set as lto_elf_append_data. + (LANG_HOOKS_END_SECTION): Set as lto_elf_end_section. + * Make-lang.in (LTO_H): Add lto-section-out.h. + +2008-06-12 Ollie Wild + + * lto.h (struct lto_file_vtable_struct): Remove. + (struct lto_file_struct): Remove vtable member. + * lto-elf.c (lto_file_init): Remove vtable argument. + (lto_elf_map_optional_lto_section): Remove. + (lto_elf_unmap_section): Remove. + (lto_elf_file_vtable): Remove. + (lto_elf_file_open): Remove lto_elf_file_vtable argument from + lto_file_init call. + (lto_elf_find_section_data): Remove. + +2008-06-11 Ollie Wild + + * lto.c (lto_file_read): Add const qualifier to data variable. + +2008-06-11 Diego Novillo + + Merge from lto-streamber sub-branch. + + 2008-06-04 Ollie Wild + + * lto.c: Remove inclusion of dwarf2.h and dwarf2out.h. + * Make-lang.in (lto.o): Remove dependency on dwarf2.h. + + 2008-05-28 Bill Maddox + + Replace the DWARF reader in the LTO front-end. + + * lto.c: Include lto-tree-in.h, lto-tags.h. + (enum DWARF2_class, DW_cl_constant, struct + DWARF2_form_data, struct lto_context, + lto_fd_init, lto_info_fd_init, + lto_abbrev_fd_init, lto_info_fd_close, + lto_file_init, lto_file_close, + lto_file_corrupt_error, lto_abi_mismatch_error, + LTO_CHECK_INT_VAL, LTO_READ_TYPE, + lto_read_uleb128, lto_read_sleb128, + lto_read_initial_length, lto_abbrev_read_attrs, + lto_abbrev_read, lto_abbrev_read_lookup, + lto_read_section_offset, + lto_read_comp_unit_header, find_cu_for_offset, + lto_get_file_name, + lto_resolve_reference,lto_read_form, + attribute_value_as_int, + make_signed_host_wide_int, + attribute_value_as_constant, lto_cache_hash, + lto_cache_eq, lto_cache_store_DIE, + lto_cache_lookup_DIE, lto_find_integral_type, + lto_find_integral_type_1, + LTO_BEGIN_READ_ATTRS_UNCHECKED, + LTO_BEGIN_READ_ATTRS, LTO_END_READ_ATTRS, + lto_unsupported_attr_error, lto_get_identifier, + lto_read_referenced_type_DIE, + lto_read_compile_unit_DIE, + lto_read_array_type_DIE, + lto_read_structure_union_class_type_DIE, + lto_read_enumerator_DIE, + lto_read_enumeration_type_DIE, + lto_read_only_for_child_DIEs, + lto_read_only_for_child_DIEs, + lto_read_member_DIE, lto_read_abbrev, + lto_read_variable_formal_parameter_constant_DIE, + lto_get_body): Removed. + (preload_common_nodes): New function. + (lto_read_decls): Convert for new global streamer. + (lto_materialze_file_data, + lto_read_subroutine_type_subprogram_die, + lto_read_unspecified_parameters_DIE, + lto_read_typedef_DIE, + lto_read_pointer_reference_type_DIE, + lto_read_subrange_type_DIE, + lto_read_base_type_DIE, + lto_read_const_volatile_restrict_type_DIE, + lto_read_namespace_DIE, + lto_read_unspecified_type_DIE, lto_read_DIE, + lto_read_child_DIEs, lto_collect_child_DIEs): + Removed. + (lto_info_read, lto_set_cu_context): Removed. + (lto_file_read): Convert for new global streamer. + (lto_resolve_type_ref, lto_read_DIE_at_ptr, + lto_resolve_var_ref, lto_resolve_fn_ref, + lto_resolve_field_ref, lto_resolve_typedecl_ref, + lto_resolve_namespacedecl_ref): Removed. + (lto_file_init, lto_file_close): Moved to lto-elf.c. + * lto-tree.h (lto_symtab_merge_var, + lto_symtab_mergee_fun): Declare here. + * lto-elf.c (lto_file_init, lto_file_close): Moved from lto.c. + (lto_elf_file_open): Removed code to read DWARF debug sections. + * lto.h (lto_context, DWARF2_attr, DWARF2_abbrev, + DWARF2_CompUnit, lto_die_ptr, + lto_die_cache_entry, lto_fd, lto_info_fd, + lto_abbrev_fd): Removed. + (lto_file): Removed debug_info and debug_abbrev fields. + (lto_ref): Removed. + (lto_file_init, lto_file_close, + lto_resolve_type_ref, lto_resolve_var_ref, + lto_resolve_fn_ref, lto_resolve_field_ref, + lto_resolve_typedecl_ref, + lto_resolve_namespacedecl_ref, + lto_get_file_name): Removed declarations. + (lto_symtab_merge_var, lto_symtab_merge_fn): + Declarations moved to lto-tree.h. + * lto-symtab.c (lto_compatible_attributes_p): + Lobotomize this, as it barfs on "Hello, world!". + * lto-section-out.c: Include lto-tree-out.h. + (lto_hash_global_slot_node, + lto_eq_global_slot_node, preload_common_nodes, + write_global_stream, write_global_references): + New functions. + (produce_asm_for_decls): Convert for new global streamer. + * lto-section-out.h (lto_hash_global_slot_node, + lto_eq_global_slot_node): Declare. + +2008-06-07 Kenneth Zadeck + Jan Hubicka + + * lto.c (sys/mman.h, tree-pass.h): New includes. + (lto_materialize_constructors_and_inits, + lto_materialize_function): Keeps length of section. + (lto_materialize_cgraph): Removed. + (lto_read_decls): Initialize fd field. + (lto_file_read): Different return type and removed much code to + lto_main. + (page_mask): New variable. + (lto_read_section_data, get_section_data, free_section_data): New + functions. + (lto_main): Now calls pass manager, sets the hooks so that the ipa + passes can get the section data. + +2008-05-27 Kenneth Zadeck + + * lto.h (lto_read_decls): Made local. + (lto_input_function_body, lto_input_constructors_and_inits, + lto_input_cgraph): Declarations moved to lto-section-in.h. + * lto-section-in.c: Moved to .. . + * lto-cgraph-in.c: Ditto. + * lto-section-in.h: Ditto. + * lto-function-in.c: Ditto. + * lto-lang.c (lto_handle_option): Added ATTRIBUTE_UNUSED to parms. + (lto_insert_block): Removed. + (LANG_HOOKS_INSERT_BLOCK): Removed. + * Make-lang.in (lto-cgraph-in.o, lto-function-in.o, + lto-section-in.o): Rules moved to lto/Makefile.in. + + +2008-05-16 Ollie Wild + + * lto-lang.c (tree-inline.h): Include. + (lto_post_options): New function. + (LANG_HOOKS_POST_OPTIONS): Define. + * lto-cgraph-in.c (overwrite_node): Set node->global.insns. + * lto-function-in.c (input_bb): Set TREE_BLOCK (stmt). + +2008-05-13 Diego Novillo + + * lto-function-in.c (input_ssa_names): Call + make_ssa_name_fn instead of make_ssa_name. + +2008-05-12 Diego Novillo + + * lto-cgraph-in.c (overwrite_node): Update references to + inline summary fields. + * lto-function-in.c (input_expr_operand): Do not handle + STRUCT_FIELD_TAG. + +2008-05-09 Ollie Wild + + * lang.opt: New file. + * lto-lang.c (lto_init_options): New function. + (lto_handle_option): New function. + (lto_init): Move initialization of flag_unit_at_a_time to + lto_init_options. + (LANG_HOOKS_INIT_OPTIONS): Define. + (LANG_HOOKS_HANDLE_OPTION): Define. + +2008-04-29 Ollie Wild + + * lto.c (lto_read_namespace_DIE): New function. + (lto_read_DIE): Add lto_read_namespace_DIE callback. Cache + NAMESPACE_DECL DIE's. + (lto_resolve_namespacedecl_ref): New function. + * lto.h (lto_resolve_namespacedecl_ref): New function. + * lto-section-in.c (lto_read_decls): Read namespace declarations. + * lto-section-in.h (struct lto_file_decl_data): Add namespace_decls + and num_namespace_decls. + * lto-function-in.c (input_expr_operand): Add NAMESPACE_DECL case. + * lto-lang.c (lto_init_ts): New function. + (LANG_HOOKS_INIT_TS): Set as lto_init_ts. + +2008-04-16 Ollie Wild + + * lto-function-in.c (input_type_ref): Updated function description. + +2008-04-16 Ollie Wild + + * lto-function-in.c (input_type_ref_1): New function. + (input_type_ref): Split into two functions. + (input_function): Add support for type contexts. + +2008-04-16 Ollie Wild + + * lto.c (lto_materialize_function): Use DECL_ASSEMBLER_NAME to compute + section name + +2008-04-16 Ollie Wild + + * lto.c (lto_read_compile_unit_DIE): Add DW_LANG_C_plus_plus to the + list of supported languages. + +2008-03-25 Kenneth Zadeck + + Merge with mainline @133491. + +2008-03-05 Kenneth Zadeck + Jan Hubicka + + * lto.c (lto_info_fd_init, lto_info_fd_close): Get rid of + fd->unmaterialized_fndecls. + (lto_get_file_name, lto_materialize_cgraph): New function. + (lto_materialize_constructors_and_inits, + lto_materialize_function): Read info directly from elf file. + (lto_file_read): Made local and initialize dictionary so that + other lto sections can be read without reprocessing the elf file. + (lto_main): Read all functions after all files have been processed + for their types, globals and cgraph. + * Make-lang.in (lto.o, lto-cgraph-in.c, lto-section-in): Changed + dependencies. + * lto-elf.c (lto_elf_file): Removed strtab, symtab fields. + (hash_name, eq_name, lto_elf_build_section_table): New functions. + (lto_elf_read_symtab): Removed function. + (lto_elf_file_open): Removed call to lto_elf_read_symtab. + * lto.h (lto_info_fd_struct): Removed unmaterialized_fndecls. + (lto_file_read): Made local. + (lto_get_file_name, lto_elf_build_section_table, + lto_input_cgraph): + New function. + * lto-section-in.c (lto_read_section_data, lto_get_section_data): + New functions. + (lto_read_decls): Get the file name. + * lto-cgraph-in.c: New file. + * lto-function-in.c (tag_to_expr): Stops at LTO_tree_last_tag. + (input_expr_operand, lto_read_body): Set lto_debug_context.tag_names. + (input_labels): Fixed latent sizeof issue. + (input_function): Build stmt array to set call sites into cgraph + edges. + (lto_read_body): Reset cfun->curr_properties. + * lto_section_in.h (lto_section_slot): New structure. + (section_hash_table.lto_file_decl_data): New field. + + +2008-02-09 Kenneth Zadeck + + * lto.c (lto_read_variable_formal_parameter_const): Remove code to + reconstruct static initializers. + (lto_get_body, lto_materialize_function): Add lto_section_type as + a parameter. + (lto_materialize_constructors_and_inits, + lto_materialize_file_data): New function. + (lto_materialize_function, + lto_read_subroutine_type_subprogram_DIE): Renamed unmap_fn_body to + unmap_section and map_fn_body to map_section. + (lto_set_cu_context): Process functions and static inits + differently. + * Make-lang.in (LTO_H, lto/lto-function-in.o, + lto/lto-section-in.o): Update dependencies. + * lto/lto-elf.c (lto_elf_map_optional_lto_section): Add + lto_section_type parameter. + (lto_elf_unmap_fn_body): Renamed to lto_elf_unmap_section. + * lto.h (lto_file_vtable_struct): Removed two of the fields and + renamed the other two so that there is only one map function and + one unmap function and each takes a section type parameter. + (lto_read_function_body): Renamed to lto_input_function_body and + added file_data parameter. + (lto_read_var_init): Removed. + (lto_input_constructors_and_inits): New function. + * lto-section-in.c (lto_read_decls): New function. + * lto-function-in.c (data_in): Moved fields field_decls, fn_decls, + var_decls, type_decls, types to lto_file_decl_data. + (input_type_ref, input_expr_operand, lto_read_body): Get + field_decls, fn_decls, var_decls, type_decls, types from different + structure. + (input_globals, input_constructor, lto_read_var_init): Removed. + (input_constructors_or_inits): New function. + (lto_read_function_body, lto_input_constructors_and_inits): + Renamed to lto_input_function_body and takes file_data parameter. + * lto-section-in.h (lto_file_decl_data): New structure. + +2008-01-28 Kenneth Zadeck + + * lto-function-in.c (input_globals.c): Changed input type to + lto_function_header. + (input_bb): Removed code to deserialize the stmt number. + (input_function): Renumber all stmts after they are input. + (lto_read_body, lto_read_function_body, lto_read_var_init): + Changed to used new header format and enum section_type. + *lto-lang.c (success): Removed. + +2008-01-28 Nathan Froyd + + * lto-elf.c (lto_elf_lookup_sym): Remove unused function. + (lto_elf_free_sym): Likewise. + + * lto-elf.c (lto_elf_read_var_init): Remove unused function. + (lto_elf_build_init): Likewise. + +2008-01-14 Kenneth Zadeck + + * lto-read.c: Renamed to lto-function-in.c. + (input_1_unsigned): Moved to lto-section-in.c and renamed + lto_input_1_unsigned. + (input_uleb128): Moved to lto-section-in.c and renamed + lto_input_uleb128. + (input_widest_uint_uleb128): Moved to lto-section-in.c and renamed + lto_input_widest_uint_uleb128. + (input_sleb128): Moved to lto-section-in.c and renamed + lto_input_sleb128. + (input_integer): Moved to lto-section-in.c and renamed + lto_input_integer. + (debug_in_fun): Moved to lto-section-in.c and renamed + lto_debug_in_fun. + (input_block): Moved to lto-section-in.h and renamed + lto_input_block. + (input_expr_operand): Fixed to allow lists with more than one + element. + * lto-section-in.h: New file. + * lto-section-in.c: New file with changes from above. + * Make-lang.in (lto-read.o): Renamed lto-function-in.c. + (lto-section-in.o): New rule. + +2007-12-29 Nathan Froyd + + * lto-read.c (input_expr_operand): Mark static and external + VAR_DECLs as needed. + +2007-12-29 Nathan Froyd + + * lto-read.c (input_integer): Use the correct shift amount. + +2007-12-29 Nathan Froyd + + * lto-lang.c (lto_pushdecl): Do nothing instead of aborting. + (LANG_HOOKS_NAME): Define. + +2007-12-27 Nathan Froyd + + * lto.c (lto_find_integral_type): Define as a macro. Rename the + original function to... + (lto_find_integral_type_1): ...this. Consult UNSIGNEDP if we + don't have a base type. + (lto_read_enumeration_type_DIE): Examine the values of the + enumeration to determine whether we can use an unsigned type for + the base type of the enumeration. + +2007-12-24 Nathan Froyd + + * lto.c (lto_read_structure_union_class_type_DIE): Set TYPE_MODE + and TYPE_ALIGN on UNION_TYPEs as soon as possible. + +2007-12-22 Nathan Froyd + + * lto-lang.c (lto_types_compatible_p): New function. + (LANG_HOOKS_TYPES_COMPATIBLE_P): Define. + +2007-12-22 Nathan Froyd + Kenneth Zadeck + + * lto-read.c (input_expr_operand): Fixed uninitialize var warning. + (input_local_vars): Read in DECL_INITIAL and context for local + statics that need to be put in unexpanded_vars_list. + +2007-12-21 Nathan Froyd + + * lto-read.c (input_real): Use a separate null-terminated buffer + for calling real_from_string. + (input_expr_operand): If we take the address of a FUNCTION_DECL, + tell cgraph that it's needed. + +2007-12-19 Doug Kwan + + * lto.c (lto_read_base_type_DIE): Handle complex integer types. + +2007-12-18 Nathan Froyd + + * lto.c (lto_read_DIE): Call lto_read_only_for_child_DIEs instead. + (lto_file_read): Reset the members of 'context' every time we read + a toplevel DIE, with special attention to last_param_type. + +2007-12-18 Nathan Froyd + + * lto.c (lto_read_subroutine_type_subprogram_DIE): Initialize + 'declaration'. Set the assembler name for non-public functions. + +2007-12-17 Kenneth Zadeck + + * lto_read.c (data_in.unexpanded_indexes): New array. + (input_local_var): Added code to read in unexpanded_var_list + indexes for variables. Only read in DECL_CHAIN field for + parameters. + (input_local_vars): Added code to rebuild unexpanded_var_list in + order using unexpanded_indexes. + (input_function): Added code to set DECL_CONTEXT for functions. + +2007-12-13 Doug Kwan + + * lto.c (lto_read_pointer_reference_type_DIE): Handle optional name + in pointer and reference types. + +2007-12-13 Nathan Froyd + + * lto-read.c (input_expr_operand): Use DECL_RESULT when reading a + RESULT_DECL. + +2007-12-13 Nathan Froyd + + * lto.c (lto_read_array_type_DIE): Return the cached DIE if we've + already read the DIE. + (lto_get_body): New function, split out from... + (lto_materialize_function): ...here. Call it. + (lto_read_subroutine_type_subprogram_DIE): Call lto_get_body to + determine DECL_EXTERNAL. + * lto-symtab.c (lto_symtab_merge_decl): Merge the DECL_RESULTs of + FUNCTION_DECLs when necessary. Use the type of the actual + function definition if we are unable to easily merge types. Ignore + spurious DECL_MODE mismatches on VAR_DECLs. Merge DECL_MODEs when + necessary. + +2007-12-13 Nathan Froyd + + * lto-lang.c (LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS): Define. + +2007-12-12 Bill Maddox + + Revert + 2007-12-07 Bill Maddox + + * lto.c (lto_str_fd_init): New function. + (lto_str_fd_close): New function. + (lto_file_init): Call lto_str_fd_init. + (lto_file_close): Call lto_str_fd_close. + (lto_str_read): New function. Read debug string table. + (lto_str_lookup): New function. Get string for debug + string table offset. + (lto_read_form): Recognize DW_FORM_strp. + (lto_file_read): Invoke lto_str_read. + + * lto-elf.c (lto_elf_file_open): Read raw section data + for the .debug_str section, if present. + + * lto.h (struct lto_str_fd_struct): New struct. + (struct lto_file_struct): Added new field DEBUG_STR + to hold the file descriptor for the debug string table. + +2007-12-07 Bill Maddox + + * lto.c (lto_str_fd_init): New function. + (lto_str_fd_close): New function. + (lto_file_init): Call lto_str_fd_init. + (lto_file_close): Call lto_str_fd_close. + (lto_str_read): New function. Read debug string table. + (lto_str_lookup): New function. Get string for debug + string table offset. + (lto_read_form): Recognize DW_FORM_strp. + (lto_file_read): Invoke lto_str_read. + + * lto-elf.c (lto_elf_file_open): Read raw section data + for the .debug_str section, if present. + + * lto.h (struct lto_str_fd_struct): New struct. + (struct lto_file_struct): Added new field DEBUG_STR + to hold the file descriptor for the debug string table. + +2007-12-07 Nathan Froyd + + * lto-read.c (input_cfg): Call init_empty_tree_cfg_for_function. + Grow the basic_block_info and label_to_block_map vectors if + necessary. Read in the block chain. + +2007-12-06 Nathan Froyd + + * lto.c (lto_read_DIE): Set TYPE_ALIAS_SET where necessary. + +2007-12-06 Nathan Froyd + + * lto.c (lto_read_form): Add DW_cl_address for DW_AT_const_value. + +2007-12-06 Nathan Froyd + + * lto-read.c (input_expr_operand): Don't check for MTAGs. + (lto_read_body): Don't declare PROP_alias. + +2007-12-06 Nathan Froyd + + * lto-symtab.c (lto_symtab_merge_decl): Handle FUNCTION_DECLs without + argument type information. + +2007-12-03 Nathan Froyd + + * lto.c (lto_read_variable_formal_parameter_constant_DIE): Set + TREE_THIS_VOLATILE if the associated type is a volatile type. + (lto_materialize_function): Remove call to init_ssa_operands. + * lto-read.c (input_expr_operand): Add SSA_NAME_VAR as a referenced + variable when reading an SSA_NAME. Do the same when reading a + RESULT_DECL, a RETURN_EXPR, or an MTAG. + (input_cfg): Call init_ssa_operands. + (input_ssa_names): Set the default def of an SSA_NAME if necessary. + Move call to init_tree_ssa... + (lto_read_body): ...here. Use push_cfun and pop_cfun. Call + add_referenced_var on any variables referenced from the body of the + function. Inform the rest of the compiler we are in SSA form and + inform later passes about the current properties. + +2007-11-30 Nathan Froyd + + * lto.c (lto_materialize_function): Add FIXME. + +2007-11-29 Nathan Froyd + + * lto-lang.c (enum built_in_attribute): New enum. + (flag_no_builtin, flag_no_nonansi_builtin, flag_isoc94, flag_isoc99, + built_in_attributes): New variables. + (def_builtin_1): New function. + (lto_define_builtins): #define DEF_BUILTIN and include builtins.def. + +2007-11-28 Nathan Froyd + + * lto.c (lto_read_variable_formal_parameter_constant_DIE): Set + DECL_SOURCE_LOCATION for debugging purposes. + (lto_read_member_DIE): Set DECL_SOURCE_LOCATION. If we have read a + bitfield, use the type specified by the DIE for TREE_TYPE and defer + laying out the decl until later. + (lto_read_subroutine_type_subprogram_DIE): Compare the function's + name with DECL_ASSEMBLER_NAME. Set DECL_SOURCE_LOCATION and + TREE_ADDRESSABLE. + * lto-read.c (input_expr_operand): Set TREE_ADDRESSABLE on the + operand of an ADDR_EXPR. + * lto-lang.c (enum lto_builtin_type): New enum. + (builtin_type): New typedef. + (builtin_types, string_type_node, const_string_type_node, + wint_type_node, intmax_type_node, uintmax_type_node, + signed_size_type_node): New variables. + (def_fn_type, builtin_type_for_size, lto_define_builtins, + lto_build_c_type_nodes): New functions. + (lto_init): Initialize builtin types. + (lto_set_decl_assembler_name): Let the target machine mangle the + name if the decl is TREE_PUBLIC, otherwise uniquify it. + +2007-11-21 Nathan Froyd + + * lto.c (lto_read_variable_formal_parameter_constant_DIE): Don't + set TREE_ADDRESSABLE. Do set DECL_COMDAT. Set TREE_READONLY if + the type is a constant type. Set the assembler name and inform + the rest of the compiler about the new decl if the decl is not + public. + (lto_read_subroutine_type_subprogram_DIE): Don't check for equivalency + of DECL_ASSEMBLER_NAME when determining if we have a builtin. Don't + try to read in function bodies for functions that already have bodies. + * lto-symtab.c (lto_same_type_p): Check for unbounded array + equivalency. + (lto_symtab_merge_decl): Don't merge decls that aren't TREE_PUBLIC. + Check for whether we matched a builtin function type before calling + lto_same_type_p on the generated type. Permit cases where the + declaration of an array is unbounded, but the definition is bounded. + Don't combine TREE_PUBLIC flags. Copy over DECL_SIZE and + DECL_SIZE_UNIT if necessary. + +2007-11-16 Kenneth Zadeck + + * lto-read.c (input_expr_operand): Get types right + for COMPLEX_CST. + +2007-11-16 Kenneth Zadeck + + * lto-read.c (make_new_block, input_cfg): Properly set + n_basic_blocks. + +2007-11-16 Nathan Froyd + + * lto.c (lto_read_array_type_DIE): Handle DIEs with DW_AT_GNU_vector + set properly by building a VECTOR_TYPE instead of an ARRAY_TYPE. + +2007-11-16 Nathan Froyd + + * lto.c (lto_read_base_type_DIE): Use make_bitfield_integer_type to + construct the integer type for bitfields. + +2007-11-16 Kenneth Zadeck + + * lto-read.c (data_in.current_node_has_loc): Removed. + (input_line_info): Returns true if node needs line set. + (set_line_info): Always sets line if called. + (clear_line_info): Removed reference to current_node_needs_loc. + (input_expr_operand): Keeps track locally if current node needs a loc. + (input_local_var): Added code to handle DECL_INITIAL for + static local vars. Only set loc if necessary. + +2007-11-15 Nathan Froyd + + * lto.c (lto_read_subroutine_type_subprogram_DIE): Fix thinko'd + DECL_CONTEXT. + +2007-11-15 Nathan Froyd + + * lto.c: Include langhooks.h. + (lto_find_integral_type): Rework logic to handle the case where + got_byte_size is true, but the bitsize requested and that of the + base_type doesn't match. + (lto_read_variable_formal_parameter_constant_DIE): Only check for + asm_name if we are creating a VAR_DECL. + (lto_materialize_function): Set DECL_EXTERNAL if we can't find a + definition. + (lto_read_subroutine_type_subprogram_DIE): Check for a builtin + function reference and use the builtin's decl if so. Set the + DECL_CONTEXT of the RESULT_DECL for the function. + * lto-lang.c (registered_builtin_fndecls): New variable. + (lto_getdecls): Return it. + (lto_builtin_function): Chain the new decl onto + registered_builtin_fndecls. + +2007-11-15 Kenneth Zadeck + + * lto-read.c (process_tree_flags, lto_static_init_local): + Renamed to ADD_CLASS_EXPR_FLAG. ADD_CLASS_DECL_FLAG New Macro. + (input_line_info, clear_line_info): Fixed new line number code. + (input_expr_operand): Added type to SWITCH_EXPR. + (lto_read_body): Properly initialized data_in. + Clear line info when leaving. + +2007-11-13 Diego Novillo + + * lto.c (lto_read_variable_formal_parameter_constant_DIE): + Initialize ARTIFICIAL. + (lto_read_subroutine_type_subprogram_DIE): Initialize + SAVED_SCOPE. + * lto-read.c (set_line_info): Remove ; from calls to + LINEMAP_POSITION_FOR_COLUMN. + +2007-11-13 Kenneth Zadeck + + * lto-read.c (input_type_ref): Renamed from get_type_ref. + (input_expr_operand, input_local_var): Renamed get_type_ref to + input_type_ref. + (input_expr_operand): Get the types correct for + vector-cst. Get SSA_NAME_DEF_STMT correct for return_exprs. + +2007-11-13 Doug Kwan + + * lto-read.c (input_widest_uint_uleb128): New function. + (input_tree_flags, process_tree_flags, input_line_info, + input_expr_operand, input_local_var, input_phi, input_ssa_names): + Change to use lto_flags_type and BITS_PER_LTO_FLAGS_TYPES instead of + unsigned HOST_WIDE_INT and HOST_BITS_PER_WIDE_INT. + (lto_static_init_local): Add code to assert that lto_flags_type is + wide enough. + +2007-11-13 Nathan Froyd + + * lto.c (lto_read_array_type_DIE): Handle DW_AT_GNU_vector. + (lto_read_subroutine_type_subprogram_DIE): Handle + DW_AT_static_link and DW_AT_specification. Return the + specification if present. + (lto_read_base_type_DIE): Handle DW_ATE_complex_float. + +2007-11-13 Nathan Froyd + + * lto-lang.c: Include target.h. + (registered_builtin_types): New variable. + (lto_type_for_mode): Increase number of modes handled. + (lto_builtin_function): Fix argument list and return the decl. + (lto_register_builtin_type): New function. + (lto_init): Initialize target builtins and language-independent + nodes. + (LANG_HOOKS_REGISTER_BUILTIN_TYPE): Define. + +2007-11-13 Kenneth Zadeck + + * lto-read.c (input_expr_operand): Added code to properly handle + index filed. Added new RANGE_EXPR case. + +2007-11-11 Kenneth Zadeck + + * lto-read.c (ADD_FUNC_FLAG): Deleted macro. + (data_in): Added current_node_has_loc field. + (input_line_info, set_line_info, clear_line_info): Added a support + for USE_MAPPED_LOCATION and not adding line numbers to nodes that + did not have on on the source side. + (input_expr_operand): Make sure that GIMPLE_MODIFY_STMTS get line + numbers too. + +2007-11-09 Doug Kwan + + * lto-read.c (input_expr_operand): Change type of operand 2 of + BIT_FIELD_REF expression to be bitsizetype instead of sizetype. + +2007-11-09 Nathan Froyd + + * lto.c: Include lto-tree.h. Effect small spaces->tabs cleanup. + (lto_read_variable_formal_parameter_constant_DIE): Transfer bits + from a DW_AT_specification or DW_AT_abstract_origin attribute to + the new decl we are creating. Move informing the middle end about + the new decl to... + (lto_main): ...here. Inform the middle end about global variables + after we have read in all the input files. + * lto-symtab.c (lto_symtab_merge_decl): We really do need to merge + variables with internal linkage, so delete the check for internal + linkage. Combine TREE_PUBLIC flags. + +2007-11-08 Nathan Froyd + + * lto.c (lto_read_subroutine_type_subprogram_DIE): Handle + DW_AT_decl_line. + * lto-symtab.c (lto_symtab_merge_decl): Handle redefinition of a + builtin specially. Move check for attribute compatibility + earlier. + +2007-11-07 Nathan Froyd + + * Make-lang.in (lto/lto.o): Depend on gt-lto-lto.h. + * config-lang.in (gtfiles): Add lto.h and lto.c. + * lto-elf.c: Include ggc.h. + (lto_elf_file_open): Allocate elf_file from GC memory. + * lto.c: Include tree-ssa-operands.h and gt-lto-lto.h + (lto_info_fd_init): Allocate the die_cache and unmaterialized_fndecls + in GC memory. + (lto_info_fd_close): Free unmaterialized_fndecls from GC memory. + (lto_file_close): Free file from GC memory. + (lto_cache_store_DIE): Allocate the new entry in GC memory. + (lto_read_member_DIE): Fix declaration. + (lto_read_subroutine_type_subprogram_DIE): unmaterialized_fndecls lives + in GC memory. + (current_lto_file): New variable. + (lto_main): Use it. + (DWARF2_attr, DWARF2_abbrev, lto_die_ptr, DWARF2_CompUnit, + lto_die_cache_entry): Move to... + * lto.h: ...here and add GTY markers as appropriate. Delete forward + declarations accordingly. + (struct lto_file_struct): Declare. + (lto_file_vtable): Use it instead of lto_file. + +2007-11-06 Alon Dayan + Kenneth Zadeck + + * lto-read.c (process_flags, lto_static_init_local): + read flags of VAR_DECL and FUNCTION_DECL of size>1. + change global array num_flags_for_code to flags_length_for_code. + (set_line_info): Make decls work in USE_MAPPED_LOCATION mode. + +2007-11-05 Nathan Froyd + + * lto.c (lto_read_structure_union_class_type_DIE): Use proper record + layout functions to compute information about the newly constructed + type. + +2007-11-02 Nathan Froyd + + * lto-read.c (input_expr_operand): Change the LTO_return_expr1 + case to use DECL_RESULT if necessary. + +2007-11-01 Kenneth Zadeck + + * lto-read.c (input_tree_list): Removed. + (input_tree_flags): Added parameter to force flags no matter what + tree code. + (input_expr_operand): Added parameter to input_tree_flags. + Added case for IDENTIFIER_NODE and TREE_LIST. Changed ASM to call + input_expr_operand rather than input_tree_lists. + (input_local_var): Use input_expr_operand to read attributes + rather then input_tree_list. + (input_phi, input_ssa_names): Added parameter to input_tree_flags. + +2007-10-31 Nathan Froyd + + * lto.c (lto_read_typedef_DIE): Fix comment typo. + (lto_resolve_typedecl_ref): Fetch the referred-to type and build a fake + TYPE_DECL for it. + * lto-read.c (lto_read_body): Use correct sizes for calculating + type_decls_offset and types_offset. + +2007-10-30 Nathan Froyd + + * lto-tree.h (union lang_tree_node): Change GTY description to chain + with GENERIC_NEXT. + * config-lang.in (gtfiles): Add lto-lang.c. + * lto-lang.c: Include gt-lto-lto-lang.h. + * Make-lang.in (lto/lto-lang.o): Add dependency on gt-lto-lto-lang.h + (lto/lto-symtab.o): Depend on LTO_H instead of TREE_H. + (lto/lto-read.o): Likewise. + +2007-10-29 Kenneth Zadeck + + * lto-read.c (data_in): Added type_decls and current_col fields. + (string_slot): New type to hold canonized file name. + (hash_string_slot_node, eq_string_slot_node, canon_file_name, + input_line_info, set_line_info, clear_line_info): New functions. + (file_name_hash_table): New hash table. + (input_local_var, input_labels, input_local_vars_index, + input_local_var, input_local_vars, input_ssa_names): Reorganized parameters. + (input_uleb128): Changed type of byte var. + (input_expr_operand): Large number of changes to get line numbers + correct. Added TYPE_DECL case. + (input_globals): Added code to get TYPE_DECLs processed. + (input_local_var): Added code to process line numbers and + TREE_CHAIN and DECL_CONTEXT. + (input_function, input_constructor): Added call to + clear_line_number. + (lto_static_init_local): Added code to get line numbers correct. + (lto_read_body): Added code to get TYPE_DECLS read and to change + parameters to the calls above that had their parms reorganized. + + +2007-10-29 Nathan Froyd + + * lto.h (lto_resolve_typedecl_ref): Declare. + * lto.c (lto_resolve_typedecl_ref): New function. + +2007-10-29 Mark Mitchell + Nathan Froyd + + * lto.c (lto_read_subroutine_type_subprogram_DIE): Read the child + DIEs even if we find an abstract origin for this DIE. + +2007-10-29 Nathan Froyd + + * lto.c (lto_read_subroutine_type_subprogram_DIE): Build the + RESULT_DECL slightly earlier. Only remember the decl for later + if we successfully merge declarations. + +2007-10-24 Kenneth Zadeck + + * lto-read.c (input_expr_operand): Give label_values the proper + context and provide switch statements with a default type. + +2007-10-23 Nathan Froyd + + * lto-read.c (lto_read_body): Move call to init_ssa_operands... + * lto.c (lto_materialize_function): ...to here. + +2007-10-22 Nathan Froyd + + * lto.h (struct lto_info_fd): Add field unmaterialized_fndecls. + * lto.c (lto_info_fd_init): Initialize it. + (lto_info_fd_close): Free it. + (lto_materialize_function): New function. + (lto_read_subroutine_type_subprogram_DIE): Save the result decl on + unmaterialized_fndecls. + (lto_file_read): Read in all the function bodies after we have read + all of the DWARF info. + * lto-read.c (lto_read_body): Call init_ssa_operands if we are + reading a function body. + +2007-10-20 Kenneth Zadeck + + * lto-read.c (input_tree_flags): Renamed from input_flags to be + semetric with output_tree_flags. Added call to log flags. + (process_tree_flags): Renamed from process_flags. Fixed a lot of + type issues to make everything consistent with flags being + unsigned HOST_WIDE_INTS. + (input_expr_operand): Added call to + recompute_tree_invariant_for_addr_expr. + (input_local_var): Added debugging for tree_chains. Now calls + input_tree_flags. + (input_phi): Made flags unsigned HOST_WIDE_INT. + (input_ssa_names): Now calls input_tree_flags. + (lto_read_body): Now sets cfun. + (lto_read_function_body): Now sets current_function_pointer. + +2007-10-19 Nathan Froyd + + * lto.c (lto_read_variable_formal_parameter_constant_DIE): Check + definitively whether SPECIFICATION or ABSTRACT_ORIGIN exist before + inspecting fields within. + (lto_read_DIE_at_ptr): Delete check for null result; let callers + handle this appropriately. + +2007-10-19 Nathan Froyd + + * lto.c (lto_read_variable_formal_parameter_constant_DIE): Handle + DW_AT_abstract_origin properly. Ensure that we're not dealing with + both DW_AT_abstract_origin and DW_AT_specification. + (lto_read_subroutine_type_subprogram_DIE): Handle + DW_AT_abstract_origin. + (lto_read_DIE): Use lto_read_only_for_child_DIEs for labels. + (lto_read_DIE_at_ptr): Define as static to match declaration. + Lookup the PTR in the cache before reading it from the file. + (lto_resolve_var_ref): Adjust accordingly. + (lto_resolve_fn_ref): Adjust accordingly. Tweak comment. + (lto_resolve_field_ref): Adjust accordingly. Tweak comment. + +2007-10-19 Nathan Froyd + + * lto.c (lto_read_DIE_at_ptr): New function. + (lto_resolve_var_ref): Use it. + (lto_resolve_fn_ref): Use it. + (lto_resolve_field_ref): Use it. + (lto_read_variable_formal_parameter_constant_DIE): Follow + DW_AT_specification and return the associated decl when appropriate. + +2007-10-18 Nathan Froyd + + * lto-lang.c (lto_type_for_mode): Move after lto_type_for_size. + Implement for scalar integer modes. + (lto_init): Initialize size_type_node. + +2007-10-18 Kenneth Zadeck + + * lto-read.c (input_expr_operand): Remove ssa name asserts. + (input_local_var): Add chaining for params. + (input_ssa_names): Add cfun parameter. + (input_function): Remove unnecessary else. + +2007-10-17 Nathan Froyd + + * lto.c (lto_read_only_for_child_DIEs): Mark die parameter as unused. + (lto_resolve_var_ref): Use proper types. + (lto_resolve_fn_ref): Likewise. + (lto_resolve_field_ref): Likewise. + +2007-10-17 Nathan Froyd + + * lto-read.c (input_expr_operand): Remove case. + +2007-10-17 Nathan Froyd + + * lto.c (lto_read_only_for_child_DIEs): New function. + (lto_read_DIE): Use it for lexical_block and inlined_subroutine DIEs. + * lto-elf.c (lto_elf_map_lto_section): Remove. + (lto_elf_file_vtable): Use lto_elf_map_optional_lto_section instead. + * lto-read.c (input_expr_operand): Assert that we never read a NULL + SSA_NAME. Add missing case for mechanical codes. + (input_cfg): Use basic_block_info_for_function instead of + basic_block_info. + +2007-10-16 Kenneth Zadeck + + * lto-read.c (input_sleb128, input_integer): Use proper casts. + (input_list): Renamed input_tree_list and modified to follow same + protocol as lto-function-out.c:output_tree_list. + (input_expr_operand): Make asm operands use input_tree_list. + (input_local_var): Now uses input_tree_list. + (lto_read_body): Change placement for setting context of debug_labels. + + +2007-10-16 Kenneth Zadeck + + * lto-read.c (input_real): Output debugging in proper order. + (input_integer): Compute bit lengths properly. + (input_list): Clean up declaration. + (input_expr_operand): Change calls to input_real to match fix. + Make reading of LTO_bit_field_ref1 match output. + (input_local_var): Make reading of attributes match what is being + written. + (dump_debug_stream): Also print char in hex. + (debug_out_fun): Fix signed unsigned mismatch. + +2007-10-10 Nathan Froyd + + * lto.c (lto_read_form): Handle DW_AT_MIPS_linkage_name and + DW_AT_GNU_vector specially, as they are not contiguous with the + specified set of attribute names. Use class_mask to check for + errors at the end of the function + (lto_resolve_var_ref): Read the DIE if it is not cached. + (lto_resolve_fn_ref): Likewise. + (lto_resolve_field_ref): Likewise. + +2007-10-05 Nathan Froyd + + * lto.c: Include dwarf2out.h. + (lto_cache_store_DIE): Assert that we never change the value. + (LTO_BEGIN_READ_ATTRS): Print an informative error message. + (lto_read_compile_unit_DIE): Handle DW_AT_entry_pc. + (lto_read_array_type_DIE): Don't error on ndims == 0; build a + sensible type instead. + (lto_read_structure_union_class_type_DIE): Store the newly + created type prior to reading the members of the structure to + avoid infinite recursion. Avoid computing types and alignments + for structures whose sizes are unknown. + (lto_read_variable_formal_parameter_const): Handle DW_AT_artificial + and set DECL_ARTIFICIAL accordingly. Ignore DW_AT_abstract_origin, + DW_AT_const_value, and DW_AT_specification. + (lto_read_subroutine_type_subprogram_DIE): Handle DW_AT_declaration. + Return early if we have already constructed the function type. + (lto_read_typedef_DIE): Check to see if the type has been cached + already. Cache the type before reading any children. + (lto_read_const_volatile_restrict_type_DIE): Handle DW_AT_name. + (lto_read_DIE): Unset context->skip_non_parameters around reading + the DIE. + (lto_resolve_fn_ref): Delete trailing whitespace. + +2007-09-11 Kenneth Zadeck + + * lto-read.c (input_expr_operand): Added type for STRING_CST. + +2007-09-10 Nathan Froyd + + * lto-read.c (lto_read): Set the type of the newly created CALL_EXPR. + +2007-09-07 Nathan Froyd + + * lto-lang.c (signed_and_unsigned_types): New variable. + (lto_type_for_size): Consult signed_and_unsigned_types to find + an approprite type, creating it if necessary. + (lto_set_decl_assembler_name): Add actual method body. + +2007-09-06 Jim Blandy + + * lto.c (lto_read_variable_formal_parameter_constant_DIE): If we + can't find a var init for this variable, leave its DECL_INITIAL. + * lto-elf.c (lto_elf_map_optional_lto_section): Renamed from + lto_elf_map_fn_body. + (lto_map_lto_section): New function. + (lto_elf_file_vtable): Use lto_elf_map_lto_section for function + bodies, and lto_elf_map_optional_lto_section for variable + initializers. + (lto_elf_find_section_data): Quietly return NULL if the section is + missing. + (lto_elf_file_open): Check for a NULL from lto_elf_find_section_data. + + * lto-elf.c (lto_elf_find_section_data): Remove dead code. + + * lto-read.c (lto_read_body): Doc fix. + +2007-08-29 Kenneth Zadeck + + * lto-read.c (fun_in): Renamed to data_in. + (input_expr_operand, input_local_var, input_string_internal, + input_string, input_real, input_list, get_label_decl, + get_type_ref, input_expr_operand, input_globals, input_labels, + input_local_vars_index, input_local_var, input_local_vars, + input_cfg, input_phi, input_ssa_names, input_bb, ): Renamed fun_in to data_in. + (input_constructor): New function. + (lto_read_function_body): Renamed to lto_read_body and generalized + to handle both functions and constructors. + (lto_read_function_body, lto_read_var_init): New function. + + +2007-08-28 Kenneth Zadeck + + * lto-read.c (input_expr_operand): Assert that there really is a + FUNCTION_DECL. + (input_globals): Removed checks on 0 section. + +2007-08-28 Kenneth Zadeck + + * lto-read.c (fun_in): Added local_decls_index and + local_decls_index_d. + (input_expr_operand): Changed inputting of PARM_DECLs and VAR_DECLs. + (input_globals): Enabled code to handle FIELD_DECLs. + (input_local_vars_index, input_local_vars): New function. + (input_local_var): Changed to allow locals to be input randomly. + (lto_read_function_body): Added code to input the + local_decls_index and to free various structures. + +2007-08-17 Jim Blandy + + * lto.c (lto_read_variable_formal_parameter_constant_DIE): Remove + ATTRIBUTE_UNUSED from 'die' formal. + + Use enum LTO_tags where appropriate, instead of 'unsigned int'. + * lto-read.c (input_record_start): Fix return type, type of 'tag'. + (input_list): Fix type of 'tag'. + (input_expr_operand): Fix type of 'tag' argument. Update + declaration. Fix type of 'ctag'. Add default case to switch, + since the type of the switched value is now an enum. + (input_local_vars): Fix type of 'tag'. + (input_bb): Fix type of 'tag' argument. + (input_function): Fix type of 'tag' argument. + +2007-08-16 Jim Blandy + + * lto.c (lto_read_member_DIE): Record the tree we create in + fd->die_cache. (Our 'die' argument is no longer unused.) + (lto_resolve_field_ref): New function. + * lto.h (lto_resolve_field_ref): New declaration. + +2007-08-15 Jim Blandy + + * lto-read.c (lto_read_var_init): Mark arguments as unused. + +2007-08-07 Jim Blandy + + * lto.c (lto_read_form): Complete attr_classes table. + (DWARF2_form_data): Doc fix. + +2007-08-05 Mark Mitchell + + * lto.h (lto_file_vtable): Remove read_var_init. Add map_var_init + and unmap_var_init. + (lto_read_var_init): Declare. + * lto.c (lto_read_variable_formal_parameter_constant_DIE): Use new + interface for reading variable initializers. + * lto-elf.c (lto_elf_read_var_init): Remove. + (lto_elf_file_vtable): Update initializer. + (lto_elf_read_var_init): Add comment about unused-ness. + * lto-read.c (lto_read_var_init): New. + + * lto.c (lto_read_form): Add entry for DW_AT_inline. + +2007-08-02 Kenneth Zadeck + + * lto-read.c (lto_read_function_body): Moved declaration of fn + outside of ifdef. + +2007-08-01 Kenneth Zadeck + + * lto-read.c (input_uleb128, input_string_internal, input_real, + input_integer, input_record_start, input_list, get_type_ref, + input_flags, input_expr_operand, input_expr_operand, + input_expr_operand, input_local_vars, input_cfg, input_phi, + input_ssa_names, input_bb, input_function): Added semicolons. + + +2007-07-31 Kenneth Zadeck + + * lto-read.c (input_globals): Remove debugging. + (input_function): Set DECL_ARGUMENTS. + + +2007-07-31 Kenneth Zadeck + + * lto-read.c (input_expr_operand): Fixed code for COND_EXEC, + RETURN_EXPR, MODIFY_EXPR and processing of flags. + (input_phi): Made work with operands other than SSA_NAMES and + fixed processing of flags. + (input_ssa_names): Initialize SSA_NAME_DEF_STMT to empty stmt. + (input_flags): New function. + * lto-lang.c (lto_init): Changed state of in_lto_p. + + +2007-07-24 Mark Mitchell + + * lto-tree.h (lto_varargs_cookie): Remove. + * lto.c (lto_context): Add last_parm_type, varargs_p, skip_all, + skip_non_parameters, skip_parameters. + (lto_varargs_cookie): Remove. + (lto_read_variable_formal_parameter_constant_DIE): Keep track of + parameter types. + (lto_read_abbrev): New function. + (lto_read_subroutine_type_subprogram_DIE): Make two passes over + child DIEs. + (lto_read_unspecified_parameters_DIE): Set context->varargs_p. + (lto_read_DIE): Use lto_read_abbrev. Honor skip_* flags. + (lto_file_read): Initialize new context fields. + * lto-lang.c (lto_type_for_mode): Return NULL_TREE. + (lto_unsigned_type): Remove. + (lto_signed_type): Likewise. + (lto_signed_or_unsigned_type): Likewise. + (lto_init): Do not create lto_varargs_cookie. + (LANG_HOOKS_UNSIGNED_TYPE): Do not define. + (LANG_HOOKS_SIGNED_TYPE): Likewise. + (LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): Likewise. + +2007-07-19 Jan Hubicka + + * lto-read.c (lto_read_function_body): Produce empty scope block + to avoid crash. + +2007-07-18 Mark Mitchell + + * lto.c (lto_read_variable_formal_parameter_constant_DIE): Do not + process local variables. + (lto_read_subroutine_type_subprogram_DIE): Read child DIEs. + +2007-07-13 Kenneth Zadeck + + * lto-read.c (input_list, input_expr_operand): Added struct + function parameter. + (init_cfg, finalize_cfg): Removed function. + (input_expr_operand): Added SSA_NAME and GIMPLE_MODIFY_STMT cases. + (input_labels, input_local_vars): Now takes input_block parameter rather than + synthsyzing it. + (input_cfg, input_phi, input_ssa_names): New functions. + (input_bb): Now passes in input_blocks. Does not construct cfg + and processes the list of phi functions. + (input_function): Now builds both the cfg and ssa_names table. + (lto_read_function_body): Processes new header fields to construct + streams for the ssa_names and cfg and their debugging. + * lto/lto-lang.c (lto_init): Set in_lto_p. + + +2007-06-28 Mark Mitchell + + * lto.h (lto_file_vtable): Add read_var_init. + * lto.c (lto_read_variable_formal_parameter_constant_DIE): Read + initializers. + (lto_main): Remove bogus asserts. + * lto-elf.c (tm.h): Include it. + (libiberty.y): Likewise. + (lto_elf_file): Add strtab and symtab. Rename + string_table_section_index to sec_strtab. + (lto_elf_file_vtable): Add lto_elf_read_var_init. + (lto_elf_get_shdr): New function. + (lto_elf_free_shdr): Likewise. + (lto_elf_find_section_data): Use them. + (lto_elf_read_symtab): New function. + (lto_elf_lookup_sym): Likewise. + (lto_elf_free_sym): Likewise. + (lto_elf_file_open): Tidy. Call lto_elf_read_symtab. + (lto_elf_built_init): New function. + (lto_elf_read_var_init): Likewise. + * Make-lang.in (lto/lto-elf.o): Depend on $(TM_H). + +2007-06-26 Kenneth Zadeck + + * lto-read (make_new_block): Initialize the stmt_list. + (lto_static_init_local): Add debugging for missing codes. + +2007-06-26 Mark Mitchell + + * lto.c (lto_read_subroutine_type_subprogram_DIE): Handle + unprototyped functions. + +2007-06-23 Mark Mitchell + + * lto.c (lto_read_variable_formal_parameter_constant_DIE): + Handle DW_AT_MIPS_linkage_name. + (lto_read_subroutine_type_subprogram): Likewise. Correct + compilation errors. + (lto_main): Remove incorrect assertions. + * lto-symbtab.c: Build function types out of TREE_LISTs. + + * lto-elf.c (): Check for HAVE_LIBELF_H. + + * Make-lang.in (LTO_OBJS): Depend on attribs.o. + +2007-06-21 Kenneth Zadeck + + * lto/lto-tree.h (lang_decl, lang_type, language_function): Added + dummy since ggc does not like empty structs. + * lto/lto-elf.c (libelf.h): Changed to libelf/libelf.h. + * lto/lto-read.c (ADD_CLASS_FLAG, ADD_EXPR_FLAG): Changed + expr->common to expr->base. + (make_new_block): Moved stmt_list to proper place. + + +2007-03-14 Robert Kennedy + + Eliminate use of lang_hooks.set_decl_assembler_name from LTO + * lto.c (lto_read_subroutine_type_subprogram_DIE) Get DECL + assembler name from DWARF. + * lto-lang.c (lto_set_decl_assembler_name) New function. + +2006-09-10 Mark Mitchell + + * lto.h (lto_file_vtable): New structure. + (lto_file): Add vtable pointer. + (lto_file_init): Add vtable paramter. + (lto_read_function_body): New function. + (lto_symtab_merge_fn): New function. + * lto.c (lto_file_init): Add vtable parameter. + (lto_read_form): Fill in entries for DW_AT_prototyped, + DW_AT_frame_base. + (lto_read_subroutine_type_subprogram_DIE): New function. + (lto_read_DIE): Fill in entries for DW_TAG_subroutine_type and + DW_TAG_subprogram. + * lto-elf.c (lto_elf_vile_vtable): New variable. + (lto_elf_file_open): Pass it to lto_file_init. + (lto_elf_map_fn_body): New function. + (lto_elf_unmap_fn_body): Likewise. + * lto-read.c: New file. + * lto-symtab.c (lto_symtab_merge_fn): New function. + * lto-lang.c (LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION): Define to + tree_rest_of_compilation. + * Make-lang.in (LTO_OBJS): Add lto-read.o + (lto-read.o): New target. + +2006-09-03 Mark Mitchell + + * lto.c (): Don't include it. + (lto_context): Don't typedef it. + (lto_resolve_reference): New function. + (lto_read_form): Use it. + (lto_resolve_type_ref): New function. + (lto_resolve_var_ref): Likewise. + (lto_resolve_fn_ref): Likewise. + * lto.h (): Include it. + (lto_context): New type. + (lto_ref): New structure. + (lto_resolve_type_ref): Declare. + (lto_resolve_var_ref): Likewise. + (lto_resolve_fn_ref): Likewise. + +2006-08-18 Mark Mitchell + + * lang-specs.h: New file. + +2006-08-14 Mark Mitchell + + * lto.c (lto_info_fd_init): Allocate the DIE cache. + (lto_info_fd_close): Deallocate it. + (lto_die_cache_entry): New structure. + (lto_cache_hash): New function. + (lto_cache_eq): Likewise. + (lto_cache_store_DIE): Likewise. + (lto_cache_lookup_DIE): Likewise. + (lto_read_referenced_type_DIE): Use the cache. + (lto_read_pointer_type_DIE): Robustify. + (lto_read_DIE): Use the cache. + * lto.h (hashtab.h): Include. + (lto_info_fd): Add DIE cache. + * Make-lang.in (LTO_H): New variable. + (lto/lto-lang.o): Use LTO_H. + (lto/lto-elf.o): Likewise. + (lto/lto-symtab.o): Likewise. + +2006-07-09 Mark Mitchell + + * lto.c (lto_abi_mismatch_error): New function. + (lto_abbrev_read): Initialize num_abbrevs. + (lto_read_form): Specify allowed form classes for + DW_AT_declaration. Adjust for change to lto_set_cu_context. + (lto_read_variable_formal_parameter_constant_DIE): Handle + DW_AT_declaration. Call lto_symtab_merge_var. + (lto_read_pointer_type_DIE): New function. + (lto_read_base_type_DIE): Use build_nonstandard_integer_type. Do + not creat TYPE_DECLs for types that already have them. + (lto_read_DIE): Add lto_read_pointer_type_DIE. + (lto_set_cu_context): Make cu_start point to the header, not the + first DIE. + (lto_file_read): Adjust for change to lto_set_cu_context. + * Make-lang.in (LTO_OBJS): Add lto-symtab.o. + (lto/lto-symtab.o): New rule. + * lto-tree.h (lang_identifier): Add decl field. + (LANG_IDENTIFIER_CAST): New macro. + (LTO_IDENTIFIER_DECL): Likewise. + (lto_symtab_merge_var): Declare. + * lto-symtab.c: New file. + +2006-07-02 Daniel Berlin + + * lto.c (lto_context): Add current_cu and info_fd members. + (DWARF2_CompUnit): New structure. + (lto_read_DIE): Take lto_info_fd *. + (lto_read_child_DIEs): Ditto. + (lto_file_corrupt_error): Constify argument. + (lto_set_cu_context): New function + (lto_info_fd_init): Ditto. + (lto_info_fd_close): Ditto. + (lto_file_init): Use lto_info_fd_init. + (lto_file_close): Use lto_info_fd_close. + (lto_read_initial_length): Pass in pointer to header size. + (lto_read_comp_unit_header): Correct cu_length to + real length from beginning of header. Take lto_info_fd * as + argument. + (find_cu_for_offset): New function. + (lto_read_form): Change first argument to lto_info_fd *. + Add FORM_CONTEXT argument. + Handle DW_FORM_ref_addr. + (lto_read_tag_DIE): Change first argument to lto_info_fd *. + (LTO_BEGIN_READ_ATTRS_UNCHECKED): Save old context. + Swap contexts if necessary for form. + (LTO_BEGIN_READ_ATTRS): Cast fd to right type for + lto_file_corrupt_error. + (LTO_END_READ_ATTRS): Swap contexts back if it had changed. + (lto_read_referenced_type_DIE): Change first argument to + lto_info_fd *. Access lto_fd fields through base pointer. + (lto_read_compile_unit_DIE): Change first argument to an + lto_info_fd *. + (lto_read_variable_formal_parameter_constant_DIE): Ditto. + (lto_read_base_type_DIE): Ditto. + (lto_read_child_DIEs): Ditto. + (lto_read_DIE): Ditto. Change type of function pointer. + (lto_info_read): New function. + (lto_set_cu_context): Ditto. + (lto_file_read): Use lto_info_read, walk resulting CU's + (lto_main): Update for lto_info_fd change. + * lto-elf.c (lto_elf_file_open): Cast lto_info_fd to lto_fd where + necessary. + * lto.h (DWARF2_CompUnit): New structure. + (lto_info_fd): Ditto. + (lto_file): Change debug_info to be an lto_info_fd. + +2006-06-25 Mark Mitchell + + * lto.c (toplev.h): Include it. + (dwarf2.h): Likewise. + (tree.h): Likewise. + (tm.h): Likewise. + (cgraph.h): Likewise. + (ggc.h): Likewise. + (inttypes.h): Likewise. + (DWARF2_attr): New type. + (DWARF2_abbrev): Likewise. + (DWARF2_class): Likewise. + (DWARF2_form_data): Likewise. + (lto_context): Likewise. + (lto_fd_init): New function. + (lto_abbrev_fd_init): Likewise. + (lto_abbrev_fd_close): Likewise. + (lto_file_init): Use them. + (lto_file_close): New function. + (lto_file_corrupt_error): Likewise. + (LTO_CHECK_INT_VAL): New macro. + (lto_check_size_t_val): New function. + (lto_check_int_val): Likewise. + (LTO_READ_TYPE): New macro. + (lto_read_ubyte): New function. + (lto_read_uhalf): Likewise. + (lto_read_uword): Likewise. + (lto_read_uleb128): Likewise. + (lto_read_initial_length): Likewise. + (lto_abbrev_read_attrs): Likewise. + (lto_abbrev_read): Likewise. + (lto_abbrev_lookup): Likewise. + (lto_read_section_offset): Likewise. + (lto_read_comp_unit_header): Likewise. + (lto_read_form): Likewise. + (LTO_BEGIN_READ_ATTRS_UNCHECKED): New macro. + (LTO_BEGIN_READ_ATTRS): Likewise. + (LTO_END_READ_ATTRS): Likewise. + (lto_unsupported_attr_error): New function. + (lto_get_identifier): Likewise. + (lto_read_referenced_type_DIE): Likewise. + (lto_read_compile_unit_DIE): Likewise. + (lto_read_variable_formal_parameter_constant_DIE): Likewise. + (lto_read_base_type_DIE): Likewise. + (lto_read_DIE): Likewise. + (lto_read_child_DIEs): Likewise. + (lto_file_read): Read DIEs. + (lto_main): Ask middle end to emit entities. + * lto-tree.h (lang_identifier): Inherit from tree_identifier. + * lto-elf.c (lto_elf_file_open): Adjust for interface changes. + (lto_elf_file_close): Likewise. + * lto.h (lto_file): Declare. + (DWARF2_abbrev): Likewise. + (lto_fd): New type. + (lto_abbrev_fd): Likewise. + (lto_file): Use new types. + (lto_file_close): Declare. + * lto-lang.c (lto_init): Always use unit-at-a-time mode. + +2006-06-18 Mark Mitchell + + * lto.h: New file. + * lto.c: New file. + * lto-elf.c: New file. + * lto-lang.c (flags.h): Include it. + (lto.h): Likewise. + (lto_init): New function. + (lto_write_globals): Remove. + (LANG_HOOKS_WRITE_GLOBALS): Define to lhd_do_nothing. + (LANG_HOOKS_INIT): Define. + (LANG_HOOKS_PARSE_FILE): Likewise. + * Make-lang.in (LTO_OBJS): Add lto.o and lto-elf.o. + (LTO_EXE): Link with libelf. + (lto/lto-lang.o): Update dependencies. + (lto/lto.o): New target. + (lto/lto-elf.o): Likewise. + +2006-06-12 Mark Mitchell + + * config-lang.in: New file. + * Make-lang.in: Likewise. + * lto-tree.h: Likewise. + * lto-lang.c: Likewise. + diff --git a/gcc/lto/Make-lang.in b/gcc/lto/Make-lang.in new file mode 100644 index 00000000000..1dcaace1ade --- /dev/null +++ b/gcc/lto/Make-lang.in @@ -0,0 +1,89 @@ +# Top level -*- makefile -*- fragment for LTO +# Copyright (C) 2009 +# Free Software Foundation, Inc. + +#This file is part of GCC. + +#GCC 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. + +#GCC 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. + +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# Variables + +# The name of the LTO compiler. +LTO_EXE = lto1$(exeext) +# The LTO-specific object files inclued in $(LTO_EXE). +LTO_OBJS = lto/lto-lang.o lto/lto.o lto/lto-elf.o attribs.o +LTO_H = lto/lto.h $(HASHTAB_H) +LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h +LTO_TREE_H = lto/lto-tree.h $(LINKER_PLUGIN_API_H) + + +# Rules + +# These hooks are used by the main GCC Makefile. Consult that +# Makefile for documentation. +lto.all.cross: $(LTO_EXE) +lto.start.encap: $(LTO_EXE) +lto.rest.encap: +lto.tags: +lto.install-common: +lto.install-man: +lto.install-info: +lto.dvi: +lto.pdf: +lto.install-pdf: +lto.html: +lto.uninstall: +lto.info: +lto.man: +lto.srcextra: +lto.srcman: +lto.srcinfo: +lto.install-plugin: + +lto.mostlyclean: + rm -f $(LTO_OBJS) $(LTO_EXE) + +lto.clean: +lto.distclean: +lto.maintainer-clean: +lto.stage1: +lto.stage2: +lto.stage3: +lto.stage4: +lto.stageprofile: +lto.stagefeedback: + +# LTO rules. + +# Use strict warnings for this front end. +lto-warn = $(STRICT_WARN) + +$(LTO_EXE): $(LTO_OBJS) $(BACKEND) $(LIBDEPS) + $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \ + $(LTO_OBJS) $(BACKEND) $(BACKENDLIBS) $(LIBS) -lelf + +# Dependencies +lto/lto-lang.o: lto/lto-lang.c $(CONFIG_H) coretypes.h debug.h \ + flags.h $(GGC_H) langhooks.h $(LANGHOOKS_DEF_H) $(SYSTEM_H) \ + $(TARGET_H) $(LTO_H) $(GIMPLE_H) gtype-lto.h gt-lto-lto-lang.h \ + $(EXPR_H) +lto/lto.o: lto/lto.c $(CONFIG_H) $(SYSTEM_H) coretypes.h opts.h \ + toplev.h $(TREE_H) $(DIAGNOSTIC_H) $(TM_H) $(LIBIBERTY_H) \ + $(CGRAPH_H) $(GGC_H) tree-ssa-operands.h $(TREE_PASS_H) \ + langhooks.h vec.h $(BITMAP_H) pointer-set.h $(IPA_PROP_H) \ + $(COMMON_H) $(TIMEVAR_H) $(GIMPLE_H) $(LTO_H) $(LTO_TREE_H) \ + $(LTO_TAGS_H) $(LTO_STREAMER_H) +lto/lto-elf.o: lto/lto-elf.c $(CONFIG_H) coretypes.h $(SYSTEM_H) \ + toplev.h $(LTO_H) $(TM_H) $(LIBIBERTY_H) $(GGC_H) $(LTO_STREAMER_H) diff --git a/gcc/lto/common.c b/gcc/lto/common.c new file mode 100644 index 00000000000..b54ec491e12 --- /dev/null +++ b/gcc/lto/common.c @@ -0,0 +1,46 @@ +/* Common code for the plugin and lto1. + Copyright (C) 2009 Free Software Foundation, Inc. + Contributed by Rafael Avila de Espindola (espindola@google.com). + +This program 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 of the License, or +(at your option) any later version. + +This program 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. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +02110-1301, USA. */ + +#include "common.h" + +const char *lto_kind_str[5] __attribute__ ((visibility ("hidden"))) = +{ + "DEF", "WEAKDEF", "UNDEF", + "WEAKUNDEF", "COMMON" +}; + +const char *lto_visibility_str[4] __attribute__ ((visibility ("hidden"))) = +{ + "DEFAULT", "PROTECTED", + "INTERNAL", "HIDDEN" +}; + +const char *lto_resolution_str[9] __attribute__ ((visibility ("hidden"))) = +{ + "UNKNOWN", + "UNDEF", + "PREVAILING_DEF", + "PREVAILING_DEF_IRONLY", + "PREEMPTED_REG", + "PREEMPTED_IR", + "RESOLVED_IR", + "RESOLVED_EXEC", + "RESOLVED_DYN" +}; + diff --git a/gcc/lto/common.h b/gcc/lto/common.h new file mode 100644 index 00000000000..e82184795ba --- /dev/null +++ b/gcc/lto/common.h @@ -0,0 +1,34 @@ +/* Common code for the plugin and lto1. + Copyright (C) 2008 Free Software Foundation, Inc. + Contributed by Rafael Avila de Espindola (espindola@google.com). + +This file is part of GCC. + +GCC 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. + +GCC 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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + + + +static const char *lto_resolution_str[9] = +{ + "UNKNOWN", + "UNDEF", + "PREVAILING_DEF", + "PREVAILING_DEF_IRONLY", + "PREEMPTED_REG", + "PREEMPTED_IR", + "RESOLVED_IR", + "RESOLVED_EXEC", + "RESOLVED_DYN" +}; diff --git a/gcc/lto/config-lang.in b/gcc/lto/config-lang.in new file mode 100644 index 00000000000..aa84db1e79f --- /dev/null +++ b/gcc/lto/config-lang.in @@ -0,0 +1,32 @@ +# Top level configure fragment for LTO +# Copyright (C) 2009 +# Free Software Foundation, Inc. + +#This file is part of GCC. + +#GCC 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. + +#GCC 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. + +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +language="lto" +compilers="lto1\$(exeext)" +stagestuff="lto1\$(exeext)" + +gtfiles="\$(srcdir)/lto/lto-tree.h \$(srcdir)/lto/lto-lang.c \$(srcdir)/lto/lto.c" + +# LTO is a special front end. From a user's perspective it is not +# really a language, but a middle end feature. However, the GIMPLE +# reading module is implemented as a front end, so enabling LTO means +# enabling this "language". To enable LTO functionality, use +# --enable-lto when configuring the compiler. +build_by_default=no diff --git a/gcc/lto/lang-specs.h b/gcc/lto/lang-specs.h new file mode 100644 index 00000000000..cbcb19b797c --- /dev/null +++ b/gcc/lto/lang-specs.h @@ -0,0 +1,24 @@ +/* LTO driver specs. + Copyright 2009 Free Software Foundation, Inc. + Contributed by CodeSourcery, Inc. + +This file is part of GCC. + +GCC 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. + +GCC 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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +/* LTO contributions to the "compilers" array in gcc.c. */ + + {"@lto", "lto1 %(cc1_options) %i %{!fsyntax-only:%(invoke_as)}", + /*cpp_spec=*/NULL, /*combinable=*/1, /*needs_preprocessing=*/0}, diff --git a/gcc/lto/lang.opt b/gcc/lto/lang.opt new file mode 100644 index 00000000000..f383d7ce18a --- /dev/null +++ b/gcc/lto/lang.opt @@ -0,0 +1,43 @@ +; Options for the LTO front end. +; Copyright (C) 2008 Free Software Foundation, Inc. +; +; This file is part of GCC. +; +; GCC 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. +; +; GCC 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. +; +; You should have received a copy of the GNU General Public License +; along with GCC; see the file COPYING3. If not see +; . + +; See the GCC internals manual for a description of this file's format. + +; Please try to keep this file in ASCII collating order. + +Language +LTO + +fltrans +LTO Report Var(flag_ltrans) Optimization +Run the link-time optimizer in local transformation (LTRANS) mode. + +fltrans-output-list= +LTO Joined Var(ltrans_output_list) +Specify a file to which a list of files output by LTRANS is written. + +fwpa +LTO Report Var(flag_wpa) Optimization +Run the link-time optimizer in whole program analysis (WPA) mode. + +resolution +LTO Separate +The resolution file + +; This comment is to ensure we retain the blank line above. diff --git a/gcc/lto/lto-elf.c b/gcc/lto/lto-elf.c new file mode 100644 index 00000000000..f678348a86f --- /dev/null +++ b/gcc/lto/lto-elf.c @@ -0,0 +1,674 @@ +/* LTO routines for ELF object files. + Copyright 2009 Free Software Foundation, Inc. + Contributed by CodeSourcery, Inc. + +This file is part of GCC. + +GCC 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. + +GCC 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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "toplev.h" +#include +#include "lto.h" +#include "tm.h" +#include "libiberty.h" +#include "ggc.h" +#include "lto-streamer.h" + + +/* Initialize FILE, an LTO file object for FILENAME. */ +static void +lto_file_init (lto_file *file, const char *filename) +{ + file->filename = filename; +} + +/* An ELF file. */ +struct lto_elf_file +{ + /* The base information. */ + lto_file base; + + /* The system file descriptor for the file. */ + int fd; + + /* The libelf descriptor for the file. */ + Elf *elf; + + /* Section number of string table used for section names. */ + size_t sec_strtab; + + /* Writable file members. */ + + /* The currently active section. */ + Elf_Scn *scn; + + /* The output stream for section header names. */ + struct lto_output_stream *shstrtab_stream; + + /* Linked list of data which must be freed *after* the file has been + closed. This is an annoying limitation of libelf. */ + struct lto_char_ptr_base *data; +}; +typedef struct lto_elf_file lto_elf_file; + +/* Stores executable header attributes which must be shared by all ELF files. + This is used for validating input files and populating output files. */ +static struct { + bool initialized; + /* 32 or 64 bits? */ + size_t bits; + unsigned char elf_ident[EI_NIDENT]; + Elf64_Half elf_machine; +} cached_file_attrs; + + +/* Return the section header for SECTION. The return value is never + NULL. Call lto_elf_free_shdr to release the memory allocated. */ + +static Elf64_Shdr * +lto_elf_get_shdr (Elf_Scn *section) +{ + Elf64_Shdr *shdr; + + switch (cached_file_attrs.bits) + { + case 32: + { + Elf32_Shdr *shdr32; + + /* Read the 32-bit section header. */ + shdr32 = elf32_getshdr (section); + if (!shdr32) + fatal_error ("could not read section header: %s", elf_errmsg (0)); + + /* Transform it into a 64-bit section header. */ + shdr = XNEW (Elf64_Shdr); + shdr->sh_name = shdr32->sh_name; + shdr->sh_type = shdr32->sh_type; + shdr->sh_flags = shdr32->sh_flags; + shdr->sh_addr = shdr32->sh_addr; + shdr->sh_offset = shdr32->sh_offset; + shdr->sh_size = shdr32->sh_size; + shdr->sh_link = shdr32->sh_link; + shdr->sh_info = shdr32->sh_info; + shdr->sh_addralign = shdr32->sh_addralign; + shdr->sh_entsize = shdr32->sh_entsize; + break; + } + break; + + case 64: + shdr = elf64_getshdr (section); + if (!shdr) + fatal_error ("could not read section header: %s", elf_errmsg (0)); + break; + + default: + gcc_unreachable (); + } + + return shdr; +} + +/* Free SHDR, previously allocated by lto_elf_get_shdr. */ +static void +lto_elf_free_shdr (Elf64_Shdr *shdr) +{ + if (cached_file_attrs.bits != 64) + free (shdr); +} + + +/* Returns a hash code for P. */ + +static hashval_t +hash_name (const void *p) +{ + const struct lto_section_slot *ds = (const struct lto_section_slot *) p; + return (hashval_t) htab_hash_string (ds->name); +} + + +/* Returns nonzero if P1 and P2 are equal. */ + +static int +eq_name (const void *p1, const void *p2) +{ + const struct lto_section_slot *s1 = + (const struct lto_section_slot *) p1; + const struct lto_section_slot *s2 = + (const struct lto_section_slot *) p2; + + return strcmp (s1->name, s2->name) == 0; +} + + +/* Build a hash table whose key is the section names and whose data is + the start and size of each section in the .o file. */ + +htab_t +lto_elf_build_section_table (lto_file *lto_file) +{ + lto_elf_file *elf_file = (lto_elf_file *)lto_file; + htab_t section_hash_table; + Elf_Scn *section; + + section_hash_table = htab_create (37, hash_name, eq_name, free); + + for (section = elf_getscn (elf_file->elf, 0); + section; + section = elf_nextscn (elf_file->elf, section)) + { + Elf64_Shdr *shdr; + const char *name; + size_t offset; + char *new_name; + void **slot; + struct lto_section_slot s_slot; + + /* Get the name of this section. */ + shdr = lto_elf_get_shdr (section); + offset = shdr->sh_name; + name = elf_strptr (elf_file->elf, + elf_file->sec_strtab, + offset); + + /* Only put lto stuff into the symtab. */ + if (strncmp (name, LTO_SECTION_NAME_PREFIX, + strlen (LTO_SECTION_NAME_PREFIX)) != 0) + { + lto_elf_free_shdr (shdr); + continue; + } + + new_name = XNEWVEC (char, strlen (name) + 1); + strcpy (new_name, name); + s_slot.name = new_name; + slot = htab_find_slot (section_hash_table, &s_slot, INSERT); + if (*slot == NULL) + { + struct lto_section_slot *new_slot = XNEW (struct lto_section_slot); + + new_slot->name = new_name; + /* The offset into the file for this section. */ + new_slot->start = shdr->sh_offset; + new_slot->len = shdr->sh_size; + *slot = new_slot; + } + else + { + error ("two or more sections for %s:", new_name); + return NULL; + } + + lto_elf_free_shdr (shdr); + } + + return section_hash_table; +} + + +/* Initialize the section header of section SCN. SH_NAME is the section name + as an index into the section header string table. SH_TYPE is the section + type, an SHT_* macro from libelf headers. */ + +#define DEFINE_INIT_SHDR(BITS) \ +static void \ +init_shdr##BITS (Elf_Scn *scn, size_t sh_name, size_t sh_type) \ +{ \ + Elf##BITS##_Shdr *shdr; \ + \ + shdr = elf##BITS##_getshdr (scn); \ + if (!shdr) \ + fatal_error ("elf"#BITS"_getshdr() failed: %s.", elf_errmsg (-1));\ + \ + shdr->sh_name = sh_name; \ + shdr->sh_type = sh_type; \ + shdr->sh_addralign = POINTER_SIZE / BITS_PER_UNIT; \ + shdr->sh_flags = 0; \ + shdr->sh_entsize = 0; \ +} + +DEFINE_INIT_SHDR (32) +DEFINE_INIT_SHDR (64) + +static bool first_data_block; + +/* Begin a new ELF section named NAME with type TYPE in the current output + file. TYPE is an SHT_* macro from the libelf headers. */ + +static void +lto_elf_begin_section_with_type (const char *name, size_t type) +{ + lto_elf_file *file; + Elf_Scn *scn; + size_t sh_name; + + /* Grab the current output file and do some basic assertion checking. */ + file = (lto_elf_file *) lto_get_current_out_file (), + gcc_assert (file); + gcc_assert (file->elf); + gcc_assert (!file->scn); + + /* Create a new section. */ + scn = elf_newscn (file->elf); + if (!scn) + fatal_error ("could not create a new ELF section: %s.", elf_errmsg (-1)); + file->scn = scn; + + /* Add a string table entry and record the offset. */ + gcc_assert (file->shstrtab_stream); + sh_name = file->shstrtab_stream->total_size; + lto_output_data_stream (file->shstrtab_stream, name, strlen (name) + 1); + + /* Initialize the section header. */ + switch (cached_file_attrs.bits) + { + case 32: + init_shdr32 (scn, sh_name, type); + break; + + case 64: + init_shdr64 (scn, sh_name, type); + break; + + default: + gcc_unreachable (); + } + + first_data_block = true; +} + + +/* Begin a new ELF section named NAME in the current output file. */ + +void +lto_elf_begin_section (const char *name) +{ + lto_elf_begin_section_with_type (name, SHT_PROGBITS); +} + + +/* Append DATA of length LEN to the current output section. BASE is a pointer + to the output page containing DATA. It is freed once the output file has + been written. */ + +void +lto_elf_append_data (const void *data, size_t len, void *block) +{ + lto_elf_file *file; + Elf_Data *elf_data; + struct lto_char_ptr_base *base = (struct lto_char_ptr_base *) block; + + /* Grab the current output file and do some basic assertion checking. */ + file = (lto_elf_file *) lto_get_current_out_file (); + gcc_assert (file); + gcc_assert (file->scn); + + elf_data = elf_newdata (file->scn); + if (!elf_data) + fatal_error ("could not append data to ELF section: %s", elf_errmsg (-1)); + + if (first_data_block) + { + elf_data->d_align = POINTER_SIZE / BITS_PER_UNIT; + first_data_block = false; + } + else + elf_data->d_align = 1; + elf_data->d_buf = CONST_CAST (void *, data); + elf_data->d_off = 0LL; + elf_data->d_size = len; + elf_data->d_type = ELF_T_BYTE; + elf_data->d_version = EV_CURRENT; + + base->ptr = (char *)file->data; + file->data = base; +} + + +/* End the current output section. This just does some assertion checking + and sets the current output file's scn member to NULL. */ + +void +lto_elf_end_section (void) +{ + lto_elf_file *file; + + /* Grab the current output file and validate some basic assertions. */ + file = (lto_elf_file *) lto_get_current_out_file (); + gcc_assert (file); + gcc_assert (file->scn); + + file->scn = NULL; +} + + +/* Validate's ELF_FILE's executable header and, if cached_file_attrs is + uninitialized, caches the architecture. */ + +#define DEFINE_VALIDATE_EHDR(BITS) \ +static bool \ +validate_ehdr##BITS (lto_elf_file *elf_file) \ +{ \ + Elf##BITS##_Ehdr *elf_header; \ + \ + elf_header = elf##BITS##_getehdr (elf_file->elf); \ + if (!elf_header) \ + { \ + error ("could not read ELF header: %s", elf_errmsg (0)); \ + return false; \ + } \ + \ + if (elf_header->e_type != ET_REL) \ + { \ + error ("not a relocatable ELF object file"); \ + return false; \ + } \ + \ + if (!cached_file_attrs.initialized) \ + cached_file_attrs.elf_machine = elf_header->e_machine; \ + \ + if (cached_file_attrs.elf_machine != elf_header->e_machine) \ + { \ + error ("inconsistent file architecture detected"); \ + return false; \ + } \ + \ + return true; \ +} + +DEFINE_VALIDATE_EHDR (32) +DEFINE_VALIDATE_EHDR (64) + + +/* Validate's ELF_FILE's executable header and, if cached_file_attrs is + uninitialized, caches the results. Also records the section header string + table's section index. Returns true on success or false on failure. */ + +static bool +validate_file (lto_elf_file *elf_file) +{ + const char *elf_ident; + + /* Some aspects of the libelf API are dependent on whether the + object file is a 32-bit or 64-bit file. Determine which kind of + file this is now. */ + elf_ident = elf_getident (elf_file->elf, NULL); + if (!elf_ident) + { + error ("could not read ELF identification information: %s", + elf_errmsg (0)); + return false; + + } + + if (!cached_file_attrs.initialized) + { + switch (elf_ident[EI_CLASS]) + { + case ELFCLASS32: + cached_file_attrs.bits = 32; + break; + + case ELFCLASS64: + cached_file_attrs.bits = 64; + break; + + default: + error ("unsupported ELF file class"); + return false; + } + + memcpy (cached_file_attrs.elf_ident, elf_ident, + sizeof cached_file_attrs.elf_ident); + } + + if (memcmp (elf_ident, cached_file_attrs.elf_ident, + sizeof cached_file_attrs.elf_ident)) + return false; + + /* Check that the input file is a relocatable object file with the correct + architecture. */ + switch (cached_file_attrs.bits) + { + case 32: + if (!validate_ehdr32 (elf_file)) + return false; + break; + + case 64: + if (!validate_ehdr64 (elf_file)) + return false; + break; + + default: + gcc_unreachable (); + } + + /* Read the string table used for section header names. */ + if (elf_getshdrstrndx (elf_file->elf, &elf_file->sec_strtab) == -1) + { + error ("could not locate ELF string table: %s", elf_errmsg (0)); + return false; + } + + cached_file_attrs.initialized = true; + return true; +} + + +/* Helper functions used by init_ehdr. Initialize ELF_FILE's executable + header using cached data from previously read files. */ + +#define DEFINE_INIT_EHDR(BITS) \ +static void \ +init_ehdr##BITS (lto_elf_file *elf_file) \ +{ \ + Elf##BITS##_Ehdr *ehdr; \ + \ + gcc_assert (cached_file_attrs.bits); \ + \ + ehdr = elf##BITS##_newehdr (elf_file->elf); \ + if (!ehdr) \ + fatal_error ("elf"#BITS"_newehdr() failed: %s.", elf_errmsg (-1));\ + \ + memcpy (ehdr->e_ident, cached_file_attrs.elf_ident, \ + sizeof cached_file_attrs.elf_ident); \ + ehdr->e_type = ET_REL; \ + ehdr->e_version = EV_CURRENT; \ + ehdr->e_machine = cached_file_attrs.elf_machine; \ +} + +DEFINE_INIT_EHDR (32) +DEFINE_INIT_EHDR (64) + + +/* Initialize ELF_FILE's executable header using cached data from previously + read files. */ + +static void +init_ehdr (lto_elf_file *elf_file) +{ + switch (cached_file_attrs.bits) + { + case 32: + init_ehdr32 (elf_file); + break; + + case 64: + init_ehdr64 (elf_file); + break; + + default: + gcc_unreachable (); + } +} + + +/* Open ELF file FILENAME. If WRITABLE is true, the file is opened for write + and, if necessary, created. Otherwise, the file is opened for reading. + Returns the opened file. */ + +lto_file * +lto_elf_file_open (const char *filename, bool writable) +{ + lto_elf_file *elf_file; + lto_file *result; + + /* Set up. */ + elf_file = XCNEW (lto_elf_file); + result = (lto_file *) elf_file; + lto_file_init (result, filename); + elf_file->fd = -1; + + /* Open the file. */ + elf_file->fd = open (filename, writable ? O_WRONLY|O_CREAT : O_RDONLY, 0666); + if (elf_file->fd == -1) + { + error ("could not open file %s", filename); + goto fail; + } + + /* Initialize the ELF library. */ + if (elf_version (EV_CURRENT) == EV_NONE) + { + error ("ELF library is older than that used when building GCC"); + goto fail; + } + + /* Open the ELF file descriptor. */ + elf_file->elf = elf_begin (elf_file->fd, writable ? ELF_C_WRITE : ELF_C_READ, + NULL); + if (!elf_file->elf) + { + error ("could not open ELF file: %s", elf_errmsg (0)); + goto fail; + } + + if (writable) + { + init_ehdr (elf_file); + elf_file->shstrtab_stream = XCNEW (struct lto_output_stream); + /* Output an empty string to the section header table. This becomes the + name of the initial NULL section. */ + lto_output_1_stream (elf_file->shstrtab_stream, '\0'); + } + else + if (!validate_file (elf_file)) + goto fail; + + return result; + + fail: + lto_elf_file_close (result); + return NULL; +} + + +/* Close ELF file FILE and clean up any associated data structures. If FILE + was opened for writing, the file's ELF data is written at this time, and + any cached data buffers are freed. */ + +void +lto_elf_file_close (lto_file *file) +{ + lto_elf_file *elf_file = (lto_elf_file *) file; + struct lto_char_ptr_base *cur, *tmp; + + /* Write the ELF section header string table. */ + if (elf_file->shstrtab_stream) + { + size_t strtab; + GElf_Ehdr *ehdr_p, ehdr_buf; + lto_file *old_file = lto_set_current_out_file (file); + + lto_elf_begin_section_with_type (".shstrtab", SHT_STRTAB); + ehdr_p = gelf_getehdr (elf_file->elf, &ehdr_buf); + if (ehdr_p == NULL) + fatal_error ("gelf_getehdr() failed: %s.", elf_errmsg (-1)); + strtab = elf_ndxscn (elf_file->scn); + if (strtab < SHN_LORESERVE) + ehdr_p->e_shstrndx = strtab; + else + { + GElf_Shdr *shdr_p, shdr_buf; + Elf_Scn *scn_p = elf_getscn (elf_file->elf, 0); + if (scn_p == NULL) + fatal_error ("elf_getscn() failed: %s.", elf_errmsg (-1)); + shdr_p = gelf_getshdr (scn_p, &shdr_buf); + if (shdr_p == NULL) + fatal_error ("gelf_getshdr() failed: %s.", elf_errmsg (-1)); + shdr_p->sh_link = strtab; + if (gelf_update_shdr (scn_p, shdr_p) == 0) + fatal_error ("gelf_update_shdr() failed: %s.", elf_errmsg (-1)); + ehdr_p->e_shstrndx = SHN_XINDEX; + } + if (gelf_update_ehdr (elf_file->elf, ehdr_p) == 0) + fatal_error ("gelf_update_ehdr() failed: %s.", elf_errmsg (-1)); + lto_write_stream (elf_file->shstrtab_stream); + lto_elf_end_section (); + + lto_set_current_out_file (old_file); + free (elf_file->shstrtab_stream); + + if (elf_update (elf_file->elf, ELF_C_WRITE) < 0) + fatal_error ("elf_update() failed: %s.", elf_errmsg (-1)); + } + + if (elf_file->elf) + elf_end (elf_file->elf); + if (elf_file->fd != -1) + close (elf_file->fd); + + /* Free any ELF data buffers. */ + cur = elf_file->data; + while (cur) + { + tmp = cur; + cur = (struct lto_char_ptr_base *) cur->ptr; + free (tmp); + } + + free (file); +} + + +/* The current output file. */ +static lto_file *current_out_file; + + +/* Sets the current output file to FILE. Returns the old output file or + NULL. */ + +lto_file * +lto_set_current_out_file (lto_file *file) +{ + lto_file *old_file = current_out_file; + current_out_file = file; + return old_file; +} + + +/* Returns the current output file. */ + +lto_file * +lto_get_current_out_file (void) +{ + return current_out_file; +} diff --git a/gcc/lto/lto-lang.c b/gcc/lto/lto-lang.c new file mode 100644 index 00000000000..f5e83de75f5 --- /dev/null +++ b/gcc/lto/lto-lang.c @@ -0,0 +1,1188 @@ +/* Language-dependent hooks for LTO. + Copyright 2009 Free Software Foundation, Inc. + Contributed by CodeSourcery, Inc. + +This file is part of GCC. + +GCC 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. + +GCC 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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "flags.h" +#include "tm.h" +#include "tree.h" +#include "expr.h" +#include "target.h" +#include "langhooks.h" +#include "langhooks-def.h" +#include "debug.h" +#include "lto-tree.h" +#include "lto.h" +#include "tree-inline.h" +#include "gimple.h" +#include "toplev.h" + +static tree handle_noreturn_attribute (tree *, tree, tree, int, bool *); +static tree handle_const_attribute (tree *, tree, tree, int, bool *); +static tree handle_malloc_attribute (tree *, tree, tree, int, bool *); +static tree handle_pure_attribute (tree *, tree, tree, int, bool *); +static tree handle_novops_attribute (tree *, tree, tree, int, bool *); +static tree handle_nonnull_attribute (tree *, tree, tree, int, bool *); +static tree handle_nothrow_attribute (tree *, tree, tree, int, bool *); +static tree handle_sentinel_attribute (tree *, tree, tree, int, bool *); +static tree handle_type_generic_attribute (tree *, tree, tree, int, bool *); +static tree handle_format_attribute (tree *, tree, tree, int, bool *); +static tree handle_format_arg_attribute (tree *, tree, tree, int, bool *); + +/* Table of machine-independent attributes supported in GIMPLE. */ +const struct attribute_spec lto_attribute_table[] = +{ + /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */ + { "noreturn", 0, 0, true, false, false, + handle_noreturn_attribute }, + /* The same comments as for noreturn attributes apply to const ones. */ + { "const", 0, 0, true, false, false, + handle_const_attribute }, + { "malloc", 0, 0, true, false, false, + handle_malloc_attribute }, + { "pure", 0, 0, true, false, false, + handle_pure_attribute }, + { "no vops", 0, 0, true, false, false, + handle_novops_attribute }, + { "nonnull", 0, -1, false, true, true, + handle_nonnull_attribute }, + { "nothrow", 0, 0, true, false, false, + handle_nothrow_attribute }, + { "sentinel", 0, 1, false, true, true, + handle_sentinel_attribute }, + { "type generic", 0, 0, false, true, true, + handle_type_generic_attribute }, + { NULL, 0, 0, false, false, false, NULL } +}; + +/* Give the specifications for the format attributes, used by C and all + descendants. */ + +const struct attribute_spec lto_format_attribute_table[] = +{ + /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */ + { "format", 3, 3, false, true, true, + handle_format_attribute }, + { "format_arg", 1, 1, false, true, true, + handle_format_arg_attribute }, + { NULL, 0, 0, false, false, false, NULL } +}; + +enum built_in_attribute +{ +#define DEF_ATTR_NULL_TREE(ENUM) ENUM, +#define DEF_ATTR_INT(ENUM, VALUE) ENUM, +#define DEF_ATTR_IDENT(ENUM, STRING) ENUM, +#define DEF_ATTR_TREE_LIST(ENUM, PURPOSE, VALUE, CHAIN) ENUM, +#include "builtin-attrs.def" +#undef DEF_ATTR_NULL_TREE +#undef DEF_ATTR_INT +#undef DEF_ATTR_IDENT +#undef DEF_ATTR_TREE_LIST + ATTR_LAST +}; + +static GTY(()) tree built_in_attributes[(int) ATTR_LAST]; + +/* Builtin types. */ + +enum lto_builtin_type +{ +#define DEF_PRIMITIVE_TYPE(NAME, VALUE) NAME, +#define DEF_FUNCTION_TYPE_0(NAME, RETURN) NAME, +#define DEF_FUNCTION_TYPE_1(NAME, RETURN, ARG1) NAME, +#define DEF_FUNCTION_TYPE_2(NAME, RETURN, ARG1, ARG2) NAME, +#define DEF_FUNCTION_TYPE_3(NAME, RETURN, ARG1, ARG2, ARG3) NAME, +#define DEF_FUNCTION_TYPE_4(NAME, RETURN, ARG1, ARG2, ARG3, ARG4) NAME, +#define DEF_FUNCTION_TYPE_5(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) NAME, +#define DEF_FUNCTION_TYPE_6(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) NAME, +#define DEF_FUNCTION_TYPE_7(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) NAME, +#define DEF_FUNCTION_TYPE_VAR_0(NAME, RETURN) NAME, +#define DEF_FUNCTION_TYPE_VAR_1(NAME, RETURN, ARG1) NAME, +#define DEF_FUNCTION_TYPE_VAR_2(NAME, RETURN, ARG1, ARG2) NAME, +#define DEF_FUNCTION_TYPE_VAR_3(NAME, RETURN, ARG1, ARG2, ARG3) NAME, +#define DEF_FUNCTION_TYPE_VAR_4(NAME, RETURN, ARG1, ARG2, ARG3, ARG4) NAME, +#define DEF_FUNCTION_TYPE_VAR_5(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG6) \ + NAME, +#define DEF_POINTER_TYPE(NAME, TYPE) NAME, +#include "builtin-types.def" +#undef DEF_PRIMITIVE_TYPE +#undef DEF_FUNCTION_TYPE_0 +#undef DEF_FUNCTION_TYPE_1 +#undef DEF_FUNCTION_TYPE_2 +#undef DEF_FUNCTION_TYPE_3 +#undef DEF_FUNCTION_TYPE_4 +#undef DEF_FUNCTION_TYPE_5 +#undef DEF_FUNCTION_TYPE_6 +#undef DEF_FUNCTION_TYPE_7 +#undef DEF_FUNCTION_TYPE_VAR_0 +#undef DEF_FUNCTION_TYPE_VAR_1 +#undef DEF_FUNCTION_TYPE_VAR_2 +#undef DEF_FUNCTION_TYPE_VAR_3 +#undef DEF_FUNCTION_TYPE_VAR_4 +#undef DEF_FUNCTION_TYPE_VAR_5 +#undef DEF_POINTER_TYPE + BT_LAST +}; + +typedef enum lto_builtin_type builtin_type; + +static GTY(()) tree builtin_types[(int) BT_LAST + 1]; + +static GTY(()) tree string_type_node; +static GTY(()) tree const_string_type_node; +static GTY(()) tree wint_type_node; +static GTY(()) tree intmax_type_node; +static GTY(()) tree uintmax_type_node; +static GTY(()) tree signed_size_type_node; + +/* Flags needed to process builtins.def. */ +int flag_no_builtin; +int flag_no_nonansi_builtin; +int flag_isoc94; +int flag_isoc99; + +/* Attribute handlers. */ + +/* Handle a "noreturn" attribute; arguments as in + struct attribute_spec.handler. */ + +static tree +handle_noreturn_attribute (tree *node, tree ARG_UNUSED (name), + tree ARG_UNUSED (args), int ARG_UNUSED (flags), + bool * ARG_UNUSED (no_add_attrs)) +{ + tree type = TREE_TYPE (*node); + + if (TREE_CODE (*node) == FUNCTION_DECL) + TREE_THIS_VOLATILE (*node) = 1; + else if (TREE_CODE (type) == POINTER_TYPE + && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE) + TREE_TYPE (*node) + = build_pointer_type + (build_type_variant (TREE_TYPE (type), + TYPE_READONLY (TREE_TYPE (type)), 1)); + else + gcc_unreachable (); + + return NULL_TREE; +} + + +/* Handle a "const" attribute; arguments as in + struct attribute_spec.handler. */ + +static tree +handle_const_attribute (tree *node, tree ARG_UNUSED (name), + tree ARG_UNUSED (args), int ARG_UNUSED (flags), + bool * ARG_UNUSED (no_add_attrs)) +{ + tree type = TREE_TYPE (*node); + + /* See FIXME comment on noreturn in c_common_attribute_table. */ + if (TREE_CODE (*node) == FUNCTION_DECL) + TREE_READONLY (*node) = 1; + else if (TREE_CODE (type) == POINTER_TYPE + && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE) + TREE_TYPE (*node) + = build_pointer_type + (build_type_variant (TREE_TYPE (type), 1, + TREE_THIS_VOLATILE (TREE_TYPE (type)))); + else + gcc_unreachable (); + + return NULL_TREE; +} + + +/* Handle a "malloc" attribute; arguments as in + struct attribute_spec.handler. */ + +static tree +handle_malloc_attribute (tree *node, tree ARG_UNUSED (name), + tree ARG_UNUSED (args), int ARG_UNUSED (flags), + bool * ARG_UNUSED (no_add_attrs)) +{ + if (TREE_CODE (*node) == FUNCTION_DECL + && POINTER_TYPE_P (TREE_TYPE (TREE_TYPE (*node)))) + DECL_IS_MALLOC (*node) = 1; + else + gcc_unreachable (); + + return NULL_TREE; +} + + +/* Handle a "pure" attribute; arguments as in + struct attribute_spec.handler. */ + +static tree +handle_pure_attribute (tree *node, tree ARG_UNUSED (name), + tree ARG_UNUSED (args), int ARG_UNUSED (flags), + bool * ARG_UNUSED (no_add_attrs)) +{ + if (TREE_CODE (*node) == FUNCTION_DECL) + DECL_PURE_P (*node) = 1; + else + gcc_unreachable (); + + return NULL_TREE; +} + + +/* Handle a "no vops" attribute; arguments as in + struct attribute_spec.handler. */ + +static tree +handle_novops_attribute (tree *node, tree ARG_UNUSED (name), + tree ARG_UNUSED (args), int ARG_UNUSED (flags), + bool *ARG_UNUSED (no_add_attrs)) +{ + gcc_assert (TREE_CODE (*node) == FUNCTION_DECL); + DECL_IS_NOVOPS (*node) = 1; + return NULL_TREE; +} + + +/* Helper for nonnull attribute handling; fetch the operand number + from the attribute argument list. */ + +static bool +get_nonnull_operand (tree arg_num_expr, unsigned HOST_WIDE_INT *valp) +{ + /* Verify the arg number is a constant. */ + if (TREE_CODE (arg_num_expr) != INTEGER_CST + || TREE_INT_CST_HIGH (arg_num_expr) != 0) + return false; + + *valp = TREE_INT_CST_LOW (arg_num_expr); + return true; +} + +/* Handle the "nonnull" attribute. */ + +static tree +handle_nonnull_attribute (tree *node, tree ARG_UNUSED (name), + tree args, int ARG_UNUSED (flags), + bool * ARG_UNUSED (no_add_attrs)) +{ + tree type = *node; + unsigned HOST_WIDE_INT attr_arg_num; + + /* If no arguments are specified, all pointer arguments should be + non-null. Verify a full prototype is given so that the arguments + will have the correct types when we actually check them later. */ + if (!args) + { + gcc_assert (TYPE_ARG_TYPES (type)); + return NULL_TREE; + } + + /* Argument list specified. Verify that each argument number references + a pointer argument. */ + for (attr_arg_num = 1; args; args = TREE_CHAIN (args)) + { + tree argument; + unsigned HOST_WIDE_INT arg_num = 0, ck_num; + + if (!get_nonnull_operand (TREE_VALUE (args), &arg_num)) + gcc_unreachable (); + + argument = TYPE_ARG_TYPES (type); + if (argument) + { + for (ck_num = 1; ; ck_num++) + { + if (!argument || ck_num == arg_num) + break; + argument = TREE_CHAIN (argument); + } + + gcc_assert (argument + && TREE_CODE (TREE_VALUE (argument)) == POINTER_TYPE); + } + } + + return NULL_TREE; +} + + +/* Handle a "nothrow" attribute; arguments as in + struct attribute_spec.handler. */ + +static tree +handle_nothrow_attribute (tree *node, tree ARG_UNUSED (name), + tree ARG_UNUSED (args), int ARG_UNUSED (flags), + bool * ARG_UNUSED (no_add_attrs)) +{ + if (TREE_CODE (*node) == FUNCTION_DECL) + TREE_NOTHROW (*node) = 1; + else + gcc_unreachable (); + + return NULL_TREE; +} + + +/* Handle a "sentinel" attribute. */ + +static tree +handle_sentinel_attribute (tree *node, tree ARG_UNUSED (name), tree args, + int ARG_UNUSED (flags), + bool * ARG_UNUSED (no_add_attrs)) +{ + tree params = TYPE_ARG_TYPES (*node); + gcc_assert (params); + + while (TREE_CHAIN (params)) + params = TREE_CHAIN (params); + + gcc_assert (!VOID_TYPE_P (TREE_VALUE (params))); + + if (args) + { + tree position = TREE_VALUE (args); + gcc_assert (TREE_CODE (position) == INTEGER_CST); + if (tree_int_cst_lt (position, integer_zero_node)) + gcc_unreachable (); + } + + return NULL_TREE; +} + +/* Handle a "type_generic" attribute. */ + +static tree +handle_type_generic_attribute (tree *node, tree ARG_UNUSED (name), + tree ARG_UNUSED (args), int ARG_UNUSED (flags), + bool * ARG_UNUSED (no_add_attrs)) +{ + tree params; + + /* Ensure we have a function type. */ + gcc_assert (TREE_CODE (*node) == FUNCTION_TYPE); + + params = TYPE_ARG_TYPES (*node); + while (params && ! VOID_TYPE_P (TREE_VALUE (params))) + params = TREE_CHAIN (params); + + /* Ensure we have a variadic function. */ + gcc_assert (!params); + + return NULL_TREE; +} + +/* Handle a "format" attribute; arguments as in + struct attribute_spec.handler. */ + +static tree +handle_format_attribute (tree * ARG_UNUSED (node), tree ARG_UNUSED (name), + tree ARG_UNUSED (args), int ARG_UNUSED (flags), + bool *no_add_attrs) +{ + *no_add_attrs = true; + return NULL_TREE; +} + + +/* Handle a "format_arg" attribute; arguments as in + struct attribute_spec.handler. */ + +tree +handle_format_arg_attribute (tree * ARG_UNUSED (node), tree ARG_UNUSED (name), + tree ARG_UNUSED (args), int ARG_UNUSED (flags), + bool *no_add_attrs) +{ + *no_add_attrs = true; + return NULL_TREE; +} + + +/* Cribbed from c-common.c. */ + +static void +def_fn_type (builtin_type def, builtin_type ret, bool var, int n, ...) +{ + tree args = NULL, t; + va_list list; + int i; + + va_start (list, n); + for (i = 0; i < n; ++i) + { + builtin_type a = (builtin_type) va_arg (list, int); + t = builtin_types[a]; + if (t == error_mark_node) + goto egress; + args = tree_cons (NULL_TREE, t, args); + } + va_end (list); + + args = nreverse (args); + if (!var) + args = chainon (args, void_list_node); + + t = builtin_types[ret]; + if (t == error_mark_node) + goto egress; + t = build_function_type (t, args); + + egress: + builtin_types[def] = t; +} + +/* Used to help initialize the builtin-types.def table. When a type of + the correct size doesn't exist, use error_mark_node instead of NULL. + The later results in segfaults even when a decl using the type doesn't + get invoked. */ + +static tree +builtin_type_for_size (int size, bool unsignedp) +{ + tree type = lang_hooks.types.type_for_size (size, unsignedp); + return type ? type : error_mark_node; +} + +/* Support for DEF_BUILTIN. */ + +static void +def_builtin_1 (enum built_in_function fncode, const char *name, + enum built_in_class fnclass, tree fntype, tree libtype, + bool both_p, bool fallback_p, bool nonansi_p, + tree fnattrs, bool implicit_p) +{ + tree decl; + const char *libname; + + if (fntype == error_mark_node) + return; + + libname = name + strlen ("__builtin_"); + decl = add_builtin_function (name, fntype, fncode, fnclass, + (fallback_p ? libname : NULL), + fnattrs); + + if (both_p + && !flag_no_builtin + && !(nonansi_p && flag_no_nonansi_builtin)) + add_builtin_function (libname, libtype, fncode, fnclass, + NULL, fnattrs); + + built_in_decls[(int) fncode] = decl; + if (implicit_p) + implicit_built_in_decls[(int) fncode] = decl; +} + + +/* Initialize the attribute table for all the supported builtins. */ + +static void +lto_init_attributes (void) +{ + /* Fill in the built_in_attributes array. */ +#define DEF_ATTR_NULL_TREE(ENUM) \ + built_in_attributes[(int) ENUM] = NULL_TREE; +#define DEF_ATTR_INT(ENUM, VALUE) \ + built_in_attributes[(int) ENUM] = build_int_cst (NULL_TREE, VALUE); +#define DEF_ATTR_IDENT(ENUM, STRING) \ + built_in_attributes[(int) ENUM] = get_identifier (STRING); +#define DEF_ATTR_TREE_LIST(ENUM, PURPOSE, VALUE, CHAIN) \ + built_in_attributes[(int) ENUM] \ + = tree_cons (built_in_attributes[(int) PURPOSE], \ + built_in_attributes[(int) VALUE], \ + built_in_attributes[(int) CHAIN]); +#include "builtin-attrs.def" +#undef DEF_ATTR_NULL_TREE +#undef DEF_ATTR_INT +#undef DEF_ATTR_IDENT +#undef DEF_ATTR_TREE_LIST +} + +/* Create builtin types and functions. VA_LIST_REF_TYPE_NODE and + VA_LIST_ARG_TYPE_NODE are used in builtin-types.def. */ + +static void +lto_define_builtins (tree va_list_ref_type_node ATTRIBUTE_UNUSED, + tree va_list_arg_type_node ATTRIBUTE_UNUSED) +{ +#define DEF_PRIMITIVE_TYPE(ENUM, VALUE) \ + builtin_types[ENUM] = VALUE; +#define DEF_FUNCTION_TYPE_0(ENUM, RETURN) \ + def_fn_type (ENUM, RETURN, 0, 0); +#define DEF_FUNCTION_TYPE_1(ENUM, RETURN, ARG1) \ + def_fn_type (ENUM, RETURN, 0, 1, ARG1); +#define DEF_FUNCTION_TYPE_2(ENUM, RETURN, ARG1, ARG2) \ + def_fn_type (ENUM, RETURN, 0, 2, ARG1, ARG2); +#define DEF_FUNCTION_TYPE_3(ENUM, RETURN, ARG1, ARG2, ARG3) \ + def_fn_type (ENUM, RETURN, 0, 3, ARG1, ARG2, ARG3); +#define DEF_FUNCTION_TYPE_4(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4) \ + def_fn_type (ENUM, RETURN, 0, 4, ARG1, ARG2, ARG3, ARG4); +#define DEF_FUNCTION_TYPE_5(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) \ + def_fn_type (ENUM, RETURN, 0, 5, ARG1, ARG2, ARG3, ARG4, ARG5); +#define DEF_FUNCTION_TYPE_6(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \ + ARG6) \ + def_fn_type (ENUM, RETURN, 0, 6, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6); +#define DEF_FUNCTION_TYPE_7(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \ + ARG6, ARG7) \ + def_fn_type (ENUM, RETURN, 0, 7, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7); +#define DEF_FUNCTION_TYPE_VAR_0(ENUM, RETURN) \ + def_fn_type (ENUM, RETURN, 1, 0); +#define DEF_FUNCTION_TYPE_VAR_1(ENUM, RETURN, ARG1) \ + def_fn_type (ENUM, RETURN, 1, 1, ARG1); +#define DEF_FUNCTION_TYPE_VAR_2(ENUM, RETURN, ARG1, ARG2) \ + def_fn_type (ENUM, RETURN, 1, 2, ARG1, ARG2); +#define DEF_FUNCTION_TYPE_VAR_3(ENUM, RETURN, ARG1, ARG2, ARG3) \ + def_fn_type (ENUM, RETURN, 1, 3, ARG1, ARG2, ARG3); +#define DEF_FUNCTION_TYPE_VAR_4(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4) \ + def_fn_type (ENUM, RETURN, 1, 4, ARG1, ARG2, ARG3, ARG4); +#define DEF_FUNCTION_TYPE_VAR_5(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) \ + def_fn_type (ENUM, RETURN, 1, 5, ARG1, ARG2, ARG3, ARG4, ARG5); +#define DEF_POINTER_TYPE(ENUM, TYPE) \ + builtin_types[(int) ENUM] = build_pointer_type (builtin_types[(int) TYPE]); + +#include "builtin-types.def" + +#undef DEF_PRIMITIVE_TYPE +#undef DEF_FUNCTION_TYPE_1 +#undef DEF_FUNCTION_TYPE_2 +#undef DEF_FUNCTION_TYPE_3 +#undef DEF_FUNCTION_TYPE_4 +#undef DEF_FUNCTION_TYPE_5 +#undef DEF_FUNCTION_TYPE_6 +#undef DEF_FUNCTION_TYPE_VAR_0 +#undef DEF_FUNCTION_TYPE_VAR_1 +#undef DEF_FUNCTION_TYPE_VAR_2 +#undef DEF_FUNCTION_TYPE_VAR_3 +#undef DEF_FUNCTION_TYPE_VAR_4 +#undef DEF_FUNCTION_TYPE_VAR_5 +#undef DEF_POINTER_TYPE + builtin_types[(int) BT_LAST] = NULL_TREE; + + lto_init_attributes (); + +#define DEF_BUILTIN(ENUM, NAME, CLASS, TYPE, LIBTYPE, BOTH_P, FALLBACK_P,\ + NONANSI_P, ATTRS, IMPLICIT, COND) \ + if (NAME && COND) \ + def_builtin_1 (ENUM, NAME, CLASS, builtin_types[(int) TYPE], \ + builtin_types[(int) LIBTYPE], BOTH_P, FALLBACK_P, \ + NONANSI_P, built_in_attributes[(int) ATTRS], IMPLICIT); +#include "builtins.def" +#undef DEF_BUILTIN +} + +static GTY(()) tree registered_builtin_types; + +/* A chain of builtin functions that we need to recognize. We will + assume that all other function names we see will be defined by the + user's program. */ +static GTY(()) tree registered_builtin_fndecls; + +/* Language hooks. */ + +static unsigned int +lto_init_options (unsigned int argc ATTRIBUTE_UNUSED, + const char **argv ATTRIBUTE_UNUSED) +{ + /* Always operate in unit-at-time mode so that we can defer + decisions about what to output. */ + flag_unit_at_a_time = 1; + + return CL_LTO; +} + +/* Handle command-line option SCODE. If the option takes an argument, it is + stored in ARG, which is otherwise NULL. VALUE holds either a numerical + argument or a binary value indicating whether the positive or negative form + of the option was supplied. */ + +const char *resolution_file_name; +static int +lto_handle_option (size_t scode, const char *arg, int value ATTRIBUTE_UNUSED) +{ + enum opt_code code = (enum opt_code) scode; + int result = 1; + + switch (code) + { + case OPT_resolution: + resolution_file_name = arg; + result = 1; + break; + + case OPT_Wabi: + warn_psabi = value; + break; + + default: + break; + } + + return result; +} + +/* Perform post-option processing. Does additional initialization based on + command-line options. PFILENAME is the main input filename. Returns false + to enable subsequent back-end initialization. */ + +static bool +lto_post_options (const char **pfilename ATTRIBUTE_UNUSED) +{ + /* FIXME lto: We have stripped enough type and other + debugging information out of the IR that it may + appear ill-formed to dwarf2out, etc. We must not + attempt to generate debug info in lto1. A more + graceful solution would disable the option flags + rather than ignoring them, but we'd also have to + worry about default debugging options. */ + write_symbols = NO_DEBUG; + debug_info_level = DINFO_LEVEL_NONE; + + /* -fltrans and -fwpa are mutually exclusive. Check for that here. */ + if (flag_wpa && flag_ltrans) + error ("-fwpa and -fltrans are mutually exclusive."); + + if (flag_ltrans) + { + flag_generate_lto = 0; + + /* During LTRANS, we are not looking at the whole program, only + a subset of the whole callgraph. */ + flag_whole_program = 0; + } + + if (flag_wpa) + flag_generate_lto = 1; + + /* Excess precision other than "fast" requires front-end + support. */ + flag_excess_precision_cmdline = EXCESS_PRECISION_FAST; + + lto_read_all_file_options (); + + /* Initialize the compiler back end. */ + return false; +} + +/* Return an integer type with PRECISION bits of precision, + that is unsigned if UNSIGNEDP is nonzero, otherwise signed. */ + +static tree +lto_type_for_size (unsigned precision, int unsignedp) +{ + if (precision == TYPE_PRECISION (integer_type_node)) + return unsignedp ? unsigned_type_node : integer_type_node; + + if (precision == TYPE_PRECISION (signed_char_type_node)) + return unsignedp ? unsigned_char_type_node : signed_char_type_node; + + if (precision == TYPE_PRECISION (short_integer_type_node)) + return unsignedp ? short_unsigned_type_node : short_integer_type_node; + + if (precision == TYPE_PRECISION (long_integer_type_node)) + return unsignedp ? long_unsigned_type_node : long_integer_type_node; + + if (precision == TYPE_PRECISION (long_long_integer_type_node)) + return unsignedp + ? long_long_unsigned_type_node + : long_long_integer_type_node; + + if (precision <= TYPE_PRECISION (intQI_type_node)) + return unsignedp ? unsigned_intQI_type_node : intQI_type_node; + + if (precision <= TYPE_PRECISION (intHI_type_node)) + return unsignedp ? unsigned_intHI_type_node : intHI_type_node; + + if (precision <= TYPE_PRECISION (intSI_type_node)) + return unsignedp ? unsigned_intSI_type_node : intSI_type_node; + + if (precision <= TYPE_PRECISION (intDI_type_node)) + return unsignedp ? unsigned_intDI_type_node : intDI_type_node; + + if (precision <= TYPE_PRECISION (intTI_type_node)) + return unsignedp ? unsigned_intTI_type_node : intTI_type_node; + + return NULL_TREE; +} + + +/* Return a data type that has machine mode MODE. + If the mode is an integer, + then UNSIGNEDP selects between signed and unsigned types. + If the mode is a fixed-point mode, + then UNSIGNEDP selects between saturating and nonsaturating types. */ + +static tree +lto_type_for_mode (enum machine_mode mode, int unsigned_p) +{ + tree t; + + if (mode == TYPE_MODE (integer_type_node)) + return unsigned_p ? unsigned_type_node : integer_type_node; + + if (mode == TYPE_MODE (signed_char_type_node)) + return unsigned_p ? unsigned_char_type_node : signed_char_type_node; + + if (mode == TYPE_MODE (short_integer_type_node)) + return unsigned_p ? short_unsigned_type_node : short_integer_type_node; + + if (mode == TYPE_MODE (long_integer_type_node)) + return unsigned_p ? long_unsigned_type_node : long_integer_type_node; + + if (mode == TYPE_MODE (long_long_integer_type_node)) + return unsigned_p ? long_long_unsigned_type_node : long_long_integer_type_node; + + if (mode == QImode) + return unsigned_p ? unsigned_intQI_type_node : intQI_type_node; + + if (mode == HImode) + return unsigned_p ? unsigned_intHI_type_node : intHI_type_node; + + if (mode == SImode) + return unsigned_p ? unsigned_intSI_type_node : intSI_type_node; + + if (mode == DImode) + return unsigned_p ? unsigned_intDI_type_node : intDI_type_node; + +#if HOST_BITS_PER_WIDE_INT >= 64 + if (mode == TYPE_MODE (intTI_type_node)) + return unsigned_p ? unsigned_intTI_type_node : intTI_type_node; +#endif + + if (mode == TYPE_MODE (float_type_node)) + return float_type_node; + + if (mode == TYPE_MODE (double_type_node)) + return double_type_node; + + if (mode == TYPE_MODE (long_double_type_node)) + return long_double_type_node; + + if (mode == TYPE_MODE (void_type_node)) + return void_type_node; + + if (mode == TYPE_MODE (build_pointer_type (char_type_node))) + return (unsigned_p + ? make_unsigned_type (GET_MODE_PRECISION (mode)) + : make_signed_type (GET_MODE_PRECISION (mode))); + + if (mode == TYPE_MODE (build_pointer_type (integer_type_node))) + return (unsigned_p + ? make_unsigned_type (GET_MODE_PRECISION (mode)) + : make_signed_type (GET_MODE_PRECISION (mode))); + + if (COMPLEX_MODE_P (mode)) + { + enum machine_mode inner_mode; + tree inner_type; + + if (mode == TYPE_MODE (complex_float_type_node)) + return complex_float_type_node; + if (mode == TYPE_MODE (complex_double_type_node)) + return complex_double_type_node; + if (mode == TYPE_MODE (complex_long_double_type_node)) + return complex_long_double_type_node; + + if (mode == TYPE_MODE (complex_integer_type_node) && !unsigned_p) + return complex_integer_type_node; + + inner_mode = GET_MODE_INNER (mode); + inner_type = lto_type_for_mode (inner_mode, unsigned_p); + if (inner_type != NULL_TREE) + return build_complex_type (inner_type); + } + else if (VECTOR_MODE_P (mode)) + { + enum machine_mode inner_mode = GET_MODE_INNER (mode); + tree inner_type = lto_type_for_mode (inner_mode, unsigned_p); + if (inner_type != NULL_TREE) + return build_vector_type_for_mode (inner_type, mode); + } + + if (mode == TYPE_MODE (dfloat32_type_node)) + return dfloat32_type_node; + if (mode == TYPE_MODE (dfloat64_type_node)) + return dfloat64_type_node; + if (mode == TYPE_MODE (dfloat128_type_node)) + return dfloat128_type_node; + + if (ALL_SCALAR_FIXED_POINT_MODE_P (mode)) + { + if (mode == TYPE_MODE (short_fract_type_node)) + return unsigned_p ? sat_short_fract_type_node : short_fract_type_node; + if (mode == TYPE_MODE (fract_type_node)) + return unsigned_p ? sat_fract_type_node : fract_type_node; + if (mode == TYPE_MODE (long_fract_type_node)) + return unsigned_p ? sat_long_fract_type_node : long_fract_type_node; + if (mode == TYPE_MODE (long_long_fract_type_node)) + return unsigned_p ? sat_long_long_fract_type_node + : long_long_fract_type_node; + + if (mode == TYPE_MODE (unsigned_short_fract_type_node)) + return unsigned_p ? sat_unsigned_short_fract_type_node + : unsigned_short_fract_type_node; + if (mode == TYPE_MODE (unsigned_fract_type_node)) + return unsigned_p ? sat_unsigned_fract_type_node + : unsigned_fract_type_node; + if (mode == TYPE_MODE (unsigned_long_fract_type_node)) + return unsigned_p ? sat_unsigned_long_fract_type_node + : unsigned_long_fract_type_node; + if (mode == TYPE_MODE (unsigned_long_long_fract_type_node)) + return unsigned_p ? sat_unsigned_long_long_fract_type_node + : unsigned_long_long_fract_type_node; + + if (mode == TYPE_MODE (short_accum_type_node)) + return unsigned_p ? sat_short_accum_type_node : short_accum_type_node; + if (mode == TYPE_MODE (accum_type_node)) + return unsigned_p ? sat_accum_type_node : accum_type_node; + if (mode == TYPE_MODE (long_accum_type_node)) + return unsigned_p ? sat_long_accum_type_node : long_accum_type_node; + if (mode == TYPE_MODE (long_long_accum_type_node)) + return unsigned_p ? sat_long_long_accum_type_node + : long_long_accum_type_node; + + if (mode == TYPE_MODE (unsigned_short_accum_type_node)) + return unsigned_p ? sat_unsigned_short_accum_type_node + : unsigned_short_accum_type_node; + if (mode == TYPE_MODE (unsigned_accum_type_node)) + return unsigned_p ? sat_unsigned_accum_type_node + : unsigned_accum_type_node; + if (mode == TYPE_MODE (unsigned_long_accum_type_node)) + return unsigned_p ? sat_unsigned_long_accum_type_node + : unsigned_long_accum_type_node; + if (mode == TYPE_MODE (unsigned_long_long_accum_type_node)) + return unsigned_p ? sat_unsigned_long_long_accum_type_node + : unsigned_long_long_accum_type_node; + + if (mode == QQmode) + return unsigned_p ? sat_qq_type_node : qq_type_node; + if (mode == HQmode) + return unsigned_p ? sat_hq_type_node : hq_type_node; + if (mode == SQmode) + return unsigned_p ? sat_sq_type_node : sq_type_node; + if (mode == DQmode) + return unsigned_p ? sat_dq_type_node : dq_type_node; + if (mode == TQmode) + return unsigned_p ? sat_tq_type_node : tq_type_node; + + if (mode == UQQmode) + return unsigned_p ? sat_uqq_type_node : uqq_type_node; + if (mode == UHQmode) + return unsigned_p ? sat_uhq_type_node : uhq_type_node; + if (mode == USQmode) + return unsigned_p ? sat_usq_type_node : usq_type_node; + if (mode == UDQmode) + return unsigned_p ? sat_udq_type_node : udq_type_node; + if (mode == UTQmode) + return unsigned_p ? sat_utq_type_node : utq_type_node; + + if (mode == HAmode) + return unsigned_p ? sat_ha_type_node : ha_type_node; + if (mode == SAmode) + return unsigned_p ? sat_sa_type_node : sa_type_node; + if (mode == DAmode) + return unsigned_p ? sat_da_type_node : da_type_node; + if (mode == TAmode) + return unsigned_p ? sat_ta_type_node : ta_type_node; + + if (mode == UHAmode) + return unsigned_p ? sat_uha_type_node : uha_type_node; + if (mode == USAmode) + return unsigned_p ? sat_usa_type_node : usa_type_node; + if (mode == UDAmode) + return unsigned_p ? sat_uda_type_node : uda_type_node; + if (mode == UTAmode) + return unsigned_p ? sat_uta_type_node : uta_type_node; + } + + for (t = registered_builtin_types; t; t = TREE_CHAIN (t)) + if (TYPE_MODE (TREE_VALUE (t)) == mode) + return TREE_VALUE (t); + + return NULL_TREE; +} + +static int +lto_global_bindings_p (void) +{ + return cfun == NULL; +} + +static void +lto_set_decl_assembler_name (tree decl) +{ + /* This is almost the same as lhd_set_decl_assembler_name, except that + we need to uniquify file-scope names, even if they are not + TREE_PUBLIC, to avoid conflicts between individual files. */ + tree id; + + if (TREE_PUBLIC (decl)) + id = targetm.mangle_decl_assembler_name (decl, DECL_NAME (decl)); + else + { + const char *name = IDENTIFIER_POINTER (DECL_NAME (decl)); + char *label; + + ASM_FORMAT_PRIVATE_NAME (label, name, DECL_UID (decl)); + id = get_identifier (label); + } + + SET_DECL_ASSEMBLER_NAME (decl, id); +} + +static tree +lto_pushdecl (tree t ATTRIBUTE_UNUSED) +{ + /* Do nothing, since we get all information from DWARF and LTO + sections. */ + return NULL_TREE; +} + +static tree +lto_getdecls (void) +{ + return registered_builtin_fndecls; +} + +static void +lto_write_globals (void) +{ + tree *vec = VEC_address (tree, lto_global_var_decls); + int len = VEC_length (tree, lto_global_var_decls); + wrapup_global_declarations (vec, len); + emit_debug_global_declarations (vec, len); + VEC_free (tree, gc, lto_global_var_decls); +} + +static tree +lto_builtin_function (tree decl) +{ + /* Record it. */ + TREE_CHAIN (decl) = registered_builtin_fndecls; + registered_builtin_fndecls = decl; + + return decl; +} + +static void +lto_register_builtin_type (tree type, const char *name) +{ + tree decl; + + decl = build_decl (UNKNOWN_LOCATION, TYPE_DECL, get_identifier (name), type); + DECL_ARTIFICIAL (decl) = 1; + if (!TYPE_NAME (type)) + TYPE_NAME (type) = decl; + + registered_builtin_types = tree_cons (0, type, registered_builtin_types); +} + +/* Build nodes that would have be created by the C front-end; necessary + for including builtin-types.def and ultimately builtins.def. */ + +static void +lto_build_c_type_nodes (void) +{ + gcc_assert (void_type_node); + + void_list_node = build_tree_list (NULL_TREE, void_type_node); + string_type_node = build_pointer_type (char_type_node); + const_string_type_node + = build_pointer_type (build_qualified_type (char_type_node, TYPE_QUAL_CONST)); + + if (strcmp (SIZE_TYPE, "unsigned int") == 0) + { + intmax_type_node = integer_type_node; + uintmax_type_node = unsigned_type_node; + signed_size_type_node = integer_type_node; + } + else if (strcmp (SIZE_TYPE, "long unsigned int") == 0) + { + intmax_type_node = long_integer_type_node; + uintmax_type_node = long_unsigned_type_node; + signed_size_type_node = long_integer_type_node; + } + else + gcc_unreachable (); + + wint_type_node = unsigned_type_node; + pid_type_node = integer_type_node; +} + + +/* Perform LTO-specific initialization. */ + +static bool +lto_init (void) +{ + /* We need to generate LTO if running in WPA mode. */ + flag_generate_lto = flag_wpa; + + /* Initialize libcpp line maps for gcc_assert to work. */ + linemap_add (line_table, LC_RENAME, 0, NULL, 0); + linemap_add (line_table, LC_RENAME, 0, NULL, 0); + + /* Create the basic integer types. */ + build_common_tree_nodes (flag_signed_char, /*signed_sizetype=*/false); + + /* Share char_type_node with whatever would be the default for the target. + char_type_node will be used for internal types such as + va_list_type_node but will not be present in the lto stream. */ + char_type_node + = DEFAULT_SIGNED_CHAR ? signed_char_type_node : unsigned_char_type_node; + + /* Tell the middle end what type to use for the size of objects. */ + if (strcmp (SIZE_TYPE, "unsigned int") == 0) + { + set_sizetype (unsigned_type_node); + size_type_node = unsigned_type_node; + } + else if (strcmp (SIZE_TYPE, "long unsigned int") == 0) + { + set_sizetype (long_unsigned_type_node); + size_type_node = long_unsigned_type_node; + } + else + gcc_unreachable (); + + /* The global tree for the main identifier is filled in by + language-specific front-end initialization that is not run in the + LTO back-end. It appears that all languages that perform such + initialization currently do so in the same way, so we do it here. */ + if (main_identifier_node == NULL_TREE) + main_identifier_node = get_identifier ("main"); + + /* In the C++ front-end, fileptr_type_node is defined as a variant + copy of of ptr_type_node, rather than ptr_node itself. The + distinction should only be relevant to the front-end, so we + always use the C definition here in lto1. */ + gcc_assert (fileptr_type_node == ptr_type_node); + + ptrdiff_type_node = integer_type_node; + + /* Create other basic types. */ + build_common_tree_nodes_2 (/*short_double=*/false); + lto_build_c_type_nodes (); + gcc_assert (va_list_type_node); + + if (TREE_CODE (va_list_type_node) == ARRAY_TYPE) + { + tree x = build_pointer_type (TREE_TYPE (va_list_type_node)); + lto_define_builtins (x, x); + } + else + { + lto_define_builtins (va_list_type_node, + build_reference_type (va_list_type_node)); + } + + targetm.init_builtins (); + build_common_builtin_nodes (); + + /* Initialize LTO-specific data structures. */ + lto_global_var_decls = VEC_alloc (tree, gc, 256); + in_lto_p = true; + + return true; +} + +/* Initialize tree structures required by the LTO front end. */ + +static void lto_init_ts (void) +{ + tree_contains_struct[NAMESPACE_DECL][TS_DECL_MINIMAL] = 1; +} + +#undef LANG_HOOKS_NAME +#define LANG_HOOKS_NAME "GNU GIMPLE" +#undef LANG_HOOKS_INIT_OPTIONS +#define LANG_HOOKS_INIT_OPTIONS lto_init_options +#undef LANG_HOOKS_HANDLE_OPTION +#define LANG_HOOKS_HANDLE_OPTION lto_handle_option +#undef LANG_HOOKS_POST_OPTIONS +#define LANG_HOOKS_POST_OPTIONS lto_post_options +#undef LANG_HOOKS_GET_ALIAS_SET +#define LANG_HOOKS_GET_ALIAS_SET gimple_get_alias_set +#undef LANG_HOOKS_TYPE_FOR_MODE +#define LANG_HOOKS_TYPE_FOR_MODE lto_type_for_mode +#undef LANG_HOOKS_TYPE_FOR_SIZE +#define LANG_HOOKS_TYPE_FOR_SIZE lto_type_for_size +#undef LANG_HOOKS_SET_DECL_ASSEMBLER_NAME +#define LANG_HOOKS_SET_DECL_ASSEMBLER_NAME lto_set_decl_assembler_name +#undef LANG_HOOKS_GLOBAL_BINDINGS_P +#define LANG_HOOKS_GLOBAL_BINDINGS_P lto_global_bindings_p +#undef LANG_HOOKS_PUSHDECL +#define LANG_HOOKS_PUSHDECL lto_pushdecl +#undef LANG_HOOKS_GETDECLS +#define LANG_HOOKS_GETDECLS lto_getdecls +#undef LANG_HOOKS_WRITE_GLOBALS +#define LANG_HOOKS_WRITE_GLOBALS lto_write_globals +#undef LANG_HOOKS_REGISTER_BUILTIN_TYPE +#define LANG_HOOKS_REGISTER_BUILTIN_TYPE lto_register_builtin_type +#undef LANG_HOOKS_BUILTIN_FUNCTION +#define LANG_HOOKS_BUILTIN_FUNCTION lto_builtin_function +#undef LANG_HOOKS_INIT +#define LANG_HOOKS_INIT lto_init +#undef LANG_HOOKS_PARSE_FILE +#define LANG_HOOKS_PARSE_FILE lto_main +#undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION +#define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION tree_rest_of_compilation +#undef LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS +#define LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS true +#undef LANG_HOOKS_TYPES_COMPATIBLE_P +#define LANG_HOOKS_TYPES_COMPATIBLE_P NULL + +/* Attribute hooks. */ +#undef LANG_HOOKS_COMMON_ATTRIBUTE_TABLE +#define LANG_HOOKS_COMMON_ATTRIBUTE_TABLE lto_attribute_table +#undef LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE +#define LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE lto_format_attribute_table + +#undef LANG_HOOKS_BEGIN_SECTION +#define LANG_HOOKS_BEGIN_SECTION lto_elf_begin_section +#undef LANG_HOOKS_APPEND_DATA +#define LANG_HOOKS_APPEND_DATA lto_elf_append_data +#undef LANG_HOOKS_END_SECTION +#define LANG_HOOKS_END_SECTION lto_elf_end_section + +#undef LANG_HOOKS_INIT_TS +#define LANG_HOOKS_INIT_TS lto_init_ts + +struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; + +/* Language hooks that are not part of lang_hooks. */ + +tree +convert (tree type ATTRIBUTE_UNUSED, tree expr ATTRIBUTE_UNUSED) +{ + gcc_unreachable (); +} + +/* Tree walking support. */ + +static enum lto_tree_node_structure_enum +lto_tree_node_structure (union lang_tree_node *t ATTRIBUTE_UNUSED) +{ + return TS_LTO_GENERIC; +} + +#include "ggc.h" +#include "gtype-lto.h" +#include "gt-lto-lto-lang.h" diff --git a/gcc/lto/lto-tree.h b/gcc/lto/lto-tree.h new file mode 100644 index 00000000000..671fa4ade26 --- /dev/null +++ b/gcc/lto/lto-tree.h @@ -0,0 +1,61 @@ +/* Language-dependent trees for LTO. + Copyright 2009 Free Software Foundation, Inc. + Contributed by CodeSourcery, Inc. + +This file is part of GCC. + +GCC 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. + +GCC 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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_LTO_TREE_H +#define GCC_LTO_TREE_H + +#include "plugin-api.h" + +struct GTY(()) lang_identifier +{ + struct tree_identifier base; +}; + +struct GTY(()) lang_decl +{ + int dummy; /* Added because ggc does not like empty structs. */ +}; + +struct GTY(()) lang_type +{ + int dummy; /* Added because ggc does not like empty structs. */ +}; + +struct GTY(()) language_function +{ + int dummy; /* Added because ggc does not like empty structs. */ +}; + +enum lto_tree_node_structure_enum { + TS_LTO_GENERIC +}; + +union GTY((desc ("lto_tree_node_structure (&%h)"), + chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)"))) + lang_tree_node +{ + union tree_node GTY ((tag ("TS_LTO_GENERIC"), + desc ("tree_node_structure (&%h)"))) generic; +}; + +/* Vector to keep track of external variables we've seen so far. */ +extern GTY(()) VEC(tree,gc) *lto_global_var_decls; + +#endif /* GCC_LTO_TREE_H */ diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c new file mode 100644 index 00000000000..056d249a161 --- /dev/null +++ b/gcc/lto/lto.c @@ -0,0 +1,2067 @@ +/* Top-level LTO routines. + Copyright 2009 Free Software Foundation, Inc. + Contributed by CodeSourcery, Inc. + +This file is part of GCC. + +GCC 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. + +GCC 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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "opts.h" +#include "toplev.h" +#include "tree.h" +#include "diagnostic.h" +#include "tm.h" +#include "libiberty.h" +#include "cgraph.h" +#include "ggc.h" +#include "tree-ssa-operands.h" +#include "tree-pass.h" +#include "langhooks.h" +#include "vec.h" +#include "bitmap.h" +#include "pointer-set.h" +#include "ipa-prop.h" +#include "common.h" +#include "timevar.h" +#include "gimple.h" +#include "lto.h" +#include "lto-tree.h" +#include "lto-streamer.h" + +/* This needs to be included after config.h. Otherwise, _GNU_SOURCE will not + be defined in time to set __USE_GNU in the system headers, and strsignal + will not be declared. */ +#include + +DEF_VEC_P(bitmap); +DEF_VEC_ALLOC_P(bitmap,heap); + +/* Read the constructors and inits. */ + +static void +lto_materialize_constructors_and_inits (struct lto_file_decl_data * file_data) +{ + size_t len; + const char *data = lto_get_section_data (file_data, + LTO_section_static_initializer, + NULL, &len); + lto_input_constructors_and_inits (file_data, data); + lto_free_section_data (file_data, LTO_section_static_initializer, NULL, + data, len); +} + +/* Read the function body for the function associated with NODE if possible. */ + +static void +lto_materialize_function (struct cgraph_node *node) +{ + tree decl; + struct lto_file_decl_data *file_data; + const char *data, *name; + size_t len; + tree step; + + /* Ignore clone nodes. Read the body only from the original one. + We may find clone nodes during LTRANS after WPA has made inlining + decisions. */ + if (node->clone_of) + return; + + decl = node->decl; + file_data = node->local.lto_file_data; + name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); + + /* We may have renamed the declaration, e.g., a static function. */ + name = lto_get_decl_name_mapping (file_data, name); + + data = lto_get_section_data (file_data, LTO_section_function_body, + name, &len); + if (data) + { + struct function *fn; + + gcc_assert (!DECL_IS_BUILTIN (decl)); + + /* This function has a definition. */ + TREE_STATIC (decl) = 1; + + gcc_assert (DECL_STRUCT_FUNCTION (decl) == NULL); + allocate_struct_function (decl, false); + + /* Load the function body only if not operating in WPA mode. In + WPA mode, the body of the function is not needed. */ + if (!flag_wpa) + { + lto_input_function_body (file_data, decl, data); + lto_stats.num_function_bodies++; + } + + fn = DECL_STRUCT_FUNCTION (decl); + lto_free_section_data (file_data, LTO_section_function_body, name, + data, len); + + /* Look for initializers of constant variables and private + statics. */ + for (step = fn->local_decls; step; step = TREE_CHAIN (step)) + { + tree decl = TREE_VALUE (step); + if (TREE_CODE (decl) == VAR_DECL + && (TREE_STATIC (decl) && !DECL_EXTERNAL (decl)) + && flag_unit_at_a_time) + varpool_finalize_decl (decl); + } + } + else + DECL_EXTERNAL (decl) = 1; + + /* Let the middle end know about the function. */ + rest_of_decl_compilation (decl, 1, 0); + if (cgraph_node (decl)->needed) + cgraph_mark_reachable_node (cgraph_node (decl)); +} + + +/* Decode the content of memory pointed to by DATA in the the + in decl state object STATE. DATA_IN points to a data_in structure for + decoding. Return the address after the decoded object in the input. */ + +static const uint32_t * +lto_read_in_decl_state (struct data_in *data_in, const uint32_t *data, + struct lto_in_decl_state *state) +{ + uint32_t ix; + tree decl; + uint32_t i, j; + + ix = *data++; + decl = lto_streamer_cache_get (data_in->reader_cache, (int) ix); + if (TREE_CODE (decl) != FUNCTION_DECL) + { + gcc_assert (decl == void_type_node); + decl = NULL_TREE; + } + state->fn_decl = decl; + + for (i = 0; i < LTO_N_DECL_STREAMS; i++) + { + uint32_t size = *data++; + tree *decls = (tree *) xcalloc (size, sizeof (tree)); + + for (j = 0; j < size; j++) + { + decls[j] = lto_streamer_cache_get (data_in->reader_cache, data[j]); + + /* Register every type in the global type table. If the + type existed already, use the existing type. */ + if (TYPE_P (decls[j])) + decls[j] = gimple_register_type (decls[j]); + } + + state->streams[i].size = size; + state->streams[i].trees = decls; + data += size; + } + + return data; +} + + +/* Read all the symbols from buffer DATA, using descriptors in DECL_DATA. + RESOLUTIONS is the set of symbols picked by the linker (read from the + resolution file when the linker plugin is being used). */ + +static void +lto_read_decls (struct lto_file_decl_data *decl_data, const void *data, + VEC(ld_plugin_symbol_resolution_t,heap) *resolutions) +{ + const struct lto_decl_header *header = (const struct lto_decl_header *) data; + const int32_t decl_offset = sizeof (struct lto_decl_header); + const int32_t main_offset = decl_offset + header->decl_state_size; + const int32_t string_offset = main_offset + header->main_size; + struct lto_input_block ib_main; + struct data_in *data_in; + unsigned int i; + const uint32_t *data_ptr, *data_end; + uint32_t num_decl_states; + + LTO_INIT_INPUT_BLOCK (ib_main, (const char *) data + main_offset, 0, + header->main_size); + + data_in = lto_data_in_create (decl_data, (const char *) data + string_offset, + header->string_size, resolutions); + + /* Read the global declarations and types. */ + while (ib_main.p < ib_main.len) + { + tree t = lto_input_tree (&ib_main, data_in); + gcc_assert (t && ib_main.p <= ib_main.len); + } + + /* Read in lto_in_decl_state objects. */ + data_ptr = (const uint32_t *) ((const char*) data + decl_offset); + data_end = + (const uint32_t *) ((const char*) data_ptr + header->decl_state_size); + num_decl_states = *data_ptr++; + + gcc_assert (num_decl_states > 0); + decl_data->global_decl_state = lto_new_in_decl_state (); + data_ptr = lto_read_in_decl_state (data_in, data_ptr, + decl_data->global_decl_state); + + /* Read in per-function decl states and enter them in hash table. */ + decl_data->function_decl_states = + htab_create (37, lto_hash_in_decl_state, lto_eq_in_decl_state, free); + + for (i = 1; i < num_decl_states; i++) + { + struct lto_in_decl_state *state = lto_new_in_decl_state (); + void **slot; + + data_ptr = lto_read_in_decl_state (data_in, data_ptr, state); + slot = htab_find_slot (decl_data->function_decl_states, state, INSERT); + gcc_assert (*slot == NULL); + *slot = state; + } + + if (data_ptr != data_end) + internal_error ("bytecode stream: garbage at the end of symbols section"); + + /* Set the current decl state to be the global state. */ + decl_data->current_decl_state = decl_data->global_decl_state; + + /* After each CU is read register and possibly merge global + symbols and their types. */ + lto_register_deferred_decls_in_symtab (data_in); + + lto_data_in_delete (data_in); +} + +/* Read resolution for file named FILE_NAME. The resolution is read from + RESOLUTION. An array with the symbol resolution is returned. The array + size is written to SIZE. */ + +static VEC(ld_plugin_symbol_resolution_t,heap) * +lto_resolution_read (FILE *resolution, const char *file_name) +{ + /* We require that objects in the resolution file are in the same + order as the lto1 command line. */ + unsigned int name_len; + char *obj_name; + unsigned int num_symbols; + unsigned int i; + VEC(ld_plugin_symbol_resolution_t,heap) *ret = NULL; + unsigned max_index = 0; + + if (!resolution) + return NULL; + + name_len = strlen (file_name); + obj_name = XNEWVEC (char, name_len + 1); + fscanf (resolution, " "); /* Read white space. */ + + fread (obj_name, sizeof (char), name_len, resolution); + obj_name[name_len] = '\0'; + if (strcmp (obj_name, file_name) != 0) + internal_error ("unexpected file name %s in linker resolution file. " + "Expected %s", obj_name, file_name); + + free (obj_name); + + fscanf (resolution, "%u", &num_symbols); + + for (i = 0; i < num_symbols; i++) + { + unsigned index; + char r_str[27]; + enum ld_plugin_symbol_resolution r; + unsigned int j; + unsigned int lto_resolution_str_len = + sizeof (lto_resolution_str) / sizeof (char *); + + fscanf (resolution, "%u %26s", &index, r_str); + if (index > max_index) + max_index = index; + + for (j = 0; j < lto_resolution_str_len; j++) + { + if (strcmp (lto_resolution_str[j], r_str) == 0) + { + r = (enum ld_plugin_symbol_resolution) j; + break; + } + } + if (j >= lto_resolution_str_len) + internal_error ("tried to read past the end of the linker resolution " + "file"); + + VEC_safe_grow_cleared (ld_plugin_symbol_resolution_t, heap, ret, + index + 1); + VEC_replace (ld_plugin_symbol_resolution_t, ret, index, r); + } + + return ret; +} + +/* Generate a TREE representation for all types and external decls + entities in FILE. + + Read all of the globals out of the file. Then read the cgraph + and process the .o index into the cgraph nodes so that it can open + the .o file to load the functions and ipa information. */ + +static struct lto_file_decl_data * +lto_file_read (lto_file *file, FILE *resolution_file) +{ + struct lto_file_decl_data *file_data; + const char *data; + size_t len; + VEC(ld_plugin_symbol_resolution_t,heap) *resolutions; + + resolutions = lto_resolution_read (resolution_file, file->filename); + + file_data = XCNEW (struct lto_file_decl_data); + file_data->file_name = file->filename; + file_data->fd = -1; + file_data->section_hash_table = lto_elf_build_section_table (file); + file_data->renaming_hash_table = lto_create_renaming_table (); + + data = lto_get_section_data (file_data, LTO_section_decls, NULL, &len); + lto_read_decls (file_data, data, resolutions); + lto_free_section_data (file_data, LTO_section_decls, NULL, data, len); + + return file_data; +} + +#if HAVE_MMAP_FILE && HAVE_SYSCONF && defined _SC_PAGE_SIZE +#define LTO_MMAP_IO 1 +#endif + +#if LTO_MMAP_IO +/* Page size of machine is used for mmap and munmap calls. */ +static size_t page_mask; +#endif + +/* Get the section data of length LEN from FILENAME starting at + OFFSET. The data segment must be freed by the caller when the + caller is finished. Returns NULL if all was not well. */ + +static char * +lto_read_section_data (struct lto_file_decl_data *file_data, + intptr_t offset, size_t len) +{ + char *result; +#if LTO_MMAP_IO + intptr_t computed_len; + intptr_t computed_offset; + intptr_t diff; +#endif + + if (file_data->fd == -1) + file_data->fd = open (file_data->file_name, O_RDONLY); + + if (file_data->fd == -1) + return NULL; + +#if LTO_MMAP_IO + if (!page_mask) + { + size_t page_size = sysconf (_SC_PAGE_SIZE); + page_mask = ~(page_size - 1); + } + + computed_offset = offset & page_mask; + diff = offset - computed_offset; + computed_len = len + diff; + + result = (char *) mmap (NULL, computed_len, PROT_READ, MAP_PRIVATE, + file_data->fd, computed_offset); + if (result == MAP_FAILED) + { + close (file_data->fd); + return NULL; + } + + return result + diff; +#else + result = (char *) xmalloc (len); + if (result == NULL) + { + close (file_data->fd); + return NULL; + } + if (lseek (file_data->fd, offset, SEEK_SET) != offset + || read (file_data->fd, result, len) != (ssize_t) len) + { + free (result); + close (file_data->fd); + return NULL; + } + + return result; +#endif +} + + +/* Get the section data from FILE_DATA of SECTION_TYPE with NAME. + NAME will be NULL unless the section type is for a function + body. */ + +static const char * +get_section_data (struct lto_file_decl_data *file_data, + enum lto_section_type section_type, + const char *name, + size_t *len) +{ + htab_t section_hash_table = file_data->section_hash_table; + struct lto_section_slot *f_slot; + struct lto_section_slot s_slot; + const char *section_name = lto_get_section_name (section_type, name); + char *data = NULL; + + *len = 0; + s_slot.name = section_name; + f_slot = (struct lto_section_slot *) htab_find (section_hash_table, &s_slot); + if (f_slot) + { + data = lto_read_section_data (file_data, f_slot->start, f_slot->len); + *len = f_slot->len; + } + + free (CONST_CAST (char *, section_name)); + return data; +} + + +/* Free the section data from FILE_DATA of SECTION_TYPE with NAME that + starts at OFFSET and has LEN bytes. */ + +static void +free_section_data (struct lto_file_decl_data *file_data, + enum lto_section_type section_type ATTRIBUTE_UNUSED, + const char *name ATTRIBUTE_UNUSED, + const char *offset, size_t len ATTRIBUTE_UNUSED) +{ +#if LTO_MMAP_IO + intptr_t computed_len; + intptr_t computed_offset; + intptr_t diff; +#endif + + if (file_data->fd == -1) + return; + +#if LTO_MMAP_IO + computed_offset = ((intptr_t) offset) & page_mask; + diff = (intptr_t) offset - computed_offset; + computed_len = len + diff; + + munmap ((caddr_t) computed_offset, computed_len); +#else + free (CONST_CAST(char *, offset)); +#endif +} + +/* Vector of all cgraph node sets. */ +static GTY (()) VEC(cgraph_node_set, gc) *lto_cgraph_node_sets; + + +/* Group cgrah nodes by input files. This is used mainly for testing + right now. */ + +static void +lto_1_to_1_map (void) +{ + struct cgraph_node *node; + struct lto_file_decl_data *file_data; + struct pointer_map_t *pmap; + cgraph_node_set set; + void **slot; + + timevar_push (TV_WHOPR_WPA); + + lto_cgraph_node_sets = VEC_alloc (cgraph_node_set, gc, 1); + + /* If the cgraph is empty, create one cgraph node set so that there is still + an output file for any variables that need to be exported in a DSO. */ + if (!cgraph_nodes) + { + set = cgraph_node_set_new (); + VEC_safe_push (cgraph_node_set, gc, lto_cgraph_node_sets, set); + goto finish; + } + + pmap = pointer_map_create (); + + for (node = cgraph_nodes; node; node = node->next) + { + /* We only need to partition the nodes that we read from the + gimple bytecode files. */ + file_data = node->local.lto_file_data; + if (file_data == NULL) + continue; + + slot = pointer_map_contains (pmap, file_data); + if (slot) + set = (cgraph_node_set) *slot; + else + { + set = cgraph_node_set_new (); + slot = pointer_map_insert (pmap, file_data); + *slot = set; + VEC_safe_push (cgraph_node_set, gc, lto_cgraph_node_sets, set); + } + + cgraph_node_set_add (set, node); + } + + pointer_map_destroy (pmap); + +finish: + timevar_pop (TV_WHOPR_WPA); + + lto_stats.num_cgraph_partitions += VEC_length (cgraph_node_set, + lto_cgraph_node_sets); +} + + +/* Add inlined clone NODE and its master clone to SET, if NODE itself has + inlined callees, recursively add the callees. */ + +static void +lto_add_inline_clones (cgraph_node_set set, struct cgraph_node *node, + bitmap original_decls, bitmap inlined_decls) +{ + struct cgraph_node *callee; + struct cgraph_edge *edge; + + cgraph_node_set_add (set, node); + + if (!bitmap_bit_p (original_decls, DECL_UID (node->decl))) + bitmap_set_bit (inlined_decls, DECL_UID (node->decl)); + + /* Check to see if NODE has any inlined callee. */ + for (edge = node->callees; edge != NULL; edge = edge->next_callee) + { + callee = edge->callee; + if (callee->global.inlined_to != NULL) + lto_add_inline_clones (set, callee, original_decls, inlined_decls); + } +} + +/* Compute the transitive closure of inlining of SET based on the + information in the callgraph. Returns a bitmap of decls that have + been inlined into SET indexed by UID. */ + +static bitmap +lto_add_all_inlinees (cgraph_node_set set) +{ + cgraph_node_set_iterator csi; + struct cgraph_node *node; + bitmap original_nodes = lto_bitmap_alloc (); + bitmap original_decls = lto_bitmap_alloc (); + bitmap inlined_decls = lto_bitmap_alloc (); + bool changed; + + /* We are going to iterate SET while adding to it, mark all original + nodes so that we only add node inlined to original nodes. */ + for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi)) + { + bitmap_set_bit (original_nodes, csi_node (csi)->uid); + bitmap_set_bit (original_decls, DECL_UID (csi_node (csi)->decl)); + } + + /* Some of the original nodes might not be needed anymore. + Remove them. */ + do + { + changed = false; + for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi)) + { + struct cgraph_node *inlined_to; + node = csi_node (csi); + + /* NODE was not inlined. We still need it. */ + if (!node->global.inlined_to) + continue; + + inlined_to = node->global.inlined_to; + + /* NODE should have only one caller. */ + gcc_assert (!node->callers->next_caller); + + if (!bitmap_bit_p (original_nodes, inlined_to->uid)) + { + bitmap_clear_bit (original_nodes, node->uid); + cgraph_node_set_remove (set, node); + changed = true; + } + } + } + while (changed); + + /* Transitively add to SET all the inline clones for every node that + has been inlined. */ + for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi)) + { + node = csi_node (csi); + if (bitmap_bit_p (original_nodes, node->uid)) + lto_add_inline_clones (set, node, original_decls, inlined_decls); + } + + lto_bitmap_free (original_nodes); + lto_bitmap_free (original_decls); + + return inlined_decls; +} + +/* Owing to inlining, we may need to promote a file-scope variable + to a global variable. Consider this case: + + a.c: + static int var; + + void + foo (void) + { + var++; + } + + b.c: + + extern void foo (void); + + void + bar (void) + { + foo (); + } + + If WPA inlines FOO inside BAR, then the static variable VAR needs to + be promoted to global because BAR and VAR may be in different LTRANS + files. */ + +/* This struct keeps track of states used in globalization. */ + +typedef struct +{ + /* Current cgraph node set. */ + cgraph_node_set set; + + /* Function DECLs of cgraph nodes seen. */ + bitmap seen_node_decls; + + /* Use in walk_tree to avoid multiple visits of a node. */ + struct pointer_set_t *visited; + + /* static vars in this set. */ + bitmap static_vars_in_set; + + /* static vars in all previous set. */ + bitmap all_static_vars; + + /* all vars in all previous set. */ + bitmap all_vars; +} globalize_context_t; + +/* Callback for walk_tree. Examine the tree pointer to by TP and see if + if its a file-scope static variable of function that need to be turned + into a global. */ + +static tree +globalize_cross_file_statics (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED, + void *data) +{ + globalize_context_t *context = (globalize_context_t *) data; + tree t = *tp; + + if (t == NULL_TREE) + return NULL; + + /* The logic for globalization of VAR_DECLs and FUNCTION_DECLs are + different. For functions, we can simply look at the cgraph node sets + to tell if there are references to static functions outside the set. + The cgraph node sets do not keep track of vars, we need to traverse + the trees to determine what vars need to be globalized. */ + if (TREE_CODE (t) == VAR_DECL) + { + if (!TREE_PUBLIC (t)) + { + /* This file-scope static variable is reachable from more + that one set. Make it global but with hidden visibility + so that we do not export it in dynamic linking. */ + if (bitmap_bit_p (context->all_static_vars, DECL_UID (t))) + { + TREE_PUBLIC (t) = 1; + DECL_VISIBILITY (t) = VISIBILITY_HIDDEN; + } + bitmap_set_bit (context->static_vars_in_set, DECL_UID (t)); + } + bitmap_set_bit (context->all_vars, DECL_UID (t)); + walk_tree (&DECL_INITIAL (t), globalize_cross_file_statics, context, + context->visited); + } + else if (TREE_CODE (t) == FUNCTION_DECL && !TREE_PUBLIC (t)) + { + if (!cgraph_node_in_set_p (cgraph_node (t), context->set)) + { + /* This file-scope static function is reachable from a set + which does not contain the function DECL. Make it global + but with hidden visibility. */ + TREE_PUBLIC (t) = 1; + DECL_VISIBILITY (t) = VISIBILITY_HIDDEN; + } + } + + return NULL; +} + +/* Helper of lto_scan_statics_in_cgraph_node below. Scan TABLE for + static decls that may be used in more than one LTRANS file. + CONTEXT is a globalize_context_t for storing scanning states. */ + +static void +lto_scan_statics_in_ref_table (struct lto_tree_ref_table *table, + globalize_context_t *context) +{ + unsigned i; + + for (i = 0; i < table->size; i++) + walk_tree (&table->trees[i], globalize_cross_file_statics, context, + context->visited); +} + +/* Promote file-scope decl reachable from NODE if necessary to global. + CONTEXT is a globalize_context_t storing scanning states. */ + +static void +lto_scan_statics_in_cgraph_node (struct cgraph_node *node, + globalize_context_t *context) +{ + struct lto_in_decl_state *state; + + /* Do nothing if NODE has no function body. */ + if (!node->analyzed) + return; + + /* Return if the DECL of nodes has been visited before. */ + if (bitmap_bit_p (context->seen_node_decls, DECL_UID (node->decl))) + return; + + bitmap_set_bit (context->seen_node_decls, DECL_UID (node->decl)); + + state = lto_get_function_in_decl_state (node->local.lto_file_data, + node->decl); + gcc_assert (state); + + lto_scan_statics_in_ref_table (&state->streams[LTO_DECL_STREAM_VAR_DECL], + context); + lto_scan_statics_in_ref_table (&state->streams[LTO_DECL_STREAM_FN_DECL], + context); +} + +/* Scan all global variables that we have not yet seen so far. CONTEXT + is a globalize_context_t storing scanning states. */ + +static void +lto_scan_statics_in_remaining_global_vars (globalize_context_t *context) +{ + tree var, var_context; + struct varpool_node *vnode; + + FOR_EACH_STATIC_VARIABLE (vnode) + { + var = vnode->decl; + var_context = DECL_CONTEXT (var); + if (TREE_STATIC (var) + && TREE_PUBLIC (var) + && (!var_context || TREE_CODE (var_context) != FUNCTION_DECL) + && !bitmap_bit_p (context->all_vars, DECL_UID (var))) + walk_tree (&var, globalize_cross_file_statics, context, + context->visited); + } +} + +/* Find out all static decls that need to be promoted to global because + of cross file sharing. This function must be run in the WPA mode after + all inlinees are added. */ + +static void +lto_promote_cross_file_statics (void) +{ + unsigned i, n_sets; + cgraph_node_set set; + cgraph_node_set_iterator csi; + globalize_context_t context; + + memset (&context, 0, sizeof (context)); + context.all_vars = lto_bitmap_alloc (); + context.all_static_vars = lto_bitmap_alloc (); + + n_sets = VEC_length (cgraph_node_set, lto_cgraph_node_sets); + for (i = 0; i < n_sets; i++) + { + set = VEC_index (cgraph_node_set, lto_cgraph_node_sets, i); + context.set = set; + context.visited = pointer_set_create (); + context.static_vars_in_set = lto_bitmap_alloc (); + context.seen_node_decls = lto_bitmap_alloc (); + + for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi)) + lto_scan_statics_in_cgraph_node (csi_node (csi), &context); + + if (i == n_sets - 1) + lto_scan_statics_in_remaining_global_vars (&context); + + bitmap_ior_into (context.all_static_vars, context.static_vars_in_set); + + pointer_set_destroy (context.visited); + lto_bitmap_free (context.static_vars_in_set); + lto_bitmap_free (context.seen_node_decls); + } + + lto_bitmap_free (context.all_vars); + lto_bitmap_free (context.all_static_vars); +} + + +/* Given a file name FNAME, return a string with FNAME prefixed with '*'. */ + +static char * +prefix_name_with_star (const char *fname) +{ + char *star_fname; + size_t len; + + len = strlen (fname) + 1 + 1; + star_fname = XNEWVEC (char, len); + snprintf (star_fname, len, "*%s", fname); + + return star_fname; +} + + +/* Return a copy of FNAME without the .o extension. */ + +static char * +strip_extension (const char *fname) +{ + char *s = XNEWVEC (char, strlen (fname) - 2 + 1); + gcc_assert (strstr (fname, ".o")); + snprintf (s, strlen (fname) - 2 + 1, "%s", fname); + + return s; +} + + +/* Return a file name associated with cgraph node set SET. This may + be a new temporary file name if SET needs to be processed by + LTRANS, or the original file name if all the nodes in SET belong to + the same input file. */ + +static char * +get_filename_for_set (cgraph_node_set set) +{ + char *fname = NULL; + static const size_t max_fname_len = 100; + + if (cgraph_node_set_needs_ltrans_p (set)) + { + /* Create a new temporary file to store SET. To facilitate + debugging, use file names from SET as part of the new + temporary file name. */ + cgraph_node_set_iterator si; + struct pointer_set_t *pset = pointer_set_create (); + for (si = csi_start (set); !csi_end_p (si); csi_next (&si)) + { + struct cgraph_node *n = csi_node (si); + const char *node_fname; + char *f; + + /* Don't use the same file name more than once. */ + if (pointer_set_insert (pset, n->local.lto_file_data)) + continue; + + /* The first file name found in SET determines the output + directory. For the remaining files, we use their + base names. */ + node_fname = n->local.lto_file_data->file_name; + if (fname == NULL) + { + fname = strip_extension (node_fname); + continue; + } + + f = strip_extension (lbasename (node_fname)); + + /* If the new name causes an excessively long file name, + make the last component "___" to indicate overflow. */ + if (strlen (fname) + strlen (f) > max_fname_len - 3) + { + fname = reconcat (fname, fname, "___", NULL); + break; + } + else + { + fname = reconcat (fname, fname, "_", f, NULL); + free (f); + } + } + + pointer_set_destroy (pset); + + /* Add the extension .wpa.o to indicate that this file has been + produced by WPA. */ + fname = reconcat (fname, fname, ".wpa.o", NULL); + gcc_assert (fname); + } + else + { + /* Since SET does not need to be processed by LTRANS, use + the original file name and mark it with a '*' prefix so that + lto_execute_ltrans knows not to process it. */ + cgraph_node_set_iterator si = csi_start (set); + struct cgraph_node *first = csi_node (si); + fname = prefix_name_with_star (first->local.lto_file_data->file_name); + } + + return fname; +} + +static lto_file *current_lto_file; + + +/* Write all output files in WPA mode. Returns a NULL-terminated array of + output file names. */ + +static char ** +lto_wpa_write_files (void) +{ + char **output_files; + unsigned i, n_sets, last_out_file_ix, num_out_files; + lto_file *file; + cgraph_node_set set; + bitmap decls; + VEC(bitmap,heap) *inlined_decls = NULL; + + timevar_push (TV_WHOPR_WPA); + + /* Include all inlined functions and determine what sets need to be + compiled by LTRANS. After this loop, only those sets that + contain callgraph nodes from more than one file will need to be + compiled by LTRANS. */ + for (i = 0; VEC_iterate (cgraph_node_set, lto_cgraph_node_sets, i, set); i++) + { + decls = lto_add_all_inlinees (set); + VEC_safe_push (bitmap, heap, inlined_decls, decls); + lto_stats.num_output_cgraph_nodes += VEC_length (cgraph_node_ptr, + set->nodes); + } + + /* After adding all inlinees, find out statics that need to be promoted + to globals because of cross-file inlining. */ + lto_promote_cross_file_statics (); + + timevar_pop (TV_WHOPR_WPA); + + timevar_push (TV_WHOPR_WPA_IO); + + /* The number of output files depends on the number of input files + and how many callgraph node sets we create. Reserve enough space + for the maximum of these two. */ + num_out_files = MAX (VEC_length (cgraph_node_set, lto_cgraph_node_sets), + num_in_fnames); + output_files = XNEWVEC (char *, num_out_files + 1); + + n_sets = VEC_length (cgraph_node_set, lto_cgraph_node_sets); + for (i = 0; i < n_sets; i++) + { + char *temp_filename; + + set = VEC_index (cgraph_node_set, lto_cgraph_node_sets, i); + temp_filename = get_filename_for_set (set); + output_files[i] = temp_filename; + + if (cgraph_node_set_needs_ltrans_p (set)) + { + /* Write all the nodes in SET to TEMP_FILENAME. */ + file = lto_elf_file_open (temp_filename, true); + if (!file) + fatal_error ("lto_elf_file_open() failed"); + + lto_set_current_out_file (file); + lto_new_extern_inline_states (); + + decls = VEC_index (bitmap, inlined_decls, i); + lto_force_functions_extern_inline (decls); + + ipa_write_summaries_of_cgraph_node_set (set); + lto_delete_extern_inline_states (); + + lto_set_current_out_file (NULL); + lto_elf_file_close (file); + } + } + + last_out_file_ix = n_sets; + + lto_stats.num_output_files += n_sets; + + output_files[last_out_file_ix] = NULL; + + for (i = 0; VEC_iterate (bitmap, inlined_decls, i, decls); i++) + lto_bitmap_free (decls); + VEC_free (bitmap, heap, inlined_decls); + + timevar_pop (TV_WHOPR_WPA_IO); + + return output_files; +} + + +/* Perform local transformations (LTRANS) on the files in the NULL-terminated + FILES array. These should have been written previously by + lto_wpa_write_files (). Transformations are performed via executing + COLLECT_GCC for reach file. */ + +static void +lto_execute_ltrans (char *const *files) +{ + struct pex_obj *pex; + const char *collect_gcc_options, *collect_gcc; + struct obstack env_obstack; + const char **argv; + const char **argv_ptr; + const char *errmsg; + size_t i, j; + int err; + int status; + FILE *ltrans_output_list_stream = NULL; + + timevar_push (TV_WHOPR_WPA_LTRANS_EXEC); + + /* Get the driver and options. */ + collect_gcc = getenv ("COLLECT_GCC"); + if (!collect_gcc) + fatal_error ("environment variable COLLECT_GCC must be set"); + + /* Set the CFLAGS environment variable. */ + collect_gcc_options = getenv ("COLLECT_GCC_OPTIONS"); + if (!collect_gcc_options) + fatal_error ("environment variable COLLECT_GCC_OPTIONS must be set"); + + /* Count arguments. */ + i = 0; + for (j = 0; collect_gcc_options[j] != '\0'; ++j) + if (collect_gcc_options[j] == '\'') + ++i; + + if (i % 2 != 0) + fatal_error ("malformed COLLECT_GCC_OPTIONS"); + + /* Initalize the arguments for the LTRANS driver. */ + argv = XNEWVEC (const char *, 8 + i / 2); + argv_ptr = argv; + *argv_ptr++ = collect_gcc; + *argv_ptr++ = "-xlto"; + for (j = 0; collect_gcc_options[j] != '\0'; ++j) + if (collect_gcc_options[j] == '\'') + { + char *option; + + ++j; + i = j; + while (collect_gcc_options[j] != '\'') + ++j; + obstack_init (&env_obstack); + obstack_grow (&env_obstack, &collect_gcc_options[i], j - i); + obstack_1grow (&env_obstack, 0); + option = XOBFINISH (&env_obstack, char *); + + /* LTRANS does not need -fwpa nor -fltrans-*. */ + if (strncmp (option, "-fwpa", 5) != 0 + && strncmp (option, "-fltrans-", 9) != 0) + *argv_ptr++ = option; + } + *argv_ptr++ = "-fltrans"; + + /* Open the LTRANS output list. */ + if (ltrans_output_list) + { + ltrans_output_list_stream = fopen (ltrans_output_list, "w"); + if (ltrans_output_list_stream == NULL) + error ("opening LTRANS output list %s: %m", ltrans_output_list); + } + + for (i = 0; files[i]; ++i) + { + size_t len; + + /* If the file is prefixed with a '*', it means that we do not + need to re-compile it with LTRANS because it has not been + modified by WPA. Skip it from the command line to + lto_execute_ltrans, but add it to ltrans_output_list_stream + so it is linked after we are done. */ + if (files[i][0] == '*') + { + size_t len = strlen (files[i]) - 1; + if (ltrans_output_list_stream) + if (fwrite (&files[i][1], 1, len, ltrans_output_list_stream) < len + || fwrite ("\n", 1, 1, ltrans_output_list_stream) < 1) + error ("writing to LTRANS output list %s: %m", + ltrans_output_list); + } + else + { + char *output_name; + + /* Otherwise, add FILES[I] to lto_execute_ltrans command line + and add the resulting file to LTRANS output list. */ + + /* Replace the .o suffix with a .ltrans.o suffix and write + the resulting name to the LTRANS output list. */ + obstack_init (&env_obstack); + obstack_grow (&env_obstack, files[i], strlen (files[i]) - 2); + obstack_grow (&env_obstack, ".ltrans.o", sizeof (".ltrans.o")); + output_name = XOBFINISH (&env_obstack, char *); + if (ltrans_output_list_stream) + { + len = strlen (output_name); + + if (fwrite (output_name, 1, len, ltrans_output_list_stream) < len + || fwrite ("\n", 1, 1, ltrans_output_list_stream) < 1) + error ("writing to LTRANS output list %s: %m", + ltrans_output_list); + } + + argv_ptr[0] = "-o"; + argv_ptr[1] = output_name; + argv_ptr[2] = files[i]; + argv_ptr[3] = NULL; + + /* Execute the driver. */ + pex = pex_init (0, "lto1", NULL); + if (pex == NULL) + fatal_error ("pex_init failed: %s", xstrerror (errno)); + + errmsg = pex_run (pex, PEX_LAST | PEX_SEARCH, argv[0], + CONST_CAST (char **, argv), NULL, NULL, &err); + if (errmsg) + fatal_error ("%s: %s", errmsg, xstrerror (err)); + + if (!pex_get_status (pex, 1, &status)) + fatal_error ("can't get program status: %s", xstrerror (errno)); + + if (status) + { + if (WIFSIGNALED (status)) + { + int sig = WTERMSIG (status); + fatal_error ("%s terminated with signal %d [%s]%s", + argv[0], sig, strsignal (sig), + WCOREDUMP (status) ? ", core dumped" : ""); + } + else + fatal_error ("%s terminated with status %d", argv[0], status); + } + + pex_free (pex); + } + } + + /* Close the LTRANS output list. */ + if (ltrans_output_list_stream && fclose (ltrans_output_list_stream)) + error ("closing LTRANS output list %s: %m", ltrans_output_list); + + obstack_free (&env_obstack, NULL); + free (argv); + + timevar_pop (TV_WHOPR_WPA_LTRANS_EXEC); +} + + +typedef struct { + struct pointer_set_t *free_list; + struct pointer_set_t *seen; +} lto_fixup_data_t; + +#define LTO_FIXUP_SUBTREE(t) \ + do \ + walk_tree (&(t), lto_fixup_tree, data, NULL); \ + while (0) + +#define LTO_REGISTER_TYPE_AND_FIXUP_SUBTREE(t) \ + do \ + { \ + if (t) \ + (t) = gimple_register_type (t); \ + walk_tree (&(t), lto_fixup_tree, data, NULL); \ + } \ + while (0) + +static tree lto_fixup_tree (tree *, int *, void *); + +/* Return true if T does not need to be fixed up recursively. */ + +static inline bool +no_fixup_p (tree t) +{ + return (t == NULL + || CONSTANT_CLASS_P (t) + || TREE_CODE (t) == IDENTIFIER_NODE); +} + +/* Fix up fields of a tree_common T. DATA points to fix-up states. */ + +static void +lto_fixup_common (tree t, void *data) +{ + /* The following re-creates the TYPE_REFERENCE_TO and TYPE_POINTER_TO + lists. We do not stream TYPE_REFERENCE_TO, TYPE_POINTER_TO or + TYPE_NEXT_PTR_TO and TYPE_NEXT_REF_TO. + First remove us from any pointer list we are on. */ + if (TREE_CODE (t) == POINTER_TYPE) + { + if (TYPE_POINTER_TO (TREE_TYPE (t)) == t) + TYPE_POINTER_TO (TREE_TYPE (t)) = TYPE_NEXT_PTR_TO (t); + else + { + tree tem = TYPE_POINTER_TO (TREE_TYPE (t)); + while (tem && TYPE_NEXT_PTR_TO (tem) != t) + tem = TYPE_NEXT_PTR_TO (tem); + if (tem) + TYPE_NEXT_PTR_TO (tem) = TYPE_NEXT_PTR_TO (t); + } + TYPE_NEXT_PTR_TO (t) = NULL_TREE; + } + else if (TREE_CODE (t) == REFERENCE_TYPE) + { + if (TYPE_REFERENCE_TO (TREE_TYPE (t)) == t) + TYPE_REFERENCE_TO (TREE_TYPE (t)) = TYPE_NEXT_REF_TO (t); + else + { + tree tem = TYPE_REFERENCE_TO (TREE_TYPE (t)); + while (tem && TYPE_NEXT_REF_TO (tem) != t) + tem = TYPE_NEXT_REF_TO (tem); + if (tem) + TYPE_NEXT_REF_TO (tem) = TYPE_NEXT_REF_TO (t); + } + TYPE_NEXT_REF_TO (t) = NULL_TREE; + } + + /* Fixup our type. */ + LTO_REGISTER_TYPE_AND_FIXUP_SUBTREE (TREE_TYPE (t)); + + /* Second put us on the list of pointers of the new pointed-to type + if we are a main variant. This is done in lto_fixup_type after + fixing up our main variant. */ + + /* This is not very efficient because we cannot do tail-recursion with + a long chain of trees. */ + LTO_FIXUP_SUBTREE (TREE_CHAIN (t)); +} + +/* Fix up fields of a decl_minimal T. DATA points to fix-up states. */ + +static void +lto_fixup_decl_minimal (tree t, void *data) +{ + lto_fixup_common (t, data); + LTO_FIXUP_SUBTREE (DECL_NAME (t)); + LTO_FIXUP_SUBTREE (DECL_CONTEXT (t)); +} + +/* Fix up fields of a decl_common T. DATA points to fix-up states. */ + +static void +lto_fixup_decl_common (tree t, void *data) +{ + lto_fixup_decl_minimal (t, data); + LTO_FIXUP_SUBTREE (DECL_SIZE (t)); + LTO_FIXUP_SUBTREE (DECL_SIZE_UNIT (t)); + LTO_FIXUP_SUBTREE (DECL_INITIAL (t)); + LTO_FIXUP_SUBTREE (DECL_ATTRIBUTES (t)); + LTO_FIXUP_SUBTREE (DECL_ABSTRACT_ORIGIN (t)); +} + +/* Fix up fields of a decl_with_vis T. DATA points to fix-up states. */ + +static void +lto_fixup_decl_with_vis (tree t, void *data) +{ + lto_fixup_decl_common (t, data); + + /* Accessor macro has side-effects, use field-name here. */ + LTO_FIXUP_SUBTREE (t->decl_with_vis.assembler_name); + + gcc_assert (no_fixup_p (DECL_SECTION_NAME (t))); +} + +/* Fix up fields of a decl_non_common T. DATA points to fix-up states. */ + +static void +lto_fixup_decl_non_common (tree t, void *data) +{ + lto_fixup_decl_with_vis (t, data); + LTO_FIXUP_SUBTREE (DECL_ARGUMENT_FLD (t)); + LTO_FIXUP_SUBTREE (DECL_RESULT_FLD (t)); + LTO_FIXUP_SUBTREE (DECL_VINDEX (t)); + + /* SAVED_TREE should not cleared by now. Also no accessor for base type. */ + gcc_assert (no_fixup_p (t->decl_non_common.saved_tree)); +} + +/* Fix up fields of a decl_non_common T. DATA points to fix-up states. */ + +static void +lto_fixup_function (tree t, void *data) +{ + lto_fixup_decl_non_common (t, data); + LTO_FIXUP_SUBTREE (DECL_FUNCTION_PERSONALITY (t)); +} + +/* Fix up fields of a field_decl T. DATA points to fix-up states. */ + +static void +lto_fixup_field_decl (tree t, void *data) +{ + lto_fixup_decl_common (t, data); + gcc_assert (no_fixup_p (DECL_FIELD_OFFSET (t))); + LTO_FIXUP_SUBTREE (DECL_BIT_FIELD_TYPE (t)); + LTO_FIXUP_SUBTREE (DECL_QUALIFIER (t)); + gcc_assert (no_fixup_p (DECL_FIELD_BIT_OFFSET (t))); + LTO_FIXUP_SUBTREE (DECL_FCONTEXT (t)); +} + +/* Fix up fields of a type T. DATA points to fix-up states. */ + +static void +lto_fixup_type (tree t, void *data) +{ + tree tem, mv; + + lto_fixup_common (t, data); + LTO_FIXUP_SUBTREE (TYPE_CACHED_VALUES (t)); + LTO_FIXUP_SUBTREE (TYPE_SIZE (t)); + LTO_FIXUP_SUBTREE (TYPE_SIZE_UNIT (t)); + LTO_FIXUP_SUBTREE (TYPE_ATTRIBUTES (t)); + LTO_FIXUP_SUBTREE (TYPE_NAME (t)); + + /* Accessors are for derived node types only. */ + if (!POINTER_TYPE_P (t)) + LTO_FIXUP_SUBTREE (t->type.minval); + LTO_FIXUP_SUBTREE (t->type.maxval); + + /* Accessor is for derived node types only. */ + LTO_FIXUP_SUBTREE (t->type.binfo); + + LTO_REGISTER_TYPE_AND_FIXUP_SUBTREE (TYPE_CONTEXT (t)); + LTO_REGISTER_TYPE_AND_FIXUP_SUBTREE (TYPE_CANONICAL (t)); + + /* The following re-creates proper variant lists while fixing up + the variant leaders. We do not stream TYPE_NEXT_VARIANT so the + variant list state before fixup is broken. */ + + /* Remove us from our main variant list if we are not the variant leader. */ + if (TYPE_MAIN_VARIANT (t) != t) + { + tem = TYPE_MAIN_VARIANT (t); + while (tem && TYPE_NEXT_VARIANT (tem) != t) + tem = TYPE_NEXT_VARIANT (tem); + if (tem) + TYPE_NEXT_VARIANT (tem) = TYPE_NEXT_VARIANT (t); + TYPE_NEXT_VARIANT (t) = NULL_TREE; + } + + /* Query our new main variant. */ + mv = gimple_register_type (TYPE_MAIN_VARIANT (t)); + + /* If we were the variant leader and we get replaced ourselves drop + all variants from our list. */ + if (TYPE_MAIN_VARIANT (t) == t + && mv != t) + { + tem = t; + while (tem) + { + tree tem2 = TYPE_NEXT_VARIANT (tem); + TYPE_NEXT_VARIANT (tem) = NULL_TREE; + tem = tem2; + } + } + + /* If we are not our own variant leader link us into our new leaders + variant list. */ + if (mv != t) + { + TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (mv); + TYPE_NEXT_VARIANT (mv) = t; + } + + /* Finally adjust our main variant and fix it up. */ + TYPE_MAIN_VARIANT (t) = mv; + LTO_FIXUP_SUBTREE (TYPE_MAIN_VARIANT (t)); + + /* As the second step of reconstructing the pointer chains put us + on the list of pointers of the new pointed-to type + if we are a main variant. See lto_fixup_common for the first step. */ + if (TREE_CODE (t) == POINTER_TYPE + && TYPE_MAIN_VARIANT (t) == t) + { + TYPE_NEXT_PTR_TO (t) = TYPE_POINTER_TO (TREE_TYPE (t)); + TYPE_POINTER_TO (TREE_TYPE (t)) = t; + } + else if (TREE_CODE (t) == REFERENCE_TYPE + && TYPE_MAIN_VARIANT (t) == t) + { + TYPE_NEXT_REF_TO (t) = TYPE_REFERENCE_TO (TREE_TYPE (t)); + TYPE_REFERENCE_TO (TREE_TYPE (t)) = t; + } +} + +/* Fix up fields of a BINFO T. DATA points to fix-up states. */ + +static void +lto_fixup_binfo (tree t, void *data) +{ + unsigned HOST_WIDE_INT i, n; + tree base, saved_base; + + lto_fixup_common (t, data); + gcc_assert (no_fixup_p (BINFO_OFFSET (t))); + LTO_FIXUP_SUBTREE (BINFO_VTABLE (t)); + LTO_FIXUP_SUBTREE (BINFO_VIRTUALS (t)); + LTO_FIXUP_SUBTREE (BINFO_VPTR_FIELD (t)); + n = VEC_length (tree, BINFO_BASE_ACCESSES (t)); + for (i = 0; i < n; i++) + { + saved_base = base = BINFO_BASE_ACCESS (t, i); + LTO_FIXUP_SUBTREE (base); + if (base != saved_base) + VEC_replace (tree, BINFO_BASE_ACCESSES (t), i, base); + } + LTO_FIXUP_SUBTREE (BINFO_INHERITANCE_CHAIN (t)); + LTO_FIXUP_SUBTREE (BINFO_SUBVTT_INDEX (t)); + LTO_FIXUP_SUBTREE (BINFO_VPTR_INDEX (t)); + n = BINFO_N_BASE_BINFOS (t); + for (i = 0; i < n; i++) + { + saved_base = base = BINFO_BASE_BINFO (t, i); + LTO_FIXUP_SUBTREE (base); + if (base != saved_base) + VEC_replace (tree, BINFO_BASE_BINFOS (t), i, base); + } +} + +/* Fix up fields of a CONSTRUCTOR T. DATA points to fix-up states. */ + +static void +lto_fixup_constructor (tree t, void *data) +{ + unsigned HOST_WIDE_INT idx; + constructor_elt *ce; + + LTO_REGISTER_TYPE_AND_FIXUP_SUBTREE (TREE_TYPE (t)); + + for (idx = 0; + VEC_iterate(constructor_elt, CONSTRUCTOR_ELTS (t), idx, ce); + idx++) + { + LTO_FIXUP_SUBTREE (ce->index); + LTO_FIXUP_SUBTREE (ce->value); + } +} + +/* A walk_tree callback used by lto_fixup_state. TP is the pointer to the + current tree. WALK_SUBTREES indicates if the subtrees will be walked. + DATA is a pointer set to record visited nodes. */ + +static tree +lto_fixup_tree (tree *tp, int *walk_subtrees, void *data) +{ + tree t; + lto_fixup_data_t *fixup_data = (lto_fixup_data_t *) data; + tree prevailing; + + t = *tp; + *walk_subtrees = 0; + if (pointer_set_contains (fixup_data->seen, t)) + return NULL; + + if (TREE_CODE (t) == VAR_DECL || TREE_CODE (t) == FUNCTION_DECL) + { + prevailing = lto_symtab_prevailing_decl (t); + + if (t != prevailing) + { + if (TREE_CODE (t) == FUNCTION_DECL + && TREE_NOTHROW (prevailing) != TREE_NOTHROW (t)) + { + /* If the prevailing definition does not throw but the + declaration (T) was considered throwing, then we + simply add PREVAILING to the list of throwing + functions. However, if the opposite is true, then + the call to PREVAILING was generated assuming that + the function didn't throw, which means that CFG + cleanup may have removed surrounding try/catch + regions. + + Note that we currently accept these cases even when + they occur within a single file. It's certainly a + user error, but we silently allow the compiler to + remove surrounding try/catch regions. Perhaps we + could emit a warning here, instead of silently + accepting the conflicting declaration. */ + if (TREE_NOTHROW (prevailing)) + lto_mark_nothrow_fndecl (prevailing); + } + + pointer_set_insert (fixup_data->free_list, t); + + /* Also replace t with prevailing defintion. We don't want to + insert the other defintion in the seen set as we want to + replace all instances of it. */ + *tp = prevailing; + t = prevailing; + } + } + else if (TYPE_P (t)) + { + /* Replace t with the prevailing type. We don't want to insert the + other type in the seen set as we want to replace all instances of it. */ + t = gimple_register_type (t); + *tp = t; + } + + if (pointer_set_insert (fixup_data->seen, t)) + return NULL; + + /* walk_tree does not visit all reachable nodes that need to be fixed up. + Hence we do special processing here for those kind of nodes. */ + switch (TREE_CODE (t)) + { + case FIELD_DECL: + lto_fixup_field_decl (t, data); + break; + + case LABEL_DECL: + case CONST_DECL: + case PARM_DECL: + case RESULT_DECL: + case IMPORTED_DECL: + lto_fixup_decl_common (t, data); + break; + + case VAR_DECL: + lto_fixup_decl_with_vis (t, data); + break; + + case TYPE_DECL: + lto_fixup_decl_non_common (t, data); + break; + + case FUNCTION_DECL: + lto_fixup_function (t, data); + break; + + case TREE_BINFO: + lto_fixup_binfo (t, data); + break; + + default: + if (TYPE_P (t)) + lto_fixup_type (t, data); + else if (TREE_CODE (t) == CONSTRUCTOR) + lto_fixup_constructor (t, data); + else if (CONSTANT_CLASS_P (t)) + LTO_REGISTER_TYPE_AND_FIXUP_SUBTREE (TREE_TYPE (t)); + else if (EXPR_P (t)) + { + /* walk_tree only handles TREE_OPERANDs. Do the rest here. */ + lto_fixup_common (t, data); + LTO_FIXUP_SUBTREE (t->exp.block); + *walk_subtrees = 1; + } + else + { + /* Let walk_tree handle sub-trees. */ + *walk_subtrees = 1; + } + } + + return NULL; +} + +/* Helper function of lto_fixup_decls. Walks the var and fn streams in STATE, + replaces var and function decls with the corresponding prevailing def and + records the old decl in the free-list in DATA. We also record visted nodes + in the seen-set in DATA to avoid multiple visit for nodes that need not + to be replaced. */ + +static void +lto_fixup_state (struct lto_in_decl_state *state, lto_fixup_data_t *data) +{ + unsigned i, si; + struct lto_tree_ref_table *table; + + /* Although we only want to replace FUNCTION_DECLs and VAR_DECLs, + we still need to walk from all DECLs to find the reachable + FUNCTION_DECLs and VAR_DECLs. */ + for (si = 0; si < LTO_N_DECL_STREAMS; si++) + { + table = &state->streams[si]; + for (i = 0; i < table->size; i++) + walk_tree (table->trees + i, lto_fixup_tree, data, NULL); + } +} + +/* A callback of htab_traverse. Just extract a state from SLOT and the + lto_fixup_data_t object from AUX and calls lto_fixup_state. */ + +static int +lto_fixup_state_aux (void **slot, void *aux) +{ + struct lto_in_decl_state *state = (struct lto_in_decl_state *) *slot; + lto_fixup_state (state, (lto_fixup_data_t *) aux); + return 1; +} + +/* A callback to pointer_set_traverse. Frees the tree pointed by p. Removes + from it from the UID -> DECL mapping. */ + +static bool +free_decl (const void *p, void *data ATTRIBUTE_UNUSED) +{ + const_tree ct = (const_tree) p; + tree t = CONST_CAST_TREE (ct); + + lto_symtab_clear_resolution (t); + + return true; +} + +/* Fix the decls from all FILES. Replaces each decl with the corresponding + prevailing one. */ + +static void +lto_fixup_decls (struct lto_file_decl_data **files) +{ + unsigned int i; + tree decl; + struct pointer_set_t *free_list = pointer_set_create (); + struct pointer_set_t *seen = pointer_set_create (); + lto_fixup_data_t data; + + data.free_list = free_list; + data.seen = seen; + for (i = 0; files[i]; i++) + { + struct lto_file_decl_data *file = files[i]; + struct lto_in_decl_state *state = file->global_decl_state; + lto_fixup_state (state, &data); + + htab_traverse (file->function_decl_states, lto_fixup_state_aux, &data); + } + + for (i = 0; VEC_iterate (tree, lto_global_var_decls, i, decl); i++) + { + tree saved_decl = decl; + walk_tree (&decl, lto_fixup_tree, &data, NULL); + if (decl != saved_decl) + VEC_replace (tree, lto_global_var_decls, i, decl); + } + + pointer_set_traverse (free_list, free_decl, NULL); + pointer_set_destroy (free_list); + pointer_set_destroy (seen); +} + +/* Unlink a temporary LTRANS file unless requested otherwise. */ + +static void +lto_maybe_unlink (const char *file) +{ + if (!getenv ("WPA_SAVE_LTRANS")) + { + if (unlink_if_ordinary (file)) + error ("deleting LTRANS input file %s: %m", file); + } + else + fprintf (stderr, "[Leaving LTRANS input file %s]\n", file); +} + +/* Read the options saved from each file in the command line. Called + from lang_hooks.post_options which is called by process_options + right before all the options are used to initialize the compiler. + This assumes that decode_options has already run, so the + num_in_fnames and in_fnames are properly set. + + Note that this assumes that all the files had been compiled with + the same options, which is not a good assumption. In general, + options ought to be read from all the files in the set and merged. + However, it is still unclear what the merge rules should be. */ + +void +lto_read_all_file_options (void) +{ + size_t i; + + /* Clear any file options currently saved. */ + lto_clear_file_options (); + + /* Set the hooks to read ELF sections. */ + lto_set_in_hooks (NULL, get_section_data, free_section_data); + + for (i = 0; i < num_in_fnames; i++) + { + struct lto_file_decl_data *file_data; + lto_file *file = lto_elf_file_open (in_fnames[i], false); + if (!file) + break; + + file_data = XCNEW (struct lto_file_decl_data); + file_data->file_name = file->filename; + file_data->fd = -1; + file_data->section_hash_table = lto_elf_build_section_table (file); + + lto_read_file_options (file_data); + + lto_elf_file_close (file); + htab_delete (file_data->section_hash_table); + if (file_data->fd != -1) + close (file_data->fd); + free (file_data); + } + + /* Apply globally the options read from all the files. */ + lto_reissue_options (); +} + + +/* Read all the symbols from the input files FNAMES. NFILES is the + number of files requested in the command line. Instantiate a + global call graph by aggregating all the sub-graphs found in each + file. */ + +static void +read_cgraph_and_symbols (unsigned nfiles, const char **fnames) +{ + unsigned int i, last_file_ix; + struct lto_file_decl_data **all_file_decl_data; + FILE *resolution; + + lto_stats.num_input_files = nfiles; + + timevar_push (TV_IPA_LTO_DECL_IO); + + /* Set the hooks so that all of the ipa passes can read in their data. */ + all_file_decl_data = XNEWVEC (struct lto_file_decl_data *, nfiles + 1); + lto_set_in_hooks (all_file_decl_data, get_section_data, free_section_data); + + /* Read the resolution file. */ + resolution = NULL; + if (resolution_file_name) + { + int t; + unsigned num_objects; + + resolution = fopen (resolution_file_name, "r"); + gcc_assert (resolution != NULL); + t = fscanf (resolution, "%u", &num_objects); + gcc_assert (t == 1); + + /* True, since the plugin splits the archives. */ + gcc_assert (num_objects == nfiles); + } + + /* Read all of the object files specified on the command line. */ + for (i = 0, last_file_ix = 0; i < nfiles; ++i) + { + struct lto_file_decl_data *file_data = NULL; + + current_lto_file = lto_elf_file_open (fnames[i], false); + if (!current_lto_file) + break; + + file_data = lto_file_read (current_lto_file, resolution); + if (!file_data) + break; + + all_file_decl_data[last_file_ix++] = file_data; + + lto_elf_file_close (current_lto_file); + current_lto_file = NULL; + } + + if (resolution_file_name) + fclose (resolution); + + all_file_decl_data[last_file_ix] = NULL; + + /* Set the hooks so that all of the ipa passes can read in their data. */ + lto_set_in_hooks (all_file_decl_data, get_section_data, free_section_data); + + /* Each pass will set the appropriate timer. */ + timevar_pop (TV_IPA_LTO_DECL_IO); + + /* Read the callgraph. */ + input_cgraph (); + + ipa_read_summaries (); + + timevar_push (TV_IPA_LTO_DECL_IO); + + lto_fixup_decls (all_file_decl_data); + + /* See if we have multiple decls for a symbol and choose the largest + one to generate the common. */ + for (i = 0; i < VEC_length (tree, lto_global_var_decls); ++i) + { + tree decl = VEC_index (tree, lto_global_var_decls, i); + tree prev_decl = NULL_TREE; + tree size; + + if (TREE_CODE (decl) != VAR_DECL + || !DECL_LANG_SPECIFIC (decl)) + continue; + + /* Find the preceeding decl of the largest one. */ + size = DECL_SIZE (decl); + do + { + tree next = (tree) DECL_LANG_SPECIFIC (decl); + if (tree_int_cst_lt (size, DECL_SIZE (next))) + { + size = DECL_SIZE (next); + prev_decl = decl; + } + decl = next; + } + while (DECL_LANG_SPECIFIC (decl)); + + /* If necessary move the largest decl to the front of the + chain. */ + if (prev_decl != NULL_TREE) + { + decl = (tree) DECL_LANG_SPECIFIC (prev_decl); + DECL_LANG_SPECIFIC (prev_decl) = DECL_LANG_SPECIFIC (decl); + DECL_LANG_SPECIFIC (decl) + = (struct lang_decl *) VEC_index (tree, lto_global_var_decls, i); + VEC_replace (tree, lto_global_var_decls, i, decl); + } + + /* Mark everything apart from the first var as written out and + unlink the chain. */ + decl = VEC_index (tree, lto_global_var_decls, i); + while (DECL_LANG_SPECIFIC (decl)) + { + tree next = (tree) DECL_LANG_SPECIFIC (decl); + DECL_LANG_SPECIFIC (decl) = NULL; + decl = next; + TREE_ASM_WRITTEN (decl) = true; + } + } + + /* FIXME lto. This loop needs to be changed to use the pass manager to + call the ipa passes directly. */ + if (!errorcount) + for (i = 0; i < last_file_ix; i++) + { + struct lto_file_decl_data *file_data = all_file_decl_data [i]; + lto_materialize_constructors_and_inits (file_data); + } + + /* Indicate that the cgraph is built and ready. */ + cgraph_function_flags_ready = true; + + timevar_pop (TV_IPA_LTO_DECL_IO); +} + + +/* Materialize all the bodies for all the nodes in the callgraph. */ + +static void +materialize_cgraph (void) +{ + tree decl; + struct cgraph_node *node; + unsigned i; + timevar_id_t lto_timer; + + /* Now that we have input the cgraph, we need to clear all of the aux + nodes and read the functions if we are not running in WPA mode. */ + timevar_push (TV_IPA_LTO_GIMPLE_IO); + + for (node = cgraph_nodes; node; node = node->next) + { + /* Some cgraph nodes get created on the fly, and they don't need + to be materialized. For instance, nodes for nested functions + where the parent function was not streamed out or builtin + functions. Additionally, builtin functions should not be + materialized and may, in fact, cause confusion because there + may be a regular function in the file whose assembler name + matches that of the function. + See gcc.c-torture/execute/20030125-1.c and + gcc.c-torture/execute/921215-1.c. */ + if (node->local.lto_file_data + && !DECL_IS_BUILTIN (node->decl)) + { + lto_materialize_function (node); + lto_stats.num_input_cgraph_nodes++; + } + } + + timevar_pop (TV_IPA_LTO_GIMPLE_IO); + + /* Start the appropriate timer depending on the mode that we are + operating in. */ + lto_timer = (flag_wpa) ? TV_WHOPR_WPA + : (flag_ltrans) ? TV_WHOPR_LTRANS + : TV_LTO; + timevar_push (lto_timer); + + current_function_decl = NULL; + set_cfun (NULL); + + /* Inform the middle end about the global variables we have seen. */ + for (i = 0; VEC_iterate (tree, lto_global_var_decls, i, decl); i++) + rest_of_decl_compilation (decl, 1, 0); + + /* Fix up any calls to DECLs that have become not exception throwing. */ + lto_fixup_nothrow_decls (); + + timevar_pop (lto_timer); +} + + +/* Perform whole program analysis (WPA) on the callgraph and write out the + optimization plan. */ + +static void +do_whole_program_analysis (void) +{ + char **output_files; + size_t i; + struct cgraph_node *node; + + lto_1_to_1_map (); + + /* Note that since we are in WPA mode, materialize_cgraph will not + actually read in all the function bodies. It only materializes + the decls and cgraph nodes so that analysis can be performed. */ + materialize_cgraph (); + + /* Reading in the cgraph uses different timers, start timing WPA now. */ + timevar_push (TV_WHOPR_WPA); + + /* FIXME lto. Hack. We should use the IPA passes. There are a + number of issues with this now. 1. There is no convenient way to + do this. 2. Some passes may depend on properties that requires + the function bodies to compute. */ + cgraph_function_flags_ready = true; + bitmap_obstack_initialize (NULL); + ipa_register_cgraph_hooks (); + + /* Reset inlining information before running IPA inliner. */ + for (node = cgraph_nodes; node; node = node->next) + reset_inline_failed (node); + + /* FIXME lto. We should not call this function directly. */ + pass_ipa_inline.pass.execute (); + + verify_cgraph (); + bitmap_obstack_release (NULL); + + /* We are about to launch the final LTRANS phase, stop the WPA timer. */ + timevar_pop (TV_WHOPR_WPA); + + output_files = lto_wpa_write_files (); + + /* Show the LTO report before launching LTRANS. */ + if (flag_lto_report) + print_lto_report (); + + lto_execute_ltrans (output_files); + + for (i = 0; output_files[i]; ++i) + { + if (output_files[i][0] != '*') + lto_maybe_unlink (output_files[i]); + + free (output_files[i]); + } + + XDELETEVEC (output_files); +} + + +/* Main entry point for the GIMPLE front end. This front end has + three main personalities: + + - LTO (-flto). All the object files on the command line are + loaded in memory and processed as a single translation unit. + This is the traditional link-time optimization behavior. + + - WPA (-fwpa). Only the callgraph and summary information for + files in the command file are loaded. A single callgraph + (without function bodies) is instantiated for the whole set of + files. IPA passes are only allowed to analyze the call graph + and make transformation decisions. The callgraph is + partitioned, each partition is written to a new object file + together with the transformation decisions. + + - LTRANS (-fltrans). Similar to -flto but it prevents the IPA + summary files from running again. Since WPA computed summary + information and decided what transformations to apply, LTRANS + simply applies them. */ + +void +lto_main (int debug_p ATTRIBUTE_UNUSED) +{ + lto_init_reader (); + + /* Read all the symbols and call graph from all the files in the + command line. */ + read_cgraph_and_symbols (num_in_fnames, in_fnames); + + if (!errorcount) + { + /* If WPA is enabled analyze the whole call graph and create an + optimization plan. Otherwise, read in all the function + bodies and continue with optimization. */ + if (flag_wpa) + do_whole_program_analysis (); + else + { + materialize_cgraph (); + + /* Let the middle end know that we have read and merged all of + the input files. */ + cgraph_optimize (); + + /* FIXME lto, if the processes spawned by WPA fail, we miss + the chance to print WPA's report, so WPA will call + print_lto_report before launching LTRANS. If LTRANS was + launched directly by the driver we would not need to do + this. */ + if (flag_lto_report) + print_lto_report (); + } + } +} + +#include "gt-lto-lto.h" diff --git a/gcc/lto/lto.h b/gcc/lto/lto.h new file mode 100644 index 00000000000..cdd1e06de93 --- /dev/null +++ b/gcc/lto/lto.h @@ -0,0 +1,60 @@ +/* LTO declarations. + Copyright 2009 Free Software Foundation, Inc. + Contributed by CodeSourcery, Inc. + +This file is part of GCC. + +GCC 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. + +GCC 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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef LTO_H +#define LTO_H + +#include "hashtab.h" + +/* A file. */ +typedef struct lto_file_struct +{ + /* The name of the file. */ + const char *filename; +} lto_file; + +/* In lto-lang.c */ +extern const char *resolution_file_name; + +/* In lto.c */ +extern void lto_main (int); +extern void lto_read_all_file_options (void); + +/* In lto-elf.c */ +extern lto_file *lto_elf_file_open (const char *filename, bool writable); +extern void lto_elf_file_close (lto_file *file); +extern htab_t lto_elf_build_section_table (lto_file *file); +extern void lto_elf_begin_section (const char *name); +extern void lto_elf_append_data (const void *data, size_t len, void *block); +extern void lto_elf_end_section (void); +extern lto_file *lto_set_current_out_file (lto_file *file); +extern lto_file *lto_get_current_out_file (void); + +/* Hash table entry to hold the start offset and length of an LTO + section in a .o file. */ +struct lto_section_slot +{ + const char *name; + intptr_t start; + size_t len; +}; + + +#endif /* LTO_H */ diff --git a/gcc/opts.c b/gcc/opts.c index 878635f8ca3..fee1c6b3065 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -44,6 +44,7 @@ along with GCC; see the file COPYING3. If not see #include "debug.h" #include "plugin.h" #include "except.h" +#include "lto-streamer.h" /* Value of the -G xx switch, and whether it was passed or not. */ unsigned HOST_WIDE_INT g_switch_value; @@ -432,6 +433,17 @@ complain_wrong_lang (const char *text, const struct cl_option *option, { char *ok_langs, *bad_lang; + /* The LTO front end inherits all the options from the first front + end that was used. However, not all the original front end + options make sense in LTO. + + A real solution would be to filter this in collect2, but collect2 + does not have access to all the option attributes to know what to + filter. So, in lto1 we silently accept inherited flags and do + nothing about it. */ + if (lang_mask & CL_LTO) + return; + ok_langs = write_langs (option->flags); bad_lang = write_langs (lang_mask); @@ -626,16 +638,28 @@ handle_option (const char **argv, unsigned int lang_mask) } if (option->flags & lang_mask) - if (lang_hooks.handle_option (opt_index, arg, value) == 0) - result = 0; + { + if (lang_hooks.handle_option (opt_index, arg, value) == 0) + result = 0; + else + lto_register_user_option (opt_index, arg, value, lang_mask); + } if (result && (option->flags & CL_COMMON)) - if (common_handle_option (opt_index, arg, value, lang_mask) == 0) - result = 0; + { + if (common_handle_option (opt_index, arg, value, lang_mask) == 0) + result = 0; + else + lto_register_user_option (opt_index, arg, value, CL_COMMON); + } if (result && (option->flags & CL_TARGET)) - if (!targetm.handle_option (opt_index, arg, value)) - result = 0; + { + if (!targetm.handle_option (opt_index, arg, value)) + result = 0; + else + lto_register_user_option (opt_index, arg, value, CL_TARGET); + } done: if (dup) @@ -958,6 +982,9 @@ decode_options (unsigned int argc, const char **argv) flag_unwind_tables = targetm.unwind_tables_default; } + /* Clear any options currently held for LTO. */ + lto_clear_user_options (); + #ifdef OPTIMIZATION_OPTIONS /* Allow default optimizations to be specified on a per-machine basis. */ OPTIMIZATION_OPTIONS (optimize, optimize_size); diff --git a/gcc/passes.c b/gcc/passes.c index 5b91698e179..e3fd7a8454d 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -84,6 +84,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-dump.h" #include "df.h" #include "predict.h" +#include "lto-streamer.h" #if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO) #include "dwarf2out.h" @@ -331,7 +332,8 @@ struct rtl_opt_pass pass_postreload = /* The root of the compilation pass tree, once constructed. */ -struct opt_pass *all_passes, *all_ipa_passes, *all_lowering_passes; +struct opt_pass *all_passes, *all_small_ipa_passes, *all_lowering_passes, + *all_regular_ipa_passes, *all_lto_gen_passes; /* A map from static pass id to optimization pass. */ struct opt_pass **passes_by_id; @@ -611,7 +613,9 @@ register_pass (struct register_pass_info *pass_info) /* Try to insert the new pass to the pass lists. We need to check all three lists as the reference pass could be in one (or all) of them. */ if (!position_pass (pass_info, &all_lowering_passes) - && !position_pass (pass_info, &all_ipa_passes) + && !position_pass (pass_info, &all_small_ipa_passes) + && !position_pass (pass_info, &all_regular_ipa_passes) + && !position_pass (pass_info, &all_lto_gen_passes) && !position_pass (pass_info, &all_passes)) gcc_unreachable (); else @@ -658,7 +662,7 @@ register_pass (struct register_pass_info *pass_info) If we are optimizing, cgraph_optimize is then invoked: cgraph_optimize () - ipa_passes () -> all_ipa_passes + ipa_passes () -> all_small_ipa_passes cgraph_expand_all_functions () for each node N in the cgraph cgraph_expand_function (N) @@ -694,7 +698,7 @@ init_optimization_passes (void) *p = NULL; /* Interprocedural optimization passes. */ - p = &all_ipa_passes; + p = &all_small_ipa_passes; NEXT_PASS (pass_ipa_function_and_variable_visibility); NEXT_PASS (pass_ipa_early_inline); { @@ -716,11 +720,16 @@ init_optimization_passes (void) NEXT_PASS (pass_referenced_vars); NEXT_PASS (pass_build_ssa); NEXT_PASS (pass_early_warn_uninitialized); + /* Note that it is not strictly necessary to schedule an early + inline pass here. However, some test cases (e.g., + g++.dg/other/p334435.C g++.dg/other/i386-1.C) expect extern + inline functions to be inlined even at -O0. This does not + happen during the first early inline pass. */ + NEXT_PASS (pass_rebuild_cgraph_edges); + NEXT_PASS (pass_early_inline); NEXT_PASS (pass_all_early_optimizations); { struct opt_pass **p = &pass_all_early_optimizations.pass.sub; - NEXT_PASS (pass_rebuild_cgraph_edges); - NEXT_PASS (pass_early_inline); NEXT_PASS (pass_remove_cgraph_callee_edges); NEXT_PASS (pass_rename_ssa_copies); NEXT_PASS (pass_ccp); @@ -747,13 +756,22 @@ init_optimization_passes (void) } NEXT_PASS (pass_ipa_increase_alignment); NEXT_PASS (pass_ipa_matrix_reorg); + *p = NULL; + + p = &all_regular_ipa_passes; NEXT_PASS (pass_ipa_cp); NEXT_PASS (pass_ipa_inline); NEXT_PASS (pass_ipa_reference); NEXT_PASS (pass_ipa_pure_const); NEXT_PASS (pass_ipa_type_escape); NEXT_PASS (pass_ipa_pta); - NEXT_PASS (pass_ipa_struct_reorg); + NEXT_PASS (pass_ipa_struct_reorg); + *p = NULL; + + p = &all_lto_gen_passes; + NEXT_PASS (pass_ipa_lto_gimple_out); + NEXT_PASS (pass_ipa_lto_wpa_fixup); + NEXT_PASS (pass_ipa_lto_finish_out); /* This must be the last LTO pass. */ *p = NULL; /* These passes are run after IPA passes on every function that is being @@ -1005,7 +1023,13 @@ init_optimization_passes (void) /* Register the passes with the tree dump code. */ register_dump_files (all_lowering_passes, PROP_gimple_any); - register_dump_files (all_ipa_passes, + register_dump_files (all_small_ipa_passes, + PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh + | PROP_cfg); + register_dump_files (all_regular_ipa_passes, + PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh + | PROP_cfg); + register_dump_files (all_lto_gen_passes, PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh | PROP_cfg); register_dump_files (all_passes, @@ -1032,8 +1056,11 @@ do_per_function (void (*callback) (void *data), void *data) push_cfun (DECL_STRUCT_FUNCTION (node->decl)); current_function_decl = node->decl; callback (data); - free_dominance_info (CDI_DOMINATORS); - free_dominance_info (CDI_POST_DOMINATORS); + if (!flag_wpa) + { + free_dominance_info (CDI_DOMINATORS); + free_dominance_info (CDI_POST_DOMINATORS); + } current_function_decl = NULL; pop_cfun (); ggc_collect (); @@ -1346,7 +1373,7 @@ add_ipa_transform_pass (void *data) /* Execute summary generation for all of the passes in IPA_PASS. */ -static void +void execute_ipa_summary_passes (struct ipa_opt_pass_d *ipa_pass) { while (ipa_pass) @@ -1355,10 +1382,21 @@ execute_ipa_summary_passes (struct ipa_opt_pass_d *ipa_pass) /* Execute all of the IPA_PASSes in the list. */ if (ipa_pass->pass.type == IPA_PASS - && (!pass->gate || pass->gate ())) + && (!pass->gate || pass->gate ()) + && ipa_pass->generate_summary) { pass_init_dump_file (pass); + + /* If a timevar is present, start it. */ + if (pass->tv_id) + timevar_push (pass->tv_id); + ipa_pass->generate_summary (); + + /* Stop timevar. */ + if (pass->tv_id) + timevar_pop (pass->tv_id); + pass_fini_dump_file (pass); } ipa_pass = (struct ipa_opt_pass_d *)ipa_pass->pass.next; @@ -1407,19 +1445,11 @@ execute_one_ipa_transform_pass (struct cgraph_node *node, current_pass = NULL; } -static bool -execute_one_pass (struct opt_pass *pass) -{ - bool initializing_dump; - unsigned int todo_after = 0; - - /* IPA passes are executed on whole program, so cfun should be NULL. - Other passes need function context set. */ - if (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS) - gcc_assert (!cfun && !current_function_decl); - else - gcc_assert (cfun && current_function_decl); +/* For the current function, execute all ipa transforms. */ +void +execute_all_ipa_transforms (void) +{ if (cfun && cfun->ipa_transforms_to_apply) { unsigned int i; @@ -1428,12 +1458,28 @@ execute_one_pass (struct opt_pass *pass) for (i = 0; i < VEC_length (ipa_opt_pass, cfun->ipa_transforms_to_apply); i++) execute_one_ipa_transform_pass (node, - VEC_index (ipa_opt_pass, + VEC_index (ipa_opt_pass, cfun->ipa_transforms_to_apply, i)); VEC_free (ipa_opt_pass, heap, cfun->ipa_transforms_to_apply); cfun->ipa_transforms_to_apply = NULL; } +} + +/* Execute PASS. */ + +static bool +execute_one_pass (struct opt_pass *pass) +{ + bool initializing_dump; + unsigned int todo_after = 0; + + /* IPA passes are executed on whole program, so cfun should be NULL. + Other passes need function context set. */ + if (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS) + gcc_assert (!cfun && !current_function_decl); + else + gcc_assert (cfun && current_function_decl); current_pass = pass; @@ -1522,26 +1568,159 @@ execute_pass_list (struct opt_pass *pass) } /* Same as execute_pass_list but assume that subpasses of IPA passes - are local passes. */ + are local passes. If SET is not NULL, write out summaries of only + those node in SET. */ + +static void +ipa_write_summaries_2 (struct opt_pass *pass, cgraph_node_set set, + struct lto_out_decl_state *state) +{ + while (pass) + { + struct ipa_opt_pass_d *ipa_pass = (struct ipa_opt_pass_d *)pass; + gcc_assert (!current_function_decl); + gcc_assert (!cfun); + gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS); + if (pass->type == IPA_PASS + && ipa_pass->write_summary + && (!pass->gate || pass->gate ())) + { + /* If a timevar is present, start it. */ + if (pass->tv_id) + timevar_push (pass->tv_id); + + ipa_pass->write_summary (set); + + /* If a timevar is present, start it. */ + if (pass->tv_id) + timevar_pop (pass->tv_id); + } + + if (pass->sub && pass->sub->type != GIMPLE_PASS) + ipa_write_summaries_2 (pass->sub, set, state); + + pass = pass->next; + } +} + +/* Helper function of ipa_write_summaries. Creates and destroys the + decl state and calls ipa_write_summaries_2 for all passes that have + summaries. SET is the set of nodes to be written. */ + +static void +ipa_write_summaries_1 (cgraph_node_set set) +{ + struct lto_out_decl_state *state = lto_new_out_decl_state (); + lto_push_out_decl_state (state); + + ipa_write_summaries_2 (all_regular_ipa_passes, set, state); + ipa_write_summaries_2 (all_lto_gen_passes, set, state); + + gcc_assert (lto_get_out_decl_state () == state); + lto_pop_out_decl_state (); + lto_delete_out_decl_state (state); +} + +/* Write out summaries for all the nodes in the callgraph. */ + void -execute_ipa_pass_list (struct opt_pass *pass) +ipa_write_summaries (void) { - bool summaries_generated = false; - do + cgraph_node_set set; + struct cgraph_node **order; + int i, order_pos; + + if (!flag_generate_lto || errorcount || sorrycount) + return; + + lto_new_extern_inline_states (); + set = cgraph_node_set_new (); + + /* Create the callgraph set in the same order used in + cgraph_expand_all_functions. This mostly facilitates debugging, + since it causes the gimple file to be processed in the same order + as the source code. */ + order = XCNEWVEC (struct cgraph_node *, cgraph_n_nodes); + order_pos = cgraph_postorder (order); + gcc_assert (order_pos == cgraph_n_nodes); + + for (i = order_pos - 1; i >= 0; i--) + cgraph_node_set_add (set, order[i]); + + ipa_write_summaries_1 (set); + lto_delete_extern_inline_states (); + + free (order); + ggc_free (set); +} + + +/* Write all the summaries for the cgraph nodes in SET. If SET is + NULL, write out all summaries of all nodes. */ + +void +ipa_write_summaries_of_cgraph_node_set (cgraph_node_set set) +{ + if (flag_generate_lto && !(errorcount || sorrycount)) + ipa_write_summaries_1 (set); +} + +/* Same as execute_pass_list but assume that subpasses of IPA passes + are local passes. */ + +static void +ipa_read_summaries_1 (struct opt_pass *pass) +{ + while (pass) { + struct ipa_opt_pass_d *ipa_pass = (struct ipa_opt_pass_d *) pass; + gcc_assert (!current_function_decl); gcc_assert (!cfun); gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS); - if (pass->type == IPA_PASS && (!pass->gate || pass->gate ())) + + if (pass->gate == NULL || pass->gate ()) { - if (!summaries_generated) + if (pass->type == IPA_PASS && ipa_pass->read_summary) { - if (!quiet_flag && !cfun) - fprintf (stderr, " "); - execute_ipa_summary_passes ((struct ipa_opt_pass_d *) pass); + /* If a timevar is present, start it. */ + if (pass->tv_id) + timevar_push (pass->tv_id); + + ipa_pass->read_summary (); + + /* Stop timevar. */ + if (pass->tv_id) + timevar_pop (pass->tv_id); } - summaries_generated = true; + + if (pass->sub && pass->sub->type != GIMPLE_PASS) + ipa_read_summaries_1 (pass->sub); } + pass = pass->next; + } +} + + +/* Read all the summaries for all_regular_ipa_passes and all_lto_gen_passes. */ + +void +ipa_read_summaries (void) +{ + ipa_read_summaries_1 (all_regular_ipa_passes); + ipa_read_summaries_1 (all_lto_gen_passes); +} + +/* Same as execute_pass_list but assume that subpasses of IPA passes + are local passes. */ +void +execute_ipa_pass_list (struct opt_pass *pass) +{ + do + { + gcc_assert (!current_function_decl); + gcc_assert (!cfun); + gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS); if (execute_one_pass (pass) && pass->sub) { if (pass->sub->type == GIMPLE_PASS) @@ -1553,13 +1732,46 @@ execute_ipa_pass_list (struct opt_pass *pass) else gcc_unreachable (); } - if (!current_function_decl) - cgraph_process_new_functions (); + gcc_assert (!current_function_decl); + cgraph_process_new_functions (); pass = pass->next; } while (pass); } +extern void debug_properties (unsigned int); +extern void dump_properties (FILE *, unsigned int); + +void +dump_properties (FILE *dump, unsigned int props) +{ + fprintf (dump, "Properties:\n"); + if (props & PROP_gimple_any) + fprintf (dump, "PROP_gimple_any\n"); + if (props & PROP_gimple_lcf) + fprintf (dump, "PROP_gimple_lcf\n"); + if (props & PROP_gimple_leh) + fprintf (dump, "PROP_gimple_leh\n"); + if (props & PROP_cfg) + fprintf (dump, "PROP_cfg\n"); + if (props & PROP_referenced_vars) + fprintf (dump, "PROP_referenced_vars\n"); + if (props & PROP_ssa) + fprintf (dump, "PROP_ssa\n"); + if (props & PROP_no_crit_edges) + fprintf (dump, "PROP_no_crit_edges\n"); + if (props & PROP_rtl) + fprintf (dump, "PROP_rtl\n"); + if (props & PROP_gimple_lomp) + fprintf (dump, "PROP_gimple_lomp\n"); +} + +void +debug_properties (unsigned int props) +{ + dump_properties (stderr, props); +} + /* Called by local passes to see if function is called by already processed nodes. Because we process nodes in topological order, this means that function is in recursive cycle or we introduced new direct calls. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 50c63625d8f..699be089ef0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,241 @@ +2009-10-03 Ben Elliston + Bill Maddox + Cary Coutant + Chris Demetriou + Diego Novillo + Doug Kwan + Jan Hubicka + Ollie Wild + Rafael Espindola + Richard Guenther + Simon Baldwin + + * g++.dg/20090107-1.C: New. + * g++.dg/20090121-1.C: New. + * g++.dg/ipa/20090113-1.C: New. + * g++.dg/lto: New directory. + * g++.dg/lto/20080829_0.C: New. + * g++.dg/lto/20080904_0.C: New. + * g++.dg/lto/20080907_0.C: New. + * g++.dg/lto/20080908-1_0.C: New. + * g++.dg/lto/20080908-2_0.C: New. + * g++.dg/lto/20080908-3_0.C: New. + * g++.dg/lto/20080909-1_0.C: New. + * g++.dg/lto/20080910-1_0.C: New. + * g++.dg/lto/20080912-1_0.C: New. + * g++.dg/lto/20080912_0.C: New. + * g++.dg/lto/20080915_0.C: New. + * g++.dg/lto/20080916_0.C: New. + * g++.dg/lto/20080917_0.C: New. + * g++.dg/lto/20080924_0.C: New. + * g++.dg/lto/20080926_0.C: New. + * g++.dg/lto/20081008_0.C: New. + * g++.dg/lto/20081022.h: New. + * g++.dg/lto/20081022_0.C: New. + * g++.dg/lto/20081022_1.C: New. + * g++.dg/lto/20081023_0.C: New. + * g++.dg/lto/20081109-1_0.C: New. + * g++.dg/lto/20081109-2_0.C: New. + * g++.dg/lto/20081109_0.C: New. + * g++.dg/lto/20081109_1.C: New. + * g++.dg/lto/20081118-1_0.C: New. + * g++.dg/lto/20081118-1_1.C: New. + * g++.dg/lto/20081118_0.C: New. + * g++.dg/lto/20081118_1.C: New. + * g++.dg/lto/20081119-1.h: New. + * g++.dg/lto/20081119-1_0.C: New. + * g++.dg/lto/20081119-1_1.C: New. + * g++.dg/lto/20081119_0.C: New. + * g++.dg/lto/20081119_1.C: New. + * g++.dg/lto/20081120-1_0.C: New. + * g++.dg/lto/20081120-1_1.C: New. + * g++.dg/lto/20081120-2_0.C: New. + * g++.dg/lto/20081120-2_1.C: New. + * g++.dg/lto/20081123_0.C: New. + * g++.dg/lto/20081123_1.C: New. + * g++.dg/lto/20081125.h: New. + * g++.dg/lto/20081125_0.C: New. + * g++.dg/lto/20081125_1.C: New. + * g++.dg/lto/20081127_0.C: New. + * g++.dg/lto/20081127_1.C: New. + * g++.dg/lto/20081203_0.C: New. + * g++.dg/lto/20081203_1.C: New. + * g++.dg/lto/20081204-1_0.C: New. + * g++.dg/lto/20081204-1_1.C: New. + * g++.dg/lto/20081204-2_0.C: New. + * g++.dg/lto/20081204-2_1.C: New. + * g++.dg/lto/20081209_0.C: New. + * g++.dg/lto/20081209_1.C: New. + * g++.dg/lto/20081211-1.h: New. + * g++.dg/lto/20081211-1_0.C: New. + * g++.dg/lto/20081211-1_1.C: New. + * g++.dg/lto/20081217-1_0.C: New. + * g++.dg/lto/20081217-2_0.C: New. + * g++.dg/lto/20081219_0.C: New. + * g++.dg/lto/20081219_1.C: New. + * g++.dg/lto/20090106_0.C: New. + * g++.dg/lto/20090112_0.C: New. + * g++.dg/lto/20090128_0.C: New. + * g++.dg/lto/20090221_0.C: New. + * g++.dg/lto/20090302_0.C: New. + * g++.dg/lto/20090302_1.C: New. + * g++.dg/lto/20090303_0.C: New. + * g++.dg/lto/20090311-1.h: New. + * g++.dg/lto/20090311-1_0.C: New. + * g++.dg/lto/20090311-1_1.C: New. + * g++.dg/lto/20090311_0.C: New. + * g++.dg/lto/20090311_1.C: New. + * g++.dg/lto/20090312.h: New. + * g++.dg/lto/20090312_0.C: New. + * g++.dg/lto/20090312_1.C: New. + * g++.dg/lto/20090313_0.C: New. + * g++.dg/lto/20090313_1.C: New. + * g++.dg/lto/20090315_0.C: New. + * g++.dg/lto/20090315_1.C: New. + * g++.dg/lto/20091002-1_0.C: New testcase. + * g++.dg/lto/20091002-2_0.C: Likewise.. + * g++.dg/lto/20091002-3_0.C: Likewise.. + * g++.dg/lto/README: New. + * g++.dg/lto/pr40818_0.C: New. + * g++.dg/opt/thunk3-1.C: New. + * g++.dg/opt/thunk4.C: New. + * gcc.c-torture/execute/builtins/lib/abs.c: Mark builtin + replacements with __attribute__ ((__noinline__)). + * gcc.c-torture/execute/builtins/lib/bfill.c: Likewise. + * gcc.c-torture/execute/builtins/lib/bzero.c: Likewise. + * gcc.c-torture/execute/builtins/lib/fprintf.c: Likewise. + * gcc.c-torture/execute/builtins/lib/memchr.c: Likewise. + * gcc.c-torture/execute/builtins/lib/memcmp.c: Likewise. + * gcc.c-torture/execute/builtins/lib/memmove.c: Likewise. + * gcc.c-torture/execute/builtins/lib/mempcpy.c: Likewise. + * gcc.c-torture/execute/builtins/lib/memset.c: Likewise. + * gcc.c-torture/execute/builtins/lib/printf.c: Likewise. + * gcc.c-torture/execute/builtins/lib/sprintf.c: Likewise. + * gcc.c-torture/execute/builtins/lib/stpcpy.c: Likewise. + * gcc.c-torture/execute/builtins/lib/strcat.c: Likewise. + * gcc.c-torture/execute/builtins/lib/strchr.c: Likewise. + * gcc.c-torture/execute/builtins/lib/strcmp.c: Likewise. + * gcc.c-torture/execute/builtins/lib/strcpy.c: Likewise. + * gcc.c-torture/execute/builtins/lib/strcspn.c: Likewise. + * gcc.c-torture/execute/builtins/lib/strlen.c: Likewise. + * gcc.c-torture/execute/builtins/lib/strncat.c: Likewise. + * gcc.c-torture/execute/builtins/lib/strncmp.c: Likewise. + * gcc.c-torture/execute/builtins/lib/strncpy.c: Likewise. + * gcc.c-torture/execute/builtins/lib/strpbrk.c: Likewise. + * gcc.c-torture/execute/builtins/lib/strrchr.c: Likewise. + * gcc.c-torture/execute/builtins/lib/strspn.c: Likewise. + * gcc.c-torture/execute/builtins/lib/strstr.c: Likewise. + * gcc.dg/20081223-1.c: New. + * gcc.dg/lto: New directory. + * gcc.dg/lto/20080908_0.c: New. + * gcc.dg/lto/20080917_0.c: New. + * gcc.dg/lto/20080924_0.c: New. + * gcc.dg/lto/20081024_0.c: New. + * gcc.dg/lto/20081109_0.c: New. + * gcc.dg/lto/20081111_0.c: New. + * gcc.dg/lto/20081111_1.c: New. + * gcc.dg/lto/20081112_0.c: New. + * gcc.dg/lto/20081112_1.c: New. + * gcc.dg/lto/20081115_0.c: New. + * gcc.dg/lto/20081115_1.c: New. + * gcc.dg/lto/20081115_2.c: New. + * gcc.dg/lto/20081118_0.c: New. + * gcc.dg/lto/20081118_1.c: New. + * gcc.dg/lto/20081118_2.c: New. + * gcc.dg/lto/20081120-1_0.c: New. + * gcc.dg/lto/20081120-1_1.c: New. + * gcc.dg/lto/20081120-2_0.c: New. + * gcc.dg/lto/20081120-2_1.c: New. + * gcc.dg/lto/20081125_0.c: New. + * gcc.dg/lto/20081125_1.c: New. + * gcc.dg/lto/20081126_0.c: New. + * gcc.dg/lto/20081201-1_0.c: New. + * gcc.dg/lto/20081201-1_1.c: New. + * gcc.dg/lto/20081201-1_2.c: New. + * gcc.dg/lto/20081201-2_0.c: New. + * gcc.dg/lto/20081201-2_1.c: New. + * gcc.dg/lto/20081202-1_0.c: New. + * gcc.dg/lto/20081202-1_1.c: New. + * gcc.dg/lto/20081202-2_0.c: New. + * gcc.dg/lto/20081202-2_1.c: New. + * gcc.dg/lto/20081204-1_0.c: New. + * gcc.dg/lto/20081204-1_1.c: New. + * gcc.dg/lto/20081204-2_0.c: New. + * gcc.dg/lto/20081210-1_0.c: New. + * gcc.dg/lto/20081212-1_0.c: New. + * gcc.dg/lto/20081222_0.c: New. + * gcc.dg/lto/20081222_0.h: New. + * gcc.dg/lto/20081222_1.c: New. + * gcc.dg/lto/20081224_0.c: New. + * gcc.dg/lto/20081224_0.h: New. + * gcc.dg/lto/20081224_1.c: New. + * gcc.dg/lto/20090116_0.c: New. + * gcc.dg/lto/20090120_0.c: New. + * gcc.dg/lto/20090126-1_0.c: New. + * gcc.dg/lto/20090126-2_0.c: New. + * gcc.dg/lto/20090206-1_0.c: New. + * gcc.dg/lto/20090206-2_0.c: New. + * gcc.dg/lto/20090210_0.c: New. + * gcc.dg/lto/20090210_1.c: New. + * gcc.dg/lto/20090213_0.c: New. + * gcc.dg/lto/20090213_1.c: New. + * gcc.dg/lto/20090218-1_0.c: New. + * gcc.dg/lto/20090218-1_1.c: New. + * gcc.dg/lto/20090218-2_0.c: New. + * gcc.dg/lto/20090218-2_1.c: New. + * gcc.dg/lto/20090218_0.c: New. + * gcc.dg/lto/20090218_1.c: New. + * gcc.dg/lto/20090218_2.c: New. + * gcc.dg/lto/20090218_3.c: New. + * gcc.dg/lto/20090219_0.c: New. + * gcc.dg/lto/20090312_0.c: New. + * gcc.dg/lto/20090312_1.c: New. + * gcc.dg/lto/20090313_0.c: New. + * gcc.dg/lto/20090706-1_0.c: New. + * gcc.dg/lto/20090706-2_0.c: New. + * gcc.dg/lto/20090717_0.c: New. + * gcc.dg/lto/20090717_1.c: New. + * gcc.dg/lto/20090729_0.c: New. + * gcc.dg/lto/20090729_1.c: New. + * gcc.dg/lto/20090812_0.c: New. + * gcc.dg/lto/20090812_1.c: New. + * gcc.dg/lto/20090914-1_0.c: New. + * gcc.dg/lto/README: New. + * gcc.dg/visibility-7.c: Adjust expected pattern + * gfortran.dg/lto: New directory. + * gfortran.dg/lto/pr40724_0.f: New. + * gfortran.dg/lto/pr40724_1.f: New. + * gfortran.dg/lto/pr40725_0.f03: New. + * gfortran.dg/lto/pr40725_1.c: New. + * gfortran.dg/lto/pr41069_0.f90: New. + * gfortran.dg/lto/pr41069_1.f90: New. + * gfortran.dg/lto/pr41069_2.f90: New. + * g++.dg/README: Add 'lto' directory. + * g++.dg/dg.exp: Also scan 'lto' directory + +2009-10-03 Ben Elliston + Janis Johnson + Diego Novillo + + * g++.dg/lto/lto.exp: New. + * gcc.c-torture/execute/execute.exp: Add + LTO_TORTURE_OPTIONS TO C_TORTURE_OPTIONS. + * gcc.c-torture/execute/builtins/builtins.exp: Likewise. + * gcc.c-torture/execute/ieee/ieee.exp: Likewise. + * gcc.c-torture/unsorted/unsorted.exp: Likewise. + * gcc.target/i386/math-torture/math-torture.exp: + Likewise. + * gcc.dg/lto/lto.exp: New. + * gfortran.dg/lto/lto.exp: New. + * lib/target-supports.exp (check_effective_target_lto): New. + * lib/c-torture.exp: Load target-supports.exp. + Define LTO_TORTURE_OPTIONS if check_effective_target_lto + returns nonzero. + * lib/gcc-dg.exp: Likewise. + * lib/lto.exp: New. + * lib/torture-options.exp: Add support for a third + argument. + 2009-10-03 Uros Bizjak PR testsuite/41542 diff --git a/gcc/testsuite/g++.dg/20090107-1.C b/gcc/testsuite/g++.dg/20090107-1.C new file mode 100644 index 00000000000..7c50675dbe0 --- /dev/null +++ b/gcc/testsuite/g++.dg/20090107-1.C @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target lto } */ +/* { dg-options "-fwhopr -Wuninitialized -O1" } */ + +template struct Q1 { typedef int x; }; +template struct Q2 { + typename Q1::x f() { + int k; + return k; /* { dg-warning "'k' is used uninitialized in this function" } */ + } +}; +int foo() { return Q2().f(); } diff --git a/gcc/testsuite/g++.dg/20090121-1.C b/gcc/testsuite/g++.dg/20090121-1.C new file mode 100644 index 00000000000..9dff0f87af3 --- /dev/null +++ b/gcc/testsuite/g++.dg/20090121-1.C @@ -0,0 +1,19 @@ +// { dg-do compile } +// { dg-require-effective-target lto } +// { dg-options "-fwhopr -Wuninitialized -O2" } +class A +{ +private: + int y; + +public: + A () { int x; y = x + 1; } /* { dg-warning "'x' is used uninitialized in this function" } */ + int get_y () { return y; } +}; + +int foo() +{ + A a; + return a.get_y (); +} + diff --git a/gcc/testsuite/g++.dg/README b/gcc/testsuite/g++.dg/README index cdf6b14aee6..fe308a54210 100644 --- a/gcc/testsuite/g++.dg/README +++ b/gcc/testsuite/g++.dg/README @@ -14,6 +14,7 @@ gcov Tests for GCOV (code coverage) support. inherit Tests for inheritance -- virtual functions, multiple inheritance, etc. init Tests for initialization semantics, constructors/destructors, etc. lookup Tests for lookup semantics, namespaces, using, etc. +lto Tests for Link Time Optimization. opt Tests for fixes of bugs with particular optimizations. overload Tests for overload resolution and conversions. parse Tests for parsing. diff --git a/gcc/testsuite/g++.dg/dg.exp b/gcc/testsuite/g++.dg/dg.exp index af8c1475848..2642da12301 100644 --- a/gcc/testsuite/g++.dg/dg.exp +++ b/gcc/testsuite/g++.dg/dg.exp @@ -37,6 +37,7 @@ set tests [prune $tests $srcdir/$subdir/compat/*] set tests [prune $tests $srcdir/$subdir/debug/*] set tests [prune $tests $srcdir/$subdir/dfp/*] set tests [prune $tests $srcdir/$subdir/gcov/*] +set tests [prune $tests $srcdir/$subdir/lto/*] set tests [prune $tests $srcdir/$subdir/pch/*] set tests [prune $tests $srcdir/$subdir/plugin/*] set tests [prune $tests $srcdir/$subdir/special/*] diff --git a/gcc/testsuite/g++.dg/ipa/20090113-1.C b/gcc/testsuite/g++.dg/ipa/20090113-1.C new file mode 100644 index 00000000000..3f371257e57 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/20090113-1.C @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +struct S1 { + S1() { } +}; + +struct S2 { + int n; + S1* p; + void f() { + p = new S1[n = 1]; + } +}; + +struct S3 { + S2 s2; + void g() { + s2.f(); + } +}; + +void h() { + S3().g(); +} diff --git a/gcc/testsuite/g++.dg/lto/20080709_0.C b/gcc/testsuite/g++.dg/lto/20080709_0.C new file mode 100644 index 00000000000..55ae8c9ec2c --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20080709_0.C @@ -0,0 +1,11 @@ +// { dg-lto-do run } + +class Init { +}; + +int f(Init *a) { +} + +int main(void){ + return 0; +} diff --git a/gcc/testsuite/g++.dg/lto/20080829_0.C b/gcc/testsuite/g++.dg/lto/20080829_0.C new file mode 100644 index 00000000000..0890cf66d3b --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20080829_0.C @@ -0,0 +1,9 @@ +// { dg-lto-do assemble } + +/* The replacement of cos+sin with __builtin_cexpi done by + pass_cse_sincos was using a builtin for which we had no attributes. + This was causing the operand scanner to materialize a VDEF at the + builtin call-site which was not marked for renaming, thus tripping + up the SSA verifier. */ +extern "C" { extern double cos (double); extern double sin (double); } +double func(double &in) { return cos(in) + sin(in); } diff --git a/gcc/testsuite/g++.dg/lto/20080904_0.C b/gcc/testsuite/g++.dg/lto/20080904_0.C new file mode 100644 index 00000000000..0161a00be7f --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20080904_0.C @@ -0,0 +1,37 @@ +// { dg-lto-do run } + +/* This test will fail to link if the vtable for Derived is not emitted. */ + +class Base { +public: + Base(char *buf, unsigned len) + : _buf(buf), + _len(len) + {} + + virtual int length () { return _len; } + +private: + char * _buf; + unsigned _len; +}; + +class Derived : public Base { +public: + Derived(char *buf, unsigned len) + : Base(buf, len), + _ctr(len) + {} + + virtual int length () { return _ctr; } + +private: + unsigned _ctr; +}; + +int main () +{ + Derived *d = new Derived (new char[256], 256); + + return 0; +} diff --git a/gcc/testsuite/g++.dg/lto/20080907_0.C b/gcc/testsuite/g++.dg/lto/20080907_0.C new file mode 100644 index 00000000000..9a4552310d9 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20080907_0.C @@ -0,0 +1,3 @@ +// { dg-lto-do assemble } +struct Foo { void func (); }; Foo & bar () { } struct Baz { Baz (Baz &); }; +Baz dummy() { bar().func(); } diff --git a/gcc/testsuite/g++.dg/lto/20080908-1_0.C b/gcc/testsuite/g++.dg/lto/20080908-1_0.C new file mode 100644 index 00000000000..8b761c0844c --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20080908-1_0.C @@ -0,0 +1,36 @@ +/* { dg-lto-do run } */ +extern "C" { extern void *memcpy (void *, const void *, unsigned); } + +inline int +bci (const float &source) +{ + int dest; + memcpy (&dest, &source, sizeof (dest)); + return dest; +} + +inline float +bcf (const int &source) +{ + float dest; + memcpy (&dest, &source, sizeof (dest)); + return dest; +} + +float +Foo () +{ + const int foo = bci (0.0f); + int bar = foo; + const int baz = foo & 1; + if (!baz && (foo & 2)) + bar = 0; + return bcf (bar); +} + +int main () +{ + if (Foo () != 0.0) + return 1; + return 0; +} diff --git a/gcc/testsuite/g++.dg/lto/20080908-2_0.C b/gcc/testsuite/g++.dg/lto/20080908-2_0.C new file mode 100644 index 00000000000..7042b3d08d6 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20080908-2_0.C @@ -0,0 +1,3 @@ +/* { dg-lto-do assemble } */ +struct Foo { double x[3]; }; +Foo func() { Foo f = { { 0, 0, 0 } }; return f; } diff --git a/gcc/testsuite/g++.dg/lto/20080908-3_0.C b/gcc/testsuite/g++.dg/lto/20080908-3_0.C new file mode 100644 index 00000000000..b7e0e1b0271 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20080908-3_0.C @@ -0,0 +1,14 @@ +/* { dg-lto-do run } */ + +int foo() +{ + double bar, baz = -__builtin_huge_val(); + return baz <= -bar; +} + +int main() +{ + if (foo () != 1) + return 1; + return 0; +} diff --git a/gcc/testsuite/g++.dg/lto/20080909-1_0.C b/gcc/testsuite/g++.dg/lto/20080909-1_0.C new file mode 100644 index 00000000000..245ca58f308 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20080909-1_0.C @@ -0,0 +1,3 @@ +// { dg-lto-do assemble } +// { dg-lto-options {{-flto}} } +int *i = (int[]) {0}; diff --git a/gcc/testsuite/g++.dg/lto/20080910-1_0.C b/gcc/testsuite/g++.dg/lto/20080910-1_0.C new file mode 100644 index 00000000000..48e9e5d15cb --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20080910-1_0.C @@ -0,0 +1,2 @@ +// { dg-lto-do assemble } +struct Foo { Foo(int); }; void func() { new Foo(0); } diff --git a/gcc/testsuite/g++.dg/lto/20080912-1_0.C b/gcc/testsuite/g++.dg/lto/20080912-1_0.C new file mode 100644 index 00000000000..ebead90e03a --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20080912-1_0.C @@ -0,0 +1,3 @@ +// { dg-lto-do assemble } +struct Foo { double x[3]; }; +Foo func() { Foo f = { { 0, 0, 0 } }; return f; } diff --git a/gcc/testsuite/g++.dg/lto/20080912_0.C b/gcc/testsuite/g++.dg/lto/20080912_0.C new file mode 100644 index 00000000000..7b3039fbf8d --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20080912_0.C @@ -0,0 +1,4 @@ +// { dg-lto-do assemble } +class Foo { virtual void f(); }; +class Bar:public Foo { }; +void func() { Bar(); } diff --git a/gcc/testsuite/g++.dg/lto/20080915_0.C b/gcc/testsuite/g++.dg/lto/20080915_0.C new file mode 100644 index 00000000000..3789765a964 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20080915_0.C @@ -0,0 +1,29 @@ +// { dg-lto-do assemble } +struct Foo { + static const int dummy; + + int bit_field:1; + int dummy2:1; + int dummy3:1; +}; + +struct Bar { + Foo foo; +}; + +int func(const Bar& b) { + return b.foo.bit_field; +} + +struct Baz { + Bar& operator*() {} +}; + +void func1(Baz baz, int i, Bar bar) { + i || func(bar); + *baz = bar; +} + +void func2(Baz baz, Bar bar) { + func1(baz, 0, bar); +} diff --git a/gcc/testsuite/g++.dg/lto/20080916_0.C b/gcc/testsuite/g++.dg/lto/20080916_0.C new file mode 100644 index 00000000000..3c900cd43b5 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20080916_0.C @@ -0,0 +1,12 @@ +/* { dg-lto-do assemble } */ + +enum _Ios_Fmtflags { + _S_boolalpha }; + +class ios_base { + static const _Ios_Fmtflags boolalpha = _S_boolalpha; + _Ios_Fmtflags _M_flags; +}; + +ios_base& g() { +} diff --git a/gcc/testsuite/g++.dg/lto/20080917_0.C b/gcc/testsuite/g++.dg/lto/20080917_0.C new file mode 100644 index 00000000000..2f4f33bd0e9 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20080917_0.C @@ -0,0 +1,29 @@ +// { dg-lto-do assemble } +// { dg-lto-options {{-O2 -flto -funsigned-char}} } +int +foo (char *s, int flag) +{ + for (;;) + { + unsigned char c; + if (flag) + c = *s; + else + c = *s; + return c; + } +} + +int +baz (const char *s, int flag) +{ + for (;;) + { + unsigned char c; + if (flag) + c = *s; + else + c = *s; + return c; + } +} diff --git a/gcc/testsuite/g++.dg/lto/20080924_0.C b/gcc/testsuite/g++.dg/lto/20080924_0.C new file mode 100644 index 00000000000..b1e381351bb --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20080924_0.C @@ -0,0 +1,16 @@ +// { dg-lto-do assemble } +// { dg-lto-options {{-O2 -flto -fno-strict-aliasing}} } + +namespace ns +{ + template class hash_set { }; +} + +struct Foo +{ + long long f1, f2, f3; +}; + +void func(ns::hash_set) { + Foo foo = { 0, 0, 0 }; +} diff --git a/gcc/testsuite/g++.dg/lto/20080926_0.C b/gcc/testsuite/g++.dg/lto/20080926_0.C new file mode 100644 index 00000000000..d6a7bbffc70 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20080926_0.C @@ -0,0 +1,4 @@ +// { dg-lto-do assemble } +// { dg-lto-options {{-O2 -flto -fno-strict-aliasing}} } +extern int foo(); +void bar() { try { int i = foo(); } catch(int) { } } diff --git a/gcc/testsuite/g++.dg/lto/20081008_0.C b/gcc/testsuite/g++.dg/lto/20081008_0.C new file mode 100644 index 00000000000..258265a4fe1 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081008_0.C @@ -0,0 +1,36 @@ +// { dg-lto-do assemble } +// { dg-lto-options {{-flto}} } + +struct Foo +{ + virtual void func() = 0; +}; + +struct Bar +{ + Foo *field; + void func2(); +}; + +struct Baz +{ + Bar &bar(); + Baz(); +}; + +struct Zonk +{ + virtual ~Zonk() { + } + virtual void func3() = 0; +}; + +void Mumble(Zonk *) { +} + +extern "C" +{ + void __attribute__ ((nothrow)) __cxa_pure_virtual() { + Baz().bar().func2(); + } +} diff --git a/gcc/testsuite/g++.dg/lto/20081022.h b/gcc/testsuite/g++.dg/lto/20081022.h new file mode 100644 index 00000000000..bccd2ad7b68 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081022.h @@ -0,0 +1,8 @@ +class foo +{ +public: + int bar () + { + return 0; + } +}; diff --git a/gcc/testsuite/g++.dg/lto/20081022_0.C b/gcc/testsuite/g++.dg/lto/20081022_0.C new file mode 100644 index 00000000000..219f92d6a96 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081022_0.C @@ -0,0 +1,11 @@ +#include "20081022.h" + +int +f (foo * a) +{ + return a->bar (); +} + +main() +{ +} diff --git a/gcc/testsuite/g++.dg/lto/20081022_1.C b/gcc/testsuite/g++.dg/lto/20081022_1.C new file mode 100644 index 00000000000..94c5aecfd6b --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081022_1.C @@ -0,0 +1,7 @@ +#include "20081022.h" + +int +g (foo * a) +{ + return a->bar (); +} diff --git a/gcc/testsuite/g++.dg/lto/20081023_0.C b/gcc/testsuite/g++.dg/lto/20081023_0.C new file mode 100644 index 00000000000..ab3fc36f386 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081023_0.C @@ -0,0 +1,14 @@ +// { dg-lto-do link } +extern inline void __attribute__ ((__always_inline__)) func (void) +{ +} + +void +f (void) +{ + func (); +} + +main() +{ +} diff --git a/gcc/testsuite/g++.dg/lto/20081109-1_0.C b/gcc/testsuite/g++.dg/lto/20081109-1_0.C new file mode 100644 index 00000000000..243f0ed7246 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081109-1_0.C @@ -0,0 +1,5 @@ +// { dg-lto-do link } +// { dg-lto-options {{-fPIC -fwhopr}} } +// { dg-extra-ld-options "-fPIC -fwhopr -shared -fno-exceptions" } +void func(); class Foo { }; +void bar() { try { func(); } catch (Foo) { } }; diff --git a/gcc/testsuite/g++.dg/lto/20081109-2_0.C b/gcc/testsuite/g++.dg/lto/20081109-2_0.C new file mode 100644 index 00000000000..dc43286bf36 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081109-2_0.C @@ -0,0 +1,15 @@ +/* { dg-lto-do assemble } */ +extern void func(int); + +struct Foo +{ + void bar() { + static int local; + func(local); + } + void baz(); +}; + +void Foo::baz() { + bar(); +} diff --git a/gcc/testsuite/g++.dg/lto/20081109_0.C b/gcc/testsuite/g++.dg/lto/20081109_0.C new file mode 100644 index 00000000000..93cfc67fff2 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081109_0.C @@ -0,0 +1,28 @@ +extern "C" { void abort (void);} +int foo (int); + +class A +{ + int x; + +public: + A() { x = 2304; } + ~A() { if (x != 2305) abort (); } + void inc () { x++; } +}; + + +int main() +{ + A x; + x.inc(); + try + { + foo (0); + abort (); // Should not execute + } + catch (int e) + { + return 0; + } +} diff --git a/gcc/testsuite/g++.dg/lto/20081109_1.C b/gcc/testsuite/g++.dg/lto/20081109_1.C new file mode 100644 index 00000000000..3395e135501 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081109_1.C @@ -0,0 +1,4 @@ +int foo (int x) +{ + throw 10; +} diff --git a/gcc/testsuite/g++.dg/lto/20081118-1_0.C b/gcc/testsuite/g++.dg/lto/20081118-1_0.C new file mode 100644 index 00000000000..99e024f9e51 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081118-1_0.C @@ -0,0 +1,27 @@ +/* { dg-lto-do link } */ + +class C { + public: + C(); + virtual ~C(); + virtual void foo(); +}; +void bar() { + new C(); +} + +C::C() { + +} + +C::~C() { + +} + +void C::foo() { +} + +int main(void) +{ + return 0; +} diff --git a/gcc/testsuite/g++.dg/lto/20081118-1_1.C b/gcc/testsuite/g++.dg/lto/20081118-1_1.C new file mode 100644 index 00000000000..fc654fe9199 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081118-1_1.C @@ -0,0 +1,12 @@ +class C { + public: + C(); + virtual ~C(); + virtual void foo(); +}; +class D { + ~D(); + C lexer_; +}; +D::~D() { +} diff --git a/gcc/testsuite/g++.dg/lto/20081118_0.C b/gcc/testsuite/g++.dg/lto/20081118_0.C new file mode 100644 index 00000000000..cbac06a4747 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081118_0.C @@ -0,0 +1,20 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options {{-fPIC -fwhopr -shared}} } */ + +/* We used to ICE because of dangling pointers. */ + +class object +{ +public: + virtual ~object() {} +}; + +class foo : public object +{ + virtual int method(void); +}; + +int +foo::method(void) +{ +} diff --git a/gcc/testsuite/g++.dg/lto/20081118_1.C b/gcc/testsuite/g++.dg/lto/20081118_1.C new file mode 100644 index 00000000000..b9e56a48b9b --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081118_1.C @@ -0,0 +1,20 @@ +class object { + virtual ~object() {} +}; + +class bar : public object +{ + static bar *method(void); +}; + +class quxx : public bar +{ + public: + static void method(); +}; + +bar* +bar::method (void) +{ + quxx::method(); +} diff --git a/gcc/testsuite/g++.dg/lto/20081119-1.h b/gcc/testsuite/g++.dg/lto/20081119-1.h new file mode 100644 index 00000000000..be193581dcd --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081119-1.h @@ -0,0 +1,8 @@ +namespace __gnu_cxx +{ + template < typename _Tp > class new_allocator + { + public: + unsigned max_size () const throw (); + }; +} diff --git a/gcc/testsuite/g++.dg/lto/20081119-1_0.C b/gcc/testsuite/g++.dg/lto/20081119-1_0.C new file mode 100644 index 00000000000..d38fca3d44d --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081119-1_0.C @@ -0,0 +1,12 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options {{-fPIC -fwhopr -shared}} } */ + +#include "20081119-1.h" + +extern __gnu_cxx::new_allocator X; + +int +f (__gnu_cxx::new_allocator * a) +{ + return a->max_size () + X.max_size(); +} diff --git a/gcc/testsuite/g++.dg/lto/20081119-1_1.C b/gcc/testsuite/g++.dg/lto/20081119-1_1.C new file mode 100644 index 00000000000..c2ba78d6ed7 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081119-1_1.C @@ -0,0 +1,9 @@ +#include "20081119-1.h" + +__gnu_cxx::new_allocator X; + +int +f (__gnu_cxx::new_allocator a) +{ + return a.max_size (); +} diff --git a/gcc/testsuite/g++.dg/lto/20081119_0.C b/gcc/testsuite/g++.dg/lto/20081119_0.C new file mode 100644 index 00000000000..c77a4309811 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081119_0.C @@ -0,0 +1,24 @@ +class foo { + public: + foo () {} + virtual ~foo() {} + virtual void m() {} +}; + +template +class bar : public foo { + public: + bar () {} +}; + +void +f1 (bar *p) +{ + p->m(); +} + +int +main () +{ + return 0; +} diff --git a/gcc/testsuite/g++.dg/lto/20081119_1.C b/gcc/testsuite/g++.dg/lto/20081119_1.C new file mode 100644 index 00000000000..71a2a5c0242 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081119_1.C @@ -0,0 +1,18 @@ +class foo { + public: + foo () {} + virtual ~foo() {} + virtual void m() {} +}; + +template +class bar : public foo { + public: + bar () {} +}; + +void +f2 (bar *p) +{ + p->m(); +} diff --git a/gcc/testsuite/g++.dg/lto/20081120-1_0.C b/gcc/testsuite/g++.dg/lto/20081120-1_0.C new file mode 100644 index 00000000000..3cb97538945 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081120-1_0.C @@ -0,0 +1,10 @@ +// { dg-lto-do link } +// { dg-lto-options {{-flto -shared}} } +extern "C" +{ + extern __inline __attribute__((__gnu_inline__)) int pthread_equal(int, int) + { + } +} +static __typeof(pthread_equal) + __gthrw_pthread_equal __attribute__((__weakref__("pthread_equal"))); diff --git a/gcc/testsuite/g++.dg/lto/20081120-1_1.C b/gcc/testsuite/g++.dg/lto/20081120-1_1.C new file mode 100644 index 00000000000..e7e24a58b76 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081120-1_1.C @@ -0,0 +1,8 @@ +extern "C" +{ + extern __inline __attribute__((__gnu_inline__)) int pthread_equal(int, int) + { + } +} +static __typeof(pthread_equal) + __gthrw_pthread_equal __attribute__((__weakref__("pthread_equal"))); diff --git a/gcc/testsuite/g++.dg/lto/20081120-2_0.C b/gcc/testsuite/g++.dg/lto/20081120-2_0.C new file mode 100644 index 00000000000..d4e4cd43cc5 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081120-2_0.C @@ -0,0 +1,13 @@ +// { dg-lto-do link } +// { dg-lto-options {{-flto -shared}} } +template < typename > struct Foo +{ + inline void rdstate() { + } +}; + +extern template struct Foo; + +struct Bar:virtual public Foo +{ +}; diff --git a/gcc/testsuite/g++.dg/lto/20081120-2_1.C b/gcc/testsuite/g++.dg/lto/20081120-2_1.C new file mode 100644 index 00000000000..242d50a41ce --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081120-2_1.C @@ -0,0 +1,11 @@ +template < typename > struct Foo +{ + inline void rdstate() { + } +}; + +extern template struct Foo; + +struct Bar:virtual public Foo +{ +}; diff --git a/gcc/testsuite/g++.dg/lto/20081123_0.C b/gcc/testsuite/g++.dg/lto/20081123_0.C new file mode 100644 index 00000000000..2b182a95e42 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081123_0.C @@ -0,0 +1,8 @@ +// { dg-lto-do link } +// { dg-lto-options {{-fwhopr -shared -fPIC}} } + +int +f(void) +{ + return 0; +} diff --git a/gcc/testsuite/g++.dg/lto/20081123_1.C b/gcc/testsuite/g++.dg/lto/20081123_1.C new file mode 100644 index 00000000000..aef512e8e4d --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081123_1.C @@ -0,0 +1,16 @@ +struct foo { + const int* int_array; + const void* default_instance; +}; +struct bar { + static const bar& _default_instance; + static const foo _internal_foo; +}; +struct quxx { + static int trouble[]; +}; +int quxx::trouble[] = { }; +const foo bar::_internal_foo = { + quxx::trouble, + &bar::_default_instance +}; diff --git a/gcc/testsuite/g++.dg/lto/20081125.h b/gcc/testsuite/g++.dg/lto/20081125.h new file mode 100644 index 00000000000..bc470040a67 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081125.h @@ -0,0 +1,15 @@ +class base +{ + public: + base() {} + virtual ~base() {} + static base *factory (void); +}; + +class object : public base +{ + public: + object() {} + object (int); + virtual void key_method (void); +}; diff --git a/gcc/testsuite/g++.dg/lto/20081125_0.C b/gcc/testsuite/g++.dg/lto/20081125_0.C new file mode 100644 index 00000000000..ade9744946d --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081125_0.C @@ -0,0 +1,18 @@ +// { dg-lto-do link } +// { dg-lto-options {{-fwhopr}} } +#include "20081125.h" + +object::object (int x) +{ +} + +void +object::key_method (void) +{ +} + +int +main () +{ + return 0; +} diff --git a/gcc/testsuite/g++.dg/lto/20081125_1.C b/gcc/testsuite/g++.dg/lto/20081125_1.C new file mode 100644 index 00000000000..d52b9edcada --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081125_1.C @@ -0,0 +1,7 @@ +#include "20081125.h" + +base * +base::factory(void) +{ + return new object (); +} diff --git a/gcc/testsuite/g++.dg/lto/20081127_0.C b/gcc/testsuite/g++.dg/lto/20081127_0.C new file mode 100644 index 00000000000..a5200ff4bea --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081127_0.C @@ -0,0 +1,2 @@ +struct Foo { Foo(); }; +static void func() { new Foo(); } diff --git a/gcc/testsuite/g++.dg/lto/20081127_1.C b/gcc/testsuite/g++.dg/lto/20081127_1.C new file mode 100644 index 00000000000..6488ac8d797 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081127_1.C @@ -0,0 +1,3 @@ +struct Foo { Foo(); }; +Foo::Foo() { } +main() { return 0; } diff --git a/gcc/testsuite/g++.dg/lto/20081203_0.C b/gcc/testsuite/g++.dg/lto/20081203_0.C new file mode 100644 index 00000000000..e92d89a4c3b --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081203_0.C @@ -0,0 +1,5 @@ +extern void f(); +extern void g(); +struct Foo { static inline void Bar() { f(); } }; +static void Func() { Foo::Bar(); } +int main() { g (); Func(); return 0; } diff --git a/gcc/testsuite/g++.dg/lto/20081203_1.C b/gcc/testsuite/g++.dg/lto/20081203_1.C new file mode 100644 index 00000000000..83de109eaa9 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081203_1.C @@ -0,0 +1,4 @@ +void f () {} +struct Foo { static inline void Bar() { f(); } }; +static void Func() { Foo::Bar(); } +void g () { Func (); } diff --git a/gcc/testsuite/g++.dg/lto/20081204-1_0.C b/gcc/testsuite/g++.dg/lto/20081204-1_0.C new file mode 100644 index 00000000000..8c625f51e47 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081204-1_0.C @@ -0,0 +1,14 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options {{-fwhopr -fPIC -shared}} } */ + +/* Tests for the absence during linking of: + lto1: error: type of '_ZTVN10__cxxabiv120__si_class_type_infoE' does + not match original declaration */ + +struct Foo { virtual ~Foo(); }; +namespace __cxxabiv1 +{ + struct __si_class_type_info: public Foo { }; + struct Baz: public Foo { virtual void Func(); }; + void Baz::Func() { } +} diff --git a/gcc/testsuite/g++.dg/lto/20081204-1_1.C b/gcc/testsuite/g++.dg/lto/20081204-1_1.C new file mode 100644 index 00000000000..20627b5c54d --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081204-1_1.C @@ -0,0 +1,3 @@ +struct Foo { virtual ~Foo(); }; +struct Bar:public Foo { Bar() { } }; +void Func() { new Bar(); } diff --git a/gcc/testsuite/g++.dg/lto/20081204-2_0.C b/gcc/testsuite/g++.dg/lto/20081204-2_0.C new file mode 100644 index 00000000000..dfae081bfa1 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081204-2_0.C @@ -0,0 +1,10 @@ +// { dg-lto-do link } +// { dg-lto-options {{-fwhopr -O3}} } +extern void foo (void); + +int +main () +{ + foo (); + return 0; +} diff --git a/gcc/testsuite/g++.dg/lto/20081204-2_1.C b/gcc/testsuite/g++.dg/lto/20081204-2_1.C new file mode 100644 index 00000000000..676b9b27d63 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081204-2_1.C @@ -0,0 +1,14 @@ +namespace { +class c +{ + public: + c () {} + virtual ~c() {} +}; +}; + +void +foo (void) +{ + c x; +} diff --git a/gcc/testsuite/g++.dg/lto/20081209_0.C b/gcc/testsuite/g++.dg/lto/20081209_0.C new file mode 100644 index 00000000000..3744a9ac42a --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081209_0.C @@ -0,0 +1,18 @@ +/* { dg-lto-do link } */ + +class foo { + public: + foo (); + virtual ~foo (); +}; + +foo::foo () +{ +} + +int +main () +{ + foo dummy; + return 0; +} diff --git a/gcc/testsuite/g++.dg/lto/20081209_1.C b/gcc/testsuite/g++.dg/lto/20081209_1.C new file mode 100644 index 00000000000..83eee3e46e8 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081209_1.C @@ -0,0 +1,9 @@ +class foo { + public: + foo (); + virtual ~foo (); +}; + +foo::~foo () +{ +} diff --git a/gcc/testsuite/g++.dg/lto/20081211-1.h b/gcc/testsuite/g++.dg/lto/20081211-1.h new file mode 100644 index 00000000000..f9a8ca7550d --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081211-1.h @@ -0,0 +1,6 @@ +class foo { + public: + foo () {} + virtual ~foo () {} + virtual void key_method (void); +}; diff --git a/gcc/testsuite/g++.dg/lto/20081211-1_0.C b/gcc/testsuite/g++.dg/lto/20081211-1_0.C new file mode 100644 index 00000000000..89c06acf53a --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081211-1_0.C @@ -0,0 +1,19 @@ +#include "20081211-1.h" + +foo * +create_foo (void) +{ + return new foo; +} + +void +destroy_foo (foo *p) +{ + delete p; +} + +int +main () +{ + return 0; +} diff --git a/gcc/testsuite/g++.dg/lto/20081211-1_1.C b/gcc/testsuite/g++.dg/lto/20081211-1_1.C new file mode 100644 index 00000000000..124d69a7cce --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081211-1_1.C @@ -0,0 +1,6 @@ +#include "20081211-1.h" + +void +foo::key_method (void) +{ +} diff --git a/gcc/testsuite/g++.dg/lto/20081217-1_0.C b/gcc/testsuite/g++.dg/lto/20081217-1_0.C new file mode 100644 index 00000000000..c91872bd2db --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081217-1_0.C @@ -0,0 +1,28 @@ +class base1 +{ + public: + base1 () {} + virtual ~base1 () {} +}; + +class base2 +{ + public: + base2 () {} + virtual ~base2 () {} +}; + +class mi_class : public base1, base2 +{ + public: + mi_class () {} + ~mi_class () {} +}; + +mi_class dummy; + +int +main () +{ + return 0; +} diff --git a/gcc/testsuite/g++.dg/lto/20081217-2_0.C b/gcc/testsuite/g++.dg/lto/20081217-2_0.C new file mode 100644 index 00000000000..a47b0b5781b --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081217-2_0.C @@ -0,0 +1,20 @@ +struct A { + virtual int foo() {} +}; +struct B { + virtual int f() {return 1; } +}; +struct C : public A, public B { + C(); + virtual int f() { return 0; } +}; + +C::C() +{ +} + +main() +{ + C c; + return c.f(); +} diff --git a/gcc/testsuite/g++.dg/lto/20081219_0.C b/gcc/testsuite/g++.dg/lto/20081219_0.C new file mode 100644 index 00000000000..29ad575d0a7 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081219_0.C @@ -0,0 +1,72 @@ +// { dg-lto-do link } +// { dg-lto-options {{-fPIC -fwhopr -O2}} } +// { dg-extra-ld-options "-O2 -fPIC -fwhopr -shared" } + +typedef long int ptrdiff_t; +extern "C" +{ + typedef struct + { + } + __mbstate_t; + namespace std + { + class exception + { + }; + } +} +namespace std __attribute__ ((__visibility__ ("default"))) +{ + template < typename _Alloc > class allocator; + template < class _CharT > struct char_traits; +} +typedef __mbstate_t mbstate_t; +namespace std __attribute__ ((__visibility__ ("default"))) +{ + using::mbstate_t; + typedef ptrdiff_t streamsize; + template < typename _CharT, typename _Traits = + char_traits < _CharT > >class basic_istream; + template < typename _CharT, typename _Traits = + char_traits < _CharT >, typename _Alloc = + allocator < _CharT > >class basic_stringbuf; + class ios_base + { + public:class failure:public exception + { + }; + virtual ~ ios_base (); + }; + template < typename _CharT, typename _Traits > class basic_streambuf + { + }; +template < typename _CharT, typename _Traits > class basic_ios:public + ios_base + { + }; +template < typename _CharT, typename _Traits > class basic_istream:virtual public basic_ios < _CharT, + _Traits + > + { + typedef basic_streambuf < _CharT, _Traits > __streambuf_type; + protected:streamsize _M_gcount; + public: explicit basic_istream (__streambuf_type * __sb):_M_gcount (streamsize + (0)) + { + } + }; +template < typename _CharT, typename _Traits, typename _Alloc > class basic_stringbuf:public basic_streambuf < _CharT, + _Traits + > + { + }; + template < typename V, typename I, typename S = std::mbstate_t > struct character + { + }; + typedef character < unsigned short, unsigned int >pod_ushort; + typedef basic_stringbuf < pod_ushort > stringbuf_type; + typedef basic_istream < pod_ushort > istream_type; + stringbuf_type strbuf01; + istream_type stream (&strbuf01); +} diff --git a/gcc/testsuite/g++.dg/lto/20081219_1.C b/gcc/testsuite/g++.dg/lto/20081219_1.C new file mode 100644 index 00000000000..1bb96ef37de --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20081219_1.C @@ -0,0 +1,42 @@ +typedef struct +{ +} +__mbstate_t; +typedef __mbstate_t mbstate_t; +namespace std __attribute__ ((__visibility__ ("default"))) +{ + using::mbstate_t; + typedef int *__c_locale; + class locale + { + class facet; + }; + class locale::facet + { + }; +template < typename _CharT > class numpunct:public locale::facet + { + void _M_initialize_numpunct (__c_locale __cloc = __null); + }; +} +namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) +{ + template < typename V, typename I, typename S = std::mbstate_t > struct character + { + }; +} + +namespace __gnu_test +{ + using __gnu_cxx::character; + typedef character < unsigned short, unsigned int >pod_ushort; +} +namespace std +{ + using __gnu_test::pod_ushort; + template <> void numpunct < + pod_ushort >::_M_initialize_numpunct (__c_locale) + { + pod_ushort *__truename = new pod_ushort[4 + 1]; + } +} diff --git a/gcc/testsuite/g++.dg/lto/20090106_0.C b/gcc/testsuite/g++.dg/lto/20090106_0.C new file mode 100644 index 00000000000..8c4d3952ef2 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20090106_0.C @@ -0,0 +1,203 @@ +// { dg-lto-do link } +typedef long unsigned int size_t; +namespace std __attribute__ ((__visibility__ ("default"))) { + using ::size_t; + template + struct __is_char + { + }; +# 422 "/usr/include/c++/4.4.0/bits/cpp_type_traits.h" 3 +} +namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { + template + struct __enable_if + { + }; +} +namespace std __attribute__ ((__visibility__ ("default"))) { + template + struct pair + { + }; +} +namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { + template + class new_allocator + { + }; +} +namespace std __attribute__ ((__visibility__ ("default"))) { + template + class allocator: public __gnu_cxx::new_allocator<_Tp> + { + }; + template + struct binary_function + { + }; + template + struct less : public binary_function<_Tp, _Tp, bool> + { + }; + template + struct char_traits + { + typedef _CharT char_type; + static std::size_t + length(const char_type* __s); + }; + template + std::size_t + char_traits<_CharT>:: + length(const char_type* __p) + { + } + template > + class istreambuf_iterator; + template + class basic_string + { + }; +} +namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { + template + class __versa_string; + template + struct __vstring_utility + { + }; + template + class __rc_string_base + { + typedef __vstring_utility<_CharT, _Traits, _Alloc> _Util_Base; + typedef typename _Util_Base::_CharT_alloc_type _CharT_alloc_type; + typedef typename _CharT_alloc_type::size_type size_type; + struct _Rep + { + union + { + }; + static _Rep* + _S_create(size_type, size_type, const _Alloc&); + }; + }; + template + typename __rc_string_base<_CharT, _Traits, _Alloc>::_Rep* + __rc_string_base<_CharT, _Traits, _Alloc>::_Rep:: + _S_create(size_type __capacity, size_type __old_capacity, + const _Alloc& __alloc) + { + }; +} +template, + typename _Alloc = std::allocator<_CharT> > +class basic_string + : public __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc> { +}; +template + operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const std::basic_string<_CharT, _Traits, _Alloc>& __rhs) + { +} +namespace std __attribute__ ((__visibility__ ("default"))) { + struct __uninitialized_copy + { + template + uninitialized_copy(_InputIterator __first, _InputIterator __last, + _ForwardIterator __result) + { + } + }; + template + uninitialized_copy(_InputIterator __first, _InputIterator __last, + _ForwardIterator __result) + { + } + class locale + { + class facet; + }; + class locale::facet + { + }; + class ios_base + { + template + friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, + istreambuf_iterator<_CharT2> >::__type + find(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, + const _CharT2&); + }; + template + class num_put : public locale::facet + { + typedef _CharT char_type; + typedef _OutIter iter_type; + template + iter_type + _M_insert_float(iter_type, ios_base& __io, char_type __fill, + char __mod, _ValueT __v) const; + }; + template + template + _OutIter + num_put<_CharT, _OutIter>:: + _M_insert_float(_OutIter __s, ios_base& __io, _CharT __fill, char __mod, + _ValueT __v) const + { + } + template + class basic_ios : public ios_base + { + }; + template + class basic_istream : virtual public basic_ios<_CharT, _Traits> + { + typedef basic_istream<_CharT, _Traits> __istream_type; + template + __istream_type& + _M_extract(_ValueT& __v); + }; + template + template + basic_istream<_CharT, _Traits>& + basic_istream<_CharT, _Traits>:: + _M_extract(_ValueT& __v) + { + } + class hash_map + { + }; +} +class CDE { + public: + virtual ~CDE() { } +}; +namespace std __attribute__ ((__visibility__ ("default"))) { + template , + typename _Alloc = std::allocator > > + class map + { + }; + template + operator==(const map<_Key, _Tp, _Compare, _Alloc>& __x, + const map<_Key, _Tp, _Compare, _Alloc>& __y) + { return !(__x < __y); } +} +namespace xyz { +class XYZ; +}; +class ABC { + public: + virtual ~ABC() { } +}; +class FGH : public CDE, public ABC { + public: + explicit FGH(CDE* efg); +}; +namespace { +class LMN : public FGH { + LMN(CDE* efg, xyz::XYZ* hij) : FGH(efg) { } +}; +} +main(){} diff --git a/gcc/testsuite/g++.dg/lto/20090112_0.C b/gcc/testsuite/g++.dg/lto/20090112_0.C new file mode 100644 index 00000000000..b9dc24bc1bc --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20090112_0.C @@ -0,0 +1,11 @@ +// { dg-lto-do run } +const char *func(int val) { + switch (val) { + case 2147483647: return "foo"; + default: return ""; + } +} + +int main() { + return 0; +} diff --git a/gcc/testsuite/g++.dg/lto/20090128_0.C b/gcc/testsuite/g++.dg/lto/20090128_0.C new file mode 100644 index 00000000000..24ff5970c12 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20090128_0.C @@ -0,0 +1,88 @@ +// { dg-lto-do assemble } +// { dg-lto-options {{-fpreprocessed -O2 -fwhopr -funsigned-char}} } +typedef unsigned char uint8; +extern const uint8 array[256]; +static inline bool +g (unsigned char c) +{ + return array[c] & 0x80; +} + +class Class1 +{ + static bool f1 (char **dst, const char *end, char c); + static bool f2 (const char *map, const char **src, char **dst, + const char *end); + static bool f3 (const char *src, char *dst, const char *end); +}; + +enum JTipL +{ + KXHR8 = 0, KXNU3, KX_HASH, KXYYZ, KXFI9, KXX3, KXAFA, KXV4Z, KXZ11, +}; + +static const char + p9t42[256] = { KXYYZ, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, + KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, + KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, + KXX3, KXX3, KXX3, KXX3, KXX3, KXAFA, KXX3, KX_HASH, KXAFA, + KXFI9, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXV4Z, KXAFA, KXAFA, + KXAFA, KXV4Z, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, + KXAFA, KXAFA, KXAFA, KXAFA, KXHR8, KXX3, KXV4Z, KXX3, KXNU3, + KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, + KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, + KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, + KXX3, KXX3, KXX3, KXX3, KXAFA, KXX3, KXAFA, KXAFA, KXAFA, KXAFA, + KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, + KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, + KXAFA, KXAFA, KXAFA, KXAFA, KXX3, KXX3, KXX3, KXAFA, KXX3, KXX3, + KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, + KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, + KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, + KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, + KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, + KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, + KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, + KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, + KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, + KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, + KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, + KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, + KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, +}; + +inline bool +Class1::f2 (const char *map, const char **src, char **dst, + const char *end) +{ + if (g ((*src)[1]) && g ((*src)[2])) + { + char c = (static_cast < unsigned char >((*src)[1])) & 0xf; + if (map[c] == KXAFA) + { + } + else if (f1 (dst, end, c)) + { + } + } + return true; +} + +bool +Class1::f3 (const char *src, char *dst, const char *end) +{ + while (dst < end) + { + char c = *src; + char m = p9t42[c]; + switch (m) + { + case KXYYZ: + *dst = '\0'; + case KXFI9: + if (!f2 (p9t42, &src, &dst, end)) + ; + } + } + return false; +} diff --git a/gcc/testsuite/g++.dg/lto/20090221_0.C b/gcc/testsuite/g++.dg/lto/20090221_0.C new file mode 100644 index 00000000000..5bf031906c7 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20090221_0.C @@ -0,0 +1,53 @@ +// { dg-lto-do assemble } +extern void some_function (const char *); +extern bool some_other_function (); + +struct Foo +{ + long long a; + int b; +}; + +bool Foo_eq(Foo x, Foo y) +{ + return x.a == y.a && x.b == y.b; +} + +struct Bar +{ + Foo a; + int b; +}; + +struct Baz +{ + Bar a; + Baz(Bar &a):a(a) { } +}; + +struct Zonk +{ + Baz baz; + + Bar func_1(const Bar & bar) { + if (Foo_eq(bar.a, baz.a.a) && bar.b == baz.a.b || some_other_function ()) + return bar; + } + + void func_2(const Baz & baz) { + func_1(baz.a); + some_function(__PRETTY_FUNCTION__); + } +}; + +void func() { + Bar bar; + Zonk *rep; + rep->func_1(bar); + rep->func_2(Baz(bar)); +} + +void foo () +{ + func(); +} diff --git a/gcc/testsuite/g++.dg/lto/20090302_0.C b/gcc/testsuite/g++.dg/lto/20090302_0.C new file mode 100644 index 00000000000..c71e062f319 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20090302_0.C @@ -0,0 +1,9 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options {{-fPIC -fwhopr -shared}} } */ +struct Foo { + bool Mumble(); + static void Bar() { if (foo_->Mumble()) foo_ = 0; } + static void Baz() { Bar(); } + static Foo *foo_; +}; +void Unused() { Foo::Bar(); Foo::Baz(); } diff --git a/gcc/testsuite/g++.dg/lto/20090302_1.C b/gcc/testsuite/g++.dg/lto/20090302_1.C new file mode 100644 index 00000000000..0ccaf3c8205 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20090302_1.C @@ -0,0 +1,7 @@ +struct Foo { + bool Mumble(); + static void Bar() { if (foo_->Mumble()) foo_ = 0; } + static void Baz() { Bar(); } + static Foo *foo_; +}; +Foo *Foo::foo_; diff --git a/gcc/testsuite/g++.dg/lto/20090303_0.C b/gcc/testsuite/g++.dg/lto/20090303_0.C new file mode 100644 index 00000000000..f6d5512e123 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20090303_0.C @@ -0,0 +1,22 @@ +/* { dg-lto-do run } */ +/* { dg-lto-options {{-fwhopr -fPIC}} } */ +/* { dg-suppress-ld-options {-fPIC} } */ +void foobar(int *, int* __x) ; +int test_ints[30]; +int j; + +void foobar (int *x, int *y) +{ + *x = *y = 0; +} + +void Test() { + int int_set_; + foobar (&int_set_, &test_ints[j]); +} +main() +{ + Test(); + return 0; +} + diff --git a/gcc/testsuite/g++.dg/lto/20090311-1.h b/gcc/testsuite/g++.dg/lto/20090311-1.h new file mode 100644 index 00000000000..389d94f0054 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20090311-1.h @@ -0,0 +1,22 @@ +typedef unsigned long uint32; +typedef int JSIntn; +#define JS_DLL_CALLBACK +typedef JSIntn JSBool; +typedef struct JSContext JSContext; +typedef struct JSObject JSObject; +typedef long long JSInt64; +typedef JSInt64 JSWord; +typedef JSWord jsword; +typedef jsword jsval; + +typedef JSBool +(* JS_DLL_CALLBACK JSPropertyOp)(JSContext *cx, JSObject *ojb, jsval id, + jsval *vp); + +struct JSClass { + const char *name; + uint32 flags; + JSPropertyOp addProperty; +}; + +extern struct JSClass K; diff --git a/gcc/testsuite/g++.dg/lto/20090311-1_0.C b/gcc/testsuite/g++.dg/lto/20090311-1_0.C new file mode 100644 index 00000000000..6d403272428 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20090311-1_0.C @@ -0,0 +1,34 @@ +/* { dg-lto-do run } */ +#include "20090311-1.h" +bool flag; + +struct B { + int a; + enum { ANOTHER, ONE } f2_; + float c; +}; + +extern struct B x[]; + +struct C { + int x; + struct B *p; + float d; +}; + +C c = { 0, 0, 3.4 }; + +struct A { + enum { UNO, DOS, TRES } f1_; + int x; +}; + +A a; + +extern int foo(); +main() +{ + a.x = 4 + c.x; + foo(); + return 0; +} diff --git a/gcc/testsuite/g++.dg/lto/20090311-1_1.C b/gcc/testsuite/g++.dg/lto/20090311-1_1.C new file mode 100644 index 00000000000..520aa957a98 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20090311-1_1.C @@ -0,0 +1,28 @@ +#include "20090311-1.h" + +struct A { + enum { UNO, DOS, TRES } f1_; + int x; +}; + +struct B; + +extern struct B x[]; + +struct C { + int x; + struct B *p; + float d; +}; + +extern A a; +extern B b; +extern bool flag; +extern C c; + +int foo() +{ + if (!flag) + return a.x - c.x; + return 0; +} diff --git a/gcc/testsuite/g++.dg/lto/20090311_0.C b/gcc/testsuite/g++.dg/lto/20090311_0.C new file mode 100644 index 00000000000..cc54bbfdc96 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20090311_0.C @@ -0,0 +1,13 @@ +class C1 { +public: virtual ~C1() { +} +}; +class C2 : public C1 { +public: + C2(void *q); + virtual void A(); +}; +int main(int argc, char **argv) { + C2 h(0); + return 0; +} diff --git a/gcc/testsuite/g++.dg/lto/20090311_1.C b/gcc/testsuite/g++.dg/lto/20090311_1.C new file mode 100644 index 00000000000..e78da7223dd --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20090311_1.C @@ -0,0 +1,13 @@ +class C1 { +public: virtual ~C1() { +} +}; +class C2 : public C1 { + C2(void *q); + virtual void A(); +}; +void C2::A() { +} +C2::C2(void *q) +{ +} diff --git a/gcc/testsuite/g++.dg/lto/20090312.h b/gcc/testsuite/g++.dg/lto/20090312.h new file mode 100644 index 00000000000..c902e93c78d --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20090312.h @@ -0,0 +1,2 @@ +enum Values { ONE, TWO, THREE }; +typedef const char * (* JSErrorCallback)(void *, const char *, const int); diff --git a/gcc/testsuite/g++.dg/lto/20090312_0.C b/gcc/testsuite/g++.dg/lto/20090312_0.C new file mode 100644 index 00000000000..b2222c2aa20 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20090312_0.C @@ -0,0 +1,14 @@ +#include "20090312.h" + +extern "C" { + extern enum Values x; + extern JSErrorCallback p; +}; + +main() +{ + if ( x == ONE && p == 0) + return 0; + + return 1; +} diff --git a/gcc/testsuite/g++.dg/lto/20090312_1.C b/gcc/testsuite/g++.dg/lto/20090312_1.C new file mode 100644 index 00000000000..a0f9085f528 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20090312_1.C @@ -0,0 +1,21 @@ +#include "20090312.h" + +/* This file should be compiled with the C front end. This + should be testing what happens when LTO merges enum types and function + prototypes compiled by the C and C++ FEs. Since both FEs generate + slightly different representations for these, LTO was emitting an + ODR violation error. + + Once dejagnu can deal with multiple languages in a single test, remove + the __cplusplus checks and force this file to be compiled with the + C front end. */ +#ifdef __cplusplus +extern "C" { +#endif + +JSErrorCallback p = 0; +enum Values x = ONE; + +#ifdef __cplusplus +} +#endif diff --git a/gcc/testsuite/g++.dg/lto/20090313_0.C b/gcc/testsuite/g++.dg/lto/20090313_0.C new file mode 100644 index 00000000000..df1a94287b2 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20090313_0.C @@ -0,0 +1,5 @@ +// { dg-lto-do link } +// { dg-lto-options {{-fwhopr -fPIC}} } +// { dg-extra-ld-options "-fwhopr -shared" } + +int X; diff --git a/gcc/testsuite/g++.dg/lto/20090313_1.C b/gcc/testsuite/g++.dg/lto/20090313_1.C new file mode 100644 index 00000000000..088792b2dd3 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20090313_1.C @@ -0,0 +1,12 @@ +struct Foo { + virtual void X(); + virtual void Y(); +}; +struct Bar: public Foo { + Bar(Foo *); + void Y(); +}; +void Baz() { + Foo f; + Bar b(&f); +} diff --git a/gcc/testsuite/g++.dg/lto/20090315_0.C b/gcc/testsuite/g++.dg/lto/20090315_0.C new file mode 100644 index 00000000000..930fb16e5cf --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20090315_0.C @@ -0,0 +1,9 @@ +// { dg-lto-do run } +struct Foo { + bool Mumble() { return true; } + static void Bar() { if (foo_->Mumble()) foo_ = 0; } + static void Baz() { Bar(); } + static Foo *foo_; +}; +Foo *Foo::foo_; +main() { return 0; } diff --git a/gcc/testsuite/g++.dg/lto/20090315_1.C b/gcc/testsuite/g++.dg/lto/20090315_1.C new file mode 100644 index 00000000000..0a2fba552a6 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20090315_1.C @@ -0,0 +1,7 @@ +struct Foo { + bool Mumble() { return true; } + static void Bar() { if (foo_->Mumble()) foo_ = 0; } + static void Baz() { Bar(); } + static Foo *foo_; +}; +void Unused() { Foo::Bar(); Foo::Baz(); } diff --git a/gcc/testsuite/g++.dg/lto/20091002-1_0.C b/gcc/testsuite/g++.dg/lto/20091002-1_0.C new file mode 100644 index 00000000000..d348e9c1a7d --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20091002-1_0.C @@ -0,0 +1,58 @@ +// { dg-lto-do link } +// { dg-lto-options {{-fPIC}} } +// { dg-extra-ld-options "-fPIC -shared" } + +namespace std __attribute__ ((__visibility__ ("default"))) +{ + template struct char_traits; + template > + class basic_ostream; + template > + class istreambuf_iterator; + typedef basic_ostream ostream; + template > + class num_get; + class locale { + class facet; + }; + class locale::facet { + }; + enum _Ios_Iostate { _S_beg = 0, _S_cur = 1, _S_end = 2, + _S_ios_seekdir_end = 1L << 16 }; + class ios_base { + public: + typedef _Ios_Iostate iostate; + }; + template + class num_get : public locale::facet { + typedef _InIter iter_type; + template iter_type + _M_extract_int(iter_type, iter_type, ios_base&, + ios_base::iostate&, _ValueT&) const; + virtual iter_type + do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, bool&) const; + }; + extern template class num_get; + template + class basic_ios : public ios_base { + typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> > + __num_get_type; + const __num_get_type* _M_num_get; + }; + template + class basic_ostream : virtual public basic_ios<_CharT, _Traits> { + public: + typedef basic_ostream<_CharT, _Traits> __ostream_type; + __ostream_type& operator<<(double __f) { } + }; + typedef double Real; + class Vector { + public: + Real operator[](int n) const { } + }; + std::ostream& operator<<(std::ostream& s, const Vector& vec) + { + int i; + s << vec[i] << ')'; + } +} diff --git a/gcc/testsuite/g++.dg/lto/20091002-2_0.C b/gcc/testsuite/g++.dg/lto/20091002-2_0.C new file mode 100644 index 00000000000..5b000fa580c --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20091002-2_0.C @@ -0,0 +1,20 @@ +// { dg-lto-do link } +// { dg-lto-options {{-fPIC}} } +// { dg-extra-ld-options "-fPIC -shared" } + +class DataArray { + int max() const { } +}; +template < class HashItem > +class DataHashTable { + template < class ElemHashItem > + class Element { }; + typedef Element< HashItem > Elem; + DataArray m_elem; +}; +class Name { }; +class NameSet { + DataHashTable < Name > hashtab; +}; +NameSet p; + diff --git a/gcc/testsuite/g++.dg/lto/20091002-3_0.C b/gcc/testsuite/g++.dg/lto/20091002-3_0.C new file mode 100644 index 00000000000..7ed81559dd3 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20091002-3_0.C @@ -0,0 +1,15 @@ +// { dg-lto-do link } +// { dg-lto-options {{-fPIC}} } +// { dg-extra-ld-options "-fPIC -shared" } + +template < class T > +class DataArray { + int max() const { } +}; +class Name { }; +class DataHashTable { + template < class ElemHashItem > class Element { }; + DataArray < Element < Name > > m_elem; +}; +DataHashTable p; + diff --git a/gcc/testsuite/g++.dg/lto/README b/gcc/testsuite/g++.dg/lto/README new file mode 100644 index 00000000000..5fa3123b42d --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/README @@ -0,0 +1,35 @@ +This directory contains tests for link-time optimization (LTO). +Tests in this directory may span multiple files, so the naming of +the files is significant. + +The name of every file must end with '_N' where N is an integer. +All the files with the same name base and different _N suffixes +will be compiled separately and linked together to form the final +executable. + +By default, each set of files will be compiled with list of +options listed in LTO_OPTIONS (../../lib/lto.exp), which can be +overwritten in the shell environment or using the 'dg-lto-options' +command in the main file of the set (i.e., the file with _0 +suffix). + +For example, given the files a_0.C a_1.C a_2.C, they will be +compiled as: + +$ g++ -c a_0.C +$ g++ -c a_1.C +$ g++ -c a_2.C +$ g++ -o a_0.o a_1.o a_2.o + +Tests that do not need more than one file are a special case +where there is a single file named 'foo_0.C'. + +The only supported dg-lto-do option are 'compile', 'run' and 'link'. +Additionally, these can only be used in the main file. If +'compile' is used, only the individual object files are +generated. If 'link' is used, the final executable is generated +but not executed (in this case, function main() needs to exist +but it does not need to do anything). If 'run' is used, the +final executable is generated and the resulting binary executed. + +The default value for dg-lto-do is 'run'. diff --git a/gcc/testsuite/g++.dg/lto/lto.exp b/gcc/testsuite/g++.dg/lto/lto.exp new file mode 100644 index 00000000000..d19bad88927 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/lto.exp @@ -0,0 +1,58 @@ +# Copyright (C) 2009 Free Software Foundation, Inc. + +# This program 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 of the License, or +# (at your option) any later version. +# +# This program 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. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . +# +# Contributed by Diego Novillo + + +# Test link-time optimization across multiple files. +# +# Programs are broken into multiple files. Each one is compiled +# separately with LTO information. The final executable is generated +# by collecting all the generated object files using regular LTO or WHOPR. + +if $tracelevel then { + strace $tracelevel +} + +# Load procedures from common libraries. +load_lib standard.exp +load_lib g++.exp +load_lib target-libpath.exp + +# Load the language-independent compabibility support procedures. +load_lib lto.exp + +g++_init +lto_init + +# Define an identifier for use with this suite to avoid name conflicts +# with other lto tests running at the same time. +set sid "cp_lto" + +# If LTO has not been enabled, bail. +if { ![check_effective_target_lto] } { + return +} + +# Main loop. +foreach src [lsort [find $srcdir/$subdir *_0.C]] { + # If we're only testing specific files and this isn't one of them, skip it. + if ![runtest_file_p $runtests $src] then { + continue + } + + lto-execute $src $sid +} diff --git a/gcc/testsuite/g++.dg/lto/pr40818_0.C b/gcc/testsuite/g++.dg/lto/pr40818_0.C new file mode 100644 index 00000000000..8430f9cd015 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr40818_0.C @@ -0,0 +1,11 @@ +// { dg-lto-do assemble } +// Test case from Eugene A. Strizhov. + +extern int i; +struct S { S (); }; + +S::S () +{ + enum { fifty = 0x50 }; + if (i > fifty); +} diff --git a/gcc/testsuite/g++.dg/opt/thunk3-1.C b/gcc/testsuite/g++.dg/opt/thunk3-1.C new file mode 100644 index 00000000000..c540b0fa2b4 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/thunk3-1.C @@ -0,0 +1,6 @@ +// { dg-do compile } +// { dg-options "-O1" } +struct Foo { }; +struct Bar { virtual ~Bar(); }; +struct Baz: public virtual Bar { virtual void Func (Foo); }; +void unused() { Baz().Func(Foo()); } diff --git a/gcc/testsuite/g++.dg/opt/thunk4.C b/gcc/testsuite/g++.dg/opt/thunk4.C new file mode 100644 index 00000000000..7dd5ea4338b --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/thunk4.C @@ -0,0 +1,63 @@ +// { dg-do compile } +// { dg-options "-O1" } +namespace std __attribute__ ((__visibility__ ("default"))) +{ + template < class _CharT > struct char_traits; +} +namespace std __attribute__ ((__visibility__ ("default"))) +{ + template < typename _CharT, typename _Traits = + char_traits < _CharT > >class basic_iostream; +} + +extern "C++" +{ + namespace std + { + class exception + { + public:exception () throw () + { + } + }; + } +} +namespace std __attribute__ ((__visibility__ ("default"))) +{ + class ios_base + { + public:class failure:public exception + { + }; + virtual ~ ios_base (); + }; +template < typename _CharT, typename _Traits > class basic_ios:public + ios_base + { + }; +template < typename _CharT, typename _Traits > class basic_ostream:virtual public basic_ios < _CharT, + _Traits + > + { + }; +} +namespace std __attribute__ ((__visibility__ ("default"))) +{ +template < typename _CharT, typename _Traits > class basic_istream:virtual public basic_ios < _CharT, + _Traits + > + { + }; +template < typename _CharT, typename _Traits > class basic_iostream:public basic_istream < _CharT, _Traits >, public basic_ostream < _CharT, + _Traits + > + { + }; + class strstream:public basic_iostream < char > + { + virtual ~ strstream (); + }; + strstream::~strstream () + { + } +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp b/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp index 573be92673d..a54f3c1b53e 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp @@ -35,7 +35,7 @@ load_lib torture-options.exp load_lib c-torture.exp torture-init -set-torture-options $C_TORTURE_OPTIONS +set-torture-options $C_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS set additional_flags "" if [istarget "powerpc-*-darwin*"] { diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/abs.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/abs.c index 590ded7892b..1e0857f734d 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/abs.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/abs.c @@ -8,6 +8,7 @@ extern void abort (void); typedef __INTMAX_TYPE__ intmax_t; +__attribute__ ((__noinline__)) int abs (int x) { @@ -15,6 +16,7 @@ abs (int x) return x < 0 ? -x : x; } +__attribute__ ((__noinline__)) long labs (long x) { @@ -22,6 +24,7 @@ labs (long x) return x < 0 ? -x : x; } +__attribute__ ((__noinline__)) long long llabs (long long x) { @@ -29,6 +32,7 @@ llabs (long long x) return x < 0 ? -x : x; } +__attribute__ ((__noinline__)) intmax_t imaxabs (intmax_t x) { diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/bfill.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/bfill.c index c5e9629bd9b..deb6cf5228e 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/bfill.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/bfill.c @@ -1,5 +1,6 @@ extern int inside_main; +__attribute__ ((__noinline__)) void bfill (void *s, __SIZE_TYPE__ n, int ch) { diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/bzero.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/bzero.c index bcbe3a4383a..a02b5358b37 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/bzero.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/bzero.c @@ -1,5 +1,6 @@ extern int inside_main; +__attribute__ ((__noinline__)) void bzero (void *s, __SIZE_TYPE__ n) { diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/fprintf.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/fprintf.c index a22db41d800..853a705e86d 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/fprintf.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/fprintf.c @@ -3,6 +3,7 @@ extern void abort (void); extern int inside_main; +__attribute__ ((__noinline__)) int fprintf (FILE *fp, const char *string, ...) { @@ -19,6 +20,7 @@ fprintf (FILE *fp, const char *string, ...) } /* Locking stdio doesn't matter for the purposes of this test. */ +__attribute__ ((__noinline__)) int fprintf_unlocked (FILE *fp, const char *string, ...) { diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memchr.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memchr.c index ddab08bcf8d..2f15c57a770 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memchr.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memchr.c @@ -1,6 +1,7 @@ extern void abort(void); extern int inside_main; +__attribute__ ((__noinline__)) void * memchr (const void *s, int c, __SIZE_TYPE__ n) { diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memcmp.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memcmp.c index 94c0a576634..fd6556d227b 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memcmp.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memcmp.c @@ -1,6 +1,7 @@ extern void abort(void); extern int inside_main; +__attribute__ ((__noinline__)) int memcmp (const void *s1, const void *s2, __SIZE_TYPE__ len) { diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memmove.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memmove.c index 03faf5e6262..08fcd080148 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memmove.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memmove.c @@ -1,6 +1,7 @@ extern void abort (void); extern int inside_main; +__attribute__ ((__noinline__)) void * memmove (void *dst, const void *src, __SIZE_TYPE__ n) { diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/mempcpy.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/mempcpy.c index 67ee3cbe413..bc16da536ff 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/mempcpy.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/mempcpy.c @@ -1,6 +1,7 @@ extern void abort (void); extern int inside_main; +__attribute__ ((__noinline__)) void * mempcpy (void *dst, const void *src, __SIZE_TYPE__ n) { diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memset.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memset.c index 4bfa33ea66f..90545abbf24 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memset.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memset.c @@ -1,6 +1,7 @@ extern void abort (void); extern int inside_main; +__attribute__ ((__noinline__)) void * memset (void *dst, int c, __SIZE_TYPE__ n) { diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/printf.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/printf.c index 2f8c133177c..4be7578d124 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/printf.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/printf.c @@ -3,6 +3,7 @@ extern void abort (void); extern int inside_main; +__attribute__ ((__noinline__)) int printf (const char *string, ...) { @@ -20,6 +21,7 @@ printf (const char *string, ...) /* Locking stdio doesn't matter for the purposes of this test. */ +__attribute__ ((__noinline__)) int printf_unlocked (const char *string, ...) { diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/sprintf.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/sprintf.c index a015d90a64c..3ac447b117f 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/sprintf.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/sprintf.c @@ -3,6 +3,7 @@ extern void abort (void); extern int inside_main; +__attribute__ ((__noinline__)) int (sprintf) (char *buf, const char *fmt, ...) { diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/stpcpy.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/stpcpy.c index e6e1a6dae9c..2c7c8178bab 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/stpcpy.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/stpcpy.c @@ -1,6 +1,7 @@ extern void abort (void); extern int inside_main; +__attribute__ ((__noinline__)) char * stpcpy (char *dst, const char *src) { diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcat.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcat.c index 2cced80f5d7..d592087a933 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcat.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcat.c @@ -1,6 +1,7 @@ extern int inside_main; extern void abort(void); +__attribute__ ((__noinline__)) char * strcat (char *dst, const char *src) { diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strchr.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strchr.c index 7ca78d1f356..bee3d3203eb 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strchr.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strchr.c @@ -1,6 +1,7 @@ extern void abort (void); extern int inside_main; +__attribute__ ((__noinline__)) char * strchr (const char *s, int c) { @@ -19,6 +20,7 @@ strchr (const char *s, int c) } } +__attribute__ ((__noinline__)) char * index (const char *s, int c) { diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcmp.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcmp.c index 220499ab317..82284546f65 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcmp.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcmp.c @@ -1,6 +1,7 @@ extern void abort (void); extern int inside_main; +__attribute__ ((__noinline__)) int strcmp (const char *s1, const char *s2) { diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcpy.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcpy.c index 45c6a45e4da..916446623f9 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcpy.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcpy.c @@ -1,6 +1,7 @@ extern void abort (void); extern int inside_main; +__attribute__ ((__noinline__)) char * strcpy (char *d, const char *s) { diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcspn.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcspn.c index 53f609114bb..8270996374a 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcspn.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcspn.c @@ -1,6 +1,7 @@ extern void abort (void); extern int inside_main; +__attribute__ ((__noinline__)) __SIZE_TYPE__ strcspn (const char *s1, const char *s2) { diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strlen.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strlen.c index 3ead79d1de5..7f81c115b81 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strlen.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strlen.c @@ -1,6 +1,7 @@ extern void abort (void); extern int inside_main; +__attribute__ ((__noinline__)) __SIZE_TYPE__ strlen (const char *s) { diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncat.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncat.c index 290d4cf49bb..7fd334cb4d8 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncat.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncat.c @@ -3,6 +3,7 @@ extern int inside_main; typedef __SIZE_TYPE__ size_t; +__attribute__ ((__noinline__)) char * strncat (char *s1, const char *s2, size_t n) { diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncmp.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncmp.c index 6599af79044..7a8eb6fd27e 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncmp.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncmp.c @@ -3,6 +3,7 @@ extern int inside_main; typedef __SIZE_TYPE__ size_t; +__attribute__ ((__noinline__)) int strncmp(const char *s1, const char *s2, size_t n) { diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncpy.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncpy.c index b297345e6ca..a6ec98b054a 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncpy.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncpy.c @@ -3,6 +3,7 @@ extern int inside_main; typedef __SIZE_TYPE__ size_t; +__attribute__ ((__noinline__)) char * strncpy(char *s1, const char *s2, size_t n) { diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strpbrk.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strpbrk.c index f6bb0321020..0c049272cca 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strpbrk.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strpbrk.c @@ -1,6 +1,7 @@ extern void abort (void); extern int inside_main; +__attribute__ ((__noinline__)) char * strpbrk(const char *s1, const char *s2) { diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strrchr.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strrchr.c index c2f7107064c..9a45af3c8e5 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strrchr.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strrchr.c @@ -1,6 +1,7 @@ extern void abort (void); extern int inside_main; +__attribute__ ((__noinline__)) char * strrchr (const char *s, int c) { @@ -23,6 +24,7 @@ strrchr (const char *s, int c) return 0; } +__attribute__ ((__noinline__)) char * rindex (const char *s, int c) { diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strspn.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strspn.c index 126c44f263b..622aac6ab38 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strspn.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strspn.c @@ -1,6 +1,7 @@ extern void abort (void); extern int inside_main; +__attribute__ ((__noinline__)) __SIZE_TYPE__ strcspn (const char *s1, const char *s2) { diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strstr.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strstr.c index d803f1ee94b..7d35445063e 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strstr.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strstr.c @@ -1,6 +1,7 @@ extern void abort (void); extern int inside_main; +__attribute__ ((__noinline__)) char * strstr(const char *s1, const char *s2) { diff --git a/gcc/testsuite/gcc.c-torture/execute/execute.exp b/gcc/testsuite/gcc.c-torture/execute/execute.exp index 9b6bccd0c31..a26e5907639 100644 --- a/gcc/testsuite/gcc.c-torture/execute/execute.exp +++ b/gcc/testsuite/gcc.c-torture/execute/execute.exp @@ -32,7 +32,7 @@ load_lib torture-options.exp load_lib c-torture.exp torture-init -set-torture-options $C_TORTURE_OPTIONS +set-torture-options $C_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS # # main test loop diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp b/gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp index 558829aa5f9..c23f32e85ab 100644 --- a/gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp @@ -35,7 +35,7 @@ if $tracelevel then { } torture-init -set-torture-options $C_TORTURE_OPTIONS +set-torture-options $C_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS set additional_flags "-fno-inline" diff --git a/gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp b/gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp index 4a8ebe75c5e..def4bc5afb6 100644 --- a/gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp +++ b/gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp @@ -33,7 +33,7 @@ load_lib c-torture.exp load_lib torture-options.exp torture-init -set-torture-options $C_TORTURE_OPTIONS +set-torture-options $C_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS # # This loop will run c-torture on any *.c file found in this directory. diff --git a/gcc/testsuite/gcc.dg/20081223-1.c b/gcc/testsuite/gcc.dg/20081223-1.c new file mode 100644 index 00000000000..3c36955c9e3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/20081223-1.c @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-options "-fwhopr" { target lto } } */ + +typedef struct foo_ foo_t; +foo_t bar; /* { dg-error "storage size of 'bar' isn't known" } */ diff --git a/gcc/testsuite/gcc.dg/lto/20080908_0.c b/gcc/testsuite/gcc.dg/lto/20080908_0.c new file mode 100644 index 00000000000..3bc1c3a725c --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20080908_0.c @@ -0,0 +1,16 @@ +/* { dg-lto-do assemble } */ +void foo(void) { + char *bar; + int baz; + while (1) + { + if (baz) + { + baz = -baz; + do + *bar++ = 0; + while (++baz); + } + ++baz; + } +} diff --git a/gcc/testsuite/gcc.dg/lto/20080917_0.c b/gcc/testsuite/gcc.dg/lto/20080917_0.c new file mode 100644 index 00000000000..ac0891081fe --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20080917_0.c @@ -0,0 +1,29 @@ +/* { dg-lto-do assemble } */ +/* { dg-lto-options {{-O2 -funsigned-char}} } */ +int +foo (char *s, int flag) +{ + for (;;) + { + unsigned char c; + if (flag) + c = *s; + else + c = *s; + return c; + } +} + +int +baz (const char *s, int flag) +{ + for (;;) + { + unsigned char c; + if (flag) + c = *s; + else + c = *s; + return c; + } +} diff --git a/gcc/testsuite/gcc.dg/lto/20080924_0.c b/gcc/testsuite/gcc.dg/lto/20080924_0.c new file mode 100644 index 00000000000..db7745077e2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20080924_0.c @@ -0,0 +1,9 @@ +/* { dg-lto-do assemble } */ +/* { dg-lto-options {{-O2 -flto -funsigned-char}} } */ +typedef unsigned int size_t; +foo (const char *src, unsigned char *dst, size_t size) +{ + int ch; + while ((ch = *src++) != '\0') { + } +} diff --git a/gcc/testsuite/gcc.dg/lto/20081024_0.c b/gcc/testsuite/gcc.dg/lto/20081024_0.c new file mode 100644 index 00000000000..9fa297abc0e --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081024_0.c @@ -0,0 +1,26 @@ +/* { dg-lto-do run } */ + +#include +#include +#include + +char * +myprintf (const char *fmt, ...) +{ + va_list args; + static char buf[80]; + + va_start (args, fmt); + (void) vsnprintf (buf, sizeof (buf), fmt, args); + va_end (args); + return buf; +} + +int +main () +{ + char *s; + + s = myprintf ("%s: %d\n", "foo", 1); + return strcmp (s, "foo: 1\n") != 0; +} diff --git a/gcc/testsuite/gcc.dg/lto/20081109_0.c b/gcc/testsuite/gcc.dg/lto/20081109_0.c new file mode 100644 index 00000000000..eaa25f673d3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081109_0.c @@ -0,0 +1,3 @@ +/* { dg-lto-do assemble } */ +/* { dg-lto-options {{-w -flto}} } */ +void Foo(void) { char bar[1]; free(bar); } diff --git a/gcc/testsuite/gcc.dg/lto/20081111_0.c b/gcc/testsuite/gcc.dg/lto/20081111_0.c new file mode 100644 index 00000000000..899689c1bc4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081111_0.c @@ -0,0 +1,11 @@ +extern int mumble; +extern void abort (void); +extern void exit (int); + +int +main () +{ + if (++mumble != 42) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/lto/20081111_1.c b/gcc/testsuite/gcc.dg/lto/20081111_1.c new file mode 100644 index 00000000000..2b7fee58690 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081111_1.c @@ -0,0 +1,7 @@ +int mumble = 41; + +int +bar (void) +{ + return mumble; +} diff --git a/gcc/testsuite/gcc.dg/lto/20081112_0.c b/gcc/testsuite/gcc.dg/lto/20081112_0.c new file mode 100644 index 00000000000..a90aa70b3ab --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081112_0.c @@ -0,0 +1,14 @@ +extern void exit (int); +extern void abort (void); + +extern void f (); +extern int g (); + +int +main () +{ + f (); + if (g () != 42) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/lto/20081112_1.c b/gcc/testsuite/gcc.dg/lto/20081112_1.c new file mode 100644 index 00000000000..2ba1cb9405c --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081112_1.c @@ -0,0 +1,13 @@ +static int mumble; + +void +f (void) +{ + mumble = 41; +} + +int __attribute__((noinline)) +g (void) +{ + return ++mumble; +} diff --git a/gcc/testsuite/gcc.dg/lto/20081115_0.c b/gcc/testsuite/gcc.dg/lto/20081115_0.c new file mode 100644 index 00000000000..f24a92deda4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081115_0.c @@ -0,0 +1,32 @@ +/* { dg-lto-options {{-O2 -DOPTIMIZE -fwhopr} {-O0 -fwhopr}} } */ + +extern void abort (void); + +int f (void) +{ + return 1; +} + +extern inline int +e_inline_baz (void) +{ + return 1 + f(); +} + +int +bar (void) +{ + return e_inline_baz (); +} + +main () +{ +#ifdef OPTIMIZE + if (bar () != 2 || foo () != 3) + abort (); +#else + if (bar () != 0 || foo () != 0) + abort (); +#endif + return 0; +} diff --git a/gcc/testsuite/gcc.dg/lto/20081115_1.c b/gcc/testsuite/gcc.dg/lto/20081115_1.c new file mode 100644 index 00000000000..62ffa520000 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081115_1.c @@ -0,0 +1,11 @@ +extern inline int +e_inline_baz (void) +{ + return 2 + 1; +} + +int +foo (void) +{ + return e_inline_baz (); +} diff --git a/gcc/testsuite/gcc.dg/lto/20081115_2.c b/gcc/testsuite/gcc.dg/lto/20081115_2.c new file mode 100644 index 00000000000..0ccecd7363d --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081115_2.c @@ -0,0 +1,5 @@ +int +e_inline_baz (void) +{ + return 0; +} diff --git a/gcc/testsuite/gcc.dg/lto/20081118_0.c b/gcc/testsuite/gcc.dg/lto/20081118_0.c new file mode 100644 index 00000000000..0640428be6d --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081118_0.c @@ -0,0 +1,28 @@ +/* { dg-lto-options {{-O2 -DOPTIMIZE -fwhopr} {-O0 -fwhopr}} } */ + +extern void abort (void); +extern int f (void); + +extern inline int +e_inline_baz (void) +{ + return 1 + f(); +} + +int +bar (void) +{ + return e_inline_baz (); +} + +main () +{ +#ifdef OPTIMIZE + if (bar () != 2 || foo () != 3) + abort (); +#else + if (bar () != 0 || foo () != 0) + abort (); +#endif + return 0; +} diff --git a/gcc/testsuite/gcc.dg/lto/20081118_1.c b/gcc/testsuite/gcc.dg/lto/20081118_1.c new file mode 100644 index 00000000000..f0a8c3c876b --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081118_1.c @@ -0,0 +1,13 @@ +extern int f (void); + +extern inline int +e_inline_baz (void) +{ + return 2 + f (); +} + +int +foo (void) +{ + return e_inline_baz (); +} diff --git a/gcc/testsuite/gcc.dg/lto/20081118_2.c b/gcc/testsuite/gcc.dg/lto/20081118_2.c new file mode 100644 index 00000000000..32ce432a128 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081118_2.c @@ -0,0 +1,11 @@ +int +e_inline_baz (void) +{ + return 0; +} + + __attribute__((noinline)) int +f (void) +{ + return 1; +} diff --git a/gcc/testsuite/gcc.dg/lto/20081120-1_0.c b/gcc/testsuite/gcc.dg/lto/20081120-1_0.c new file mode 100644 index 00000000000..c35119605d6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081120-1_0.c @@ -0,0 +1,5 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options {{-flto -shared}} } */ +extern int stat(void) __asm__("" "stat64"); +extern inline int stat(void) { } +static void foo(void) { stat(); } diff --git a/gcc/testsuite/gcc.dg/lto/20081120-1_1.c b/gcc/testsuite/gcc.dg/lto/20081120-1_1.c new file mode 100644 index 00000000000..73d25000c91 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081120-1_1.c @@ -0,0 +1,3 @@ +extern int stat(void) __asm__("" "stat64"); +extern inline int stat(void) { } +static void foo(void) { stat(); } diff --git a/gcc/testsuite/gcc.dg/lto/20081120-2_0.c b/gcc/testsuite/gcc.dg/lto/20081120-2_0.c new file mode 100644 index 00000000000..ff8a9a435f2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081120-2_0.c @@ -0,0 +1,3 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options {{-fwhopr -shared}} } */ +void bar(void) {} diff --git a/gcc/testsuite/gcc.dg/lto/20081120-2_1.c b/gcc/testsuite/gcc.dg/lto/20081120-2_1.c new file mode 100644 index 00000000000..c81f8c7fd07 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081120-2_1.c @@ -0,0 +1,2 @@ +int mumble = 0; +void foo(void) {} diff --git a/gcc/testsuite/gcc.dg/lto/20081125_0.c b/gcc/testsuite/gcc.dg/lto/20081125_0.c new file mode 100644 index 00000000000..4b2e7191fed --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081125_0.c @@ -0,0 +1,6 @@ +int foo (int); + +int main() +{ + return foo (0); +} diff --git a/gcc/testsuite/gcc.dg/lto/20081125_1.c b/gcc/testsuite/gcc.dg/lto/20081125_1.c new file mode 100644 index 00000000000..1fcf4e7d391 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081125_1.c @@ -0,0 +1,4 @@ +int foo (int x) +{ + return x; +} diff --git a/gcc/testsuite/gcc.dg/lto/20081126_0.c b/gcc/testsuite/gcc.dg/lto/20081126_0.c new file mode 100644 index 00000000000..9d0bb14c4cb --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081126_0.c @@ -0,0 +1,8 @@ +/* { dg-lto-do link } */ +/* { dg-skip-if "" { ! { i?86-*-* x86_64-*-* } } { "*" } { "" } } */ +/* { dg-lto-options {{-flto -shared}} } */ + +int f(void) { + register int ri asm("edi"); + return ri; +} diff --git a/gcc/testsuite/gcc.dg/lto/20081201-1_0.c b/gcc/testsuite/gcc.dg/lto/20081201-1_0.c new file mode 100644 index 00000000000..05cbb82fdd1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081201-1_0.c @@ -0,0 +1,33 @@ +/* { dg-lto-options {{-O2 -DOPTIMIZE -fwhopr} {-O0 -fwhopr}} } */ + +extern void abort (void); + +int +f (void) +{ + return 1; +} + +extern inline int +e_inline_baz (void) +{ + return 1 + f(); +} + +int +bar (void) +{ + return e_inline_baz (); +} + +main () +{ +#ifdef OPTIMIZE + if (bar () != 2 || foo () != 3) + abort (); +#else + if (bar () != 0 || foo () != 0) + abort (); +#endif + return 0; +} diff --git a/gcc/testsuite/gcc.dg/lto/20081201-1_1.c b/gcc/testsuite/gcc.dg/lto/20081201-1_1.c new file mode 100644 index 00000000000..f0a8c3c876b --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081201-1_1.c @@ -0,0 +1,13 @@ +extern int f (void); + +extern inline int +e_inline_baz (void) +{ + return 2 + f (); +} + +int +foo (void) +{ + return e_inline_baz (); +} diff --git a/gcc/testsuite/gcc.dg/lto/20081201-1_2.c b/gcc/testsuite/gcc.dg/lto/20081201-1_2.c new file mode 100644 index 00000000000..bcf87a749b5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081201-1_2.c @@ -0,0 +1,7 @@ +int +e_inline_baz (void) +{ + return 0; +} + + diff --git a/gcc/testsuite/gcc.dg/lto/20081201-2_0.c b/gcc/testsuite/gcc.dg/lto/20081201-2_0.c new file mode 100644 index 00000000000..4c1510d1cec --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081201-2_0.c @@ -0,0 +1,16 @@ +/* { dg-lto-options {{-O3 -fwhopr}} } */ + +/* Test that cross-TU inlining works. */ + +extern void abort (); +extern void exit (int); +extern void *foo (void); + +int +main () +{ + if (foo () != __builtin_return_address (0)) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/lto/20081201-2_1.c b/gcc/testsuite/gcc.dg/lto/20081201-2_1.c new file mode 100644 index 00000000000..f93e1fd025f --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081201-2_1.c @@ -0,0 +1,5 @@ +void * +foo (void) +{ + return __builtin_return_address (0); +} diff --git a/gcc/testsuite/gcc.dg/lto/20081202-1_0.c b/gcc/testsuite/gcc.dg/lto/20081202-1_0.c new file mode 100644 index 00000000000..933610a894b --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081202-1_0.c @@ -0,0 +1,11 @@ +/* { dg-lto-options {{-fwhopr -O3}} } */ + +extern void exit (int); +extern void foo (void); + +int +main () +{ + foo (); + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/lto/20081202-1_1.c b/gcc/testsuite/gcc.dg/lto/20081202-1_1.c new file mode 100644 index 00000000000..2f6777864a0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081202-1_1.c @@ -0,0 +1,10 @@ +static void __attribute__((noinline)) +bar (void) +{ +} + +void +foo (void) +{ + bar (); +} diff --git a/gcc/testsuite/gcc.dg/lto/20081202-2_0.c b/gcc/testsuite/gcc.dg/lto/20081202-2_0.c new file mode 100644 index 00000000000..09f417698ca --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081202-2_0.c @@ -0,0 +1,13 @@ +/* { dg-lto-options {{-fwhopr -O3}} } */ + +extern void exit (int); +extern void *foo (void); + +void *p; + +int +main () +{ + p = foo (); + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/lto/20081202-2_1.c b/gcc/testsuite/gcc.dg/lto/20081202-2_1.c new file mode 100644 index 00000000000..adb15024502 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081202-2_1.c @@ -0,0 +1,16 @@ +static void __attribute__((noinline)) +bar (void) +{ +} + +void * +foo (void) +{ + return bar; +} + +void +quxx (void) +{ + return bar (); +} diff --git a/gcc/testsuite/gcc.dg/lto/20081204-1_0.c b/gcc/testsuite/gcc.dg/lto/20081204-1_0.c new file mode 100644 index 00000000000..92598085c9a --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081204-1_0.c @@ -0,0 +1,7 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options {{-fwhopr -fPIC -shared}} } */ + +/* Tests for the absence during linking of: + lto1: error: type of 'i' does not match original declaration */ + +const int i[1]; diff --git a/gcc/testsuite/gcc.dg/lto/20081204-1_1.c b/gcc/testsuite/gcc.dg/lto/20081204-1_1.c new file mode 100644 index 00000000000..95761ea156b --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081204-1_1.c @@ -0,0 +1,5 @@ +extern const int i[]; + +int dummy(void) { + return i[0]; +} diff --git a/gcc/testsuite/gcc.dg/lto/20081204-2_0.c b/gcc/testsuite/gcc.dg/lto/20081204-2_0.c new file mode 100644 index 00000000000..241ac5d607a --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081204-2_0.c @@ -0,0 +1,5 @@ +/* { dg-lto-do link } */ +/* { dg-skip-if "" { ! { i?86-*-* x86_64-*-* } } { "*" } { "" } } */ +/* { dg-lto-options {{-w -flto -fPIC -shared}} } */ + +register int ri asm("edi"); diff --git a/gcc/testsuite/gcc.dg/lto/20081210-1_0.c b/gcc/testsuite/gcc.dg/lto/20081210-1_0.c new file mode 100644 index 00000000000..5cf020ec227 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081210-1_0.c @@ -0,0 +1,21 @@ +#if defined(_LP64) || defined(_WIN64) +typedef unsigned long int uintptr_t; +#else +typedef unsigned int uintptr_t; +#endif + +extern void srand (uintptr_t); + +inline void +foo (uintptr_t seed) +{ + srand (seed * seed); +} + +int +main () +{ + foo (0); + srand ((uintptr_t) (&foo)); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/lto/20081212-1_0.c b/gcc/testsuite/gcc.dg/lto/20081212-1_0.c new file mode 100644 index 00000000000..a19bff1bac5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081212-1_0.c @@ -0,0 +1,4 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options {{-shared}} } */ +int exported_var = 42; +/* { dg-final { scan-symbol "exported_var" } } */ diff --git a/gcc/testsuite/gcc.dg/lto/20081222_0.c b/gcc/testsuite/gcc.dg/lto/20081222_0.c new file mode 100644 index 00000000000..e44766613bd --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081222_0.c @@ -0,0 +1,11 @@ +#include "20081222_0.h" + +extern void abort (void); + +int +main () +{ + if (x () == 7) + return 0; + abort (); +} diff --git a/gcc/testsuite/gcc.dg/lto/20081222_0.h b/gcc/testsuite/gcc.dg/lto/20081222_0.h new file mode 100644 index 00000000000..4c26f461651 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081222_0.h @@ -0,0 +1 @@ +int x(); diff --git a/gcc/testsuite/gcc.dg/lto/20081222_1.c b/gcc/testsuite/gcc.dg/lto/20081222_1.c new file mode 100644 index 00000000000..e8f9254421b --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081222_1.c @@ -0,0 +1,16 @@ +#include "20081222_0.h" + +/* Actually, call "x" "INT_X", and make it hidden. */ +extern __typeof (x) x + __asm__ ("INT_x") + __attribute__ ((__visibility__ ("hidden"))); + +int x () +{ + return 7; +} + +/* Make an externally-visible symbol "X" that's an alias for INT_x. */ +extern __typeof (x) EXT_x + __asm__ ("x") + __attribute__ ((__alias__ ("INT_x"))); diff --git a/gcc/testsuite/gcc.dg/lto/20081224_0.c b/gcc/testsuite/gcc.dg/lto/20081224_0.c new file mode 100644 index 00000000000..c146115b086 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081224_0.c @@ -0,0 +1,9 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options {{-fwhopr -shared -fPIC}} } */ +#include "20081224_0.h" + +extern struct foo x; + +void f(void) { + x.x = 0; +} diff --git a/gcc/testsuite/gcc.dg/lto/20081224_0.h b/gcc/testsuite/gcc.dg/lto/20081224_0.h new file mode 100644 index 00000000000..7b62a079667 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081224_0.h @@ -0,0 +1,3 @@ +typedef struct foo { + int x; +} foo_t; diff --git a/gcc/testsuite/gcc.dg/lto/20081224_1.c b/gcc/testsuite/gcc.dg/lto/20081224_1.c new file mode 100644 index 00000000000..3e1ff341088 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20081224_1.c @@ -0,0 +1,2 @@ +#include "20081224_0.h" +foo_t x; diff --git a/gcc/testsuite/gcc.dg/lto/20090116_0.c b/gcc/testsuite/gcc.dg/lto/20090116_0.c new file mode 100644 index 00000000000..4b88e4ab3b1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090116_0.c @@ -0,0 +1,12 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options {{-O1 -fwhopr -fPIC}} } */ +/* { dg-extra-ld-options {-shared -O0} } */ + +int foo(void) { + int ret, i; + for (i = 0; i < 1; i++) + ret = 0; + for (i = 0; i < 1; i++) + ret = 1; + return ret; +} diff --git a/gcc/testsuite/gcc.dg/lto/20090120_0.c b/gcc/testsuite/gcc.dg/lto/20090120_0.c new file mode 100644 index 00000000000..6c69a9918b2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090120_0.c @@ -0,0 +1,14 @@ +/* { dg-lto-options {{-flto -funsigned-char}} } */ + +extern void abort (); + +char c = 0xff; + +int +main () +{ + int i = (unsigned) c; + if (i < 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/lto/20090126-1_0.c b/gcc/testsuite/gcc.dg/lto/20090126-1_0.c new file mode 100644 index 00000000000..0ed8ea32401 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090126-1_0.c @@ -0,0 +1,7 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options {{-O0 -fwhopr}} } */ +/* { dg-extra-ld-options {-shared -O2 -fwhopr} } */ + +int main(int argc, char **argv) { + return 0; +} diff --git a/gcc/testsuite/gcc.dg/lto/20090126-2_0.c b/gcc/testsuite/gcc.dg/lto/20090126-2_0.c new file mode 100644 index 00000000000..64e63853250 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090126-2_0.c @@ -0,0 +1,7 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options {{-fPIC -O2 -fwhopr}} } */ +/* { dg-extra-ld-options {-fno-PIC -shared -O2 -fwhopr} } */ + +int main(int argc, char **argv) { + return 0; +} diff --git a/gcc/testsuite/gcc.dg/lto/20090206-1_0.c b/gcc/testsuite/gcc.dg/lto/20090206-1_0.c new file mode 100644 index 00000000000..42eaca9d5e2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090206-1_0.c @@ -0,0 +1,10 @@ +/* { dg-lto-do link } */ +/* { dg-skip-if "" { ! { i?86-*-linux* x86_64-*-linux* } } { "*" } { "" } } */ +/* { dg-lto-options {{-fPIC -shared -fwhopr -msse2}} } */ +/* { dg-suppress-ld-options {-fPIC -msse2} } */ + +typedef short v8hi __attribute__((__vector_size__(16))); +void func (void) { + v8hi x, y, z; + z = __builtin_ia32_paddw128 (x, y); +} diff --git a/gcc/testsuite/gcc.dg/lto/20090206-2_0.c b/gcc/testsuite/gcc.dg/lto/20090206-2_0.c new file mode 100644 index 00000000000..3e85c5d227c --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090206-2_0.c @@ -0,0 +1,18 @@ +/* { dg-lto-do link } */ +/* { dg-skip-if "" { ! { i?86-*-linux* x86_64-*-linux* } } { "*" } { "" } } */ +/* { dg-lto-options {{-fwhopr -fPIC}} } */ +/* { dg-suppress-ld-options {-fPIC} } */ + +void func(int n) { + static int __thread v = 0; + int i; + for (i = 0; i < n; ++i) { + volatile int *p = &v; + volatile int x __attribute__ ((unused)) = *p; + } +} + +int main(int argc, char **argv) { + func(argc); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/lto/20090210_0.c b/gcc/testsuite/gcc.dg/lto/20090210_0.c new file mode 100644 index 00000000000..c588e8a2778 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090210_0.c @@ -0,0 +1,6 @@ +/* { dg-lto-do run } */ +/* { dg-suppress-ld-options {-fPIC} } */ +int foo (int x) +{ + return x; +} diff --git a/gcc/testsuite/gcc.dg/lto/20090210_1.c b/gcc/testsuite/gcc.dg/lto/20090210_1.c new file mode 100644 index 00000000000..bf12aa6c08b --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090210_1.c @@ -0,0 +1,22 @@ +/* { dg-options "-fPIC" } */ +static void +f (int n) +{ + int i; + static int __thread value = 100; + for (i = 0; i < n; ++i) + { + volatile int *p = &value; + volatile int x __attribute__ ((unused)) = *p; + } +} + + +extern int foo (int); + +int +main (int argc, char **argv) +{ + f (foo (4) + argc); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/lto/20090213_0.c b/gcc/testsuite/gcc.dg/lto/20090213_0.c new file mode 100644 index 00000000000..6387a0e4716 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090213_0.c @@ -0,0 +1,11 @@ +/* { dg-lto-do run } */ +#include + +extern int foo (int); + +main() +{ + int x = foo (10); + printf ("x is %d, foo is at 0x%p\n", x, foo); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/lto/20090213_1.c b/gcc/testsuite/gcc.dg/lto/20090213_1.c new file mode 100644 index 00000000000..4a852efd193 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090213_1.c @@ -0,0 +1,6 @@ +int foo (int x) +{ + return x * 32; +} + + diff --git a/gcc/testsuite/gcc.dg/lto/20090218-1_0.c b/gcc/testsuite/gcc.dg/lto/20090218-1_0.c new file mode 100644 index 00000000000..1dc9ee08540 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090218-1_0.c @@ -0,0 +1,4 @@ +void set_mem_alias_set () __attribute__ ((always_inline)); +void emit_push_insn () { + set_mem_alias_set (); +} diff --git a/gcc/testsuite/gcc.dg/lto/20090218-1_1.c b/gcc/testsuite/gcc.dg/lto/20090218-1_1.c new file mode 100644 index 00000000000..33d4fb000f3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090218-1_1.c @@ -0,0 +1,9 @@ +int main(void) +{ + return 0; +} +static void __attribute__ ((noinline)) get_mem_attrs () { +} +void __attribute__ ((always_inline)) set_mem_alias_set () { + get_mem_attrs (); +} diff --git a/gcc/testsuite/gcc.dg/lto/20090218-2_0.c b/gcc/testsuite/gcc.dg/lto/20090218-2_0.c new file mode 100644 index 00000000000..8857e7a6d21 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090218-2_0.c @@ -0,0 +1,3 @@ +void emit_push_insn () { + set_mem_alias_set (); +} diff --git a/gcc/testsuite/gcc.dg/lto/20090218-2_1.c b/gcc/testsuite/gcc.dg/lto/20090218-2_1.c new file mode 100644 index 00000000000..119fbe4a16b --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090218-2_1.c @@ -0,0 +1,19 @@ +typedef struct { +} mem_attrs; +int main(void) +{ + return 0; +} +void *malloc(unsigned long size); +void *memcpy(void *dest, const void *src, unsigned long n); +static mem_attrs * get_mem_attrs () { + void **slot; + *slot = malloc (3); + memcpy (*slot, 0, 3); +} +void set_mem_attributes () { + get_mem_attrs (); +} +void set_mem_alias_set () { + get_mem_attrs (); +} diff --git a/gcc/testsuite/gcc.dg/lto/20090218_0.c b/gcc/testsuite/gcc.dg/lto/20090218_0.c new file mode 100644 index 00000000000..c4390fa1f10 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090218_0.c @@ -0,0 +1,7 @@ +void __attribute__((noinline)) *foo1(void); +void __attribute__((noinline)) *foo2(void); + +int main(void) +{ + return foo1() != foo2(); +} diff --git a/gcc/testsuite/gcc.dg/lto/20090218_1.c b/gcc/testsuite/gcc.dg/lto/20090218_1.c new file mode 100644 index 00000000000..c28b84ada6e --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090218_1.c @@ -0,0 +1,6 @@ +void bar(void); +void __attribute__((noinline)) *foo1 (void) +{ + bar(); + return (void *) bar; +} diff --git a/gcc/testsuite/gcc.dg/lto/20090218_2.c b/gcc/testsuite/gcc.dg/lto/20090218_2.c new file mode 100644 index 00000000000..e9f835f3627 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090218_2.c @@ -0,0 +1,6 @@ +void bar(void); +void __attribute__((noinline)) *foo2 (void) +{ + bar(); + return (void *) bar; +} diff --git a/gcc/testsuite/gcc.dg/lto/20090218_3.c b/gcc/testsuite/gcc.dg/lto/20090218_3.c new file mode 100644 index 00000000000..e1f4df61479 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090218_3.c @@ -0,0 +1,3 @@ +void bar(void) +{ +} diff --git a/gcc/testsuite/gcc.dg/lto/20090219_0.c b/gcc/testsuite/gcc.dg/lto/20090219_0.c new file mode 100644 index 00000000000..6229de7aef1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090219_0.c @@ -0,0 +1,28 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options {{-O3 -fwhopr -fPIC -shared}} } */ + +struct Foo { int f1, f2, f3, f4, f5; }; + +int x = 0; +struct Foo *foo; + +inline void Bar(int n){ + foo[x].f1 = 0; + foo[x].f2 = 0; + foo[x].f3 = 0; + foo[x].f4 = 0; + foo[x].f5 = n; +} + +int ei[1]; +inline void Baz(int n) { + if (ei[n] == 1) + Bar (0); + else if (ei[n] == 0) + Bar (1); +} + +void mumble(void) { + for (;;) + Baz (0); +} diff --git a/gcc/testsuite/gcc.dg/lto/20090312_0.c b/gcc/testsuite/gcc.dg/lto/20090312_0.c new file mode 100644 index 00000000000..8aaad754cc3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090312_0.c @@ -0,0 +1,43 @@ +/* { dg-lto-do link } */ +extern int **foo (void); +extern void mumble (char*, char*, char*); + +static int * +bar (char **sp) +{ + char *s = *sp, *rs = s; + int c; + while (*foo ()[c]) + rs++; + while (c = *rs) + { + if (c || ((c == '"') || (c == '\''))) + { + if (c) + *rs++ = c; + else + mumble (0, "", ""); + } + else if (c || (*foo ()[c] & 1)) + *rs++ = c; + } + if (c) + mumble (0, "", ""); +} + +static void +baz (char *s) +{ + char *args[100]; + while (bar (&s)) + { + mumble (args[0], "", ""); + } +} + +int +main (void) +{ + baz (""); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/lto/20090312_1.c b/gcc/testsuite/gcc.dg/lto/20090312_1.c new file mode 100644 index 00000000000..882fb0f4157 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090312_1.c @@ -0,0 +1,9 @@ +int **foo (void) +{ + +} + +void mumble (char* a, char* b , char* c) +{ + +} diff --git a/gcc/testsuite/gcc.dg/lto/20090313_0.c b/gcc/testsuite/gcc.dg/lto/20090313_0.c new file mode 100644 index 00000000000..120ba3c50e0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090313_0.c @@ -0,0 +1,9 @@ +void +_cairo_clip_path_reference () { + int a; + __sync_fetch_and_add(&a, 1); +} + +int main(void) { + return 0; +} diff --git a/gcc/testsuite/gcc.dg/lto/20090706-1_0.c b/gcc/testsuite/gcc.dg/lto/20090706-1_0.c new file mode 100644 index 00000000000..7877fd350d7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090706-1_0.c @@ -0,0 +1,42 @@ +#include + +extern void abort (void); + +void foo (int size, ...) +{ + struct + { + struct + { + char x[size]; + } e; + unsigned r; + } d; + va_list ap; + char c; + int i; + + va_start (ap, size); + d = va_arg (ap, typeof (d)); + c = d.e.x[3]; + if (c != '3') + abort (); + if (d.r != 2602) + abort (); + va_end (ap); +} + +int main (void) +{ + int z = 5, i; + struct { struct { char a[z]; } y; unsigned r; } x; + + x.y.a[0] = '0'; + x.y.a[1] = '1'; + x.y.a[2] = '2'; + x.y.a[3] = '3'; + x.y.a[4] = '4'; + x.r = 2602; + foo (z, x); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/lto/20090706-2_0.c b/gcc/testsuite/gcc.dg/lto/20090706-2_0.c new file mode 100644 index 00000000000..69da98b5cca --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090706-2_0.c @@ -0,0 +1,16 @@ +extern void abort (void); + +int foo (int size) +{ + int a[size]; + a[size - 10] = 42; + return a[size - 10] + size; +} + +main() +{ + int x = foo (20); + if (x != 62) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/lto/20090717_0.c b/gcc/testsuite/gcc.dg/lto/20090717_0.c new file mode 100644 index 00000000000..fe13bdf78d4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090717_0.c @@ -0,0 +1,4 @@ +struct variable { + const char *string; +}; +struct variable table[] = { }; diff --git a/gcc/testsuite/gcc.dg/lto/20090717_1.c b/gcc/testsuite/gcc.dg/lto/20090717_1.c new file mode 100644 index 00000000000..bda8138214b --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090717_1.c @@ -0,0 +1,11 @@ +struct variable { + const char *string; +}; +extern struct variable table[]; +int main(int argc, char *argv[]) +{ + struct variable *p; + for(p = table; p->string; p++) + ; + return 0; +} diff --git a/gcc/testsuite/gcc.dg/lto/20090729_0.c b/gcc/testsuite/gcc.dg/lto/20090729_0.c new file mode 100644 index 00000000000..05ae74f872e --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090729_0.c @@ -0,0 +1,4 @@ +/* { dg-lto-options "-w" } */ + +double i; +int j; diff --git a/gcc/testsuite/gcc.dg/lto/20090729_1.c b/gcc/testsuite/gcc.dg/lto/20090729_1.c new file mode 100644 index 00000000000..0a5091ac29e --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090729_1.c @@ -0,0 +1,4 @@ +double j; +int i; +int main () { return i; } + diff --git a/gcc/testsuite/gcc.dg/lto/20090812_0.c b/gcc/testsuite/gcc.dg/lto/20090812_0.c new file mode 100644 index 00000000000..baf20f520a2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090812_0.c @@ -0,0 +1,11 @@ +struct X; +struct Y +{ + struct X *p; + int i; +}; + +void foo (struct Y *p) +{ + p->i = 1; +} diff --git a/gcc/testsuite/gcc.dg/lto/20090812_1.c b/gcc/testsuite/gcc.dg/lto/20090812_1.c new file mode 100644 index 00000000000..e91424492a0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090812_1.c @@ -0,0 +1,26 @@ +/* struct X is complete in this TU, this causes us to not merge Y and + thus assign different alias-sets to them. */ +struct X +{ + int i; +}; +struct Y +{ + struct X *p; + int i; +}; +extern void abort (void); +extern void foo(struct Y *); +int __attribute__((noinline)) bar(struct Y *p) +{ + p->i = 0; + foo (p); + return p->i; +} +int main() +{ + struct Y y; + if (bar (&y) != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/lto/20090914-1_0.c b/gcc/testsuite/gcc.dg/lto/20090914-1_0.c new file mode 100644 index 00000000000..ef9f7b35182 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090914-1_0.c @@ -0,0 +1,13 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options {{-flto -g -fvar-tracking-assignments}} } */ +/* { dg-suppress-ld-options "-g -fvar-tracking-assignments" } */ + +void foo() +{ + int hex = 0x4; +} + +int main() +{ + return 0; +} diff --git a/gcc/testsuite/gcc.dg/lto/README b/gcc/testsuite/gcc.dg/lto/README new file mode 100644 index 00000000000..1a13dd92c62 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/README @@ -0,0 +1,35 @@ +This directory contains tests for link-time optimization (LTO). +Tests in this directory may span multiple files, so the naming of +the files is significant. + +The name of every file must end with '_N' where N is an integer. +All the files with the same name base and different _N suffixes +will be compiled separately and linked together to form the final +executable. + +By default, each set of files will be compiled with list of +options listed in LTO_OPTIONS (../../lib/lto.exp), which can be +overwritten in the shell environment or using the 'dg-lto-options' +command in the main file of the set (i.e., the file with _0 +suffix). + +For example, given the files a_0.C a_1.C a_2.C, they will be +compiled as: + +$ g++ -c a_0.C +$ g++ -c a_1.C +$ g++ -c a_2.C +$ g++ -o a_0.o a_1.o a_2.o + +Tests that do not need more than one file are a special case +where there is a single file named 'foo_0.C'. + +The only supported dg-lto-do option are 'assemble', 'run' and 'link'. +Additionally, these can only be used in the main file. If +'assemble' is used, only the individual object files are +generated. If 'link' is used, the final executable is generated +but not executed (in this case, function main() needs to exist +but it does not need to do anything). If 'run' is used, the +final executable is generated and the resulting binary executed. + +The default value for dg-lto-do is 'run'. diff --git a/gcc/testsuite/gcc.dg/lto/lto.exp b/gcc/testsuite/gcc.dg/lto/lto.exp new file mode 100644 index 00000000000..0e343c19b77 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/lto.exp @@ -0,0 +1,57 @@ +# Copyright (C) 2009 Free Software Foundation, Inc. + +# This program 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 of the License, or +# (at your option) any later version. +# +# This program 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. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . +# +# Contributed by Diego Novillo + + +# Test link-time optimization across multiple files. +# +# Programs are broken into multiple files. Each one is compiled +# separately with LTO information. The final executable is generated +# by collecting all the generated object files using regular LTO or WHOPR. + +if $tracelevel then { + strace $tracelevel +} + +# Load procedures from common libraries. +load_lib standard.exp +load_lib gcc.exp + +# Load the language-independent compabibility support procedures. +load_lib lto.exp + +gcc_init +lto_init + +# Define an identifier for use with this suite to avoid name conflicts +# with other lto tests running at the same time. +set sid "c_lto" + +# If LTO has not been enabled, bail. +if { ![check_effective_target_lto] } { + return +} + +# Main loop. +foreach src [lsort [find $srcdir/$subdir *_0.c]] { + # If we're only testing specific files and this isn't one of them, skip it. + if ![runtest_file_p $runtests $src] then { + continue + } + + lto-execute $src $sid +} diff --git a/gcc/testsuite/gcc.target/i386/math-torture/math-torture.exp b/gcc/testsuite/gcc.target/i386/math-torture/math-torture.exp index 78831374455..9b97ccb1b38 100644 --- a/gcc/testsuite/gcc.target/i386/math-torture/math-torture.exp +++ b/gcc/testsuite/gcc.target/i386/math-torture/math-torture.exp @@ -52,7 +52,7 @@ load_lib gcc-dg.exp load_lib torture-options.exp torture-init -set-torture-options $MATH_TORTURE_OPTIONS +set-torture-options $MATH_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS dg-init gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.c]] "" diff --git a/gcc/testsuite/gfortran.dg/lto/lto.exp b/gcc/testsuite/gfortran.dg/lto/lto.exp new file mode 100644 index 00000000000..a3707ddbd6b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/lto/lto.exp @@ -0,0 +1,57 @@ +# Copyright (C) 2009 Free Software Foundation, Inc. + +# This program 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 of the License, or +# (at your option) any later version. +# +# This program 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. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . +# +# Contributed by Diego Novillo + + +# Test link-time optimization across multiple files. +# +# Programs are broken into multiple files. Each one is compiled +# separately with LTO information. The final executable is generated +# by collecting all the generated object files using regular LTO or WHOPR. + +if $tracelevel then { + strace $tracelevel +} + +# Load procedures from common libraries. +load_lib standard.exp +load_lib gfortran-dg.exp + +# Load the language-independent compabibility support procedures. +load_lib lto.exp + +lto_init + + +# Define an identifier for use with this suite to avoid name conflicts +# with other lto tests running at the same time. +set sid "f_lto" + +# If LTO has not been enabled, bail. +if { ![check_effective_target_lto] } { + return +} + +# Main loop. +foreach src [lsort [glob -nocomplain $srcdir/$subdir/*_0.\[fF\]{,90,95,03,08} ]] { + # If we're only testing specific files and this isn't one of them, skip it. + if ![runtest_file_p $runtests $src] then { + continue + } + + lto-execute $src $sid +} diff --git a/gcc/testsuite/gfortran.dg/lto/pr40724_0.f b/gcc/testsuite/gfortran.dg/lto/pr40724_0.f new file mode 100644 index 00000000000..2d7a9864e40 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/lto/pr40724_0.f @@ -0,0 +1,3 @@ + subroutine f + print *, "Hello World" + end diff --git a/gcc/testsuite/gfortran.dg/lto/pr40724_1.f b/gcc/testsuite/gfortran.dg/lto/pr40724_1.f new file mode 100644 index 00000000000..ed8f31020dd --- /dev/null +++ b/gcc/testsuite/gfortran.dg/lto/pr40724_1.f @@ -0,0 +1,3 @@ + program test + call f + end diff --git a/gcc/testsuite/gfortran.dg/lto/pr40725_0.f03 b/gcc/testsuite/gfortran.dg/lto/pr40725_0.f03 new file mode 100644 index 00000000000..2f33a0f5bf4 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/lto/pr40725_0.f03 @@ -0,0 +1,16 @@ +module bind_c_dts_2 +use, intrinsic :: iso_c_binding +implicit none +type, bind(c) :: my_c_type_1 + integer(c_int) :: j +end type my_c_type_1 +contains + subroutine sub0(my_type, expected_j) bind(c) + type(my_c_type_1) :: my_type + integer(c_int), value :: expected_j + if (my_type%j .ne. expected_j) then + call abort () + end if + end subroutine sub0 +end module bind_c_dts_2 + diff --git a/gcc/testsuite/gfortran.dg/lto/pr40725_1.c b/gcc/testsuite/gfortran.dg/lto/pr40725_1.c new file mode 100644 index 00000000000..7de46b8a988 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/lto/pr40725_1.c @@ -0,0 +1,12 @@ +typedef struct c_type_1 +{ + int j; +} c_type_1_t; +void sub0(c_type_1_t *c_type, int expected_j); +int main(int argc, char **argv) +{ + c_type_1_t c_type; + c_type.j = 11; + sub0(&c_type, c_type.j); + return 0; +} diff --git a/gcc/testsuite/gfortran.dg/lto/pr41069_0.f90 b/gcc/testsuite/gfortran.dg/lto/pr41069_0.f90 new file mode 100644 index 00000000000..4e7d65939c8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/lto/pr41069_0.f90 @@ -0,0 +1,7 @@ +! { dg-lto-do link } +SUBROUTINE mltfftsg ( a, ldax, lday ) + INTEGER, PARAMETER :: dbl = SELECTED_REAL_KIND ( 14, 200 ) + INTEGER, INTENT ( IN ) :: ldax, lday + COMPLEX ( dbl ), INTENT ( INOUT ) :: a ( ldax, lday ) +END SUBROUTINE mltfftsg + diff --git a/gcc/testsuite/gfortran.dg/lto/pr41069_1.f90 b/gcc/testsuite/gfortran.dg/lto/pr41069_1.f90 new file mode 100644 index 00000000000..0c4e05d66d3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/lto/pr41069_1.f90 @@ -0,0 +1,10 @@ +SUBROUTINE S(zin) + COMPLEX(8), DIMENSION(3,3,3) :: zin + INTEGER :: m,n + CALL mltfftsg ( zin, m, n ) +END SUBROUTINE + +COMPLEX(8), DIMENSION(3,3,3) :: zin +CALL s(zin) +END + diff --git a/gcc/testsuite/gfortran.dg/lto/pr41069_2.f90 b/gcc/testsuite/gfortran.dg/lto/pr41069_2.f90 new file mode 100644 index 00000000000..121603eaa60 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/lto/pr41069_2.f90 @@ -0,0 +1,9 @@ +SUBROUTINE fftsg3d ( n, zout ) + INTEGER, PARAMETER :: dp = SELECTED_REAL_KIND ( 14, 200 ) + INTEGER, DIMENSION(*), INTENT(IN) :: n + COMPLEX(KIND=dp), DIMENSION(*), INTENT(INOUT) :: zout + INTEGER :: nx + nx = n ( 1 ) + CALL mltfftsg ( zout, nx, nx ) +END SUBROUTINE fftsg3d + diff --git a/gcc/testsuite/lib/c-torture.exp b/gcc/testsuite/lib/c-torture.exp index 769ec97d3ec..8b15b577005 100644 --- a/gcc/testsuite/lib/c-torture.exp +++ b/gcc/testsuite/lib/c-torture.exp @@ -17,6 +17,7 @@ # This file was written by Rob Savoye. (rob@cygnus.com) +load_lib target-supports.exp load_lib file-format.exp load_lib target-libpath.exp @@ -49,6 +50,14 @@ if [info exists ADDITIONAL_TORTURE_OPTIONS] { [concat $C_TORTURE_OPTIONS $ADDITIONAL_TORTURE_OPTIONS] } +set LTO_TORTURE_OPTIONS "" +if [check_effective_target_lto] { + set LTO_TORTURE_OPTIONS [list \ + { -O2 -flto } \ + { -O2 -fwhopr } + ] +} + global GCC_UNDER_TEST if ![info exists GCC_UNDER_TEST] { set GCC_UNDER_TEST "[find_gcc]" diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index feec5058214..4acfdfec8ff 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -60,6 +60,15 @@ if [info exists ADDITIONAL_TORTURE_OPTIONS] { [concat $DG_TORTURE_OPTIONS $ADDITIONAL_TORTURE_OPTIONS] } +set LTO_TORTURE_OPTIONS "" +if [check_effective_target_lto] { + set LTO_TORTURE_OPTIONS [list \ + { -O2 -flto } \ + { -O2 -fwhopr } + ] +} + + global GCC_UNDER_TEST if ![info exists GCC_UNDER_TEST] { set GCC_UNDER_TEST "[find_gcc]" @@ -241,9 +250,9 @@ proc gcc-dg-runtest { testcases default-extra-flags } { # Some callers set torture options themselves; don't override those. set existing_torture_options [torture-options-exist] if { $existing_torture_options == 0 } { - global DG_TORTURE_OPTIONS + global DG_TORTURE_OPTIONS LTO_TORTURE_OPTIONS torture-init - set-torture-options $DG_TORTURE_OPTIONS + set-torture-options $DG_TORTURE_OPTIONS [list {}] $LTO_TORTURE_OPTIONS } dump-torture-options diff --git a/gcc/testsuite/lib/lto.exp b/gcc/testsuite/lib/lto.exp new file mode 100644 index 00000000000..7f2d7ecec83 --- /dev/null +++ b/gcc/testsuite/lib/lto.exp @@ -0,0 +1,501 @@ +# Copyright (C) 2009 Free Software Foundation, Inc. + +# This program 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 of the License, or +# (at your option) any later version. +# +# This program 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. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# Contributed by Diego Novillo + + +# lto_init -- called at the start of eac subdir of tests + +proc lto_init { args } { + global LTO_OPTIONS + + # Each test is run with the compiler options from this list. + # The default option lists can be overridden by LTO_OPTIONS="[list + # {opts_1} {opts_2}... {opts_n}]" where opts_i are lists of options. + # You can put this in the environment before site.exp is written or + # add it to site.exp directly. + if ![info exists LTO_OPTIONS] { + set LTO_OPTIONS [list \ + {-O0 -fwhopr} \ + {-O2 -fwhopr} \ + {-O0 -flto} \ + {-O2 -flto} \ + ] + } +} + + +# Subsets of tests can be selectively disabled by members of this list: +# - ATTRIBUTE: disable all tests using the __attribute__ extension, +# - COMPLEX: disable all tests using the complex types feature, +# - COMPLEX_INT: disable all tests using the complex integral types extension, +# - VA: disable all tests using the variable number of arguments feature, +# - VLA_IN_STRUCT: disable all tests using the variable-length arrays as +# structure members extension, +# - ZERO_ARRAY: disable all tests using the zero-sized arrays extension. +# The default skip lists can be overriden by +# LTO_SKIPS="[list {skip_1}...{skip_n}]" +# where skip_i are skip identifiers. You can put this in the environment +# before site.exp is written or add it to site.exp directly. +if ![info exists LTO_SKIPS] { + set LTO_SKIPS [list {}] +} + +global lto_skip_list +set lto_skip_list $LTO_SKIPS + +load_lib dg.exp +load_lib gcc-dg.exp + +# lto-obj -- compile to an object file +# +# SOURCE is the source file +# DEST is the object file +# OPTALL is the list of compiler options to use with all tests +# OPTFILE is the list of compiler options to use with this file +# OPTSTR is the options to print with test messages +# XFAILDATA is the xfail data to be passed to the compiler +proc lto-obj { source dest optall optfile optstr xfaildata } { + global testcase + global tool + global compiler_conditional_xfail_data + global lto_skip_list + + # Add the skip specifiers. + foreach skip $lto_skip_list { + if { ![string match $skip ""] } { + lappend optall "-DSKIP_$skip" + } + } + + # Set up the options for compiling this file. + set options "" + lappend options "additional_flags=$optall $optfile" + + set compiler_conditional_xfail_data $xfaildata + set comp_output [${tool}_target_compile "$source" "$dest" object $options] + ${tool}_check_compile "$testcase $dest assemble" $optstr $dest $comp_output +} + +# lto-link-and-maybe-run -- link the object files and run the executable +# if compile_type is set to "run" +# +# TESTNAME is the mixture of object files to link +# OBJLIST is the list of object files to link +# DEST is the name of the executable +# OPTALL is a list of compiler and linker options to use for all tests +# OPTFILE is a list of compiler and linker options to use for this test +# OPTSTR is the list of options to list in messages +proc lto-link-and-maybe-run { testname objlist dest optall optfile optstr } { + global testcase + global tool + global compile_type + + # Check that all of the objects were built successfully. + foreach obj [split $objlist] { + if ![file_on_host exists $obj] then { + unresolved "$testcase $testname link $optstr" + unresolved "$testcase $testname execute $optstr" + return + } + } + + # Set up the options for linking this test. + set options "" + lappend options "additional_flags=$optall $optfile" + + # Link the objects into an executable. + set comp_output [${tool}_target_compile "$objlist" $dest executable \ + "$options"] + if ![${tool}_check_compile "$testcase $testname link" "" \ + $dest $comp_output] then { + unresolved "$testcase $testname execute $optstr" + return + } + + # Return if we only needed to link. + if { ![string compare "link" $compile_type] } { + return + } + + # Run the self-checking executable. + if ![string match "*/*" $dest] then { + set dest "./$dest" + } + set result [${tool}_load $dest "" ""] + set status [lindex $result 0] + if { $status == "pass" } then { + file_on_host delete $dest + } + $status "$testcase $testname execute $optstr" +} + +# lto-get-options-main -- get target requirements for a test and +# options for the primary source file and the test as a whole +# +# SRC is the full pathname of the primary source file. +proc lto-get-options-main { src } { + global compile_type + global dg-extra-ld-options + global dg-suppress-ld-options + + set dg-extra-ld-options "" + set dg-suppress-ld-options "" + + # dg-options sets a variable called dg-extra-tool-flags. + set dg-extra-tool-flags "" + + # dg-options sets a variable called tool_flags. + set tool_flags "" + + # dg-require-* sets dg-do-what. + upvar dg-do-what dg-do-what + upvar dg-final-code dg-final-code + set dg-final-code "" + + set tmp [dg-get-options $src] + verbose "getting options for $src: $tmp" + foreach op $tmp { + set cmd [lindex $op 0] + verbose "cmd is $cmd" + if { [string match "dg-skip-if" $cmd] \ + || [string match "dg-require-*" $cmd] } { + set status [catch "$op" errmsg] + if { $status != 0 } { + perror "src: $errmsg for \"$op\"\n" + unresolved "$src: $errmsg for \"$op\"" + return + } + } elseif { [string match "dg-lto-options" $cmd] } { + set op [lreplace $op 0 0 "dg-options"] + set status [catch "$op" errmsg] + if { $status != 0 } { + perror "src: $errmsg for \"$op\"\n" + unresolved "$src: $errmsg for \"$op\"" + return + } + } elseif { ![string compare "dg-xfail-if" $cmd] \ + || ![string compare "dg-options" $cmd] } { + warning "lto.exp does not support $cmd in primary source file" + } elseif { ![string compare "dg-lto-do" $cmd] } { + set dgdo [lindex $op 2] + verbose "dg-lto-do command for \"$op\" is $dgdo" + if { ![string compare "assemble" $dgdo] } { + set compile_type "assemble" + } elseif { ![string compare "run" $dgdo] } { + set compile_type "run" + } elseif { ![string compare "link" $dgdo] } { + set compile_type "link" + } else { + warning "lto.exp does not support dg-lto-do $dgdo" + } + } elseif { ![string compare "dg-extra-ld-options" $cmd] } { + set dg-extra-ld-options [lindex $op 2] + verbose "dg-extra-ld-options for main is ${dg-extra-ld-options}" + } elseif { ![string compare "dg-suppress-ld-options" $cmd] } { + set dg-suppress-ld-options [lindex $op 2] + verbose \ + "dg-suppress-ld-options for main is ${dg-suppress-ld-options}" + } elseif { ![string compare "dg-final" $cmd] } { + if { [llength $op] > 3 } { + error "[lindex $op 0]: too many arguments" + } else { + append dg-final-code "[lindex $op 2]\n" + } + } else { + # Ignore unrecognized dg- commands, but warn about them. + warning "lto.exp does not support $cmd" + } + } + + # Return flags to use for compiling the primary source file and for + # linking. + verbose "dg-extra-tool-flags for main is ${dg-extra-tool-flags}" + return ${dg-extra-tool-flags} +} + + +# lto-get-options -- get special tool flags to use for a secondary +# source file +# +# SRC is the full pathname of the source file. +# The result is a list of options to use. +# +# This code is copied from proc dg-test in dg.exp from DejaGNU. +proc lto-get-options { src } { + # dg-options sets a variable called dg-extra-tool-flags. + set dg-extra-tool-flags "" + + # dg-xfail-if sets compiler_conditional_xfail_data. + global compiler_conditional_xfail_data + set compiler_conditional_xfail_data "" + + # dg-xfail-if needs access to dg-do-what. + upvar dg-do-what dg-do-what + + set tmp [dg-get-options $src] + foreach op $tmp { + set cmd [lindex $op 0] + if { ![string compare "dg-options" $cmd] \ + || ![string compare "dg-xfail-if" $cmd] } { + set status [catch "$op" errmsg] + if { $status != 0 } { + perror "src: $errmsg for \"$op\"\n" + unresolved "$src: $errmsg for \"$op\"" + return + } + } elseif { [string match "dg-require-*" $cmd] } { + warning "lto.exp does not support $cmd in secondary source files" + } else { + # Ignore unrecognized dg- commands, but warn about them. + warning "lto.exp does not support $cmd in secondary source files" + } + } + + return ${dg-extra-tool-flags} +} + +# lto-execute -- compile multi-file tests +# +# SRC1 is the full pathname of the main file of the testcase. +# SID identifies a test suite in the names of temporary files. +proc lto-execute { src1 sid } { + global srcdir tmpdir + global option_list + global tool + global verbose + global testcase + global gluefile + global compiler_conditional_xfail_data + global dg-do-what-default + global compile_type + global dg-extra-ld-options + global dg-suppress-ld-options + global LTO_OPTIONS + global dg-final-code + + # Get extra flags for this test from the primary source file, and + # process other dg-* options that this suite supports. Warn about + # unsupported flags. + verbose "lto-execute: $src1" 1 + set compile_type "run" + set dg-do-what [list ${dg-do-what-default} "" P] + set extra_flags(0) [lto-get-options-main $src1] + set compile_xfail(0) "" + + # If the main file defines dg-options, those flags are used to + # overwrite the default option_list taken from LTO_OPTIONS. + if { [string length $extra_flags(0)] > 0 } { + set option_list $extra_flags(0) + set extra_flags(0) "" + } else { + set option_list $LTO_OPTIONS + } + + # Check whether this test is supported for this target. + if { [lindex ${dg-do-what} 1 ] == "N" } { + unsupported "$src1" + verbose "$src1 not supported on this target, skipping it" 3 + return + } + + # Set up the names of the other source files. + set dir [file dirname $src1] + set base [file rootname $src1] + set base [string range $base [string length $dir] end] + regsub "_0" $base "" base + regsub "/" $base "" base + set src_list $src1 + set i 1 + set done 0 + while { !$done } { + set names [glob -nocomplain -types f -- "${dir}/${base}_${i}.*"] + if { [llength ${names}] > 1 } { + warning "lto-execute: more than one file matched ${dir}/${base}_${i}.*" + } + if { [llength ${names}] == 1 } { + lappend src_list [lindex ${names} 0] + incr i + } else { + set num_srcs ${i} + set done 1 + } + } + + # Use the dg-options mechanism to specify extra flags for each + # of the secondary files. + # The extra flags in each file are used to compile that file, and the + # extra flags in *_0.* are also used for linking. + verbose "\tsrc_list is: $src_list" + for {set i 1} {$i < $num_srcs} {incr i} { + set extra_flags($i) [lto-get-options [lindex $src_list $i]] + set compile_xfail($i) $compiler_conditional_xfail_data + } + + # Define the names of the object files. + set obj_list "" + for {set i 0} {$i < $num_srcs} {incr i} { + lappend obj_list "${sid}_${base}_${i}.o" + } + + # Get the base name of this test, for use in messages. + set testcase [lindex ${src_list} 0] + + # Remove the $srcdir and $tmpdir prefixes from $src1. (It would + # be possible to use "regsub" here, if we were careful to escape + # all regular expression characters in $srcdir and $tmpdir, but + # that would be more complicated that this approach.) + if {[string first "$srcdir/" "${testcase}"] == 0} { + set testcase [string range "${testcase}" [string length "$srcdir/"] end] + } + if {[string first "$tmpdir/" "$testcase"] == 0} { + set testcase [string range "$testcase" [string length "$tmpdir/"] end] + set testcase "tmpdir-$testcase" + } + regsub "_0.*" $testcase "" testcase + + # Set up the base name of executable files so they'll be unique. + regsub -all "\[./\]" $testcase "-" execbase + + # If we couldn't rip $srcdir out of `src1' then just do the best we can. + # The point is to reduce the unnecessary noise in the logs. Don't strip + # out too much because different testcases with the same name can confuse + # `test-tool'. + if [string match "/*" $testcase] then { + set testcase "[file tail [file dirname $src1]]/[file tail $src1]" + } + + # Loop through all of the option lists used for this test. + set count 0 + foreach option $option_list { + verbose "Testing $testcase, $option" + + # There's a unique name for each executable we generate. + set execname "${execbase}-${count}1" + incr count + + file_on_host delete $execname + + # Compile pieces with the compiler under test. + set i 0 + foreach src $src_list obj $obj_list { + lto-obj $src $obj $option $extra_flags($i) $option \ + $compile_xfail($i) + incr i + } + + # Link (using the compiler under test), run, and clean up tests. + if { ![string compare "run" $compile_type] \ + || ![string compare "link" $compile_type] } { + + # Filter out any link options we were asked to suppress. + set reduced {} + foreach x [split $option] { + if {[lsearch ${dg-suppress-ld-options} $x] == -1} { + lappend reduced $x + } + } + set filtered [join $reduced " "] + + lto-link-and-maybe-run \ + "[lindex $obj_list 0]-[lindex $obj_list end]" \ + $obj_list $execname $filtered ${dg-extra-ld-options} \ + $filtered + } + + + # Are there any further tests to perform? + # Note that if the program has special run-time requirements, running + # of the program can be delayed until here. Ditto for other situations. + # It would be a bit cumbersome though. + + if ![string match ${dg-final-code} ""] { + regsub -all "\\\\(\[{}\])" ${dg-final-code} "\\1" dg-final-code + # Note that the use of `args' here makes this a varargs proc. + proc dg-final-proc { args } ${dg-final-code} + verbose "Running dg-final tests." 3 + verbose "dg-final-proc:\n[info body dg-final-proc]" 4 + if [catch "dg-final-proc $src1" errmsg] { + perror "$name: error executing dg-final: $errmsg" + # ??? The call to unresolved here is necessary to clear + # `errcnt'. What we really need is a proc like perror that + # doesn't set errcnt. It should also set exit_status to 1. + unresolved "$name: error executing dg-final: $errmsg" + } + } + + # Clean up object files. + set files [glob -nocomplain ${sid}_*.o] + if { $files != "" } { + foreach objfile $files { + if { ![info exists gluefile] || $objfile != $gluefile } { + eval "file_on_host delete $objfile" + } + } + } + + if { ![string compare "run" $compile_type] \ + || ![string compare "link" $compile_type] } { + file_on_host delete $execname + } + } +} + +# Utility for scanning a symbol in the final executable, invoked via dg-final. +# Call pass if pattern is present, otherwise fail. +# +# Argument 0 is the regexp to match. +# Argument 1 handles expected failures and the like +proc scan-symbol { args } { + global nm + global base_dir + upvar 2 execname execname + + if { [llength $args] >= 2 } { + switch [dg-process-target [lindex $args 1]] { + "S" { } + "N" { return } + "F" { setup_xfail "*-*-*" } + "P" { } + } + } + + # Find nm like we find g++ in g++.exp. + if ![info exists nm] { + set nm [findfile $base_dir/../../../binutils/nm \ + $base_dir/../../../binutils/nm \ + [findfile $base_dir/../../nm $base_dir/../../nm \ + [findfile $base_dir/nm $base_dir/nm \ + [transform nm]]]] + verbose -log "nm is $nm" + } + + set output_file $execname + if { $output_file == "" } { + fail "scan-symbol $args: dump file does not exist" + return + } + + set fd [open "| $nm $output_file" r] + set text [read $fd] + close $fd + + if [regexp -- [lindex $args 0] $text] { + pass "scan-symbol $args" + } else { + fail "scan-symbol $args" + } +} diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 5272bcd3791..26ef7b7038e 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -3093,6 +3093,14 @@ proc check_effective_target_correct_iso_cpp_string_wchar_protos { } { }] } +# Return 1 if the compiler has been configure with link-time optimization +# (LTO) support. + +proc check_effective_target_lto { } { + global ENABLE_LTO + return [info exists ENABLE_LTO] +} + # Return 1 if the MPC library is integrated with GCC, 0 otherwise. proc check_effective_target_mpc { } { diff --git a/gcc/testsuite/lib/torture-options.exp b/gcc/testsuite/lib/torture-options.exp index 7721f901bfe..f3b3e22948b 100644 --- a/gcc/testsuite/lib/torture-options.exp +++ b/gcc/testsuite/lib/torture-options.exp @@ -48,12 +48,14 @@ proc contains-loop-option-p { arg } { # # Argument 0 is the list to use as torture options # Argument 1 is the list to combine with the torture options. +# Argument 2 is the list to be appended to the torture options after +# combining argument 0 and 1. proc set-torture-options { args } { global torture_with_loops torture_without_loops set torture_list [lindex $args 0] - if { [llength $args] != 1 } { + if { [llength $args] > 1 } { set other_list [lindex $args 1] } else { set other_list [list {}] @@ -71,6 +73,12 @@ proc set-torture-options { args } { lappend torture_with_loops "$torture_opts $other_opts" } } + + if { [llength $args] > 2 } { + set append_list [lindex $args 2] + append torture_with_loops " $append_list" + append torture_without_loops " $append_list" + } } # Finish up after using a set of torture options. diff --git a/gcc/timevar.def b/gcc/timevar.def index 92f280d4a73..d885e50dd30 100644 --- a/gcc/timevar.def +++ b/gcc/timevar.def @@ -42,6 +42,15 @@ DEFTIMEVAR (TV_DUMP , "dump files") DEFTIMEVAR (TV_CGRAPH , "callgraph construction") DEFTIMEVAR (TV_CGRAPHOPT , "callgraph optimization") DEFTIMEVAR (TV_IPA_CONSTANT_PROP , "ipa cp") +DEFTIMEVAR (TV_IPA_LTO_GIMPLE_IO , "ipa lto gimple I/O") +DEFTIMEVAR (TV_IPA_LTO_DECL_IO , "ipa lto decl I/O") +DEFTIMEVAR (TV_IPA_LTO_CGRAPH_IO , "ipa lto cgraph I/O") +DEFTIMEVAR (TV_LTO , "lto") +DEFTIMEVAR (TV_WHOPR_WPA , "whopr wpa") +DEFTIMEVAR (TV_WHOPR_WPA_IO , "whopr wpa I/O") +DEFTIMEVAR (TV_WHOPR_LTRANS , "whopr ltrans") +DEFTIMEVAR (TV_WHOPR_WPA_FIXUP , "whopr wpa fixup") +DEFTIMEVAR (TV_WHOPR_WPA_LTRANS_EXEC , "whopr wpa->ltrans") DEFTIMEVAR (TV_IPA_REFERENCE , "ipa reference") DEFTIMEVAR (TV_IPA_PURE_CONST , "ipa pure const") DEFTIMEVAR (TV_IPA_TYPE_ESCAPE , "ipa type escape") diff --git a/gcc/tlink.c b/gcc/tlink.c index 50206472eba..969c75d0aa6 100644 --- a/gcc/tlink.c +++ b/gcc/tlink.c @@ -283,7 +283,7 @@ tlink_execute (const char *prog, char **argv, const char *outname, { struct pex_obj *pex; - pex = collect_execute (prog, argv, outname, errname); + pex = collect_execute (prog, argv, outname, errname, PEX_LAST | PEX_SEARCH); return collect_wait (prog, pex); } diff --git a/gcc/toplev.c b/gcc/toplev.c index 4dd17e4b0c8..8686e4dd947 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -198,6 +198,17 @@ int optimize = 0; int optimize_size = 0; +/* True if this is the lto front end. This is used to disable + gimple generation and lowering passes that are normally run on the + output of a front end. These passes must be bypassed for lto since + they have already been done before the gimple was written. */ + +bool in_lto_p = false; + +/* Nonzero if we should write GIMPLE bytecode for link-time optimization. */ + +int flag_generate_lto; + /* The FUNCTION_DECL for the function currently being compiled, or 0 if between functions. */ tree current_function_decl; @@ -1087,6 +1098,14 @@ compile_file (void) /* Flush any pending external directives. */ process_pending_assemble_externals (); + /* Emit LTO marker if LTO info has been previously emitted. This is + used by collect2 to determine whether an object file contains IL. + We used to emit an undefined reference here, but this produces + link errors if an object file with IL is stored into a shared + library without invoking lto1. */ + if (flag_generate_lto) + fprintf (asm_out_file,"\t.comm\tgnu_lto_v1,1,1\n"); + /* Attach a special .ident directive to the end of the file to identify the version of GCC which compiled this code. The format of the .ident string is patterned after the ones produced by native SVR4 compilers. */ @@ -2344,6 +2363,8 @@ finalize (void) fatal_error ("error writing to %s: %m", asm_file_name); if (fclose (asm_out_file) != 0) fatal_error ("error closing %s: %m", asm_file_name); + if (flag_wpa) + unlink_if_ordinary (asm_file_name); } statistics_fini (); diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index df1f6caa857..e392f48af3e 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -4526,7 +4526,7 @@ verify_stmt (gimple_stmt_iterator *gsi) /* Return true when the T can be shared. */ -static bool +bool tree_node_can_be_shared (tree t) { if (IS_TYPE_OR_DECL_P (t) diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h index 77cd80bdfe9..8e790aec784 100644 --- a/gcc/tree-flow.h +++ b/gcc/tree-flow.h @@ -540,6 +540,7 @@ extern basic_block move_sese_region_to_fn (struct function *, basic_block, basic_block, tree); void remove_edge_and_dominated_blocks (edge); void mark_virtual_ops_in_bb (basic_block); +bool tree_node_can_be_shared (tree); /* In tree-cfgcleanup.c */ extern bitmap cfgcleanup_altered_bbs; diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 6e1ea39aa92..e38da6d5bde 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -1632,6 +1632,7 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale, edge = cgraph_edge (id->src_node, orig_stmt); if (edge) edge = cgraph_clone_edge (edge, id->dst_node, stmt, + gimple_uid (stmt), REG_BR_PROB_BASE, 1, edge->frequency, true); break; @@ -5119,13 +5120,16 @@ tree_can_inline_p (struct cgraph_edge *e) { e->inline_failed = CIF_TARGET_OPTION_MISMATCH; gimple_call_set_cannot_inline (e->call_stmt, true); + e->call_stmt_cannot_inline_p = true; return false; } - if (!gimple_check_call_args (e->call_stmt)) + if (e->call_stmt + && !gimple_check_call_args (e->call_stmt)) { e->inline_failed = CIF_MISMATCHED_ARGUMENTS; gimple_call_set_cannot_inline (e->call_stmt, true); + e->call_stmt_cannot_inline_p = true; return false; } diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c index 73eacf6c2f2..abd56fcc484 100644 --- a/gcc/tree-optimize.c +++ b/gcc/tree-optimize.c @@ -87,7 +87,7 @@ static bool gate_all_early_local_passes (void) { /* Don't bother doing anything if the program has errors. */ - return (!errorcount && !sorrycount); + return (!errorcount && !sorrycount && !in_lto_p); } struct simple_ipa_opt_pass pass_early_local_passes = @@ -385,6 +385,9 @@ tree_rest_of_compilation (tree fndecl) gimple_register_cfg_hooks (); bitmap_obstack_initialize (®_obstack); /* FIXME, only at RTL generation*/ + + execute_all_ipa_transforms (); + /* Perform all tree transforms and optimizations. */ execute_pass_list (all_passes); diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h index 3241ee1482c..ae510494c86 100644 --- a/gcc/tree-pass.h +++ b/gcc/tree-pass.h @@ -432,20 +432,24 @@ extern struct gimple_opt_pass pass_tracer; extern struct gimple_opt_pass pass_warn_unused_result; /* IPA Passes */ +extern struct simple_ipa_opt_pass pass_ipa_function_and_variable_visibility; +extern struct simple_ipa_opt_pass pass_ipa_early_inline; + +extern struct simple_ipa_opt_pass pass_early_local_passes; + +extern struct ipa_opt_pass_d pass_ipa_lto_gimple_out; +extern struct simple_ipa_opt_pass pass_ipa_increase_alignment; +extern struct simple_ipa_opt_pass pass_ipa_matrix_reorg; extern struct ipa_opt_pass_d pass_ipa_inline; extern struct simple_ipa_opt_pass pass_ipa_free_lang_data; extern struct ipa_opt_pass_d pass_ipa_cp; extern struct ipa_opt_pass_d pass_ipa_reference; extern struct ipa_opt_pass_d pass_ipa_pure_const; - -extern struct simple_ipa_opt_pass pass_ipa_matrix_reorg; -extern struct simple_ipa_opt_pass pass_ipa_early_inline; extern struct simple_ipa_opt_pass pass_ipa_type_escape; extern struct simple_ipa_opt_pass pass_ipa_pta; extern struct simple_ipa_opt_pass pass_ipa_struct_reorg; -extern struct simple_ipa_opt_pass pass_early_local_passes; -extern struct simple_ipa_opt_pass pass_ipa_increase_alignment; -extern struct simple_ipa_opt_pass pass_ipa_function_and_variable_visibility; +extern struct ipa_opt_pass_d pass_ipa_lto_wpa_fixup; +extern struct ipa_opt_pass_d pass_ipa_lto_finish_out; extern struct gimple_opt_pass pass_all_optimizations; extern struct gimple_opt_pass pass_cleanup_cfg_post_optimizing; @@ -554,7 +558,8 @@ extern struct gimple_opt_pass pass_update_address_taken; extern struct gimple_opt_pass pass_convert_switch; /* The root of the compilation pass tree, once constructed. */ -extern struct opt_pass *all_passes, *all_ipa_passes, *all_lowering_passes; +extern struct opt_pass *all_passes, *all_small_ipa_passes, *all_lowering_passes, + *all_regular_ipa_passes, *all_lto_gen_passes; /* Current optimization pass. */ extern struct opt_pass *current_pass; @@ -562,8 +567,15 @@ extern struct opt_pass *current_pass; extern struct opt_pass * get_pass_for_id (int); extern void execute_pass_list (struct opt_pass *); extern void execute_ipa_pass_list (struct opt_pass *); +extern void execute_ipa_summary_passes (struct ipa_opt_pass_d *); +extern void execute_all_ipa_transforms (void); + extern void print_current_pass (FILE *); extern void debug_pass (void); +extern void ipa_write_summaries (void); +extern void ipa_write_summaries_of_cgraph_node_set ( + struct cgraph_node_set_def *); +extern void ipa_read_summaries (void); extern void register_one_dump_file (struct opt_pass *); extern bool function_called_by_processed_nodes_p (void); extern void register_pass (struct register_pass_info *); diff --git a/gcc/tree.c b/gcc/tree.c index 315df903b30..77ba3f8498c 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4130,6 +4130,31 @@ build_type_attribute_variant (tree ttype, tree attribute) TYPE_QUALS (ttype)); } + +/* Reset all the fields in a binfo node BINFO. We only keep + BINFO_VIRTUALS, which is used by gimple_fold_obj_type_ref. */ + +static void +free_lang_data_in_binfo (tree binfo) +{ + unsigned i; + tree t; + + gcc_assert (TREE_CODE (binfo) == TREE_BINFO); + + BINFO_OFFSET (binfo) = NULL_TREE; + BINFO_VTABLE (binfo) = NULL_TREE; + BINFO_VPTR_FIELD (binfo) = NULL_TREE; + BINFO_BASE_ACCESSES (binfo) = NULL; + BINFO_INHERITANCE_CHAIN (binfo) = NULL_TREE; + BINFO_SUBVTT_INDEX (binfo) = NULL_TREE; + BINFO_VPTR_FIELD (binfo) = NULL_TREE; + + for (i = 0; VEC_iterate (tree, BINFO_BASE_BINFOS (binfo), i, t); i++) + free_lang_data_in_binfo (t); +} + + /* Reset all language specific information still present in TYPE. */ static void @@ -4179,9 +4204,7 @@ free_lang_data_in_type (tree type) /* Remove members that are not actually FIELD_DECLs from the field list of an aggregate. These occur in C++. */ - if (TREE_CODE (type) == RECORD_TYPE - || TREE_CODE (type) == UNION_TYPE - || TREE_CODE (type) == QUAL_UNION_TYPE) + if (RECORD_OR_UNION_TYPE_P (type)) { tree prev, member; @@ -4215,30 +4238,7 @@ free_lang_data_in_type (tree type) TYPE_METHODS (type) = NULL_TREE; if (TYPE_BINFO (type)) - { - tree binfo = TYPE_BINFO (type); - - if (BINFO_VIRTUALS (binfo)) - { - /* If the virtual function table for BINFO contains - entries, these may be useful for folding OBJ_TYPE_REF - expressions (see gimple_fold_obj_type_ref). In that - case, we only clear the unused fields in the BINFO - structure. */ - BINFO_OFFSET (binfo) = NULL_TREE; - BINFO_VTABLE (binfo) = NULL_TREE; - BINFO_VPTR_FIELD (binfo) = NULL_TREE; - BINFO_BASE_ACCESSES (binfo) = NULL; - BINFO_INHERITANCE_CHAIN (binfo) = NULL_TREE; - BINFO_SUBVTT_INDEX (binfo) = NULL_TREE; - BINFO_VPTR_FIELD (binfo) = NULL_TREE; - } - else - { - /* Otherwise, get rid of the whole binfo data. */ - TYPE_BINFO (type) = NULL_TREE; - } - } + free_lang_data_in_binfo (TYPE_BINFO (type)); } else { @@ -4276,19 +4276,22 @@ need_assembler_name_p (tree decl) && !DECL_EXTERNAL (decl)) return false; - /* Do not set assembler name on builtins. Allow RTL expansion to - decide whether to expand inline or via a regular call. */ - if (TREE_CODE (decl) == FUNCTION_DECL - && DECL_BUILT_IN (decl) - && DECL_BUILT_IN_CLASS (decl) != BUILT_IN_FRONTEND) - return false; + if (TREE_CODE (decl) == FUNCTION_DECL) + { + /* Do not set assembler name on builtins. Allow RTL expansion to + decide whether to expand inline or via a regular call. */ + if (DECL_BUILT_IN (decl) + && DECL_BUILT_IN_CLASS (decl) != BUILT_IN_FRONTEND) + return false; - /* For FUNCTION_DECLs, only used functions and functions - represented in the callgraph need an assembler name. */ - if (TREE_CODE (decl) == FUNCTION_DECL - && cgraph_node_for_decl (decl) == NULL - && !TREE_USED (decl)) - return false; + /* Functions represented in the callgraph need an assembler name. */ + if (cgraph_node_for_decl (decl) != NULL) + return true; + + /* Unused and not public functions don't need an assembler name. */ + if (!TREE_USED (decl) && !TREE_PUBLIC (decl)) + return false; + } return true; } @@ -4340,9 +4343,6 @@ free_lang_data_in_decl (tree decl) if (DECL_NAME (decl)) TREE_TYPE (DECL_NAME (decl)) = NULL_TREE; - if (TREE_CODE (decl) == CONST_DECL) - DECL_CONTEXT (decl) = NULL_TREE; - /* Ignore any intervening types, because we are going to clear their TYPE_CONTEXT fields. */ if (TREE_CODE (decl) != FIELD_DECL) @@ -4522,15 +4522,21 @@ add_tree_to_fld_list (tree t, struct free_lang_data_d *fld) gcc_unreachable (); } -#define PUSH(t) \ - if (t && !pointer_set_contains (fld->pset, t)) \ - VEC_safe_push (tree, heap, fld->worklist, (t)) +/* Push tree node T into FLD->WORKLIST. */ + +static inline void +fld_worklist_push (tree t, struct free_lang_data_d *fld) +{ + if (t && !is_lang_specific (t) && !pointer_set_contains (fld->pset, t)) + VEC_safe_push (tree, heap, fld->worklist, (t)); +} + /* Operand callback helper for free_lang_data_in_node. *TP is the subtree operand being considered. */ static tree -find_decls_types_r (tree *tp, int *ws ATTRIBUTE_UNUSED, void *data) +find_decls_types_r (tree *tp, int *ws, void *data) { tree t = *tp; struct free_lang_data_d *fld = (struct free_lang_data_d *) data; @@ -4538,45 +4544,59 @@ find_decls_types_r (tree *tp, int *ws ATTRIBUTE_UNUSED, void *data) if (TREE_CODE (t) == TREE_LIST) return NULL_TREE; + /* Language specific nodes will be removed, so there is no need + to gather anything under them. */ + if (is_lang_specific (t)) + { + *ws = 0; + return NULL_TREE; + } + if (DECL_P (t)) { /* Note that walk_tree does not traverse every possible field in decls, so we have to do our own traversals here. */ add_tree_to_fld_list (t, fld); - PUSH (DECL_NAME (t)); - PUSH (DECL_CONTEXT (t)); - PUSH (DECL_SIZE (t)); - PUSH (DECL_SIZE_UNIT (t)); - PUSH (DECL_INITIAL(t)); - PUSH (DECL_ATTRIBUTES (t)); - PUSH (DECL_ABSTRACT_ORIGIN (t)); + fld_worklist_push (DECL_NAME (t), fld); + fld_worklist_push (DECL_CONTEXT (t), fld); + fld_worklist_push (DECL_SIZE (t), fld); + fld_worklist_push (DECL_SIZE_UNIT (t), fld); + + /* We are going to remove everything under DECL_INITIAL for + TYPE_DECLs. No point walking them. */ + if (TREE_CODE (t) != TYPE_DECL) + fld_worklist_push (DECL_INITIAL (t), fld); + + fld_worklist_push (DECL_ATTRIBUTES (t), fld); + fld_worklist_push (DECL_ABSTRACT_ORIGIN (t), fld); if (TREE_CODE (t) == FUNCTION_DECL) { - PUSH (DECL_ARGUMENTS (t)); - PUSH (DECL_RESULT (t)); + fld_worklist_push (DECL_ARGUMENTS (t), fld); + fld_worklist_push (DECL_RESULT (t), fld); } else if (TREE_CODE (t) == TYPE_DECL) { - PUSH (DECL_ARGUMENT_FLD (t)); - PUSH (DECL_VINDEX (t)); + fld_worklist_push (DECL_ARGUMENT_FLD (t), fld); + fld_worklist_push (DECL_VINDEX (t), fld); } else if (TREE_CODE (t) == FIELD_DECL) { - PUSH (DECL_FIELD_OFFSET (t)); - PUSH (DECL_BIT_FIELD_TYPE (t)); - PUSH (DECL_QUALIFIER (t)); - PUSH (DECL_FIELD_BIT_OFFSET (t)); - PUSH (DECL_FCONTEXT (t)); + fld_worklist_push (DECL_FIELD_OFFSET (t), fld); + fld_worklist_push (DECL_BIT_FIELD_TYPE (t), fld); + fld_worklist_push (DECL_QUALIFIER (t), fld); + fld_worklist_push (DECL_FIELD_BIT_OFFSET (t), fld); + fld_worklist_push (DECL_FCONTEXT (t), fld); } else if (TREE_CODE (t) == VAR_DECL) { - PUSH (DECL_SECTION_NAME (t)); - PUSH (DECL_COMDAT_GROUP (t)); + fld_worklist_push (DECL_SECTION_NAME (t), fld); + fld_worklist_push (DECL_COMDAT_GROUP (t), fld); } - PUSH (TREE_CHAIN (t)); + if (TREE_CODE (t) != FIELD_DECL) + fld_worklist_push (TREE_CHAIN (t), fld); *ws = 0; } else if (TYPE_P (t)) @@ -4585,40 +4605,59 @@ find_decls_types_r (tree *tp, int *ws ATTRIBUTE_UNUSED, void *data) types, so we have to do our own traversals here. */ add_tree_to_fld_list (t, fld); - PUSH (TYPE_CACHED_VALUES (t)); - PUSH (TYPE_SIZE (t)); - PUSH (TYPE_SIZE_UNIT (t)); - PUSH (TYPE_ATTRIBUTES (t)); - PUSH (TYPE_POINTER_TO (t)); - PUSH (TYPE_REFERENCE_TO (t)); - PUSH (TYPE_NAME (t)); - PUSH (TYPE_MINVAL (t)); - PUSH (TYPE_MAXVAL (t)); - PUSH (TYPE_MAIN_VARIANT (t)); - PUSH (TYPE_NEXT_VARIANT (t)); - PUSH (TYPE_CONTEXT (t)); - PUSH (TYPE_CANONICAL (t)); - - if (RECORD_OR_UNION_TYPE_P (t) - && TYPE_BINFO (t)) + if (!RECORD_OR_UNION_TYPE_P (t)) + fld_worklist_push (TYPE_CACHED_VALUES (t), fld); + fld_worklist_push (TYPE_SIZE (t), fld); + fld_worklist_push (TYPE_SIZE_UNIT (t), fld); + fld_worklist_push (TYPE_ATTRIBUTES (t), fld); + fld_worklist_push (TYPE_POINTER_TO (t), fld); + fld_worklist_push (TYPE_REFERENCE_TO (t), fld); + fld_worklist_push (TYPE_NAME (t), fld); + fld_worklist_push (TYPE_MINVAL (t), fld); + if (!RECORD_OR_UNION_TYPE_P (t)) + fld_worklist_push (TYPE_MAXVAL (t), fld); + fld_worklist_push (TYPE_MAIN_VARIANT (t), fld); + fld_worklist_push (TYPE_NEXT_VARIANT (t), fld); + fld_worklist_push (TYPE_CONTEXT (t), fld); + fld_worklist_push (TYPE_CANONICAL (t), fld); + + if (RECORD_OR_UNION_TYPE_P (t) && TYPE_BINFO (t)) { unsigned i; tree tem; for (i = 0; VEC_iterate (tree, BINFO_BASE_BINFOS (TYPE_BINFO (t)), i, tem); ++i) - PUSH (TREE_TYPE (tem)); + fld_worklist_push (TREE_TYPE (tem), fld); + tem = BINFO_VIRTUALS (TYPE_BINFO (t)); + while (tem) + { + fld_worklist_push (TREE_VALUE (tem), fld); + tem = TREE_CHAIN (tem); + } + } + if (RECORD_OR_UNION_TYPE_P (t)) + { + tree tem; + /* Push all TYPE_FIELDS - there can be interleaving interesting + and non-interesting things. */ + tem = TYPE_FIELDS (t); + while (tem) + { + if (TREE_CODE (tem) == FIELD_DECL) + fld_worklist_push (tem, fld); + tem = TREE_CHAIN (tem); + } } - PUSH (TREE_CHAIN (t)); + fld_worklist_push (TREE_CHAIN (t), fld); *ws = 0; } - PUSH (TREE_TYPE (t)); + fld_worklist_push (TREE_TYPE (t), fld); return NULL_TREE; } -#undef PUSH /* Find decls and types in T. */ @@ -4907,6 +4946,13 @@ free_lang_data (void) diagnostic_finalizer (global_dc) = default_diagnostic_finalizer; diagnostic_format_decoder (global_dc) = default_tree_printer; + /* FIXME. We remove sufficient language data that the debug + info writer gets completely confused. Disable debug information + for now. */ + debug_info_level = DINFO_LEVEL_NONE; + write_symbols = NO_DEBUG; + debug_hooks = &do_nothing_debug_hooks; + return 0; } @@ -4917,7 +4963,9 @@ static bool gate_free_lang_data (void) { /* FIXME. Remove after save_debug_info is working. */ - return !flag_gtoggle && debug_info_level <= DINFO_LEVEL_TERSE; + return (flag_generate_lto + || (!in_lto_p + && !flag_gtoggle && debug_info_level <= DINFO_LEVEL_TERSE)); } @@ -10110,9 +10158,7 @@ walk_tree_1 (tree *tp, walk_tree_fn func, void *data, return result; /* If this is a record type, also walk the fields. */ - if (TREE_CODE (*type_p) == RECORD_TYPE - || TREE_CODE (*type_p) == UNION_TYPE - || TREE_CODE (*type_p) == QUAL_UNION_TYPE) + if (RECORD_OR_UNION_TYPE_P (*type_p)) { tree field; diff --git a/gcc/tree.h b/gcc/tree.h index 7e2e88b2a42..20463b4a18b 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -4906,7 +4906,8 @@ extern bool validate_arglist (const_tree, ...); extern rtx builtin_memset_read_str (void *, HOST_WIDE_INT, enum machine_mode); extern bool can_trust_pointer_alignment (void); extern int get_pointer_alignment (tree, unsigned int); -extern bool is_builtin_name (const char*); +extern bool is_builtin_name (const char *); +extern bool is_builtin_fn (tree); extern int get_object_alignment (tree, unsigned int, unsigned int); extern tree fold_call_stmt (gimple, bool); extern tree gimple_fold_builtin_snprintf_chk (gimple, tree, enum built_in_function); @@ -4914,6 +4915,7 @@ extern tree make_range (tree, int *, tree *, tree *, bool *); extern tree build_range_check (location_t, tree, tree, int, tree, tree); extern bool merge_ranges (int *, tree *, tree *, int, tree, tree, int, tree, tree); +extern void set_builtin_user_assembler_name (tree decl, const char *asmspec); /* In convert.c */ extern tree strip_float_extensions (tree); @@ -5409,4 +5411,11 @@ more_const_call_expr_args_p (const const_call_expr_arg_iterator *iter) for ((arg) = first_const_call_expr_arg ((call), &(iter)); (arg); \ (arg) = next_const_call_expr_arg (&(iter))) +/* Return true if tree node T is a language-specific node. */ +static inline bool +is_lang_specific (tree t) +{ + return TREE_CODE (t) == LANG_TYPE || TREE_CODE (t) >= NUM_TREE_CODES; +} + #endif /* GCC_TREE_H */ diff --git a/include/ChangeLog b/include/ChangeLog index 2a2bebcd3c0..63cebabfad5 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,8 @@ +2008-10-03 Rafael Espindola + + * plugin-api.h: New. + * lto-symtab.h: New. + 2009-09-29 Jason Merrill * demangle.h (enum demangle_component_type): Add diff --git a/include/lto-symtab.h b/include/lto-symtab.h new file mode 100644 index 00000000000..9312c5d9d33 --- /dev/null +++ b/include/lto-symtab.h @@ -0,0 +1,41 @@ +/* Data types used in the IL symbol table. + Copyright (C) 2009 Free Software Foundation, Inc. + Contributed by Rafael Espindola + +This file is part of GCC. + +GCC 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. + +GCC 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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_LTO_SYMTAB_H +#define GCC_LTO_SYMTAB_H + +enum gcc_plugin_symbol_kind + { + GCCPK_DEF, + GCCPK_WEAKDEF, + GCCPK_UNDEF, + GCCPK_WEAKUNDEF, + GCCPK_COMMON + }; + +enum gcc_plugin_symbol_visibility + { + GCCPV_DEFAULT, + GCCPV_PROTECTED, + GCCPV_INTERNAL, + GCCPV_HIDDEN + }; + +#endif /* GCC_LTO_SYMTAB_H */ diff --git a/include/plugin-api.h b/include/plugin-api.h new file mode 100644 index 00000000000..bb038ad249e --- /dev/null +++ b/include/plugin-api.h @@ -0,0 +1,263 @@ +/* plugin-api.h -- External linker plugin API. */ + +/* Copyright 2009 Free Software Foundation, Inc. + Written by Cary Coutant . + + This file is part of binutils. + + This program 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 of the License, or + (at your option) any later version. + + This program 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. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ + +/* This file defines the interface for writing a linker plugin, which is + described at < http://gcc.gnu.org/wiki/whopr/driver >. */ + +#ifndef PLUGIN_API_H +#define PLUGIN_API_H + +#include +#include + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* Status code returned by most API routines. */ + +enum ld_plugin_status +{ + LDPS_OK = 0, + LDPS_NO_SYMS, /* Attempt to get symbols that haven't been added. */ + LDPS_ERR + /* Additional Error codes TBD. */ +}; + +/* The version of the API specification. */ + +enum ld_plugin_api_version +{ + LD_PLUGIN_API_VERSION = 1 +}; + +/* The type of output file being generated by the linker. */ + +enum ld_plugin_output_file_type +{ + LDPO_REL, + LDPO_EXEC, + LDPO_DYN +}; + +/* An input file managed by the plugin library. */ + +struct ld_plugin_input_file +{ + const char *name; + int fd; + off_t offset; + off_t filesize; + void *handle; +}; + +/* A symbol belonging to an input file managed by the plugin library. */ + +struct ld_plugin_symbol +{ + char *name; + char *version; + int def; + int visibility; + uint64_t size; + char *comdat_key; + int resolution; +}; + +/* Whether the symbol is a definition, reference, or common, weak or not. */ + +enum ld_plugin_symbol_kind +{ + LDPK_DEF, + LDPK_WEAKDEF, + LDPK_UNDEF, + LDPK_WEAKUNDEF, + LDPK_COMMON +}; + +/* The visibility of the symbol. */ + +enum ld_plugin_symbol_visibility +{ + LDPV_DEFAULT, + LDPV_PROTECTED, + LDPV_INTERNAL, + LDPV_HIDDEN +}; + +/* How a symbol is resolved. */ + +enum ld_plugin_symbol_resolution +{ + LDPR_UNKNOWN = 0, + + /* Symbol is still undefined at this point. */ + LDPR_UNDEF, + + /* This is the prevailing definition of the symbol, with references from + regular object code. */ + LDPR_PREVAILING_DEF, + + /* This is the prevailing definition of the symbol, with no + references from regular objects. It is only referenced from IR + code. */ + LDPR_PREVAILING_DEF_IRONLY, + + /* This definition was pre-empted by a definition in a regular + object file. */ + LDPR_PREEMPTED_REG, + + /* This definition was pre-empted by a definition in another IR file. */ + LDPR_PREEMPTED_IR, + + /* This symbol was resolved by a definition in another IR file. */ + LDPR_RESOLVED_IR, + + /* This symbol was resolved by a definition in a regular object + linked into the main executable. */ + LDPR_RESOLVED_EXEC, + + /* This symbol was resolved by a definition in a shared object. */ + LDPR_RESOLVED_DYN +}; + +/* The plugin library's "claim file" handler. */ + +typedef +enum ld_plugin_status +(*ld_plugin_claim_file_handler) ( + const struct ld_plugin_input_file *file, int *claimed); + +/* The plugin library's "all symbols read" handler. */ + +typedef +enum ld_plugin_status +(*ld_plugin_all_symbols_read_handler) (void); + +/* The plugin library's cleanup handler. */ + +typedef +enum ld_plugin_status +(*ld_plugin_cleanup_handler) (void); + +/* The linker's interface for registering the "claim file" handler. */ + +typedef +enum ld_plugin_status +(*ld_plugin_register_claim_file) (ld_plugin_claim_file_handler handler); + +/* The linker's interface for registering the "all symbols read" handler. */ + +typedef +enum ld_plugin_status +(*ld_plugin_register_all_symbols_read) ( + ld_plugin_all_symbols_read_handler handler); + +/* The linker's interface for registering the cleanup handler. */ + +typedef +enum ld_plugin_status +(*ld_plugin_register_cleanup) (ld_plugin_cleanup_handler handler); + +/* The linker's interface for adding symbols from a claimed input file. */ + +typedef +enum ld_plugin_status +(*ld_plugin_add_symbols) (void *handle, int nsyms, + const struct ld_plugin_symbol *syms); + +/* The linker's interface for retrieving symbol resolution information. */ + +typedef +enum ld_plugin_status +(*ld_plugin_get_symbols) (const void *handle, int nsyms, + struct ld_plugin_symbol *syms); + +/* The linker's interface for adding a compiled input file. */ + +typedef +enum ld_plugin_status +(*ld_plugin_add_input_file) (char *pathname); + +/* The linker's interface for issuing a warning or error message. */ + +typedef +enum ld_plugin_status +(*ld_plugin_message) (int level, char *format, ...); + +enum ld_plugin_level +{ + LDPL_INFO, + LDPL_WARNING, + LDPL_ERROR, + LDPL_FATAL +}; + +/* Values for the tv_tag field of the transfer vector. */ + +enum ld_plugin_tag +{ + LDPT_NULL = 0, + LDPT_API_VERSION, + LDPT_GOLD_VERSION, + LDPT_LINKER_OUTPUT, + LDPT_OPTION, + LDPT_REGISTER_CLAIM_FILE_HOOK, + LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK, + LDPT_REGISTER_CLEANUP_HOOK, + LDPT_ADD_SYMBOLS, + LDPT_GET_SYMBOLS, + LDPT_ADD_INPUT_FILE, + LDPT_MESSAGE +}; + +/* The plugin transfer vector. */ + +struct ld_plugin_tv +{ + enum ld_plugin_tag tv_tag; + union + { + int tv_val; + const char *tv_string; + ld_plugin_register_claim_file tv_register_claim_file; + ld_plugin_register_all_symbols_read tv_register_all_symbols_read; + ld_plugin_register_cleanup tv_register_cleanup; + ld_plugin_add_symbols tv_add_symbols; + ld_plugin_get_symbols tv_get_symbols; + ld_plugin_add_input_file tv_add_input_file; + ld_plugin_message tv_message; + } tv_u; +}; + +/* The plugin library's "onload" entry point. */ + +typedef +enum ld_plugin_status +(*ld_plugin_onload) (struct ld_plugin_tv *tv); + +#ifdef __cplusplus +}; +#endif + +#endif /* !defined(PLUGIN_API_H) */ diff --git a/lto-plugin/ChangeLog b/lto-plugin/ChangeLog new file mode 100644 index 00000000000..49f2efb40c5 --- /dev/null +++ b/lto-plugin/ChangeLog @@ -0,0 +1,347 @@ +2009-10-02 Diego Novillo + + * Makefile.am (AM_CPPFLAGS): Remove -D_LARGEFILE_SOURCE + and -D_FILE_OFFSET_BITS=64. + * configure.ac: Add AC_SYS_LARGEFILE. + * configure: Regenerate. + * Makefile.in: Regenerate. + * lto-plugin.c: Fix copyright boilerplate. + +2009-10-02 Diego Novillo + + * Makefile.am (ACLOCAL_AMFLAGS): Define. + * aclocal.m4: Regenerate with aclocal-2.64 + * acinclude.m4: Remove. + * Makefile.in: Regenerate with automake-1.11 + * configure.ac (AC_PREREQ): Update to 2.64. + * configure: Regenerate. + +2009-10-02 Diego Novillo + + * Makefile.am (AM_CPPFLAGS): Remove -D_LARGEFILE_SOURCE + and -D_FILE_OFFSET_BITS=64. + * configure.ac: Add AC_SYS_LARGEFILE. + * configure: Regenerate. + * Makefile.in: Regenerate. + * lto-plugin.c: Fix copyright boilerplate. + +2009-10-02 Diego Novillo + + * Makefile.am (ACLOCAL_AMFLAGS): Define. + * aclocal.m4: Regenerate with aclocal-2.64 + * acinclude.m4: Remove. + * Makefile.in: Regenerate with automake-1.11 + * configure.ac (AC_PREREQ): Update to 2.64. + * configure: Regenerate. + +2009-10-02 Rafael Avila de Espindola + + * Makefile.am (liblto_plugin_la_SOURCES): Remove + $(top_srcdir)/../gcc/lto/common.c + * Makefile.in: Regenerate. + +2009-10-01 Rafael Avila de Espindola + + * lto-plugin.c (pass_through_items): New. + (num_pass_through_items): New. + (all_symbols_read_handler): Update to use the -pass-through option. + (process_option): Replace -libgcc with -pass-through. + +2009-09-30 Rafael Avila de Espindola + + * lto-plugin.c (onload): Return a ld_plugin_status. Don't require + register_cleanup to be set. + +2009-09-30 Rafael Avila de Espindola + + * Makefile.am: Remove all reference to ltosymtab. + * Makefile.in: Regenerate. + * lto-symtab.c: Remove. + +2009-05-21 Diego Novillo + + * configure.ac: Remove call to AC_CHECK_GELF. + Call AC_ARG_VAR for LIBELFLIBS and LIBELFINC. + * acinclude.m4: Do not include ../config/libelf.m4 + * Makefile.am (LIBELFLIBS): Define. + (LIBELFINC): Define. + (AM_CPPFLAGS): Add $(LIBELFINC). + (ltosymtab_LDADD): Add $(LIBELFLIBS). + (liblto_plugin_la_LIBADD): Add $(LIBELFLIBS) + * lto-plugin.c: Always include + * lto-symtab.c: Likewise. + * configure: Regenerate. + * Makefile.in: Regenerate. + +2009-03-23 Rafael Avila de Espindola + + * lto-plugin.c (libgcc_filename): New. + (all_symbols_read_handler): Pass libgcc to the linker. + (all_symbols_read_handler): Parse -libgcc + +2009-02-05 Rafael Avila de Espindola + + * Makefile.am (liblto_plugin_la_LIBADD): Link with libiberty. + * Makefile.in: Regenerate. + * lto-plugin.c (add_output_files): Argument is now a FILE. + (exec_lto_wrapper): Use writeargv and pex. + +2009-02-04 Rafael Avila de Espindola + + Revert: + 2009-02-04 Rafael Avila de Espindola + * lto-plugin.c (exec_lto_wrapper): Use writeargv. + + +2009-02-04 Rafael Avila de Espindola + + * lto-plugin.c (exec_lto_wrapper): Use writeargv. + +2009-01-29 Rafael Avila de Espindola + + * lto-plugin.c: Include libiberty.h. + (exec_lto_wrapper, claim_file_handler): Use asprintf instead of + snprintf. + +2009-01-29 Rafael Avila de Espindola + + * lto-plugin.c (exec_lto_wrapper): Write argv to a file. Pass that + file to lto-wrapper. + +2009-01-28 Rafael Avila de Espindola + + * lto-plugin.c (plugin_file_info): Remove fd and elf. + (parse_table_entry): strdup entry->name and entry->comdat_key. + (free_1): Free name and comdat_key. Don't close the file. Don't call + elf_end. + (claim_file_handler): Always call elf_end. + +2008-12-23 Rafael Avila de Espindola + + * Makefile.am (AM_CPPFLAGS): Add -D_LARGEFILE_SOURCE + -D_FILE_OFFSET_BITS=64 + * Makefile.in: Regenerate + +2008-12-22 Rafael Avila de Espindola + + * Makefile.am (gcc_version, target_noncanonical, libexecsubdir): New. + (lib_LTLIBRARIES): Rename to libexecsub_LTLIBRARIES. + * Makefile.in: Regenerate. + * acinclude.m4: Include ../config/acx.m4 and ../lt~obsolete.m4 + * configure: Regenerate. + * configure.ac: Add AC_SUBST(target_noncanonical). + +2008-12-08 Rafael Avila de Espindola + + * lto-plugin.c: Include stdbool.h. + (debug, nop): Declare as bool. + +2008-12-08 Rafael Avila de Espindola + + * lto-plugin.c (nop): New. + (use_original_files): New. + (all_symbols_read_handler): Call use_original_files if nop is true. + (process_option): Parse the -nop option. + +2008-12-08 Rafael Avila de Espindola + + * lto-plugin.c (debug): New. + (exec_lto_wrapper): Print argv if debug is true. + (process_option): Process the -debug command line option. + +2008-12-03 Rafael Avila de Espindola + + * lto-plugin.c (process_option): The argument is now a single option, + not a space separated list. + +2008-12-02 Rafael Avila de Espindola + + * lto-plugin.c: Include sys/types.h and sys/wait.h + (output_files, num_output_files, lto_wrapper_argv, + lto_wrapper_num_args): New. + (free_2): Free output_files. + (write_resolution): Disable. + (add_output_files): New. + (exec_lto_wrapper): New. + (all_symbols_read_handler): Run lto-wrapper. + (claim_file_handler): Free lto_file.name and call elf_end. + (process_option): New. + +2008-11-26 Rafael Espindola + + * lto-plugin.c (add_input_file): New. + (get_section): Return NULL if get_section fails. + (write_resolution): New. + (all_symbols_read_handler): Call add_input_file. + (claim_file_handler): Unlink the correct file. + (onload): Record add_input_file. + +2008-09-23 Rafael Espindola + + * Makefile.am (ltosymtab_SOURCES, liblto_plugin_la_SOURCES): + Update the location of common.c. + * Makefile.in: Regenerate. + * common.c: Moved to gcc/lto. + * common.h: Moved to gcc/lto. + * lto-plugin.c: Update the location of common.h. + * lto-symtab.c: Update the location of common.h. + +2008-09-23 Rafael Espindola + + * common.c: Include common.h. + (lto_kind_str, lto_visibility_str, lto_resolution_str): Use explicit + sizes. + * common.h (lto_kind_str, lto_visibility_str, lto_resolution_str): Use + explicit sizes. + +2008-09-23 Rafael Espindola + + * lto-plugin.c (plugin_file_info): Add temp. + (cleanup_handler): Only delete temporary files. + (claim_file_handler): Initialize lto_file.temp. + +2008-09-23 Rafael Espindola + + * plugin-api.h: Moved to include. + +2008-09-23 Rafael Espindola + + * lto-plugin.c (all_symbols_read_handler): Print resolution in a new + format. + +2008-09-22 Rafael Espindola + + * plugin-api.h: Copy from binutils' cvs. + +2008-09-22 Rafael Espindola + + * lto-symtab.c (get_symbols, add_symbols): Update signature. + * plugin-api.h: Copy from binutils' cvs. + +2008-09-22 Rafael Espindola + + * common.h (lto_kind_str, lto_visibility_str, lto_resolution_str): + Make extern + +2008-09-10 Rafael Espindola + + * lto-plugin.c (onload): add missing break statements and asserts. + * lto-symtab.c (claim_file_handler): Make it static. + (all_symbols_read_handler): Make it static. + (all_file_handles): Make it static. + (num_file_handles): Make it static. + (register_claim_file): Make it static. + (register_object): Indent properly. + +2008-09-10 Rafael Avila de Espindola + + * Makefile.am (ltosymtab_LDADD): Add -lelf. + * Makefiel.in: Regenerate. + * lto-plugin.c: Include ar.h. + (claim_file_handler): Handle file->offset != 0. + * lto-symtab.c: Include gelf.h. + (all_file_handles): Change type. + (register_object): New. + (register_file): Add support for archives. + (resolve): Update to new type of all_file_handles. + (print): Update to new type of all_file_handles. + (free_all): Update to new type of all_file_handles. + (main): Update to new type of all_file_handles. + +2008-09-10 Rafael Avila de Espindola + + * lto-plugin.c (get_string_table): Remove. + (get_section): Use elf_strptr instead of get_string_table. + +2008-09-08 Doug Kwan + + * lto-plugin.c (all_symbols_read_handler): Widen fprintf arguments + to 64-bit to fix a 32-bit bootstrap failure due to format warnings. + +2008-09-08 Rafael Avila de Espindola + + * Makefile.am (ltosymtab_SOURCES): add common.c. + (ltosymtab_CFLAGS): New. + (liblto_plugin_la_SOURCES): Add common.c. + * Makefile.in: Regenerate. + * common.c: New. + * common.h: New. + * lto-plugin.c: Include stdio.h, inttypes.h and common.h. + (plugin_symtab): New. + (plugin_file_info): New. + (register_all_symbols_read): New. + (get_symbols): New. + (claimed_files): New. + (num_claimed_files): New. + (translate): Don't drop the slot number. + (free_1): New. + (free_2): New. + (all_symbols_read_handler): New. + (claim_file_handler): Record every claimed file. + (onload): Handle LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK and + LDPT_GET_SYMBOLS. + * lto-symtab.c: Include stdlib.h, string.h and common.h. + (current_file_handle): Remove. + (ld_plugin_all_symbols_read_handler): New. + (plugin_handle): New. + (file_handle): New. + (all_file_handles): New. + (num_file_handles): New. + (get_symbols): New. + (register_all_symbols_read): New. + (add_symbols): Don't print the symbols, just record them. + (ld_plugin_tv): Add LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK and + LDPT_GET_SYMBOLS. + (load_plugin): Use plugin_handle. + (register_file): Add the file handle to all_file_handles. + (resolve): New. + (print): New. + (unload_plugin): New. + (free_all): New. + (main): Call all_symbols_read_handler and free resources. + +2008-09-03 Rafael Avila de Espindola + + * Makefile.am (AM_CFLAGS): New. + (ltosymtab_LDADD): Remove -lelf. Add -ldl. + (lib_LTLIBRARIES): New. + (liblto_plugin_la_SOURCES): New. + (liblto_plugin_la_LIBADD): New. + * Makefile.in: Regenerate. + * acinclude.m4: Don't include ../config/acx.m4 and + ../config/no-executables.m4. + Include ../ltsugar.m4, ../ltoptions.m4, ../ltversion.m4 and + ../libtool.m4. + * aclocal.m4: Regenerate. + * configure: Regenerate. + * configure.ac: Use AM_PROG_LIBTOOL. + * lto-plugin.c: New. + * lto-symtab.c: Rewrite to use the plugin. + * plugin-api.h: New. + +2008-08-25 Rafael Avila de Espindola + + * configure: Regenerate. + * configure.ac: Use AC_CHECK_GELF. + * lto-symtab.c: Include gelf.h. + (get_string_table): Use size independent API. + (printTable): Use lld to print 64 bit integers. + +2008-08-22 Rafael Avila de Espindola + + * lto-symtab.c (parse_table_entry): Assert entry->kind and + entry->visibility are valid. + +2008-07-22 Rafael Avila de Espindola + * lto-symtab.c (table_entry): Add comdat. + (parse_table_entry): Read comdat. + +2008-08-21 Rafael Espindola + + * Makefile.am: New. + * Makefile.in: New. + * acinclude.m4: New. + * aclocal.m4: New. + * configure: New. + * configure.ac: New. + * lto-symtab.c: New. diff --git a/lto-plugin/Makefile.am b/lto-plugin/Makefile.am new file mode 100644 index 00000000000..b5dd5fc4716 --- /dev/null +++ b/lto-plugin/Makefile.am @@ -0,0 +1,19 @@ +# Makefile.am is used by automake 1.11 to generate Makefile.in. + +ACLOCAL_AMFLAGS = -I .. -I ../config + +gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER) +target_noncanonical := @target_noncanonical@ +libexecsubdir := $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version) + +# How to find libelf +LIBELFLIBS = @LIBELFLIBS@ +LIBELFINC = @LIBELFINC@ + +AM_CPPFLAGS = -I$(top_srcdir)/../include $(LIBELFINC) +AM_CFLAGS = -Wall -Werror + +libexecsub_LTLIBRARIES = liblto_plugin.la + +liblto_plugin_la_SOURCES = lto-plugin.c +liblto_plugin_la_LIBADD = $(LIBELFLIBS) -L../libiberty/pic -liberty diff --git a/lto-plugin/Makefile.in b/lto-plugin/Makefile.in new file mode 100644 index 00000000000..7284e4cb856 --- /dev/null +++ b/lto-plugin/Makefile.in @@ -0,0 +1,680 @@ +# Makefile.in generated by automake 1.11 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Makefile.am is used by automake 1.11 to generate Makefile.in. + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = . +DIST_COMMON = $(am__configure_deps) $(srcdir)/../config.guess \ + $(srcdir)/../config.sub $(srcdir)/../depcomp \ + $(srcdir)/../install-sh $(srcdir)/../ltmain.sh \ + $(srcdir)/../missing $(srcdir)/../mkinstalldirs \ + $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/configure ChangeLog +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \ + $(top_srcdir)/../config/depstand.m4 \ + $(top_srcdir)/../config/lead-dot.m4 \ + $(top_srcdir)/../config/override.m4 \ + $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \ + $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \ + $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(libexecsubdir)" +LTLIBRARIES = $(libexecsub_LTLIBRARIES) +am__DEPENDENCIES_1 = +liblto_plugin_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_liblto_plugin_la_OBJECTS = lto-plugin.lo +liblto_plugin_la_OBJECTS = $(am_liblto_plugin_la_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/../depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(liblto_plugin_la_SOURCES) +DIST_SOURCES = $(liblto_plugin_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d "$(distdir)" \ + || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr "$(distdir)"; }; } +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBELFINC = @LIBELFINC@ + +# How to find libelf +LIBELFLIBS = @LIBELFLIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_libsubdir = @build_libsubdir@ +build_os = @build_os@ +build_subdir = @build_subdir@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_subdir = @host_subdir@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +target_noncanonical := @target_noncanonical@ +target_subdir = @target_subdir@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +ACLOCAL_AMFLAGS = -I .. -I ../config +gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER) +libexecsubdir := $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version) +AM_CPPFLAGS = -I$(top_srcdir)/../include $(LIBELFINC) +AM_CFLAGS = -Wall -Werror +libexecsub_LTLIBRARIES = liblto_plugin.la +liblto_plugin_la_SOURCES = lto-plugin.c +liblto_plugin_la_LIBADD = $(LIBELFLIBS) -L../libiberty/pic -liberty +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +am--refresh: + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + $(am__cd) $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +$(am__aclocal_m4_deps): +install-libexecsubLTLIBRARIES: $(libexecsub_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libexecsubdir)" || $(MKDIR_P) "$(DESTDIR)$(libexecsubdir)" + @list='$(libexecsub_LTLIBRARIES)'; test -n "$(libexecsubdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libexecsubdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libexecsubdir)"; \ + } + +uninstall-libexecsubLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(libexecsub_LTLIBRARIES)'; test -n "$(libexecsubdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libexecsubdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libexecsubdir)/$$f"; \ + done + +clean-libexecsubLTLIBRARIES: + -test -z "$(libexecsub_LTLIBRARIES)" || rm -f $(libexecsub_LTLIBRARIES) + @list='$(libexecsub_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +liblto_plugin.la: $(liblto_plugin_la_OBJECTS) $(liblto_plugin_la_DEPENDENCIES) + $(LINK) -rpath $(libexecsubdir) $(liblto_plugin_la_OBJECTS) $(liblto_plugin_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lto-plugin.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool config.lt + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(am__remove_distdir) + test -d "$(distdir)" || mkdir "$(distdir)" + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + -test -n "$(am__skip_mode_fix)" \ + || find "$(distdir)" -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r "$(distdir)" +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) + +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lzma*) \ + unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ + *.tar.xz*) \ + xz -dc $(distdir).tar.xz | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + test -d $(distdir)/_build || exit 0; \ + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && am__cwd=`pwd` \ + && $(am__cd) $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ + && cd "$$am__cwd" \ + || exit 1 + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @$(am__cd) '$(distuninstallcheck_dir)' \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(libexecsubdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libexecsubLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libexecsubLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libexecsubLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ + clean-generic clean-libexecsubLTLIBRARIES clean-libtool ctags \ + dist dist-all dist-bzip2 dist-gzip dist-lzma dist-shar \ + dist-tarZ dist-xz dist-zip distcheck distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-libexecsubLTLIBRARIES \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-libexecsubLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lto-plugin/acinclude.m4 b/lto-plugin/acinclude.m4 new file mode 100644 index 00000000000..c74f7dd83cf --- /dev/null +++ b/lto-plugin/acinclude.m4 @@ -0,0 +1,7 @@ +m4_include([../config/acx.m4]) +m4_include([../lt~obsolete.m4]) +m4_include([../ltsugar.m4]) +m4_include([../ltoptions.m4]) +m4_include([../ltversion.m4]) + +sinclude(../libtool.m4) diff --git a/lto-plugin/aclocal.m4 b/lto-plugin/aclocal.m4 new file mode 100644 index 00000000000..c38cda2ec48 --- /dev/null +++ b/lto-plugin/aclocal.m4 @@ -0,0 +1,939 @@ +# generated automatically by aclocal 1.11 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.64],, +[m4_warning([this file was generated for autoconf 2.64. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically `autoreconf'.])]) + +# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.11' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.11], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.11])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 9 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +m4_define([_AM_COND_VALUE_$1], [$2])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 10 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], UPC, [depcc="$UPC" am_compiler_list=], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + am__universal=false + m4_case([$1], [CC], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac], + [CXX], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac]) + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +#serial 5 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[{ + # Autoconf 2.62 quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2008, 2009 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 16 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.62])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES(OBJC)], + [define([AC_PROG_OBJC], + defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl +]) +_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl +dnl The `parallel-tests' driver may need to know about EXEEXT, so add the +dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro +dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_CONFIG_COMMANDS_PRE(dnl +[m4_provide_if([_AM_COMPILER_EXEEXT], + [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl +]) + +dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further +dnl mangled by Autoconf and run in a shell conditional statement. +m4_define([_AC_COMPILER_EXEEXT], +m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +if test x"${install_sh}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi +AC_SUBST(install_sh)]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from `make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 6 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_MKDIR_P +# --------------- +# Check for `mkdir -p'. +AC_DEFUN([AM_PROG_MKDIR_P], +[AC_PREREQ([2.60])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, +dnl while keeping a definition of mkdir_p for backward compatibility. +dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. +dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of +dnl Makefile.ins that do not define MKDIR_P, so we do our own +dnl adjustment using top_builddir (which is defined more often than +dnl MKDIR_P). +AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl +case $mkdir_p in + [[\\/$]]* | ?:[[\\/]]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[[\\\"\#\$\&\'\`$am_lf]]*) + AC_MSG_ERROR([unsafe absolute working directory name]);; +esac +case $srcdir in + *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) + AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; +esac + +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + +m4_include([../config/acx.m4]) +m4_include([../config/depstand.m4]) +m4_include([../config/lead-dot.m4]) +m4_include([../config/override.m4]) +m4_include([../libtool.m4]) +m4_include([../ltoptions.m4]) +m4_include([../ltsugar.m4]) +m4_include([../ltversion.m4]) +m4_include([../lt~obsolete.m4]) diff --git a/lto-plugin/configure b/lto-plugin/configure new file mode 100755 index 00000000000..e701ee1aa10 --- /dev/null +++ b/lto-plugin/configure @@ -0,0 +1,12715 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.64 for LTO plugin for ld 0.1. +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software +# Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error ERROR [LINENO LOG_FD] +# --------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with status $?, using 1 if that was 0. +as_fn_error () +{ + as_status=$?; test $as_status -eq 0 && as_status=1 + if test "$3"; then + as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 + fi + $as_echo "$as_me: error: $1" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$lt_ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','` + ;; +esac + +ECHO=${lt_ECHO-echo} +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then + # Yippee, $ECHO works! + : +else + # Restart under the correct shell. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<_LT_EOF +$* +_LT_EOF + exit 0 +fi + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test -z "$lt_ECHO"; then + if test "X${echo_test_string+set}" != Xset; then + # find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if { echo_test_string=`eval $cmd`; } 2>/dev/null && + { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null + then + break + fi + done + fi + + if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : + else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + ECHO="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$ECHO" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + ECHO='print -r' + elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} + else + # Try using printf. + ECHO='printf %s\n' + if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + ECHO="$CONFIG_SHELL $0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + ECHO="$CONFIG_SHELL $0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do + if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "$0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} + else + # Oops. We lost completely, so just stick with echo. + ECHO=echo + fi + fi + fi + fi + fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +lt_ECHO=$ECHO +if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then + lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" +fi + + + + +exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='LTO plugin for ld' +PACKAGE_TARNAME='lto-plugin' +PACKAGE_VERSION='0.1' +PACKAGE_STRING='LTO plugin for ld 0.1' +PACKAGE_BUGREPORT='' +PACKAGE_URL='' + +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='am__EXEEXT_FALSE +am__EXEEXT_TRUE +LTLIBOBJS +LIBOBJS +target_noncanonical +CPP +OTOOL64 +OTOOL +LIPO +NMEDIT +DSYMUTIL +lt_ECHO +RANLIB +AR +OBJDUMP +LN_S +NM +ac_ct_DUMPBIN +DUMPBIN +LD +FGREP +EGREP +GREP +SED +host_os +host_vendor +host_cpu +host +LIBTOOL +LIBELFINC +LIBELFLIBS +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__quote +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +target_subdir +host_subdir +build_subdir +build_libsubdir +build_os +build_vendor +build_cpu +build +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +with_build_libsubdir +enable_dependency_tracking +enable_shared +enable_static +with_pic +enable_fast_install +with_gnu_ld +enable_libtool_lock +enable_largefile +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +LIBELFLIBS +LIBELFINC +CPP' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information." + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures LTO plugin for ld 0.1 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/lto-plugin] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of LTO plugin for ld 0.1:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --enable-shared[=PKGS] build shared libraries [default=yes] + --enable-static[=PKGS] build static libraries [default=yes] + --enable-fast-install[=PKGS] + optimize for fast installation [default=yes] + --disable-libtool-lock avoid locking (might break parallel builds) + --disable-largefile omit support for large files + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-build-libsubdir=DIR Directory where to find libraries for build system + --with-pic try to use only PIC/non-PIC objects [default=use + both] + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + LIBELFLIBS How to link libelf + LIBELFINC How to find libelf include files + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to the package provider. +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +LTO plugin for ld configure 0.1 +generated by GNU Autoconf 2.64 + +Copyright (C) 2009 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + return $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + return $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_header_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + return $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + return $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_func +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by LTO plugin for ld $as_me 0.1, which was +generated by GNU Autoconf 2.64. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------------- ## +## File substitutions. ## +## ------------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + ac_site_file1=$CONFIG_SITE +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + for ac_t in install-sh install.sh shtool; do + if test -f "$ac_dir/$ac_t"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/$ac_t -c" + break 2 + fi + done +done +if test -z "$ac_aux_dir"; then + as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if test "${ac_cv_build+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + + case ${build_alias} in + "") build_noncanonical=${build} ;; + *) build_noncanonical=${build_alias} ;; +esac + + case ${host_alias} in + "") host_noncanonical=${build_noncanonical} ;; + *) host_noncanonical=${host_alias} ;; +esac + + case ${target_alias} in + "") target_noncanonical=${host_noncanonical} ;; + *) target_noncanonical=${target_alias} ;; +esac + + +# post-stage1 host modules use a different CC_FOR_BUILD so, in order to +# have matching libraries, they should use host libraries: Makefile.tpl +# arranges to pass --with-build-libsubdir=$(HOST_SUBDIR). +# However, they still use the build modules, because the corresponding +# host modules (e.g. bison) are only built for the host when bootstrap +# finishes. So: +# - build_subdir is where we find build modules, and never changes. +# - build_libsubdir is where we find build libraries, and can be overridden. + +# Prefix 'build-' so this never conflicts with target_subdir. +build_subdir="build-${build_noncanonical}" + +# Check whether --with-build-libsubdir was given. +if test "${with_build_libsubdir+set}" = set; then : + withval=$with_build_libsubdir; build_libsubdir="$withval" +else + build_libsubdir="$build_subdir" +fi + +# --srcdir=. covers the toplevel, while "test -d" covers the subdirectories +if ( test $srcdir = . && test -d gcc ) \ + || test -d $srcdir/../host-${host_noncanonical}; then + host_subdir="host-${host_noncanonical}" +else + host_subdir=. +fi +# No prefix. +target_subdir=${target_noncanonical} + +am__api_version='1.11' + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Just in case +sleep 1 +echo timestamp > conftest.file +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; +esac + +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error "ls -t appears to fail. Make sure there is not a broken +alias in your environment" "$LINENO" 5 + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_STRIP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if test "${ac_cv_path_mkdir+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + test -d ./--version && rmdir ./--version + MKDIR_P="$ac_install_sh -d" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } + +mkdir_p="$MKDIR_P" +case $mkdir_p in + [\\/$]* | ?:[\\/]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_AWK+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + as_fn_error "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='lto-plugin' + VERSION='0.1' + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "no acceptable C compiler found in \$PATH +See \`config.log' for more details." "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + rm -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +if test -z "$ac_file"; then : + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ as_fn_set_status 77 +as_fn_error "C compiler cannot create executables +See \`config.log' for more details." "$LINENO" 5; }; } +fi +ac_exeext=$ac_cv_exeext + +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out +ac_clean_files=$ac_clean_files_save +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." "$LINENO" 5; } +fi +rm -f conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if test "${ac_cv_objext+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "cannot compute suffix of object files: cannot compile +See \`config.log' for more details." "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 +$as_echo_n "checking for style of include used by $am_make... " >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from `make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 +$as_echo "$_am_result" >&6; } +rm -f confinc confmf + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + + + +case `pwd` in + *\ * | *\ *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 +$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; +esac + + + +macro_version='2.2.6' +macro_revision='1.3012' + + + + + + + + + + + + + +ltmain="$ac_aux_dir/ltmain.sh" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if test "${ac_cv_host+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if test "${ac_cv_path_SED+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if test "${ac_cv_path_GREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +$as_echo_n "checking for fgrep... " >&6; } +if test "${ac_cv_path_FGREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 + then ac_cv_path_FGREP="$GREP -F" + else + if test -z "$FGREP"; then + ac_path_FGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in fgrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue +# Check for GNU ac_path_FGREP and select it if it is found. + # Check for GNU $ac_path_FGREP +case `"$ac_path_FGREP" --version 2>&1` in +*GNU*) + ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'FGREP' >> "conftest.nl" + "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_FGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_FGREP="$ac_path_FGREP" + ac_path_FGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_FGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_FGREP"; then + as_fn_error "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_FGREP=$FGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +$as_echo "$ac_cv_path_FGREP" >&6; } + FGREP="$ac_cv_path_FGREP" + + +test -z "$GREP" && GREP=grep + + + + + + + + + + + + + + + + + + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then : + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +$as_echo_n "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } +fi +if test "${lt_cv_path_LD+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if test "${lt_cv_prog_gnu_ld+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +$as_echo "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if test "${lt_cv_path_NM+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + : ${lt_cv_path_NM=no} +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +$as_echo "$lt_cv_path_NM" >&6; } +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$ac_tool_prefix"; then + for ac_prog in "dumpbin -symbols" "link -dump -symbols" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_DUMPBIN+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DUMPBIN"; then + ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DUMPBIN=$ac_cv_prog_DUMPBIN +if test -n "$DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 +$as_echo "$DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$DUMPBIN" && break + done +fi +if test -z "$DUMPBIN"; then + ac_ct_DUMPBIN=$DUMPBIN + for ac_prog in "dumpbin -symbols" "link -dump -symbols" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DUMPBIN"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN +if test -n "$ac_ct_DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 +$as_echo "$ac_ct_DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_DUMPBIN" && break +done + + if test "x$ac_ct_DUMPBIN" = x; then + DUMPBIN=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DUMPBIN=$ac_ct_DUMPBIN + fi +fi + + + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" + fi +fi +test -z "$NM" && NM=nm + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 +$as_echo_n "checking the name lister ($NM) interface... " >&6; } +if test "${lt_cv_nm_interface+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:4403: $ac_compile\"" >&5) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&5 + (eval echo "\"\$as_me:4406: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&5 + (eval echo "\"\$as_me:4409: output\"" >&5) + cat conftest.out >&5 + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 +$as_echo "$lt_cv_nm_interface" >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +$as_echo_n "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +$as_echo "no, using $LN_S" >&6; } +fi + +# find the maximum length of command line arguments +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 +$as_echo_n "checking the maximum length of command line arguments... " >&6; } +if test "${lt_cv_sys_max_cmd_len+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8 ; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ + = "XX$teststring$teststring"; } >/dev/null 2>&1 && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac + +fi + +if test -n $lt_cv_sys_max_cmd_len ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 +$as_echo "$lt_cv_sys_max_cmd_len" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 +$as_echo "none" >&6; } +fi +max_cmd_len=$lt_cv_sys_max_cmd_len + + + + + + +: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 +$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } +# Try some XSI features +xsi_shell=no +( _lt_dummy="a/b/c" + test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 +$as_echo "$xsi_shell" >&6; } + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 +$as_echo_n "checking whether the shell understands \"+=\"... " >&6; } +lt_shell_append=no +( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ + >/dev/null 2>&1 \ + && lt_shell_append=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 +$as_echo "$lt_shell_append" >&6; } + + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi + + + + + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 +$as_echo_n "checking for $LD option to reload object files... " >&6; } +if test "${lt_cv_ld_reload_flag+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_reload_flag='-r' +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 +$as_echo "$lt_cv_ld_reload_flag" >&6; } +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + darwin*) + if test "$GCC" = yes; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_OBJDUMP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OBJDUMP=$ac_cv_prog_OBJDUMP +if test -n "$OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +$as_echo "$OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OBJDUMP"; then + ac_ct_OBJDUMP=$OBJDUMP + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OBJDUMP"; then + ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP +if test -n "$ac_ct_OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +$as_echo "$ac_ct_OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OBJDUMP=$ac_ct_OBJDUMP + fi +else + OBJDUMP="$ac_cv_prog_OBJDUMP" +fi + +test -z "$OBJDUMP" && OBJDUMP=objdump + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 +$as_echo_n "checking how to recognize dependent libraries... " >&6; } +if test "${lt_cv_deplibs_check_method+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix[4-9]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[45]*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + if ( file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[3-9]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 +$as_echo "$lt_cv_deplibs_check_method" >&6; } +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_AR+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_AR+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_AR="ar" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +else + AR="$ac_cv_prog_AR" +fi + +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru + + + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_STRIP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +test -z "$STRIP" && STRIP=: + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_RANLIB+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +test -z "$RANLIB" && RANLIB=: + + + + + + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 +$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } +if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[ABCDGISTW]' + ;; +hpux*) + if test "$host_cpu" = ia64; then + symcode='[ABCDEGRST]' + fi + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris*) + symcode='[BDRT]' + ;; +sco3.2v5*) + symcode='[DT]' + ;; +sysv4.2uw2*) + symcode='[DT]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[ABDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK '"\ +" {last_section=section; section=\$ 3};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ +" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ +" s[1]~/^[@?]/{print s[1], s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\""; } >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +$as_echo "ok" >&6; } +fi + + + + + + + + + + + + + + + + + + + + + + + +# Check whether --enable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then : + enableval=$enable_libtool_lock; +fi + +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 5615 "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 +$as_echo_n "checking whether the C compiler needs -belf... " >&6; } +if test "${lt_cv_cc_needs_belf+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_cc_needs_belf=yes +else + lt_cv_cc_needs_belf=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 +$as_echo "$lt_cv_cc_needs_belf" >&6; } + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +sparc*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) LD="${LD-ld} -m elf64_sparc" ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks="$enable_libtool_lock" + + + case $host_os in + rhapsody* | darwin*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. +set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_DSYMUTIL+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DSYMUTIL"; then + ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DSYMUTIL=$ac_cv_prog_DSYMUTIL +if test -n "$DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +$as_echo "$DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DSYMUTIL"; then + ac_ct_DSYMUTIL=$DSYMUTIL + # Extract the first word of "dsymutil", so it can be a program name with args. +set dummy dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DSYMUTIL"; then + ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL +if test -n "$ac_ct_DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 +$as_echo "$ac_ct_DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DSYMUTIL" = x; then + DSYMUTIL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DSYMUTIL=$ac_ct_DSYMUTIL + fi +else + DSYMUTIL="$ac_cv_prog_DSYMUTIL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. +set dummy ${ac_tool_prefix}nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_NMEDIT+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NMEDIT"; then + ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +NMEDIT=$ac_cv_prog_NMEDIT +if test -n "$NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 +$as_echo "$NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_NMEDIT"; then + ac_ct_NMEDIT=$NMEDIT + # Extract the first word of "nmedit", so it can be a program name with args. +set dummy nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_NMEDIT"; then + ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_NMEDIT="nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT +if test -n "$ac_ct_NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 +$as_echo "$ac_ct_NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_NMEDIT" = x; then + NMEDIT=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + NMEDIT=$ac_ct_NMEDIT + fi +else + NMEDIT="$ac_cv_prog_NMEDIT" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. +set dummy ${ac_tool_prefix}lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_LIPO+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$LIPO"; then + ac_cv_prog_LIPO="$LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_LIPO="${ac_tool_prefix}lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +LIPO=$ac_cv_prog_LIPO +if test -n "$LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 +$as_echo "$LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_LIPO"; then + ac_ct_LIPO=$LIPO + # Extract the first word of "lipo", so it can be a program name with args. +set dummy lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_LIPO"; then + ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_LIPO="lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO +if test -n "$ac_ct_LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 +$as_echo "$ac_ct_LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_LIPO" = x; then + LIPO=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + LIPO=$ac_ct_LIPO + fi +else + LIPO="$ac_cv_prog_LIPO" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_OTOOL+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL"; then + ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OTOOL="${ac_tool_prefix}otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL=$ac_cv_prog_OTOOL +if test -n "$OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 +$as_echo "$OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL"; then + ac_ct_OTOOL=$OTOOL + # Extract the first word of "otool", so it can be a program name with args. +set dummy otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL"; then + ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OTOOL="otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL +if test -n "$ac_ct_OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 +$as_echo "$ac_ct_OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL" = x; then + OTOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL=$ac_ct_OTOOL + fi +else + OTOOL="$ac_cv_prog_OTOOL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_OTOOL64+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL64"; then + ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL64=$ac_cv_prog_OTOOL64 +if test -n "$OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 +$as_echo "$OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL64"; then + ac_ct_OTOOL64=$OTOOL64 + # Extract the first word of "otool64", so it can be a program name with args. +set dummy otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL64"; then + ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OTOOL64="otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 +if test -n "$ac_ct_OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 +$as_echo "$ac_ct_OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL64" = x; then + OTOOL64=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL64=$ac_ct_OTOOL64 + fi +else + OTOOL64="$ac_cv_prog_OTOOL64" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 +$as_echo_n "checking for -single_module linker flag... " >&6; } +if test "${lt_cv_apple_cc_single_mod+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&5 + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 +$as_echo "$lt_cv_apple_cc_single_mod" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 +$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } +if test "${lt_cv_ld_exported_symbols_list+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_ld_exported_symbols_list=yes +else + lt_cv_ld_exported_symbols_list=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 +$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } + case $host_os in + rhapsody* | darwin1.[012]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[91]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[012]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + if test "$DSYMUTIL" != ":"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if test "${ac_cv_header_stdc+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +eval as_val=\$$as_ac_Header + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in dlfcn.h +do : + ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default +" +if test "x$ac_cv_header_dlfcn_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DLFCN_H 1 +_ACEOF + +fi + +done + + + +# Set options + + + + enable_dlopen=no + + + enable_win32_dll=no + + + # Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then : + enableval=$enable_shared; p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_shared=yes +fi + + + + + + + + + + # Check whether --enable-static was given. +if test "${enable_static+set}" = set; then : + enableval=$enable_static; p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_static=yes +fi + + + + + + + + + + +# Check whether --with-pic was given. +if test "${with_pic+set}" = set; then : + withval=$with_pic; pic_mode="$withval" +else + pic_mode=default +fi + + +test -z "$pic_mode" && pic_mode=default + + + + + + + + # Check whether --enable-fast-install was given. +if test "${enable_fast_install+set}" = set; then : + enableval=$enable_fast_install; p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_fast_install=yes +fi + + + + + + + + + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ltmain" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + + + + + + + + + + + + + + + + + + + + + + + + + +test -z "$LN_S" && LN_S="ln -s" + + + + + + + + + + + + + + +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 +$as_echo_n "checking for objdir... " >&6; } +if test "${lt_cv_objdir+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 +$as_echo "$lt_cv_objdir" >&6; } +objdir=$lt_cv_objdir + + + + + +cat >>confdefs.h <<_ACEOF +#define LT_OBJDIR "$lt_cv_objdir/" +_ACEOF + + + + + + + + + + + + + + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld="$lt_cv_prog_gnu_ld" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 +$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 +$as_echo_n "checking for file... " >&6; } +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +# Use C for the default configuration in the libtool script + +lt_save_CC="$CC" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* + + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + +lt_prog_compiler_no_builtin_flag= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag=' -fno-builtin' + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:7145: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:7149: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + + + + + + + lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } + + if test "$GCC" = yes; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + # old Intel for x86_64 which still supported -KPIC. + ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='--shared' + lt_prog_compiler_static='--static' + ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + xl*) + # IBM XL C 8.0/Fortran 10.1 on PPC + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-qpic' + lt_prog_compiler_static='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + esac + ;; + esac + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_can_build_shared=no + ;; + + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared=no + ;; + esac + fi + +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5 +$as_echo "$lt_prog_compiler_pic" >&6; } + + + + + + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } +if test "${lt_cv_prog_compiler_pic_works+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:7484: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:7488: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 +$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } + +if test x"$lt_cv_prog_compiler_pic_works" = xyes; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi + +fi + + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if test "${lt_cv_prog_compiler_static_works+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works=yes + fi + else + lt_cv_prog_compiler_static_works=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 +$as_echo "$lt_cv_prog_compiler_static_works" >&6; } + +if test x"$lt_cv_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test "${lt_cv_prog_compiler_c_o+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:7589: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:7593: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test "${lt_cv_prog_compiler_c_o+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:7644: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:7648: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +$as_echo_n "checking if we can lock with hard links... " >&6; } + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +$as_echo "$hard_links" >&6; } + if test "$hard_links" = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + + runpath_var= + allow_undefined_flag= + always_export_symbols=no + archive_cmds= + archive_expsym_cmds= + compiler_needs_object=no + enable_shared_with_static_runtimes=no + export_dynamic_flag_spec= + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + hardcode_automatic=no + hardcode_direct=no + hardcode_direct_absolute=no + hardcode_libdir_flag_spec= + hardcode_libdir_flag_spec_ld= + hardcode_libdir_separator= + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + inherit_rpath=no + link_all_deplibs=unknown + module_cmds= + module_expsym_cmds= + old_archive_from_new_cmds= + old_archive_from_expsyms_cmds= + thread_safe_flag_spec= + whole_archive_flag_spec= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs=no + fi + ;; + + interix[3-9]*) + hardcode_direct=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test "$host_os" = linux-dietlibc; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test "$tmp_diet" = no + then + tmp_addflag= + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + whole_archive_flag_spec= + tmp_sharedflag='--shared' ;; + xl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + xlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' + hardcode_libdir_flag_spec= + hardcode_libdir_flag_spec_ld='-rpath $libdir' + archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = no; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_direct_absolute=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + file_list_spec='${wl}-f,' + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + export_dynamic_flag_spec='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + archive_cmds_need_lc=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + bsdi[45]*) + export_dynamic_flag_spec=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes=yes + ;; + + darwin* | rhapsody*) + + + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + whole_archive_flag_spec='' + link_all_deplibs=yes + allow_undefined_flag="$_lt_dar_allow_undefined" + case $cc_basename in + ifort*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test "$_lt_dar_can_shared" = "yes"; then + output_verbose_link_cmd=echo + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + + else + ld_shlibs=no + fi + + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld='+b $libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + *) + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo(void) {} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + inherit_rpath=yes + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + *nto* | *qnx*) + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + hardcode_shlibpath_var=no + hardcode_direct_absolute=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + archive_cmds_need_lc='no' + hardcode_libdir_separator=: + ;; + + solaris*) + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='${wl}' + archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag='${wl}-z,text' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag='${wl}-z,text' + allow_undefined_flag='${wl}-z,nodefs' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-R,$libdir' + hardcode_libdir_separator=':' + link_all_deplibs=yes + export_dynamic_flag_spec='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + + if test x$host_vendor = xsni; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + export_dynamic_flag_spec='${wl}-Blargedynsym' + ;; + esac + fi + fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 +$as_echo "$ld_shlibs" >&6; } +test "$ld_shlibs" = no && can_build_shared=no + +with_gnu_ld=$with_gnu_ld + + + + + + + + + + + + + + + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } +if test "${lt_cv_archive_cmds_need_lc+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 +$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } + archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +$as_echo_n "checking dynamic linker characteristics... " >&6; } + +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` + else + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[lt_foo]++; } + if (lt_freq[lt_foo] == 1) { print lt_foo; } +}'` + sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[4-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[123]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +interix[3-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + if test "${lt_cv_shlibpath_overrides_runpath+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : + lt_cv_shlibpath_overrides_runpath=yes +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +$as_echo "$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +fi +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +$as_echo_n "checking how to hardcode library paths into programs... " >&6; } +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || + test -n "$runpath_var" || + test "X$hardcode_automatic" = "Xyes" ; then + + # We can hardcode non-existent directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 +$as_echo "$hardcode_action" >&6; } + +if test "$hardcode_action" = relink || + test "$inherit_rpath" = yes; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if test "${ac_cv_lib_dl_dlopen+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" +if test "x$ac_cv_func_shl_load" = x""yes; then : + lt_cv_dlopen="shl_load" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 +$as_echo_n "checking for shl_load in -ldld... " >&6; } +if test "${ac_cv_lib_dld_shl_load+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char shl_load (); +int +main () +{ +return shl_load (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_shl_load=yes +else + ac_cv_lib_dld_shl_load=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 +$as_echo "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = x""yes; then : + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" +else + ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" +if test "x$ac_cv_func_dlopen" = x""yes; then : + lt_cv_dlopen="dlopen" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if test "${ac_cv_lib_dl_dlopen+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 +$as_echo_n "checking for dlopen in -lsvld... " >&6; } +if test "${ac_cv_lib_svld_dlopen+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_svld_dlopen=yes +else + ac_cv_lib_svld_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 +$as_echo "$ac_cv_lib_svld_dlopen" >&6; } +if test "x$ac_cv_lib_svld_dlopen" = x""yes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 +$as_echo_n "checking for dld_link in -ldld... " >&6; } +if test "${ac_cv_lib_dld_dld_link+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dld_link (); +int +main () +{ +return dld_link (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_dld_link=yes +else + ac_cv_lib_dld_dld_link=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 +$as_echo "$ac_cv_lib_dld_dld_link" >&6; } +if test "x$ac_cv_lib_dld_dld_link" = x""yes; then : + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 +$as_echo_n "checking whether a program can dlopen itself... " >&6; } +if test "${lt_cv_dlopen_self+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line 10026 "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 +$as_echo "$lt_cv_dlopen_self" >&6; } + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 +$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } +if test "${lt_cv_dlopen_self_static+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line 10122 "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 +$as_echo "$lt_cv_dlopen_self_static" >&6; } + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + + + + + + + + + + + + + + + + +striplib= +old_striplib= +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 +$as_echo_n "checking whether stripping libraries is possible... " >&6; } +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + esac +fi + + + + + + + + + + + + + # Report which library types will actually be built + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 +$as_echo_n "checking if libtool supports shared libraries... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 +$as_echo "$can_build_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 +$as_echo_n "checking whether to build shared libraries... " >&6; } + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[4-9]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 +$as_echo "$enable_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 +$as_echo_n "checking whether to build static libraries... " >&6; } + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +$as_echo "$enable_static" >&6; } + + + + +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC="$lt_save_CC" + + + + + + + + + + + + + + ac_config_commands="$ac_config_commands libtool" + + + + +# Only expand once: + + + +ac_config_files="$ac_config_files Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +ac_script=' +:mline +/\\$/{ + N + s,\\\n,, + b mline +} +t clear +:clear +s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g +t quote +s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g +t quote +b any +:quote +s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g +s/\[/\\&/g +s/\]/\\&/g +s/\$/$$/g +H +:any +${ + g + s/^\n// + s/\n/ /g + p +} +' +DEFS=`sed -n "$ac_script" confdefs.h` + + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: ${CONFIG_STATUS=./config.status} +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error ERROR [LINENO LOG_FD] +# --------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with status $?, using 1 if that was 0. +as_fn_error () +{ + as_status=$?; test $as_status -eq 0 && as_status=1 + if test "$3"; then + as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 + fi + $as_echo "$as_me: error: $1" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by LTO plugin for ld $as_me 0.1, which was +generated by GNU Autoconf 2.64. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Configuration commands: +$config_commands + +Report bugs to the package provider." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_version="\\ +LTO plugin for ld config.status 0.1 +configured by $0, generated by GNU Autoconf 2.64, + with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2009 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`' +macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`' +enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`' +enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`' +pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`' +host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`' +host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`' +host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`' +build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`' +build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`' +build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`' +SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`' +Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`' +GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`' +EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`' +FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`' +LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`' +NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`' +LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`' +ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`' +exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`' +lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`' +reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`' +OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`' +AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`' +STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`' +RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' +CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`' +compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`' +GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' +objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`' +SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`' +ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`' +need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`' +DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`' +NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`' +LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`' +OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`' +OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`' +libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' +module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`' +fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' +need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`' +version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`' +runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`' +libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`' +soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`' +finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`' +sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`' +old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`' +striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`' + +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# Quote evaled strings. +for var in SED \ +GREP \ +EGREP \ +FGREP \ +LD \ +NM \ +LN_S \ +lt_SP2NL \ +lt_NL2SP \ +reload_flag \ +OBJDUMP \ +deplibs_check_method \ +file_magic_cmd \ +AR \ +AR_FLAGS \ +STRIP \ +RANLIB \ +CC \ +CFLAGS \ +compiler \ +lt_cv_sys_global_symbol_pipe \ +lt_cv_sys_global_symbol_to_cdecl \ +lt_cv_sys_global_symbol_to_c_name_address \ +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ +SHELL \ +ECHO \ +lt_prog_compiler_no_builtin_flag \ +lt_prog_compiler_wl \ +lt_prog_compiler_pic \ +lt_prog_compiler_static \ +lt_cv_prog_compiler_c_o \ +need_locks \ +DSYMUTIL \ +NMEDIT \ +LIPO \ +OTOOL \ +OTOOL64 \ +shrext_cmds \ +export_dynamic_flag_spec \ +whole_archive_flag_spec \ +compiler_needs_object \ +with_gnu_ld \ +allow_undefined_flag \ +no_undefined_flag \ +hardcode_libdir_flag_spec \ +hardcode_libdir_flag_spec_ld \ +hardcode_libdir_separator \ +fix_srcfile_path \ +exclude_expsyms \ +include_expsyms \ +file_list_spec \ +variables_saved_for_relink \ +libname_spec \ +library_names_spec \ +soname_spec \ +finish_eval \ +old_striplib \ +striplib; do + case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in reload_cmds \ +old_postinstall_cmds \ +old_postuninstall_cmds \ +old_archive_cmds \ +extract_expsyms_cmds \ +old_archive_from_new_cmds \ +old_archive_from_expsyms_cmds \ +archive_cmds \ +archive_expsym_cmds \ +module_cmds \ +module_expsym_cmds \ +export_symbols_cmds \ +prelink_cmds \ +postinstall_cmds \ +postuninstall_cmds \ +finish_cmds \ +sys_lib_search_path_spec \ +sys_lib_dlsearch_path_spec; do + case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Fix-up fallback echo if it was mangled by the above quoting rules. +case \$lt_ECHO in +*'\\\$0 --fallback-echo"') lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\` + ;; +esac + +ac_aux_dir='$ac_aux_dir' +xsi_shell='$xsi_shell' +lt_shell_append='$lt_shell_append' + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + + + PACKAGE='$PACKAGE' + VERSION='$VERSION' + TIMESTAMP='$TIMESTAMP' + RM='$RM' + ofile='$ofile' + + + + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + + *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5 + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\).*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\).*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ + || as_fn_error "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + + +eval set X " :F $CONFIG_FILES :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin" \ + || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ + || as_fn_error "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out" && rm -f "$tmp/out";; + *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + esac \ + || as_fn_error "could not create $ac_file" "$LINENO" 5 + ;; + + + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Autoconf 2.62 quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir=$dirpart/$fdir; as_fn_mkdir_p + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} + ;; + "libtool":C) + + # See if we are running on zsh, and set the options which allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + + cfgfile="${ofile}T" + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008 Free Software Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is part of GNU Libtool. +# +# GNU Libtool 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 2 of +# the License, or (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool 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. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +# The names of the tagged configurations supported by this script. +available_tags="" + +# ### BEGIN LIBTOOL CONFIG + +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# What type of objects to build. +pic_mode=$pic_mode + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="\$SED -e 1s/^X//" + +# A grep program that handles long lines. +GREP=$lt_GREP + +# An ERE matcher. +EGREP=$lt_EGREP + +# A literal string matcher. +FGREP=$lt_FGREP + +# A BSD- or MS-compatible name lister. +NM=$lt_NM + +# Whether we need soft or hard links. +LN_S=$lt_LN_S + +# What is the maximum length of a command? +max_cmd_len=$max_cmd_len + +# Object file suffix (normally "o"). +objext=$ac_objext + +# Executable file suffix (normally ""). +exeext=$exeext + +# whether the shell understands "unset". +lt_unset=$lt_unset + +# turn spaces into newlines. +SP2NL=$lt_lt_SP2NL + +# turn newlines into spaces. +NL2SP=$lt_lt_NL2SP + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# An object symbol dumper. +OBJDUMP=$lt_OBJDUMP + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == "file_magic". +file_magic_cmd=$lt_file_magic_cmd + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A symbol stripping program. +STRIP=$lt_STRIP + +# Commands used to install an old-style archive. +RANLIB=$lt_RANLIB +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# A C compiler. +LTCC=$lt_CC + +# LTCC compiler flags. +LTCFLAGS=$lt_CFLAGS + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration. +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair. +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# Transform the output of nm in a C name address pair when lib prefix is needed. +global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that does not interpret backslashes. +ECHO=$lt_ECHO + +# Used to examine libraries when file_magic_cmd begins with "file". +MAGIC_CMD=$MAGIC_CMD + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Tool to manipulate archived DWARF debug symbol files on Mac OS X. +DSYMUTIL=$lt_DSYMUTIL + +# Tool to change global to local symbols on Mac OS X. +NMEDIT=$lt_NMEDIT + +# Tool to manipulate fat objects and archives on Mac OS X. +LIPO=$lt_LIPO + +# ldd/readelf like tool for Mach-O binaries on Mac OS X. +OTOOL=$lt_OTOOL + +# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. +OTOOL64=$lt_OTOOL64 + +# Old archive suffix (normally "a"). +libext=$libext + +# Shared library suffix (normally ".so"). +shrext_cmds=$lt_shrext_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at link time. +variables_saved_for_relink=$lt_variables_saved_for_relink + +# Do we need the "lib" prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Library versioning type. +version_type=$version_type + +# Shared library runtime path variable. +runpath_var=$runpath_var + +# Shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Command to use after installation of a shared archive. +postinstall_cmds=$lt_postinstall_cmds + +# Command to use after uninstallation of a shared archive. +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# As "finish_cmds", except a single script fragment to be evaled but +# not shown. +finish_eval=$lt_finish_eval + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Compile-time system search path for libraries. +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + + +# The linker used to build libraries. +LD=$lt_LD + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds + +# A language specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU compiler? +with_gcc=$GCC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# If ld is used when linking, flag to hardcode \$libdir into a binary +# during linking. This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \${shlibpath_var} if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# ### END LIBTOOL CONFIG + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + +ltmain="$ac_aux_dir/ltmain.sh" + + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + case $xsi_shell in + yes) + cat << \_LT_EOF >> "$cfgfile" + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac +} + +# func_basename file +func_basename () +{ + func_basename_result="${1##*/}" +} + +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac + func_basename_result="${1##*/}" +} + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +func_stripname () +{ + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary parameter first. + func_stripname_result=${3} + func_stripname_result=${func_stripname_result#"${1}"} + func_stripname_result=${func_stripname_result%"${2}"} +} + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=${1%%=*} + func_opt_split_arg=${1#*=} +} + +# func_lo2o object +func_lo2o () +{ + case ${1} in + *.lo) func_lo2o_result=${1%.lo}.${objext} ;; + *) func_lo2o_result=${1} ;; + esac +} + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=${1%.*}.lo +} + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=$(( $* )) +} + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=${#1} +} + +_LT_EOF + ;; + *) # Bourne compatible functions. + cat << \_LT_EOF >> "$cfgfile" + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi +} + +# func_basename file +func_basename () +{ + func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` +} + + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# func_strip_suffix prefix name +func_stripname () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; + esac +} + +# sed scripts: +my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q' +my_sed_long_arg='1s/^-[^=]*=//' + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` + func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` +} + +# func_lo2o object +func_lo2o () +{ + func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` +} + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'` +} + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=`expr "$@"` +} + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` +} + +_LT_EOF +esac + +case $lt_shell_append in + yes) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$1+=\$2" +} +_LT_EOF + ;; + *) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$1=\$$1\$2" +} + +_LT_EOF + ;; + esac + + + sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit $? +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + +# Check whether --enable-largefile was given. +if test "${enable_largefile+set}" = set; then : + enableval=$enable_largefile; +fi + +if test "$enable_largefile" != no; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 +$as_echo_n "checking for special C compiler options needed for large files... " >&6; } +if test "${ac_cv_sys_largefile_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_sys_largefile_CC=no + if test "$GCC" != yes; then + ac_save_CC=$CC + while :; do + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF + if ac_fn_c_try_compile "$LINENO"; then : + break +fi +rm -f core conftest.err conftest.$ac_objext + CC="$CC -n32" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_largefile_CC=' -n32'; break +fi +rm -f core conftest.err conftest.$ac_objext + break + done + CC=$ac_save_CC + rm -f conftest.$ac_ext + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 +$as_echo "$ac_cv_sys_largefile_CC" >&6; } + if test "$ac_cv_sys_largefile_CC" != no; then + CC=$CC$ac_cv_sys_largefile_CC + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } +if test "${ac_cv_sys_file_offset_bits+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_file_offset_bits=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _FILE_OFFSET_BITS 64 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_file_offset_bits=64; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_file_offset_bits=unknown + break +done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 +$as_echo "$ac_cv_sys_file_offset_bits" >&6; } +case $ac_cv_sys_file_offset_bits in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits +_ACEOF +;; +esac +rm -rf conftest* + if test $ac_cv_sys_file_offset_bits = unknown; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 +$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } +if test "${ac_cv_sys_large_files+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_large_files=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _LARGE_FILES 1 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_large_files=1; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_large_files=unknown + break +done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 +$as_echo "$ac_cv_sys_large_files" >&6; } +case $ac_cv_sys_large_files in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _LARGE_FILES $ac_cv_sys_large_files +_ACEOF +;; +esac +rm -rf conftest* + fi +fi + diff --git a/lto-plugin/configure.ac b/lto-plugin/configure.ac new file mode 100644 index 00000000000..277d31135fe --- /dev/null +++ b/lto-plugin/configure.ac @@ -0,0 +1,12 @@ +AC_PREREQ(2.64) +AC_INIT([LTO plugin for ld], 0.1,,[lto-plugin]) +GCC_TOPLEV_SUBDIRS +AM_INIT_AUTOMAKE([foreign]) +AC_PROG_CC +AC_ARG_VAR(LIBELFLIBS,[How to link libelf]) +AC_ARG_VAR(LIBELFINC,[How to find libelf include files]) +AM_PROG_LIBTOOL +AC_SUBST(target_noncanonical) +AC_CONFIG_FILES(Makefile) +AC_OUTPUT +AC_SYS_LARGEFILE diff --git a/lto-plugin/lto-plugin.c b/lto-plugin/lto-plugin.c new file mode 100644 index 00000000000..a0c1a54e0e2 --- /dev/null +++ b/lto-plugin/lto-plugin.c @@ -0,0 +1,689 @@ +/* LTO plugin for gold. + Copyright (C) 2009 Free Software Foundation, Inc. + Contributed by Rafael Avila de Espindola (espindola@google.com). + +This program 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. + +This program 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. + +You should have received a copy of the GNU General Public License +along with this program; see the file COPYING3. If not see +. */ + +/* The plugin has only one external function: onload. Gold passes it an array of + function that the plugin uses to communicate back to gold. + + With the functions provided by gold, the plugin can be notified when + gold first analyzes a file and pass a symbol table back to gold. The plugin + is also notified when all symbols have been read and it is time to generate + machine code for the necessary symbols. + + More information at http://gcc.gnu.org/wiki/whopr/driver. + + This plugin should be passed the lto-wrapper options and will forward them. + It also has 2 options of its own: + -debug: Print the command line used to run lto-wrapper. + -nop: Instead of running lto-wrapper, pass the original to the plugin. This + only works if the input files are hybrid. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* The presence of gelf.h is checked by the toplevel configure script. */ +#include + +#include "plugin-api.h" +#include "../gcc/lto/common.h" + +/* The part of the symbol table the plugin has to keep track of. Note that we + must keep SYMS until all_symbols_read is called to give the linker time to + copy the symbol information. */ + +struct plugin_symtab +{ + int nsyms; + uint32_t *slots; + struct ld_plugin_symbol *syms; +}; + +/* All that we have to remember about a file. */ + +struct plugin_file_info +{ + char *name; + void *handle; + struct plugin_symtab symtab; + unsigned char temp; +}; + + +static char *temp_obj_dir_name; +static ld_plugin_register_claim_file register_claim_file; +static ld_plugin_add_symbols add_symbols; +static ld_plugin_register_all_symbols_read register_all_symbols_read; +static ld_plugin_get_symbols get_symbols; +static ld_plugin_register_cleanup register_cleanup; +static ld_plugin_add_input_file add_input_file; + +static struct plugin_file_info *claimed_files = NULL; +static unsigned int num_claimed_files = 0; + +static char **output_files = NULL; +static unsigned int num_output_files = 0; + +static char **lto_wrapper_argv; +static int lto_wrapper_num_args; + +static char **pass_through_items = NULL; +static unsigned int num_pass_through_items; + +static bool debug; +static bool nop; + +/* Parse an entry of the IL symbol table. The data to be parsed is pointed + by P and the result is written in ENTRY. The slot number is stored in SLOT. + Returns the address of the next entry. */ + +static char * +parse_table_entry (char *p, struct ld_plugin_symbol *entry, uint32_t *slot) +{ + unsigned char t; + enum ld_plugin_symbol_kind translate_kind[] = + { + LDPK_DEF, + LDPK_WEAKDEF, + LDPK_UNDEF, + LDPK_WEAKUNDEF, + LDPK_COMMON + }; + + enum ld_plugin_symbol_visibility translate_visibility[] = + { + LDPV_DEFAULT, + LDPV_PROTECTED, + LDPV_INTERNAL, + LDPV_HIDDEN + }; + + entry->name = strdup (p); + while (*p) + p++; + p++; + + entry->version = NULL; + + entry->comdat_key = p; + while (*p) + p++; + p++; + + if (strlen (entry->comdat_key) == 0) + entry->comdat_key = NULL; + else + entry->comdat_key = strdup (entry->comdat_key); + + t = *p; + assert (t <= 4); + entry->def = translate_kind[t]; + p++; + + t = *p; + assert (t <= 3); + entry->visibility = translate_visibility[t]; + p++; + + entry->size = *(uint64_t *) p; + p += 8; + + *slot = *(uint32_t *) p; + p += 4; + + entry->resolution = LDPR_UNKNOWN; + + return p; +} + +/* Return the section in ELF that is named NAME. */ + +static Elf_Scn * +get_section (Elf *elf, const char *name) +{ + Elf_Scn *section = 0; + GElf_Ehdr header; + GElf_Ehdr *t = gelf_getehdr (elf, &header); + if (t == NULL) + return NULL; + assert (t == &header); + + while ((section = elf_nextscn(elf, section)) != 0) + { + GElf_Shdr shdr; + GElf_Shdr *tshdr = gelf_getshdr (section, &shdr); + const char *t; + assert (tshdr == &shdr); + t = elf_strptr (elf, header.e_shstrndx, shdr.sh_name); + assert (t != NULL); + if (strcmp (t, name) == 0) + return section; + } + return NULL; +} + +/* Returns the IL symbol table of file ELF. */ + +static Elf_Data * +get_symtab (Elf *elf) +{ + Elf_Data *data = 0; + Elf_Scn *section = get_section (elf, ".gnu.lto_.symtab"); + if (!section) + return NULL; + + data = elf_getdata (section, data); + assert (data); + return data; +} + +/* Translate the IL symbol table SYMTAB. Write the slots and symbols in OUT. */ + +static void +translate (Elf_Data *symtab, struct plugin_symtab *out) +{ + uint32_t *slots = NULL; + char *data = symtab->d_buf; + char *end = data + symtab->d_size; + struct ld_plugin_symbol *syms = NULL; + int n = 0; + + while (data < end) + { + n++; + syms = realloc (syms, n * sizeof (struct ld_plugin_symbol)); + assert (syms); + slots = realloc (slots, n * sizeof (uint32_t)); + assert (slots); + data = parse_table_entry (data, &syms[n - 1], &slots[n - 1]); + } + + out->nsyms = n; + out->syms = syms; + out->slots = slots; +} + +/* Free all memory that is no longer needed at the beginning of all_symbols_read. */ + +static void +free_1 (void) +{ + unsigned int i; + for (i = 0; i < num_claimed_files; i++) + { + struct plugin_file_info *info = &claimed_files[i]; + struct plugin_symtab *symtab = &info->symtab; + unsigned int j; + for (j = 0; j < symtab->nsyms; j++) + { + struct ld_plugin_symbol *s = &symtab->syms[j]; + free (s->name); + if (s->comdat_key) + free (s->comdat_key); + } + free (symtab->syms); + symtab->syms = NULL; + } +} + +/* Free all remaining memory. */ + +static void +free_2 (void) +{ + unsigned int i; + for (i = 0; i < num_claimed_files; i++) + { + struct plugin_file_info *info = &claimed_files[i]; + struct plugin_symtab *symtab = &info->symtab; + free (symtab->slots); + free (info->name); + } + + for (i = 0; i < num_output_files; i++) + free (output_files[i]); + free (output_files); + + free (claimed_files); + claimed_files = NULL; + num_claimed_files = 0; + + free (temp_obj_dir_name); + temp_obj_dir_name = NULL; +} + +/* Writes the relocations to disk. */ + +static void +write_resolution (void) +{ + unsigned int i; + FILE *f; + /* FIXME: Disabled for now since we are not using the resolution file. */ + return; + + + /* FIXME: This should be a temporary file. */ + f = fopen ("resolution", "w"); + + fprintf (f, "%d\n", num_claimed_files); + + for (i = 0; i < num_claimed_files; i++) + { + struct plugin_file_info *info = &claimed_files[i]; + struct plugin_symtab *symtab = &info->symtab; + struct ld_plugin_symbol *syms = calloc (symtab->nsyms, + sizeof (struct ld_plugin_symbol)); + unsigned j; + + assert (syms); + get_symbols (info->handle, symtab->nsyms, syms); + + fprintf (f, "%s %d\n", info->name, info->symtab.nsyms); + + for (j = 0; j < info->symtab.nsyms; j++) + { + uint32_t slot = symtab->slots[j]; + unsigned int resolution = syms[j].resolution; + fprintf (f, "%d %s\n", slot, lto_resolution_str[resolution]); + } + free (syms); + } + fclose (f); +} + +/* Pass files generated by the lto-wrapper to the linker. FD is lto-wrapper's + stdout. */ + +static void +add_output_files (FILE *f) +{ + char fname[1000]; /* FIXME: Is this big enough? */ + + for (;;) + { + size_t len; + char *s = fgets (fname, sizeof (fname), f); + if (!s) + break; + + len = strlen (s); + assert (s[len - 1] == '\n'); + s[len - 1] = '\0'; + + num_output_files++; + output_files = realloc (output_files, num_output_files * sizeof (char *)); + output_files[num_output_files - 1] = strdup (s); + add_input_file (output_files[num_output_files - 1]); + } +} + +/* Execute the lto-wrapper. ARGV[0] is the binary. The rest of ARGV is the + argument list. */ + +static void +exec_lto_wrapper (char *argv[]) +{ + int t; + int status; + char *at_args; + char *args_name; + FILE *args; + FILE *wrapper_output; + char *new_argv[3]; + struct pex_obj *pex; + const char *errmsg; + + /* Write argv to a file to avoid a command line that is too long. */ + t = asprintf (&at_args, "@%s/arguments", temp_obj_dir_name); + assert (t >= 0); + + args_name = at_args + 1; + args = fopen (args_name, "w"); + assert (args); + + t = writeargv (&argv[1], args); + assert (t == 0); + t = fclose (args); + assert (t == 0); + + new_argv[0] = argv[0]; + new_argv[1] = at_args; + new_argv[2] = NULL; + + if (debug) + { + int i; + for (i = 0; new_argv[i]; i++) + fprintf (stderr, "%s ", new_argv[i]); + fprintf (stderr, "\n"); + } + + + pex = pex_init (PEX_USE_PIPES, "lto-wrapper", NULL); + assert (pex != NULL); + + errmsg = pex_run (pex, 0, new_argv[0], new_argv, NULL, NULL, &t); + assert (errmsg == NULL); + assert (t == 0); + + wrapper_output = pex_read_output (pex, 0); + assert (wrapper_output); + + add_output_files (wrapper_output); + + t = pex_get_status (pex, 1, &status); + assert (t == 1); + assert (WIFEXITED (status) && WEXITSTATUS (status) == 0); + + pex_free (pex); + + t = unlink (args_name); + assert (t == 0); + free (at_args); +} + +/* Pass the original files back to the linker. */ + +static void +use_original_files (void) +{ + unsigned i; + for (i = 0; i < num_claimed_files; i++) + { + struct plugin_file_info *info = &claimed_files[i]; + add_input_file (info->name); + } +} + + +/* Called by the linker once all symbols have been read. */ + +static enum ld_plugin_status +all_symbols_read_handler (void) +{ + unsigned i; + unsigned num_lto_args = num_claimed_files + lto_wrapper_num_args + 1; + char **lto_argv; + const char **lto_arg_ptr; + if (num_claimed_files == 0) + return LDPS_OK; + + free_1 (); + + if (nop) + { + use_original_files (); + return LDPS_OK; + } + + lto_argv = (char **) calloc (sizeof (char *), num_lto_args); + lto_arg_ptr = (const char **) lto_argv; + assert (lto_wrapper_argv); + + write_resolution (); + + for (i = 0; i < lto_wrapper_num_args; i++) + *lto_arg_ptr++ = lto_wrapper_argv[i]; + + for (i = 0; i < num_claimed_files; i++) + { + struct plugin_file_info *info = &claimed_files[i]; + + *lto_arg_ptr++ = info->name; + } + + *lto_arg_ptr++ = NULL; + exec_lto_wrapper (lto_argv); + + free (lto_argv); + + if (pass_through_items) + { + unsigned int i; + for (i = 0; i < num_pass_through_items; i++) + { + add_input_file (pass_through_items[i]); + free (pass_through_items[i]); + pass_through_items[i] = NULL; + } + free (pass_through_items); + pass_through_items = NULL; + } + + return LDPS_OK; +} + +/* Remove temporary files at the end of the link. */ + +static enum ld_plugin_status +cleanup_handler (void) +{ + int t; + unsigned i; + + for (i = 0; i < num_claimed_files; i++) + { + struct plugin_file_info *info = &claimed_files[i]; + if (info->temp) + { + t = unlink (info->name); + assert (t == 0); + } + } + t = rmdir (temp_obj_dir_name); + assert (t == 0); + + free_2 (); + return LDPS_OK; +} + +/* Callback used by gold to check if the plugin will claim FILE. Writes + the result in CLAIMED. */ + +static enum ld_plugin_status +claim_file_handler (const struct ld_plugin_input_file *file, int *claimed) +{ + enum ld_plugin_status status; + Elf *elf; + struct plugin_file_info lto_file; + Elf_Data *symtab; + int lto_file_fd; + + if (file->offset != 0) + { + /* FIXME lto: lto1 should know how to handle archives. */ + int fd; + off_t size = file->filesize; + off_t offset; + + static int objnum = 0; + char *objname; + int t = asprintf (&objname, "%s/obj%d.o", + temp_obj_dir_name, objnum); + assert (t >= 0); + objnum++; + + fd = open (objname, O_RDWR | O_CREAT, 0666); + assert (fd > 0); + offset = lseek (file->fd, file->offset, SEEK_SET); + assert (offset == file->offset); + while (size > 0) + { + ssize_t r, written; + char buf[1000]; + off_t s = sizeof (buf) < size ? sizeof (buf) : size; + r = read (file->fd, buf, s); + written = write (fd, buf, r); + assert (written = r); + size -= r; + } + lto_file.name = objname; + lto_file_fd = fd; + lto_file.handle = file->handle; + lto_file.temp = 1; + } + else + { + lto_file.name = strdup (file->name); + lto_file_fd = file->fd; + lto_file.handle = file->handle; + lto_file.temp = 0; + } + elf = elf_begin (lto_file_fd, ELF_C_READ, NULL); + + *claimed = 0; + + if (!elf) + goto err; + + symtab = get_symtab (elf); + if (!symtab) + goto err; + + translate (symtab, <o_file.symtab); + + status = add_symbols (file->handle, lto_file.symtab.nsyms, + lto_file.symtab.syms); + assert (status == LDPS_OK); + + *claimed = 1; + num_claimed_files++; + claimed_files = + realloc (claimed_files, + num_claimed_files * sizeof (struct plugin_file_info)); + claimed_files[num_claimed_files - 1] = lto_file; + + goto cleanup; + + err: + if (file->offset != 0) + { + int t = unlink (lto_file.name); + assert (t == 0); + } + free (lto_file.name); + + cleanup: + if (elf) + elf_end (elf); + + return LDPS_OK; +} + +/* Parse the plugin options. */ + +static void +process_option (const char *option) +{ + if (strcmp (option, "-debug") == 0) + debug = 1; + else if (strcmp (option, "-nop") == 0) + nop = 1; + else if (!strncmp (option, "-pass-through=", strlen("-pass-through="))) + { + num_pass_through_items++; + pass_through_items = realloc (pass_through_items, num_pass_through_items * sizeof (char *)); + pass_through_items[num_pass_through_items - 1] = strdup (option + strlen ("-pass-through=")); + } + else + { + int size; + lto_wrapper_num_args += 1; + size = lto_wrapper_num_args * sizeof (char *); + lto_wrapper_argv = (char **) realloc (lto_wrapper_argv, size); + lto_wrapper_argv[lto_wrapper_num_args - 1] = strdup(option); + } +} + +/* Called by gold after loading the plugin. TV is the transfer vector. */ + +enum ld_plugin_status +onload (struct ld_plugin_tv *tv) +{ + struct ld_plugin_tv *p; + enum ld_plugin_status status; + char *t; + + unsigned version = elf_version (EV_CURRENT); + assert (version != EV_NONE); + + p = tv; + while (p->tv_tag) + { + switch (p->tv_tag) + { + case LDPT_REGISTER_CLAIM_FILE_HOOK: + register_claim_file = p->tv_u.tv_register_claim_file; + break; + case LDPT_ADD_SYMBOLS: + add_symbols = p->tv_u.tv_add_symbols; + break; + case LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK: + register_all_symbols_read = p->tv_u.tv_register_all_symbols_read; + break; + case LDPT_GET_SYMBOLS: + get_symbols = p->tv_u.tv_get_symbols; + break; + case LDPT_REGISTER_CLEANUP_HOOK: + register_cleanup = p->tv_u.tv_register_cleanup; + break; + case LDPT_ADD_INPUT_FILE: + add_input_file = p->tv_u.tv_add_input_file; + break; + case LDPT_OPTION: + process_option (p->tv_u.tv_string); + break; + default: + break; + } + p++; + } + + assert (register_claim_file); + assert (add_symbols); + status = register_claim_file (claim_file_handler); + assert (status == LDPS_OK); + + if (register_cleanup) + { + status = register_cleanup (cleanup_handler); + assert (status == LDPS_OK); + } + + if (register_all_symbols_read) + { + assert (get_symbols); + status = register_all_symbols_read (all_symbols_read_handler); + assert (status == LDPS_OK); + } + + temp_obj_dir_name = strdup ("tmp_objectsXXXXXX"); + t = mkdtemp (temp_obj_dir_name); + assert (t == temp_obj_dir_name); + return LDPS_OK; +} diff --git a/lto-plugin/lto-symtab.c b/lto-plugin/lto-symtab.c new file mode 100644 index 00000000000..fc42a9eb816 --- /dev/null +++ b/lto-plugin/lto-symtab.c @@ -0,0 +1,359 @@ +/* Program to read the IL symbol table. + Copyright (C) 2008 Free Software Foundation, Inc. + Contributed by Rafael Avila de Espindola (espindola@google.com). + +This program 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 of the License, or +(at your option) any later version. + +This program 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. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include +#include +#include +#include +#include +#include +#include + +#include "plugin-api.h" +#include "../gcc/lto/common.h" + +/* The presence of gelf.h is checked by the toplevel configure script. */ +# include + +static ld_plugin_claim_file_handler claim_file_handler; +static ld_plugin_all_symbols_read_handler all_symbols_read_handler; +static ld_plugin_cleanup_handler cleanup_handler; +static void *plugin_handle; + +struct file_handle { + unsigned nsyms; + struct ld_plugin_symbol *syms; +}; + +static struct file_handle **all_file_handles = NULL; +static unsigned int num_file_handles; + +/* Write NSYMS symbols from file HANDLE in SYMS. */ + +static enum ld_plugin_status +get_symbols (const void *handle, int nsyms, struct ld_plugin_symbol *syms) +{ + unsigned i; + struct file_handle *h = (struct file_handle *) handle; + assert (h->nsyms == nsyms); + + for (i = 0; i < nsyms; i++) + syms[i] = h->syms[i]; + + return LDPS_OK; +} + +/* Register HANDLER as the callback for notifying the plugin that all symbols + have been read. */ + +static enum ld_plugin_status +register_all_symbols_read (ld_plugin_all_symbols_read_handler handler) +{ + all_symbols_read_handler = handler; + return LDPS_OK; +} + +/* Register HANDLER as the callback for claiming a file. */ + +static enum ld_plugin_status +register_claim_file(ld_plugin_claim_file_handler handler) +{ + claim_file_handler = handler; + return LDPS_OK; +} + +/* Register HANDLER as the callback to removing temporary files. */ + +static enum ld_plugin_status +register_cleanup (ld_plugin_cleanup_handler handler) +{ + cleanup_handler = handler; + return LDPS_OK; +} + +/* For a file identified by HANDLE, add NSYMS symbols from SYMS. */ + +static enum ld_plugin_status +add_symbols (void *handle, int nsyms, + const struct ld_plugin_symbol *syms) +{ + int i; + struct file_handle *h = (struct file_handle *) handle; + h->nsyms = nsyms; + h->syms = calloc (nsyms, sizeof (struct ld_plugin_symbol)); + assert (h->syms); + + for (i = 0; i < nsyms; i++) + { + h->syms[i] = syms[i]; + h->syms[i].name = strdup (h->syms[i].name); + if (h->syms[i].version) + h->syms[i].version = strdup (h->syms[i].version); + if (h->syms[i].comdat_key) + h->syms[i].comdat_key = strdup (h->syms[i].comdat_key); + } + + return LDPS_OK; +} + +struct ld_plugin_tv tv[] = { + {LDPT_REGISTER_CLAIM_FILE_HOOK, + {.tv_register_claim_file = register_claim_file} + }, + {LDPT_ADD_SYMBOLS, + {.tv_add_symbols = add_symbols} + }, + + {LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK, + {.tv_register_all_symbols_read = register_all_symbols_read} + }, + {LDPT_GET_SYMBOLS, + {.tv_get_symbols = get_symbols} + }, + {LDPT_REGISTER_CLEANUP_HOOK, + {.tv_register_cleanup = register_cleanup} + }, + {0, {0}} +}; + +/* Load a plugin from a file named NAME. */ + +static void +load_plugin (const char *name) +{ + ld_plugin_onload onload; + plugin_handle = dlopen (name, RTLD_LAZY); + + assert (plugin_handle != NULL); + onload = dlsym (plugin_handle, "onload"); + assert (onload); + onload (tv); + assert (claim_file_handler); +} + +/* Send object to the plugin. The file (archive or object) name is NAME. + FD is an open file descriptor. The object data starts at OFFSET and is + FILESIZE bytes long. */ + +static void +register_object (const char *name, int fd, off_t offset, off_t filesize) +{ + int claimed; + struct ld_plugin_input_file file; + void *handle; + + num_file_handles++; + all_file_handles = realloc (all_file_handles, num_file_handles + * sizeof (struct file_handle *)); + assert (all_file_handles); + + all_file_handles[num_file_handles - 1] = calloc (1, + sizeof (struct file_handle)); + handle = all_file_handles[num_file_handles - 1]; + assert (handle); + + file.name = (char *) name; + file.fd = fd; + file.offset = offset; + file.filesize = filesize; + + file.handle = handle; + + claim_file_handler (&file, &claimed); +} + +/* Send file named NAME to the plugin. */ + +static void +register_file (const char *name) +{ + int fd = open (name, O_RDONLY); + Elf *elf; + + assert (fd >= 0); + + elf = elf_begin (fd, ELF_C_READ, NULL); + assert (elf); + + Elf_Kind kind = elf_kind (elf); + + assert (kind == ELF_K_ELF || kind == ELF_K_AR); + + if (kind == ELF_K_AR) + { + Elf *member = elf_begin (fd, ELF_C_READ, elf); + while (member) + { + Elf_Arhdr *h = elf_getarhdr (member); + assert (h); + + if (h->ar_name[0] != '/') + { + off_t offset = elf_getbase (member); + register_object (name, fd, offset, h->ar_size); + } + + Elf_Cmd cmd = elf_next (member); + elf_end (member); + member = elf_begin (fd, cmd, elf); + } + } + else /* Single File */ + register_object (name, fd, 0, 0); + + elf_end (elf); +} + +/* Fake symbol resolution for testing. */ + +static void +resolve (void) +{ + unsigned j; + for (j = 0; j < num_file_handles; j++) + { + struct file_handle *handle = all_file_handles[j]; + unsigned int nsyms = handle->nsyms; + struct ld_plugin_symbol *syms = handle->syms; + unsigned i; + for (i = 0; i < nsyms; i++) + { + switch (syms[i].def) + { + case LDPK_DEF: + case LDPK_WEAKDEF: + case LDPK_COMMON: + syms[i].resolution = LDPR_PREVAILING_DEF; + break; + case LDPK_UNDEF: + case LDPK_WEAKUNDEF: + syms[i].resolution = LDPR_RESOLVED_IR; + break; + } + } + } +} + +/* Print all symbol information. */ + +static void +print (void) +{ + unsigned j; + for (j = 0; j < num_file_handles; j++) + { + struct file_handle *handle = all_file_handles[j]; + unsigned int nsyms = handle->nsyms; + struct ld_plugin_symbol *syms = handle->syms; + unsigned i; + for (i = 0; i < nsyms; i++) + { + printf("name: %s; ", syms[i].name); + if (syms[i].version) + printf("version: %s;", syms[i].version); + else + printf("not versioned; "); + printf("kind: %s; ", lto_kind_str[syms[i].def]); + printf("visibility: %s; ", lto_visibility_str[syms[i].visibility]); + printf("size: %" PRId64 "; ", syms[i].size); + if (syms[i].comdat_key) + printf("comdat_key: %s; ", syms[i].comdat_key); + else + printf("no comdat_key; "); + printf ("resolution: %s\n", lto_resolution_str[syms[i].resolution]); + } + } +} + +/* Unload the plugin. */ + +static void +unload_plugin (void) +{ + unsigned err = dlclose (plugin_handle); + assert (err == 0); + claim_file_handler = 0; + all_symbols_read_handler = 0; +} + +/* Free all memory allocated by us that hasn't been freed yet. */ + +static void +free_all (void) +{ + unsigned j; + for (j = 0; j < num_file_handles; j++) + { + struct file_handle *handle = all_file_handles[j]; + unsigned int nsyms = handle->nsyms; + struct ld_plugin_symbol *syms = handle->syms; + unsigned i; + for (i = 0; i < nsyms; i++) + { + free (syms[i].name); + syms[i].name = 0; + if (syms[i].version) + { + free (syms[i].version); + syms[i].version = 0; + } + if (syms[i].comdat_key) + { + free (syms[i].comdat_key); + syms[i].comdat_key = 0; + } + } + free (syms); + handle->syms = NULL; + handle->nsyms = 0; + free (all_file_handles[j]); + all_file_handles[j] = NULL; + } + + free (all_file_handles); + all_file_handles = NULL; + num_file_handles = 0; +} + +int +main(int argc, char *argv[]) +{ + const char *plugin; + unsigned int i; + assert (argc >= 3); + plugin = argv[1]; + + load_plugin (plugin); + + for (i = 2; i < argc; i++) + register_file (argv[i]); + + resolve (); + + print (); + + all_symbols_read_handler (); + + free_all (); + + cleanup_handler (); + + unload_plugin (); + + return 0; +} diff --git a/maintainer-scripts/ChangeLog b/maintainer-scripts/ChangeLog index 71190393b6a..664871f3ab7 100644 --- a/maintainer-scripts/ChangeLog +++ b/maintainer-scripts/ChangeLog @@ -1,3 +1,7 @@ +2009-10-03 Diego Novillo + + * gcc_release (JAVA_DIRS): Remove zlib. + 2009-04-23 Gerald Pfeifer * update_web_docs_svn: Redirect output of texi2dvi to /dev/null. diff --git a/maintainer-scripts/gcc_release b/maintainer-scripts/gcc_release index 0ecf54bfbbc..ddcd22f7ca0 100755 --- a/maintainer-scripts/gcc_release +++ b/maintainer-scripts/gcc_release @@ -547,7 +547,7 @@ SOURCE_DIRECTORY="" ADA_DIRS="gcc/ada libada gnattools" CPLUSPLUS_DIRS="gcc/cp libstdc++-v3" FORTRAN95_DIRS="gcc/fortran libgfortran" -JAVA_DIRS="gcc/java libjava libffi zlib boehm-gc" +JAVA_DIRS="gcc/java libjava libffi boehm-gc" OBJECTIVEC_DIRS="gcc/objc gcc/objcp libobjc" TESTSUITE_DIRS="gcc/testsuite" -- 2.11.4.GIT