aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>2014-11-14 22:49:15 +0000
committermeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>2014-11-14 22:49:15 +0000
commit3a1dc8e1e5039e85b407c8f10f325f50a10aded1 (patch)
treec1877896affef9286e19fd9019055d312af89dc4
parente783301116dca707058757b3bac6c9ebc66e3b04 (diff)
parent5797c9aa91b4ddbe113ebd7bf16ef11bf0d9dc17 (diff)
Merge up to 217592.ibm/addr-patch
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ibm/addr-patch@217594 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--ChangeLog19
-rw-r--r--Makefile.def8
-rw-r--r--Makefile.in497
-rw-r--r--config/ChangeLog4
-rw-r--r--config/target-posix12
-rwxr-xr-xconfigure95
-rw-r--r--configure.ac75
-rw-r--r--contrib/ChangeLog5
-rwxr-xr-xcontrib/mklog16
-rw-r--r--gcc/ChangeLog863
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/Makefile.in97
-rw-r--r--gcc/asan.c6
-rw-r--r--gcc/builtin-attrs.def2
-rw-r--r--gcc/builtins.c9
-rw-r--r--gcc/cfgexpand.c1
-rw-r--r--gcc/cfgrtl.c19
-rw-r--r--gcc/cgraph.c11
-rw-r--r--gcc/cgraph.h28
-rw-r--r--gcc/cgraphunit.c21
-rw-r--r--gcc/common.opt25
-rw-r--r--gcc/config.gcc35
-rw-r--r--gcc/config.in36
-rw-r--r--gcc/config/aarch64/aarch64-simd.md4
-rw-r--r--gcc/config/aarch64/aarch64.c364
-rw-r--r--gcc/config/aarch64/aarch64.md49
-rw-r--r--gcc/config/arm/arm.c131
-rw-r--r--gcc/config/i386/i386.c15
-rw-r--r--gcc/config/i386/intelmic-mkoffload.c541
-rw-r--r--gcc/config/i386/t-intelmic9
-rw-r--r--gcc/config/rs6000/vector.md48
-rwxr-xr-xgcc/configure87
-rw-r--r--gcc/configure.ac66
-rw-r--r--gcc/context.c2
-rw-r--r--gcc/context.h3
-rw-r--r--gcc/coretypes.h7
-rw-r--r--gcc/cp/ChangeLog59
-rw-r--r--gcc/cp/Make-lang.in32
-rw-r--r--gcc/cp/call.c8
-rw-r--r--gcc/cp/class.c9
-rw-r--r--gcc/cp/constexpr.c73
-rw-r--r--gcc/cp/cp-tree.h8
-rw-r--r--gcc/cp/decl.c7
-rw-r--r--gcc/cp/decl2.c2
-rw-r--r--gcc/cp/mangle.c2
-rw-r--r--gcc/cp/parser.c6
-rw-r--r--gcc/cp/pt.c17
-rw-r--r--gcc/cp/semantics.c6
-rw-r--r--gcc/cp/tree.c2
-rw-r--r--gcc/cp/typeck.c39
-rw-r--r--gcc/cp/typeck2.c6
-rw-r--r--gcc/doc/install.texi23
-rw-r--r--gcc/doc/invoke.texi27
-rw-r--r--gcc/doc/md.texi2
-rw-r--r--gcc/doc/passes.texi8
-rw-r--r--gcc/doc/tm.texi101
-rw-r--r--gcc/doc/tm.texi.in22
-rw-r--r--gcc/expr.c6
-rw-r--r--gcc/fold-const.c304
-rw-r--r--gcc/fold-const.h2
-rw-r--r--gcc/fortran/ChangeLog8
-rw-r--r--gcc/fortran/Make-lang.in18
-rw-r--r--gcc/gcc.c160
-rw-r--r--gcc/gengtype.c2
-rw-r--r--gcc/genmatch.c19
-rw-r--r--gcc/gimple-fold.c5
-rw-r--r--gcc/gimple-fold.h3
-rw-r--r--gcc/gimple.c25
-rw-r--r--gcc/go/gofrontend/expressions.cc10
-rw-r--r--gcc/go/gofrontend/gogo.cc32
-rw-r--r--gcc/go/gofrontend/gogo.h28
-rw-r--r--gcc/go/gofrontend/parse.cc9
-rw-r--r--gcc/haifa-sched.c84
-rw-r--r--gcc/hooks.c9
-rw-r--r--gcc/hooks.h1
-rw-r--r--gcc/ipa-cp.c1344
-rw-r--r--gcc/ipa-devirt.c5
-rw-r--r--gcc/ipa-inline-analysis.c101
-rw-r--r--gcc/ipa-inline.h3
-rw-r--r--gcc/ipa-polymorphic-call.c54
-rw-r--r--gcc/ipa-profile.c2
-rw-r--r--gcc/ipa-prop.c498
-rw-r--r--gcc/ipa-prop.h86
-rw-r--r--gcc/ipa-pure-const.c79
-rw-r--r--gcc/ipa-utils.h2
-rw-r--r--gcc/lra-constraints.c188
-rw-r--r--gcc/lra-eliminations.c97
-rw-r--r--gcc/lra-int.h12
-rw-r--r--gcc/lra-lives.c101
-rw-r--r--gcc/lra-remat.c1237
-rw-r--r--gcc/lra-spills.c2
-rw-r--r--gcc/lra.c126
-rw-r--r--gcc/lto-cgraph.c128
-rw-r--r--gcc/lto-opts.c32
-rw-r--r--gcc/lto-section-in.c3
-rw-r--r--gcc/lto-section-names.h8
-rw-r--r--gcc/lto-streamer-out.c8
-rw-r--r--gcc/lto-streamer.c3
-rw-r--r--gcc/lto-streamer.h12
-rw-r--r--gcc/lto-wrapper.c685
-rw-r--r--gcc/lto/ChangeLog25
-rw-r--r--gcc/lto/lto-object.c3
-rw-r--r--gcc/lto/lto-partition.c2
-rw-r--r--gcc/lto/lto.c11
-rw-r--r--gcc/match.pd355
-rw-r--r--gcc/omp-low.c205
-rw-r--r--gcc/omp-low.h4
-rw-r--r--gcc/optabs.c82
-rw-r--r--gcc/optabs.h2
-rw-r--r--gcc/optc-save-gen.awk134
-rw-r--r--gcc/opth-gen.awk6
-rw-r--r--gcc/opts-global.c4
-rw-r--r--gcc/opts.c20
-rw-r--r--gcc/passes.c11
-rw-r--r--gcc/passes.def4
-rw-r--r--gcc/sanitizer.def2
-rw-r--r--gcc/sanopt.c478
-rw-r--r--gcc/sched-int.h8
-rw-r--r--gcc/sched-rgn.c63
-rw-r--r--gcc/target.def90
-rw-r--r--gcc/testsuite/ChangeLog95
-rw-r--r--gcc/testsuite/c-c++-common/ubsan/overflow-negate-3.c21
-rw-r--r--gcc/testsuite/c-c++-common/ubsan/pr63839.c23
-rw-r--r--gcc/testsuite/c-c++-common/ubsan/unreachable-2.c14
-rw-r--r--gcc/testsuite/g++.dg/abi/abi-tag11.C12
-rw-r--r--gcc/testsuite/g++.dg/ipa/devirt-10.C4
-rw-r--r--gcc/testsuite/g++.dg/ipa/devirt-11.C6
-rw-r--r--gcc/testsuite/g++.dg/ipa/devirt-21.C2
-rw-r--r--gcc/testsuite/g++.dg/ipa/devirt-24.C2
-rw-r--r--gcc/testsuite/g++.dg/ipa/devirt-41.C2
-rw-r--r--gcc/testsuite/g++.dg/ipa/devirt-43.C2
-rw-r--r--gcc/testsuite/g++.dg/ipa/devirt-44.C2
-rw-r--r--gcc/testsuite/g++.dg/ipa/pr63838.C56
-rw-r--r--gcc/testsuite/g++.dg/tree-prof/pr63581.C91
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/pr63841.C35
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/shiftopt-1.c5
-rw-r--r--gcc/testsuite/gcc.dg/builtins-59.c1
-rw-r--r--gcc/testsuite/gcc.dg/builtins-61.c1
-rw-r--r--gcc/testsuite/gcc.dg/builtins-67.c2
-rw-r--r--gcc/testsuite/gcc.dg/c99-tgmath-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/c99-tgmath-2.c1
-rw-r--r--gcc/testsuite/gcc.dg/c99-tgmath-3.c1
-rw-r--r--gcc/testsuite/gcc.dg/c99-tgmath-4.c1
-rw-r--r--gcc/testsuite/gcc.dg/dfp/convert-dfp-round-thread.c2
-rw-r--r--gcc/testsuite/gcc.dg/strlenopt-14g.c2
-rw-r--r--gcc/testsuite/gcc.dg/strlenopt-14gf.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/forwprop-28.c7
-rw-r--r--gcc/testsuite/gcc.target/arm/ldrd-strd-pair-1.c23
-rw-r--r--gcc/testsuite/gcc.target/arm/vfp-1.c2
-rw-r--r--gcc/testsuite/lib/target-supports.exp24
-rw-r--r--gcc/timevar.def2
-rw-r--r--gcc/toplev.c33
-rw-r--r--gcc/tree-cfg.c32
-rw-r--r--gcc/tree-inline.c1
-rw-r--r--gcc/tree-parloops.c18
-rw-r--r--gcc/tree-pass.h5
-rw-r--r--gcc/tree-pretty-print.c5
-rw-r--r--gcc/tree-ssa-ccp.c27
-rw-r--r--gcc/tree-ssa-dce.c5
-rw-r--r--gcc/tree-ssa-forwprop.c196
-rw-r--r--gcc/tree-ssa-loop-ivcanon.c8
-rw-r--r--gcc/tree-ssa-strlen.c2
-rw-r--r--gcc/tree-streamer-in.c6
-rw-r--r--gcc/tree-streamer-out.c6
-rw-r--r--gcc/tree-vect-data-refs.c51
-rw-r--r--gcc/tree-vect-generic.c1
-rw-r--r--gcc/tree-vect-loop.c129
-rw-r--r--gcc/tree-vect-stmts.c41
-rw-r--r--gcc/tree-vectorizer.h3
-rw-r--r--gcc/tree-vrp.c26
-rw-r--r--gcc/tree.c14
-rw-r--r--gcc/tree.def5
-rw-r--r--gcc/tree.h6
-rw-r--r--gcc/ubsan.c27
-rw-r--r--gcc/ubsan.h2
-rw-r--r--gcc/varpool.c12
-rw-r--r--include/ChangeLog10
-rw-r--r--include/dwarf2.def14
-rw-r--r--libatomic/ChangeLog4
-rw-r--r--libatomic/cas_n.c2
-rw-r--r--libcc1/ChangeLog7
-rwxr-xr-xlibcc1/configure116
-rw-r--r--libcc1/configure.ac30
-rw-r--r--libcc1/connection.cc1
-rw-r--r--libcc1/libcc1.cc2
-rw-r--r--libcilkrts/ChangeLog4
-rw-r--r--libcilkrts/configure.tgt17
-rw-r--r--libcpp/ChangeLog5
-rw-r--r--libcpp/include/line-map.h3
-rw-r--r--libgcc/ChangeLog27
-rw-r--r--libgcc/Makefile.in10
-rw-r--r--libgcc/config/rl78/divmodhi.S87
-rw-r--r--libgcc/config/rl78/divmodqi.S87
-rw-r--r--libgcc/config/rl78/divmodsi.S108
-rw-r--r--libgcc/config/rl78/lib2div.c35
-rw-r--r--libgcc/config/rl78/lib2mul.c20
-rw-r--r--libgcc/config/rl78/mulsi3.S101
-rw-r--r--libgcc/config/rl78/t-rl782
-rw-r--r--libgcc/config/rl78/vregs.h15
-rw-r--r--libgcc/configure18
-rw-r--r--libgcc/configure.ac17
-rw-r--r--libgcc/offloadstuff.c80
-rw-r--r--libgfortran/ChangeLog73
-rwxr-xr-xlibgfortran/configure2
-rw-r--r--libgfortran/configure.ac2
-rw-r--r--libgfortran/intrinsics/access.c18
-rw-r--r--libgfortran/intrinsics/chdir.c25
-rw-r--r--libgfortran/intrinsics/chmod.c32
-rw-r--r--libgfortran/intrinsics/env.c30
-rw-r--r--libgfortran/intrinsics/execute_command_line.c6
-rw-r--r--libgfortran/intrinsics/hostnm.c56
-rw-r--r--libgfortran/intrinsics/link.c76
-rw-r--r--libgfortran/intrinsics/perror.c14
-rw-r--r--libgfortran/intrinsics/random.c6
-rw-r--r--libgfortran/intrinsics/rename.c71
-rw-r--r--libgfortran/intrinsics/stat.c20
-rw-r--r--libgfortran/intrinsics/symlnk.c69
-rw-r--r--libgfortran/intrinsics/system.c6
-rw-r--r--libgfortran/intrinsics/unlink.c13
-rw-r--r--libgfortran/io/file_pos.c2
-rw-r--r--libgfortran/io/list_read.c13
-rw-r--r--libgfortran/io/read.c16
-rw-r--r--libgfortran/io/transfer.c4
-rw-r--r--libgfortran/io/write_float.def10
-rw-r--r--libgfortran/libgfortran.h7
-rw-r--r--libgfortran/runtime/string.c14
-rw-r--r--libgo/Makefile.am30
-rw-r--r--libgo/Makefile.in91
-rwxr-xr-xlibgo/configure31
-rw-r--r--libgo/configure.ac8
-rw-r--r--libgomp/ChangeLog139
-rw-r--r--libgomp/Makefile.in3
-rw-r--r--libgomp/config.h.in9
-rwxr-xr-xlibgomp/configure98
-rw-r--r--libgomp/configure.ac41
-rw-r--r--libgomp/libgomp.map5
-rw-r--r--libgomp/libgomp_target.h44
-rw-r--r--libgomp/splay-tree.h232
-rw-r--r--libgomp/target.c851
-rw-r--r--libgomp/testsuite/Makefile.am5
-rw-r--r--libgomp/testsuite/Makefile.in8
-rw-r--r--libgomp/testsuite/lib/libgomp.exp39
-rw-r--r--libgomp/testsuite/libgomp.c++/c++.exp2
-rw-r--r--libgomp/testsuite/libgomp.c++/examples-4/e.51.5.C62
-rw-r--r--libgomp/testsuite/libgomp.c++/examples-4/e.53.2.C43
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.50.1.c63
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.50.2.c64
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.50.3.c64
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.50.4.c57
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.50.5.c67
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.51.1.c64
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.51.2.c94
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.51.3.c79
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.51.4.c77
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.51.6.c109
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.51.7.c72
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.52.1.c94
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.52.2.c96
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.53.1.c36
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.53.3.c62
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.53.4.c67
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.53.5.c84
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.54.2.c72
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.54.3.c67
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.54.4.c70
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.54.5.c65
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.54.6.c65
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.55.1.c68
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.55.2.c95
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.56.3.c26
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.56.4.c27
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.57.1.c59
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.57.2.c29
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.57.3.c27
-rw-r--r--libgomp/testsuite/libgomp.c/target-7.c8
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.50.1.f9044
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.50.2.f9043
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.50.3.f9043
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.50.4.f9059
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.50.5.f9047
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.51.1.f9045
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.51.2.f9061
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.51.3.f9079
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.51.4.f9054
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.51.5.f9053
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.51.6.f9066
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.51.7.f9049
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.52.1.f9065
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.52.2.f9077
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.53.1.f9031
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.53.2.f9022
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.53.3.f9045
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.53.4.f9068
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.53.5.f9080
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.54.2.f9065
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.54.3.f9058
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.54.4.f9061
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.54.5.f9047
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.54.6.f9047
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.55.1.f9070
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.55.2.f9056
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.56.3.f9017
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.56.4.f9018
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.57.1.f9056
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.57.2.f9024
-rw-r--r--libgomp/testsuite/libgomp.fortran/examples-4/e.57.3.f9021
-rw-r--r--liboffloadmic/ChangeLog108
-rw-r--r--liboffloadmic/Makefile.am172
-rw-r--r--liboffloadmic/Makefile.in1255
-rw-r--r--liboffloadmic/aclocal.m4979
-rw-r--r--liboffloadmic/configure17108
-rw-r--r--liboffloadmic/configure.ac132
-rw-r--r--liboffloadmic/configure.tgt39
-rw-r--r--liboffloadmic/doc/doxygen/config2328
-rw-r--r--liboffloadmic/doc/doxygen/header.tex90
-rw-r--r--liboffloadmic/include/coi/common/COIEngine_common.h108
-rw-r--r--liboffloadmic/include/coi/common/COIMacros_common.h69
-rw-r--r--liboffloadmic/include/coi/common/COIPerf_common.h87
-rw-r--r--liboffloadmic/include/coi/common/COIResult_common.h145
-rw-r--r--liboffloadmic/include/coi/common/COITypes_common.h85
-rw-r--r--liboffloadmic/include/coi/sink/COIBuffer_sink.h130
-rw-r--r--liboffloadmic/include/coi/sink/COIPipeline_sink.h137
-rw-r--r--liboffloadmic/include/coi/sink/COIProcess_sink.h103
-rw-r--r--liboffloadmic/include/coi/source/COIBuffer_source.h1311
-rw-r--r--liboffloadmic/include/coi/source/COIEngine_source.h247
-rw-r--r--liboffloadmic/include/coi/source/COIEvent_source.h192
-rw-r--r--liboffloadmic/include/coi/source/COIPipeline_source.h426
-rw-r--r--liboffloadmic/include/coi/source/COIProcess_source.h971
-rw-r--r--liboffloadmic/include/myo/myo.h619
-rw-r--r--liboffloadmic/include/myo/myoimpl.h538
-rw-r--r--liboffloadmic/include/myo/myotypes.h116
-rw-r--r--liboffloadmic/liboffloadmic_host.spec.in3
-rw-r--r--liboffloadmic/liboffloadmic_target.spec.in3
-rw-r--r--liboffloadmic/plugin/Makefile.am123
-rw-r--r--liboffloadmic/plugin/Makefile.in697
-rw-r--r--liboffloadmic/plugin/aclocal.m4979
-rw-r--r--liboffloadmic/plugin/configure16656
-rw-r--r--liboffloadmic/plugin/configure.ac135
-rw-r--r--liboffloadmic/plugin/libgomp-plugin-intelmic.cpp447
-rw-r--r--liboffloadmic/plugin/offload_target_main.cpp366
-rw-r--r--liboffloadmic/runtime/cean_util.cpp366
-rw-r--r--liboffloadmic/runtime/cean_util.h116
-rw-r--r--liboffloadmic/runtime/coi/coi_client.cpp370
-rw-r--r--liboffloadmic/runtime/coi/coi_client.h138
-rw-r--r--liboffloadmic/runtime/coi/coi_server.cpp150
-rw-r--r--liboffloadmic/runtime/coi/coi_server.h94
-rw-r--r--liboffloadmic/runtime/compiler_if_host.cpp343
-rw-r--r--liboffloadmic/runtime/compiler_if_host.h153
-rw-r--r--liboffloadmic/runtime/compiler_if_target.cpp64
-rw-r--r--liboffloadmic/runtime/compiler_if_target.h70
-rw-r--r--liboffloadmic/runtime/dv_util.cpp153
-rw-r--r--liboffloadmic/runtime/dv_util.h83
-rw-r--r--liboffloadmic/runtime/emulator/coi_common.h140
-rw-r--r--liboffloadmic/runtime/emulator/coi_device.cpp330
-rw-r--r--liboffloadmic/runtime/emulator/coi_device.h56
-rw-r--r--liboffloadmic/runtime/emulator/coi_host.cpp1214
-rw-r--r--liboffloadmic/runtime/emulator/coi_host.h55
-rw-r--r--liboffloadmic/runtime/emulator/coi_version_asm.h68
-rw-r--r--liboffloadmic/runtime/emulator/coi_version_linker_script.map79
-rw-r--r--liboffloadmic/runtime/emulator/myo_client.cpp31
-rw-r--r--liboffloadmic/runtime/emulator/myo_service.cpp159
-rw-r--r--liboffloadmic/runtime/emulator/myo_service.h63
-rw-r--r--liboffloadmic/runtime/emulator/myo_version_asm.h53
-rw-r--r--liboffloadmic/runtime/emulator/myo_version_linker_script.map60
-rw-r--r--liboffloadmic/runtime/liboffload_error.c475
-rw-r--r--liboffloadmic/runtime/liboffload_error_codes.h297
-rw-r--r--liboffloadmic/runtime/liboffload_msg.c67
-rw-r--r--liboffloadmic/runtime/liboffload_msg.h348
-rw-r--r--liboffloadmic/runtime/mic_lib.f90282
-rw-r--r--liboffloadmic/runtime/offload.h371
-rw-r--r--liboffloadmic/runtime/offload_common.cpp190
-rw-r--r--liboffloadmic/runtime/offload_common.h475
-rw-r--r--liboffloadmic/runtime/offload_engine.cpp551
-rw-r--r--liboffloadmic/runtime/offload_engine.h502
-rw-r--r--liboffloadmic/runtime/offload_env.cpp378
-rw-r--r--liboffloadmic/runtime/offload_env.h111
-rw-r--r--liboffloadmic/runtime/offload_host.cpp4402
-rw-r--r--liboffloadmic/runtime/offload_host.h363
-rw-r--r--liboffloadmic/runtime/offload_myo_host.cpp829
-rw-r--r--liboffloadmic/runtime/offload_myo_host.h100
-rw-r--r--liboffloadmic/runtime/offload_myo_target.cpp204
-rw-r--r--liboffloadmic/runtime/offload_myo_target.h74
-rw-r--r--liboffloadmic/runtime/offload_omp_host.cpp485
-rw-r--r--liboffloadmic/runtime/offload_omp_target.cpp560
-rw-r--r--liboffloadmic/runtime/offload_orsl.cpp104
-rw-r--r--liboffloadmic/runtime/offload_orsl.h45
-rw-r--r--liboffloadmic/runtime/offload_table.cpp331
-rw-r--r--liboffloadmic/runtime/offload_table.h321
-rw-r--r--liboffloadmic/runtime/offload_target.cpp776
-rw-r--r--liboffloadmic/runtime/offload_target.h120
-rw-r--r--liboffloadmic/runtime/offload_target_main.cpp37
-rw-r--r--liboffloadmic/runtime/offload_timer.h192
-rw-r--r--liboffloadmic/runtime/offload_timer_host.cpp379
-rw-r--r--liboffloadmic/runtime/offload_timer_target.cpp87
-rw-r--r--liboffloadmic/runtime/offload_trace.cpp329
-rw-r--r--liboffloadmic/runtime/offload_trace.h72
-rw-r--r--liboffloadmic/runtime/offload_util.cpp226
-rw-r--r--liboffloadmic/runtime/offload_util.h173
-rw-r--r--liboffloadmic/runtime/ofldbegin.cpp184
-rw-r--r--liboffloadmic/runtime/ofldend.cpp97
-rw-r--r--liboffloadmic/runtime/orsl-lite/include/orsl-lite.h241
-rw-r--r--liboffloadmic/runtime/orsl-lite/lib/orsl-lite.c357
-rw-r--r--liboffloadmic/runtime/orsl-lite/version.txt1
-rw-r--r--liboffloadmic/runtime/use_mpss2.txt1
-rw-r--r--libsanitizer/ChangeLog40
-rw-r--r--libsanitizer/MERGE2
-rw-r--r--libsanitizer/asan/Makefile.am1
-rw-r--r--libsanitizer/asan/Makefile.in2
-rw-r--r--libsanitizer/asan/asan_allocator.h22
-rw-r--r--libsanitizer/asan/asan_allocator2.cc57
-rw-r--r--libsanitizer/asan/asan_debugging.cc81
-rw-r--r--libsanitizer/asan/asan_flags.h1
-rw-r--r--libsanitizer/asan/asan_globals.cc44
-rw-r--r--libsanitizer/asan/asan_interface_internal.h26
-rw-r--r--libsanitizer/asan/asan_internal.h1
-rw-r--r--libsanitizer/asan/asan_mac.cc2
-rw-r--r--libsanitizer/asan/asan_mapping.h15
-rw-r--r--libsanitizer/asan/asan_poisoning.cc35
-rw-r--r--libsanitizer/asan/asan_posix.cc7
-rw-r--r--libsanitizer/asan/asan_report.cc266
-rw-r--r--libsanitizer/asan/asan_report.h57
-rw-r--r--libsanitizer/asan/asan_rtl.cc6
-rw-r--r--libsanitizer/asan/asan_stack.h28
-rw-r--r--libsanitizer/asan/asan_thread.cc23
-rw-r--r--libsanitizer/asan/asan_thread.h26
-rw-r--r--libsanitizer/include/sanitizer/asan_interface.h28
-rw-r--r--libsanitizer/include/sanitizer/common_interface_defs.h2
-rw-r--r--libsanitizer/interception/Makefile.am1
-rw-r--r--libsanitizer/interception/Makefile.in3
-rw-r--r--libsanitizer/interception/interception_win.cc5
-rw-r--r--libsanitizer/libbacktrace/Makefile.am1
-rw-r--r--libsanitizer/libbacktrace/Makefile.in2
-rw-r--r--libsanitizer/lsan/Makefile.am1
-rw-r--r--libsanitizer/lsan/Makefile.in3
-rw-r--r--libsanitizer/lsan/lsan.h22
-rw-r--r--libsanitizer/lsan/lsan_allocator.cc2
-rw-r--r--libsanitizer/lsan/lsan_common.cc25
-rw-r--r--libsanitizer/lsan/lsan_common_linux.cc7
-rw-r--r--libsanitizer/sanitizer_common/Makefile.am2
-rw-r--r--libsanitizer/sanitizer_common/Makefile.in5
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_allocator.h15
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_common.cc34
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_common.h9
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc4
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_coverage_libcdep.cc97
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_coverage_mapping_libcdep.cc3
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_flags.cc12
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_flags.h3
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_mac.cc3
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_mac.h3
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_platform.h10
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_platform_interceptors.h6
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc3
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc18
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h61
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_posix.cc5
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_printf.cc2
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_stackdepot.cc89
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_stackdepot.h11
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_stackdepotbase.h4
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_stacktrace.cc47
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_stacktrace.h56
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_stacktrace_libcdep.cc56
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_stacktrace_printer.cc130
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_stacktrace_printer.h60
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_symbolizer.h12
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc2
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc14
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_unwind_posix_libcdep.cc18
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_win.cc8
-rw-r--r--libsanitizer/tsan/Makefile.am1
-rw-r--r--libsanitizer/tsan/Makefile.in3
-rw-r--r--libsanitizer/tsan/tsan_defs.h2
-rw-r--r--libsanitizer/tsan/tsan_fd.cc9
-rw-r--r--libsanitizer/tsan/tsan_flags.cc1
-rw-r--r--libsanitizer/tsan/tsan_interceptors.cc370
-rw-r--r--libsanitizer/tsan/tsan_interface_ann.cc4
-rw-r--r--libsanitizer/tsan/tsan_interface_atomic.cc2
-rw-r--r--libsanitizer/tsan/tsan_interface_java.cc2
-rw-r--r--libsanitizer/tsan/tsan_mman.cc16
-rw-r--r--libsanitizer/tsan/tsan_mman.h4
-rw-r--r--libsanitizer/tsan/tsan_platform.h294
-rw-r--r--libsanitizer/tsan/tsan_platform_linux.cc149
-rw-r--r--libsanitizer/tsan/tsan_platform_mac.cc22
-rw-r--r--libsanitizer/tsan/tsan_platform_windows.cc4
-rw-r--r--libsanitizer/tsan/tsan_report.cc53
-rw-r--r--libsanitizer/tsan/tsan_report.h28
-rw-r--r--libsanitizer/tsan/tsan_rtl.cc35
-rw-r--r--libsanitizer/tsan/tsan_rtl.h31
-rw-r--r--libsanitizer/tsan/tsan_rtl_amd64.S22
-rw-r--r--libsanitizer/tsan/tsan_rtl_mutex.cc22
-rw-r--r--libsanitizer/tsan/tsan_rtl_report.cc174
-rw-r--r--libsanitizer/tsan/tsan_stack_trace.cc108
-rw-r--r--libsanitizer/tsan/tsan_stack_trace.h39
-rw-r--r--libsanitizer/tsan/tsan_suppressions.cc19
-rw-r--r--libsanitizer/tsan/tsan_symbolize.cc65
-rw-r--r--libsanitizer/tsan/tsan_trace.h18
-rw-r--r--libsanitizer/ubsan/Makefile.am1
-rw-r--r--libsanitizer/ubsan/Makefile.in3
-rw-r--r--libsanitizer/ubsan/ubsan_diag.cc21
-rw-r--r--libsanitizer/ubsan/ubsan_handlers.cc6
-rw-r--r--libsanitizer/ubsan/ubsan_type_hash.cc47
-rw-r--r--libstdc++-v3/ChangeLog56
-rw-r--r--libstdc++-v3/config/abi/pre/gnu.ver15
-rw-r--r--libstdc++-v3/include/Makefile.am1
-rw-r--r--libstdc++-v3/include/Makefile.in1
-rw-r--r--libstdc++-v3/include/bits/ios_base.h62
-rw-r--r--libstdc++-v3/include/bits/regex.h20
-rw-r--r--libstdc++-v3/include/bits/regex_compiler.h5
-rw-r--r--libstdc++-v3/include/bits/regex_compiler.tcc65
-rw-r--r--libstdc++-v3/include/bits/shared_ptr_atomic.h330
-rw-r--r--libstdc++-v3/include/std/memory1
-rw-r--r--libstdc++-v3/include/std/system_error15
-rw-r--r--libstdc++-v3/src/c++11/Makefile.am8
-rw-r--r--libstdc++-v3/src/c++11/Makefile.in16
-rw-r--r--libstdc++-v3/src/c++11/cxx11-ios_failure.cc89
-rw-r--r--libstdc++-v3/src/c++11/shared_ptr.cc58
-rw-r--r--libstdc++-v3/src/c++98/ios_failure.cc3
-rw-r--r--libstdc++-v3/src/c++98/mt_allocator.cc9
-rw-r--r--libstdc++-v3/testsuite/20_util/shared_ptr/atomic/1.cc40
-rw-r--r--libstdc++-v3/testsuite/20_util/shared_ptr/atomic/2.cc40
-rw-r--r--libstdc++-v3/testsuite/20_util/shared_ptr/atomic/3.cc53
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/failure/cxx11.cc52
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/failure/what-1.cc9
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/failure/what-2.cc8
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/failure/what-3.cc8
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/failure/what-big.cc4
-rw-r--r--libstdc++-v3/testsuite/28_regex/algorithms/regex_match/cstring_bracket_01.cc (renamed from libstdc++-v3/testsuite/28_regex/algorithms/regex_match/extended/cstring_bracket_01.cc)51
-rw-r--r--libstdc++-v3/testsuite/28_regex/sub_match/embedded_zeros_cmp.cc55
-rw-r--r--lto-plugin/ChangeLog24
-rw-r--r--lto-plugin/Makefile.am2
-rw-r--r--lto-plugin/Makefile.in4
-rwxr-xr-xlto-plugin/configure16
-rw-r--r--lto-plugin/configure.ac10
-rw-r--r--lto-plugin/lto-plugin.c25
535 files changed, 84767 insertions, 4530 deletions
diff --git a/ChangeLog b/ChangeLog
index bc99f9b60b5..f83fa5a1a5d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2014-11-13 Kirill Yukhin <kirill.yukhin@intel.com>
+
+ * Makefile.def: Add liboffloadmic to target_modules. Make
+ liboffloadmic depend on libgomp's configure, libstdc++ and libgcc.
+ * Makefile.in: Regenerate.
+ * configure: Regenerate.
+ * configure.ac: Add liboffloadmic to target binaries.
+ Restrict liboffloadmic for POSIX and i*86, and x86_64 architectures.
+ Add liboffloadmic to noconfig list when C++ is not supported.
+
+2014-11-13 Bernd Schmidt <bernds@codesourcery.com>
+ Thomas Schwinge <thomas@codesourcery.com>
+ Ilya Verbin <ilya.verbin@intel.com>
+ Andrey Turetskiy <andrey.turetskiy@intel.com>
+
+ * configure: Regenerate.
+ * configure.ac (--enable-as-accelerator-for)
+ (--enable-offload-targets): New configure options.
+
2014-11-11 Tobias Burnus <burnus@net-b.de>
* Makefile.def: Make all-gcc depend on all-isl.
diff --git a/Makefile.def b/Makefile.def
index a68f2083e56..40bbca9c3a9 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -134,6 +134,9 @@ target_modules = { module= libvtv;
raw_cxx=true; };
target_modules = { module= libcilkrts;
lib_path=.libs; };
+target_modules = { module= liboffloadmic;
+ lib_path=.libs;
+ extra_configure_flags='@extra_liboffloadmic_configure_flags@'; };
target_modules = { module= libssp; lib_path=.libs; };
target_modules = { module= newlib; };
target_modules = { module= libgcc; bootstrap=true; no_check=true; };
@@ -509,6 +512,7 @@ dependencies = { module=all-m4; on=all-build-texinfo; };
lang_env_dependencies = { module=libjava; cxx=true; };
lang_env_dependencies = { module=libitm; cxx=true; };
lang_env_dependencies = { module=libcilkrts; cxx=true; };
+lang_env_dependencies = { module=liboffloadmic; cxx=true; };
lang_env_dependencies = { module=newlib; no_c=true; };
lang_env_dependencies = { module=libgloss; no_c=true; };
lang_env_dependencies = { module=libgcc; no_gcc=true; no_c=true; };
@@ -535,12 +539,14 @@ dependencies = { module=all-target-libjava; on=all-target-libffi; };
dependencies = { module=configure-target-libobjc; on=configure-target-boehm-gc; };
dependencies = { module=all-target-libobjc; on=all-target-boehm-gc; };
dependencies = { module=configure-target-libstdc++-v3; on=configure-target-libgomp; };
+dependencies = { module=configure-target-liboffloadmic; on=configure-target-libgomp; };
dependencies = { module=configure-target-libsanitizer; on=all-target-libstdc++-v3; };
dependencies = { module=configure-target-libvtv; on=all-target-libstdc++-v3; };
// parallel_list.o and parallel_settings.o depend on omp.h, which is
// generated by the libgomp configure. Unfortunately, due to the use of
// recursive make, we can't be that specific.
dependencies = { module=all-target-libstdc++-v3; on=configure-target-libgomp; };
+dependencies = { module=all-target-liboffloadmic; on=configure-target-libgomp; };
dependencies = { module=install-target-libgo; on=install-target-libatomic; };
dependencies = { module=install-target-libgfortran; on=install-target-libquadmath; };
@@ -551,6 +557,8 @@ dependencies = { module=install-target-libvtv; on=install-target-libstdc++-v3; }
dependencies = { module=install-target-libvtv; on=install-target-libgcc; };
dependencies = { module=install-target-libcilkrts; on=install-target-libstdc++-v3; };
dependencies = { module=install-target-libcilkrts; on=install-target-libgcc; };
+dependencies = { module=install-target-liboffloadmic; on=install-target-libstdc++-v3; };
+dependencies = { module=install-target-liboffloadmic; on=install-target-libgcc; };
dependencies = { module=install-target-libjava; on=install-target-libgcc; };
dependencies = { module=install-target-libitm; on=install-target-libgcc; };
dependencies = { module=install-target-libobjc; on=install-target-libgcc; };
diff --git a/Makefile.in b/Makefile.in
index 9e686843f6c..f1ff972c1f5 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -574,7 +574,7 @@ all:
# This is the list of directories that may be needed in RPATH_ENVVAR
# so that programs built for the target machine work.
-TARGET_LIB_PATH = $(TARGET_LIB_PATH_libstdc++-v3)$(TARGET_LIB_PATH_libsanitizer)$(TARGET_LIB_PATH_libvtv)$(TARGET_LIB_PATH_libcilkrts)$(TARGET_LIB_PATH_libssp)$(TARGET_LIB_PATH_libgomp)$(TARGET_LIB_PATH_libitm)$(TARGET_LIB_PATH_libatomic)$(HOST_LIB_PATH_gcc)
+TARGET_LIB_PATH = $(TARGET_LIB_PATH_libstdc++-v3)$(TARGET_LIB_PATH_libsanitizer)$(TARGET_LIB_PATH_libvtv)$(TARGET_LIB_PATH_libcilkrts)$(TARGET_LIB_PATH_liboffloadmic)$(TARGET_LIB_PATH_libssp)$(TARGET_LIB_PATH_libgomp)$(TARGET_LIB_PATH_libitm)$(TARGET_LIB_PATH_libatomic)$(HOST_LIB_PATH_gcc)
@if target-libstdc++-v3
TARGET_LIB_PATH_libstdc++-v3 = $$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs:
@@ -592,6 +592,10 @@ TARGET_LIB_PATH_libvtv = $$r/$(TARGET_SUBDIR)/libvtv/.libs:
TARGET_LIB_PATH_libcilkrts = $$r/$(TARGET_SUBDIR)/libcilkrts/.libs:
@endif target-libcilkrts
+@if target-liboffloadmic
+TARGET_LIB_PATH_liboffloadmic = $$r/$(TARGET_SUBDIR)/liboffloadmic/.libs:
+@endif target-liboffloadmic
+
@if target-libssp
TARGET_LIB_PATH_libssp = $$r/$(TARGET_SUBDIR)/libssp/.libs:
@endif target-libssp
@@ -926,6 +930,7 @@ configure-target: \
maybe-configure-target-libsanitizer \
maybe-configure-target-libvtv \
maybe-configure-target-libcilkrts \
+ maybe-configure-target-liboffloadmic \
maybe-configure-target-libssp \
maybe-configure-target-newlib \
maybe-configure-target-libgcc \
@@ -1084,6 +1089,7 @@ all-target: maybe-all-target-libsanitizer
all-target: maybe-all-target-libvtv
@endif target-libvtv-no-bootstrap
all-target: maybe-all-target-libcilkrts
+all-target: maybe-all-target-liboffloadmic
all-target: maybe-all-target-libssp
all-target: maybe-all-target-newlib
@if target-libgcc-no-bootstrap
@@ -1177,6 +1183,7 @@ info-target: maybe-info-target-libstdc++-v3
info-target: maybe-info-target-libsanitizer
info-target: maybe-info-target-libvtv
info-target: maybe-info-target-libcilkrts
+info-target: maybe-info-target-liboffloadmic
info-target: maybe-info-target-libssp
info-target: maybe-info-target-newlib
info-target: maybe-info-target-libgcc
@@ -1261,6 +1268,7 @@ dvi-target: maybe-dvi-target-libstdc++-v3
dvi-target: maybe-dvi-target-libsanitizer
dvi-target: maybe-dvi-target-libvtv
dvi-target: maybe-dvi-target-libcilkrts
+dvi-target: maybe-dvi-target-liboffloadmic
dvi-target: maybe-dvi-target-libssp
dvi-target: maybe-dvi-target-newlib
dvi-target: maybe-dvi-target-libgcc
@@ -1345,6 +1353,7 @@ pdf-target: maybe-pdf-target-libstdc++-v3
pdf-target: maybe-pdf-target-libsanitizer
pdf-target: maybe-pdf-target-libvtv
pdf-target: maybe-pdf-target-libcilkrts
+pdf-target: maybe-pdf-target-liboffloadmic
pdf-target: maybe-pdf-target-libssp
pdf-target: maybe-pdf-target-newlib
pdf-target: maybe-pdf-target-libgcc
@@ -1429,6 +1438,7 @@ html-target: maybe-html-target-libstdc++-v3
html-target: maybe-html-target-libsanitizer
html-target: maybe-html-target-libvtv
html-target: maybe-html-target-libcilkrts
+html-target: maybe-html-target-liboffloadmic
html-target: maybe-html-target-libssp
html-target: maybe-html-target-newlib
html-target: maybe-html-target-libgcc
@@ -1513,6 +1523,7 @@ TAGS-target: maybe-TAGS-target-libstdc++-v3
TAGS-target: maybe-TAGS-target-libsanitizer
TAGS-target: maybe-TAGS-target-libvtv
TAGS-target: maybe-TAGS-target-libcilkrts
+TAGS-target: maybe-TAGS-target-liboffloadmic
TAGS-target: maybe-TAGS-target-libssp
TAGS-target: maybe-TAGS-target-newlib
TAGS-target: maybe-TAGS-target-libgcc
@@ -1597,6 +1608,7 @@ install-info-target: maybe-install-info-target-libstdc++-v3
install-info-target: maybe-install-info-target-libsanitizer
install-info-target: maybe-install-info-target-libvtv
install-info-target: maybe-install-info-target-libcilkrts
+install-info-target: maybe-install-info-target-liboffloadmic
install-info-target: maybe-install-info-target-libssp
install-info-target: maybe-install-info-target-newlib
install-info-target: maybe-install-info-target-libgcc
@@ -1681,6 +1693,7 @@ install-pdf-target: maybe-install-pdf-target-libstdc++-v3
install-pdf-target: maybe-install-pdf-target-libsanitizer
install-pdf-target: maybe-install-pdf-target-libvtv
install-pdf-target: maybe-install-pdf-target-libcilkrts
+install-pdf-target: maybe-install-pdf-target-liboffloadmic
install-pdf-target: maybe-install-pdf-target-libssp
install-pdf-target: maybe-install-pdf-target-newlib
install-pdf-target: maybe-install-pdf-target-libgcc
@@ -1765,6 +1778,7 @@ install-html-target: maybe-install-html-target-libstdc++-v3
install-html-target: maybe-install-html-target-libsanitizer
install-html-target: maybe-install-html-target-libvtv
install-html-target: maybe-install-html-target-libcilkrts
+install-html-target: maybe-install-html-target-liboffloadmic
install-html-target: maybe-install-html-target-libssp
install-html-target: maybe-install-html-target-newlib
install-html-target: maybe-install-html-target-libgcc
@@ -1849,6 +1863,7 @@ installcheck-target: maybe-installcheck-target-libstdc++-v3
installcheck-target: maybe-installcheck-target-libsanitizer
installcheck-target: maybe-installcheck-target-libvtv
installcheck-target: maybe-installcheck-target-libcilkrts
+installcheck-target: maybe-installcheck-target-liboffloadmic
installcheck-target: maybe-installcheck-target-libssp
installcheck-target: maybe-installcheck-target-newlib
installcheck-target: maybe-installcheck-target-libgcc
@@ -1933,6 +1948,7 @@ mostlyclean-target: maybe-mostlyclean-target-libstdc++-v3
mostlyclean-target: maybe-mostlyclean-target-libsanitizer
mostlyclean-target: maybe-mostlyclean-target-libvtv
mostlyclean-target: maybe-mostlyclean-target-libcilkrts
+mostlyclean-target: maybe-mostlyclean-target-liboffloadmic
mostlyclean-target: maybe-mostlyclean-target-libssp
mostlyclean-target: maybe-mostlyclean-target-newlib
mostlyclean-target: maybe-mostlyclean-target-libgcc
@@ -2017,6 +2033,7 @@ clean-target: maybe-clean-target-libstdc++-v3
clean-target: maybe-clean-target-libsanitizer
clean-target: maybe-clean-target-libvtv
clean-target: maybe-clean-target-libcilkrts
+clean-target: maybe-clean-target-liboffloadmic
clean-target: maybe-clean-target-libssp
clean-target: maybe-clean-target-newlib
clean-target: maybe-clean-target-libgcc
@@ -2101,6 +2118,7 @@ distclean-target: maybe-distclean-target-libstdc++-v3
distclean-target: maybe-distclean-target-libsanitizer
distclean-target: maybe-distclean-target-libvtv
distclean-target: maybe-distclean-target-libcilkrts
+distclean-target: maybe-distclean-target-liboffloadmic
distclean-target: maybe-distclean-target-libssp
distclean-target: maybe-distclean-target-newlib
distclean-target: maybe-distclean-target-libgcc
@@ -2185,6 +2203,7 @@ maintainer-clean-target: maybe-maintainer-clean-target-libstdc++-v3
maintainer-clean-target: maybe-maintainer-clean-target-libsanitizer
maintainer-clean-target: maybe-maintainer-clean-target-libvtv
maintainer-clean-target: maybe-maintainer-clean-target-libcilkrts
+maintainer-clean-target: maybe-maintainer-clean-target-liboffloadmic
maintainer-clean-target: maybe-maintainer-clean-target-libssp
maintainer-clean-target: maybe-maintainer-clean-target-newlib
maintainer-clean-target: maybe-maintainer-clean-target-libgcc
@@ -2324,6 +2343,7 @@ check-target: \
maybe-check-target-libsanitizer \
maybe-check-target-libvtv \
maybe-check-target-libcilkrts \
+ maybe-check-target-liboffloadmic \
maybe-check-target-libssp \
maybe-check-target-newlib \
maybe-check-target-libgcc \
@@ -2482,6 +2502,7 @@ install-target: \
maybe-install-target-libsanitizer \
maybe-install-target-libvtv \
maybe-install-target-libcilkrts \
+ maybe-install-target-liboffloadmic \
maybe-install-target-libssp \
maybe-install-target-newlib \
maybe-install-target-libgcc \
@@ -2586,6 +2607,7 @@ install-strip-target: \
maybe-install-strip-target-libsanitizer \
maybe-install-strip-target-libvtv \
maybe-install-strip-target-libcilkrts \
+ maybe-install-strip-target-liboffloadmic \
maybe-install-strip-target-libssp \
maybe-install-strip-target-newlib \
maybe-install-strip-target-libgcc \
@@ -35188,6 +35210,469 @@ maintainer-clean-target-libcilkrts:
+.PHONY: configure-target-liboffloadmic maybe-configure-target-liboffloadmic
+maybe-configure-target-liboffloadmic:
+@if gcc-bootstrap
+configure-target-liboffloadmic: stage_current
+@endif gcc-bootstrap
+@if target-liboffloadmic
+maybe-configure-target-liboffloadmic: configure-target-liboffloadmic
+configure-target-liboffloadmic:
+ @: $(MAKE); $(unstage)
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ echo "Checking multilib configuration for liboffloadmic..."; \
+ $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/liboffloadmic ; \
+ $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/liboffloadmic/multilib.tmp 2> /dev/null ; \
+ if test -r $(TARGET_SUBDIR)/liboffloadmic/multilib.out; then \
+ if cmp -s $(TARGET_SUBDIR)/liboffloadmic/multilib.tmp $(TARGET_SUBDIR)/liboffloadmic/multilib.out; then \
+ rm -f $(TARGET_SUBDIR)/liboffloadmic/multilib.tmp; \
+ else \
+ rm -f $(TARGET_SUBDIR)/liboffloadmic/Makefile; \
+ mv $(TARGET_SUBDIR)/liboffloadmic/multilib.tmp $(TARGET_SUBDIR)/liboffloadmic/multilib.out; \
+ fi; \
+ else \
+ mv $(TARGET_SUBDIR)/liboffloadmic/multilib.tmp $(TARGET_SUBDIR)/liboffloadmic/multilib.out; \
+ fi; \
+ test ! -f $(TARGET_SUBDIR)/liboffloadmic/Makefile || exit 0; \
+ $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/liboffloadmic ; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo Configuring in $(TARGET_SUBDIR)/liboffloadmic; \
+ \
+ this_target="${target_alias}"; \
+ \
+ cd "$(TARGET_SUBDIR)/liboffloadmic" || exit 1; \
+ case $(srcdir) in \
+ /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+ *) topdir=`echo $(TARGET_SUBDIR)/liboffloadmic/ | \
+ sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+ esac; \
+ module_srcdir=liboffloadmic; \
+ srcdiroption="--srcdir=$${topdir}/liboffloadmic"; \
+ libsrcdir="$$s/liboffloadmic"; \
+ rm -f no-such-file || : ; \
+ CONFIG_SITE=no-such-file $(SHELL) \
+ $$s/$$module_srcdir/configure \
+ --srcdir=$${topdir}/$$module_srcdir \
+ $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
+ --target=$${this_target} $${srcdiroption} @extra_liboffloadmic_configure_flags@ \
+ || exit 1
+@endif target-liboffloadmic
+
+
+
+
+
+.PHONY: all-target-liboffloadmic maybe-all-target-liboffloadmic
+maybe-all-target-liboffloadmic:
+@if gcc-bootstrap
+all-target-liboffloadmic: stage_current
+@endif gcc-bootstrap
+@if target-liboffloadmic
+TARGET-target-liboffloadmic=all
+maybe-all-target-liboffloadmic: all-target-liboffloadmic
+all-target-liboffloadmic: configure-target-liboffloadmic
+ @: $(MAKE); $(unstage)
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ (cd $(TARGET_SUBDIR)/liboffloadmic && \
+ $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS) \
+ $(TARGET-target-liboffloadmic))
+@endif target-liboffloadmic
+
+
+
+
+
+.PHONY: check-target-liboffloadmic maybe-check-target-liboffloadmic
+maybe-check-target-liboffloadmic:
+@if target-liboffloadmic
+maybe-check-target-liboffloadmic: check-target-liboffloadmic
+
+check-target-liboffloadmic:
+ @: $(MAKE); $(unstage)
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ (cd $(TARGET_SUBDIR)/liboffloadmic && \
+ $(MAKE) $(TARGET_FLAGS_TO_PASS) check)
+
+@endif target-liboffloadmic
+
+.PHONY: install-target-liboffloadmic maybe-install-target-liboffloadmic
+maybe-install-target-liboffloadmic:
+@if target-liboffloadmic
+maybe-install-target-liboffloadmic: install-target-liboffloadmic
+
+install-target-liboffloadmic: installdirs
+ @: $(MAKE); $(unstage)
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ (cd $(TARGET_SUBDIR)/liboffloadmic && \
+ $(MAKE) $(TARGET_FLAGS_TO_PASS) install)
+
+@endif target-liboffloadmic
+
+.PHONY: install-strip-target-liboffloadmic maybe-install-strip-target-liboffloadmic
+maybe-install-strip-target-liboffloadmic:
+@if target-liboffloadmic
+maybe-install-strip-target-liboffloadmic: install-strip-target-liboffloadmic
+
+install-strip-target-liboffloadmic: installdirs
+ @: $(MAKE); $(unstage)
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ (cd $(TARGET_SUBDIR)/liboffloadmic && \
+ $(MAKE) $(TARGET_FLAGS_TO_PASS) install-strip)
+
+@endif target-liboffloadmic
+
+# Other targets (info, dvi, pdf, etc.)
+
+.PHONY: maybe-info-target-liboffloadmic info-target-liboffloadmic
+maybe-info-target-liboffloadmic:
+@if target-liboffloadmic
+maybe-info-target-liboffloadmic: info-target-liboffloadmic
+
+info-target-liboffloadmic: \
+ configure-target-liboffloadmic
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/liboffloadmic/Makefile ] || exit 0 ; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing info in $(TARGET_SUBDIR)/liboffloadmic" ; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/liboffloadmic && \
+ $(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 target-liboffloadmic
+
+.PHONY: maybe-dvi-target-liboffloadmic dvi-target-liboffloadmic
+maybe-dvi-target-liboffloadmic:
+@if target-liboffloadmic
+maybe-dvi-target-liboffloadmic: dvi-target-liboffloadmic
+
+dvi-target-liboffloadmic: \
+ configure-target-liboffloadmic
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/liboffloadmic/Makefile ] || exit 0 ; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing dvi in $(TARGET_SUBDIR)/liboffloadmic" ; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/liboffloadmic && \
+ $(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 target-liboffloadmic
+
+.PHONY: maybe-pdf-target-liboffloadmic pdf-target-liboffloadmic
+maybe-pdf-target-liboffloadmic:
+@if target-liboffloadmic
+maybe-pdf-target-liboffloadmic: pdf-target-liboffloadmic
+
+pdf-target-liboffloadmic: \
+ configure-target-liboffloadmic
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/liboffloadmic/Makefile ] || exit 0 ; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing pdf in $(TARGET_SUBDIR)/liboffloadmic" ; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/liboffloadmic && \
+ $(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 target-liboffloadmic
+
+.PHONY: maybe-html-target-liboffloadmic html-target-liboffloadmic
+maybe-html-target-liboffloadmic:
+@if target-liboffloadmic
+maybe-html-target-liboffloadmic: html-target-liboffloadmic
+
+html-target-liboffloadmic: \
+ configure-target-liboffloadmic
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/liboffloadmic/Makefile ] || exit 0 ; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing html in $(TARGET_SUBDIR)/liboffloadmic" ; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/liboffloadmic && \
+ $(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 target-liboffloadmic
+
+.PHONY: maybe-TAGS-target-liboffloadmic TAGS-target-liboffloadmic
+maybe-TAGS-target-liboffloadmic:
+@if target-liboffloadmic
+maybe-TAGS-target-liboffloadmic: TAGS-target-liboffloadmic
+
+TAGS-target-liboffloadmic: \
+ configure-target-liboffloadmic
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/liboffloadmic/Makefile ] || exit 0 ; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing TAGS in $(TARGET_SUBDIR)/liboffloadmic" ; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/liboffloadmic && \
+ $(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 target-liboffloadmic
+
+.PHONY: maybe-install-info-target-liboffloadmic install-info-target-liboffloadmic
+maybe-install-info-target-liboffloadmic:
+@if target-liboffloadmic
+maybe-install-info-target-liboffloadmic: install-info-target-liboffloadmic
+
+install-info-target-liboffloadmic: \
+ configure-target-liboffloadmic \
+ info-target-liboffloadmic
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/liboffloadmic/Makefile ] || exit 0 ; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing install-info in $(TARGET_SUBDIR)/liboffloadmic" ; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/liboffloadmic && \
+ $(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 target-liboffloadmic
+
+.PHONY: maybe-install-pdf-target-liboffloadmic install-pdf-target-liboffloadmic
+maybe-install-pdf-target-liboffloadmic:
+@if target-liboffloadmic
+maybe-install-pdf-target-liboffloadmic: install-pdf-target-liboffloadmic
+
+install-pdf-target-liboffloadmic: \
+ configure-target-liboffloadmic \
+ pdf-target-liboffloadmic
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/liboffloadmic/Makefile ] || exit 0 ; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing install-pdf in $(TARGET_SUBDIR)/liboffloadmic" ; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/liboffloadmic && \
+ $(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 target-liboffloadmic
+
+.PHONY: maybe-install-html-target-liboffloadmic install-html-target-liboffloadmic
+maybe-install-html-target-liboffloadmic:
+@if target-liboffloadmic
+maybe-install-html-target-liboffloadmic: install-html-target-liboffloadmic
+
+install-html-target-liboffloadmic: \
+ configure-target-liboffloadmic \
+ html-target-liboffloadmic
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/liboffloadmic/Makefile ] || exit 0 ; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing install-html in $(TARGET_SUBDIR)/liboffloadmic" ; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/liboffloadmic && \
+ $(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 target-liboffloadmic
+
+.PHONY: maybe-installcheck-target-liboffloadmic installcheck-target-liboffloadmic
+maybe-installcheck-target-liboffloadmic:
+@if target-liboffloadmic
+maybe-installcheck-target-liboffloadmic: installcheck-target-liboffloadmic
+
+installcheck-target-liboffloadmic: \
+ configure-target-liboffloadmic
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/liboffloadmic/Makefile ] || exit 0 ; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing installcheck in $(TARGET_SUBDIR)/liboffloadmic" ; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/liboffloadmic && \
+ $(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 target-liboffloadmic
+
+.PHONY: maybe-mostlyclean-target-liboffloadmic mostlyclean-target-liboffloadmic
+maybe-mostlyclean-target-liboffloadmic:
+@if target-liboffloadmic
+maybe-mostlyclean-target-liboffloadmic: mostlyclean-target-liboffloadmic
+
+mostlyclean-target-liboffloadmic:
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/liboffloadmic/Makefile ] || exit 0 ; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing mostlyclean in $(TARGET_SUBDIR)/liboffloadmic" ; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/liboffloadmic && \
+ $(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 target-liboffloadmic
+
+.PHONY: maybe-clean-target-liboffloadmic clean-target-liboffloadmic
+maybe-clean-target-liboffloadmic:
+@if target-liboffloadmic
+maybe-clean-target-liboffloadmic: clean-target-liboffloadmic
+
+clean-target-liboffloadmic:
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/liboffloadmic/Makefile ] || exit 0 ; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing clean in $(TARGET_SUBDIR)/liboffloadmic" ; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/liboffloadmic && \
+ $(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 target-liboffloadmic
+
+.PHONY: maybe-distclean-target-liboffloadmic distclean-target-liboffloadmic
+maybe-distclean-target-liboffloadmic:
+@if target-liboffloadmic
+maybe-distclean-target-liboffloadmic: distclean-target-liboffloadmic
+
+distclean-target-liboffloadmic:
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/liboffloadmic/Makefile ] || exit 0 ; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing distclean in $(TARGET_SUBDIR)/liboffloadmic" ; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/liboffloadmic && \
+ $(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 target-liboffloadmic
+
+.PHONY: maybe-maintainer-clean-target-liboffloadmic maintainer-clean-target-liboffloadmic
+maybe-maintainer-clean-target-liboffloadmic:
+@if target-liboffloadmic
+maybe-maintainer-clean-target-liboffloadmic: maintainer-clean-target-liboffloadmic
+
+maintainer-clean-target-liboffloadmic:
+ @: $(MAKE); $(unstage)
+ @[ -f $(TARGET_SUBDIR)/liboffloadmic/Makefile ] || exit 0 ; \
+ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(NORMAL_TARGET_EXPORTS) \
+ echo "Doing maintainer-clean in $(TARGET_SUBDIR)/liboffloadmic" ; \
+ for flag in $(EXTRA_TARGET_FLAGS); do \
+ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+ done; \
+ (cd $(TARGET_SUBDIR)/liboffloadmic && \
+ $(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 target-liboffloadmic
+
+
+
+
+
.PHONY: configure-target-libssp maybe-configure-target-libssp
maybe-configure-target-libssp:
@if gcc-bootstrap
@@ -47511,6 +47996,7 @@ configure-stage4-target-libvtv: maybe-all-stage4-gcc
configure-stageprofile-target-libvtv: maybe-all-stageprofile-gcc
configure-stagefeedback-target-libvtv: maybe-all-stagefeedback-gcc
configure-target-libcilkrts: stage_last
+configure-target-liboffloadmic: stage_last
configure-target-libssp: stage_last
configure-target-newlib: stage_last
configure-stage1-target-libgcc: maybe-all-stage1-gcc
@@ -47548,6 +48034,7 @@ configure-target-libstdc++-v3: maybe-all-gcc
configure-target-libsanitizer: maybe-all-gcc
configure-target-libvtv: maybe-all-gcc
configure-target-libcilkrts: maybe-all-gcc
+configure-target-liboffloadmic: maybe-all-gcc
configure-target-libssp: maybe-all-gcc
configure-target-newlib: maybe-all-gcc
configure-target-libgcc: maybe-all-gcc
@@ -48341,6 +48828,7 @@ configure-stage3-target-libstdc++-v3: maybe-configure-stage3-target-libgomp
configure-stage4-target-libstdc++-v3: maybe-configure-stage4-target-libgomp
configure-stageprofile-target-libstdc++-v3: maybe-configure-stageprofile-target-libgomp
configure-stagefeedback-target-libstdc++-v3: maybe-configure-stagefeedback-target-libgomp
+configure-target-liboffloadmic: maybe-configure-target-libgomp
configure-target-libsanitizer: maybe-all-target-libstdc++-v3
configure-stage1-target-libsanitizer: maybe-all-stage1-target-libstdc++-v3
@@ -48365,6 +48853,7 @@ all-stage3-target-libstdc++-v3: maybe-configure-stage3-target-libgomp
all-stage4-target-libstdc++-v3: maybe-configure-stage4-target-libgomp
all-stageprofile-target-libstdc++-v3: maybe-configure-stageprofile-target-libgomp
all-stagefeedback-target-libstdc++-v3: maybe-configure-stagefeedback-target-libgomp
+all-target-liboffloadmic: maybe-configure-target-libgomp
install-target-libgo: maybe-install-target-libatomic
install-target-libgfortran: maybe-install-target-libquadmath
install-target-libgfortran: maybe-install-target-libgcc
@@ -48374,6 +48863,8 @@ install-target-libvtv: maybe-install-target-libstdc++-v3
install-target-libvtv: maybe-install-target-libgcc
install-target-libcilkrts: maybe-install-target-libstdc++-v3
install-target-libcilkrts: maybe-install-target-libgcc
+install-target-liboffloadmic: maybe-install-target-libstdc++-v3
+install-target-liboffloadmic: maybe-install-target-libgcc
install-target-libjava: maybe-install-target-libgcc
install-target-libitm: maybe-install-target-libgcc
install-target-libobjc: maybe-install-target-libgcc
@@ -48422,6 +48913,7 @@ configure-target-libstdc++-v3: maybe-all-target-libgcc
configure-target-libsanitizer: maybe-all-target-libgcc
configure-target-libvtv: maybe-all-target-libgcc
configure-target-libcilkrts: maybe-all-target-libgcc
+configure-target-liboffloadmic: maybe-all-target-libgcc
configure-target-libssp: maybe-all-target-libgcc
configure-target-newlib: maybe-all-target-libgcc
configure-target-libbacktrace: maybe-all-target-libgcc
@@ -48453,6 +48945,9 @@ configure-target-libvtv: maybe-all-target-newlib maybe-all-target-libgloss
configure-target-libcilkrts: maybe-all-target-newlib maybe-all-target-libgloss
configure-target-libcilkrts: maybe-all-target-libstdc++-v3
+configure-target-liboffloadmic: maybe-all-target-newlib maybe-all-target-libgloss
+configure-target-liboffloadmic: maybe-all-target-libstdc++-v3
+
configure-target-libssp: maybe-all-target-newlib maybe-all-target-libgloss
diff --git a/config/ChangeLog b/config/ChangeLog
index 215063c2765..793e4d263b9 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,7 @@
+2014-11-13 Kirill Yukhin <kirill.yukhin@intel.com>
+
+ * target-posix: New file.
+
2014-10-27 Tom Tromey <tromey@redhat.com>
* gcc-plugin.m4: New file.
diff --git a/config/target-posix b/config/target-posix
new file mode 100644
index 00000000000..2fba066c615
--- /dev/null
+++ b/config/target-posix
@@ -0,0 +1,12 @@
+case "${target}" in
+ *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
+ ;;
+ *-*-netbsd* | *-*-freebsd* | *-*-openbsd* | *-*-dragonfly*)
+ ;;
+ *-*-solaris2* | *-*-hpux11*)
+ ;;
+ *-*-darwin* | *-*-aix*)
+ ;;
+ *)
+ UNSUPPORTED=1 ;;
+ esac
diff --git a/configure b/configure
index 7213c1b8f13..96225b570dd 100755
--- a/configure
+++ b/configure
@@ -672,6 +672,7 @@ LDFLAGS
CFLAGS
CC
EXTRA_CONFIGARGS_LIBJAVA
+extra_liboffloadmic_configure_flags
target_subdir
host_subdir
build_subdir
@@ -745,6 +746,8 @@ ospace_frag'
ac_user_opts='
enable_option_checking
with_build_libsubdir
+enable_as_accelerator_for
+enable_offload_targets
enable_gold
enable_ld
enable_libquadmath
@@ -752,6 +755,7 @@ enable_libquadmath_support
enable_libada
enable_libssp
enable_libstdcxx
+enable_liboffloadmic
enable_static_libjava
enable_bootstrap
with_mpc
@@ -1460,6 +1464,13 @@ 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]
+ --enable-as-accelerator-for=ARG
+ build as offload target compiler. Specify offload
+ host triple by ARG
+ --enable-offload-targets=LIST
+ enable offloading to devices from comma-separated
+ LIST of TARGET[=DIR]. Use optional path to find
+ offload target compiler during the build
--enable-gold[=ARG] build gold [ARG={default,yes,no}]
--enable-ld[=ARG] build ld [ARG={default,yes,no}]
--disable-libquadmath do not build libquadmath directory
@@ -1468,6 +1479,8 @@ Optional Features:
--enable-libada build libada directory
--enable-libssp build libssp directory
--disable-libstdcxx do not build libstdc++-v3 directory
+ --enable-liboffloadmic=ARG
+ build liboffloadmic [ARG={no,host,target}]
--enable-static-libjava[=ARG]
build static libjava [default=no]
--enable-bootstrap enable bootstrapping [yes if native build]
@@ -2728,6 +2741,7 @@ target_libraries="target-libgcc \
target-newlib \
target-libgomp \
target-libcilkrts \
+ target-liboffloadmic \
target-libatomic \
target-libitm \
target-libstdc++-v3 \
@@ -2877,6 +2891,26 @@ case ${with_newlib} in
yes) skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'` ;;
esac
+# Check whether --enable-as-accelerator-for was given.
+if test "${enable_as_accelerator_for+set}" = set; then :
+ enableval=$enable_as_accelerator_for; ENABLE_AS_ACCELERATOR_FOR=$enableval
+else
+ ENABLE_AS_ACCELERATOR_FOR=no
+fi
+
+
+# Check whether --enable-offload-targets was given.
+if test "${enable_offload_targets+set}" = set; then :
+ enableval=$enable_offload_targets;
+ if test x"$enable_offload_targets" = x; then
+ as_fn_error "no offload targets specified" "$LINENO" 5
+ fi
+
+else
+ enable_offload_targets=
+fi
+
+
# Handle --enable-gold, --enable-ld.
# --disable-gold [--enable-ld]
# Build only ld. Default option.
@@ -3047,6 +3081,44 @@ if test "${ENABLE_LIBSTDCXX}" = "no" ; then
noconfigdirs="$noconfigdirs target-libstdc++-v3"
fi
+# If this is accelerator compiler and its target is intelmic we enable
+# target liboffloadmic by default. If this is compiler with offloading
+# for intelmic we enable host liboffloadmic by default. Otherwise
+# liboffloadmic is disabled by default.
+# Check whether --enable-liboffloadmic was given.
+if test "${enable_liboffloadmic+set}" = set; then :
+ enableval=$enable_liboffloadmic; case "$enableval" in
+ no | host | target)
+ enable_liboffloadmic=$enableval ;;
+ *)
+ as_fn_error "--enable-liboffloadmic=no/host/target" "$LINENO" 5 ;;
+esac
+else
+ if test "${ENABLE_AS_ACCELERATOR_FOR}" != "no"; then
+ case "${target}" in
+ *-intelmic-* | *-intelmicemul-*)
+ enable_liboffloadmic=target
+ extra_liboffloadmic_configure_flags="--enable-liboffloadmic=target"
+ ;;
+ *)
+ enable_liboffloadmic=no
+ ;;
+ esac
+else
+ case "${enable_offload_targets}" in
+ *-intelmic-* | *-intelmicemul-*)
+ enable_liboffloadmic=host
+ extra_liboffloadmic_configure_flags="--enable-liboffloadmic=host"
+ ;;
+ *)
+ enable_liboffloadmic=no
+ ;;
+ esac
+fi
+fi
+
+
+
# Save it here so that, even in case of --enable-libgcj, if the Java
# front-end isn't enabled, we still get libgcj disabled.
libgcj_saved=$libgcj
@@ -3140,6 +3212,25 @@ $as_echo "yes" >&6; }
fi
fi
+# Disable liboffloadmic on unsupported systems.
+if test -d ${srcdir}/liboffloadmic; then
+ if test x$enable_liboffloadmic != xno; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for liboffloadmic support" >&5
+$as_echo_n "checking for liboffloadmic support... " >&6; }
+ if (srcdir=${srcdir}/liboffloadmic; \
+ . ${srcdir}/configure.tgt; \
+ test -n "$UNSUPPORTED")
+ then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ noconfigdirs="$noconfigdirs target-liboffloadmic"
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ fi
+ fi
+fi
+
# Disable libitm on unsupported systems.
if test -d ${srcdir}/libitm; then
if test x$enable_libitm = x; then
@@ -6321,7 +6412,7 @@ case ,${enable_languages},:${enable_objc_gc} in
;;
esac
-# Disable libcilkrts, libitm, libsanitizer, libvtv if we're not building C++
+# Disable libcilkrts, libitm, libsanitizer, libvtv, liboffloadmic if we're not building C++
case ,${enable_languages}, in
*,c++,*)
# Disable libcilkrts, libitm, libsanitizer if we're not building libstdc++
@@ -6333,7 +6424,7 @@ case ,${enable_languages}, in
esac
;;
*)
- noconfigdirs="$noconfigdirs target-libcilkrts target-libitm target-libsanitizer target-libvtv"
+ noconfigdirs="$noconfigdirs target-libcilkrts target-liboffloadmic target-libitm target-libsanitizer target-libvtv"
;;
esac
diff --git a/configure.ac b/configure.ac
index 2c958a2e729..b27fb1dfdea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -156,6 +156,7 @@ target_libraries="target-libgcc \
target-newlib \
target-libgomp \
target-libcilkrts \
+ target-liboffloadmic \
target-libatomic \
target-libitm \
target-libstdc++-v3 \
@@ -285,6 +286,24 @@ case ${with_newlib} in
yes) skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'` ;;
esac
+AC_ARG_ENABLE(as-accelerator-for,
+[AS_HELP_STRING([--enable-as-accelerator-for=ARG],
+ [build as offload target compiler.
+ Specify offload host triple by ARG])],
+ENABLE_AS_ACCELERATOR_FOR=$enableval,
+ENABLE_AS_ACCELERATOR_FOR=no)
+
+AC_ARG_ENABLE(offload-targets,
+[AS_HELP_STRING([--enable-offload-targets=LIST],
+ [enable offloading to devices from comma-separated LIST of
+ TARGET[=DIR]. Use optional path to find offload target compiler
+ during the build])],
+[
+ if test x"$enable_offload_targets" = x; then
+ AC_MSG_ERROR([no offload targets specified])
+ fi
+], [enable_offload_targets=])
+
# Handle --enable-gold, --enable-ld.
# --disable-gold [--enable-ld]
# Build only ld. Default option.
@@ -438,6 +457,42 @@ ENABLE_LIBSTDCXX=default)
noconfigdirs="$noconfigdirs target-libstdc++-v3"
fi]
+# If this is accelerator compiler and its target is intelmic we enable
+# target liboffloadmic by default. If this is compiler with offloading
+# for intelmic we enable host liboffloadmic by default. Otherwise
+# liboffloadmic is disabled by default.
+AC_ARG_ENABLE([liboffloadmic],
+AC_HELP_STRING([[--enable-liboffloadmic[=ARG]]],
+ [build liboffloadmic @<:@ARG={no,host,target}@:>@]),
+[case "$enableval" in
+ no | host | target)
+ enable_liboffloadmic=$enableval ;;
+ *)
+ AC_MSG_ERROR([--enable-liboffloadmic=no/host/target]) ;;
+esac],
+[if test "${ENABLE_AS_ACCELERATOR_FOR}" != "no"; then
+ case "${target}" in
+ *-intelmic-* | *-intelmicemul-*)
+ enable_liboffloadmic=target
+ extra_liboffloadmic_configure_flags="--enable-liboffloadmic=target"
+ ;;
+ *)
+ enable_liboffloadmic=no
+ ;;
+ esac
+else
+ case "${enable_offload_targets}" in
+ *-intelmic-* | *-intelmicemul-*)
+ enable_liboffloadmic=host
+ extra_liboffloadmic_configure_flags="--enable-liboffloadmic=host"
+ ;;
+ *)
+ enable_liboffloadmic=no
+ ;;
+ esac
+fi])
+AC_SUBST(extra_liboffloadmic_configure_flags)
+
# Save it here so that, even in case of --enable-libgcj, if the Java
# front-end isn't enabled, we still get libgcj disabled.
libgcj_saved=$libgcj
@@ -523,6 +578,22 @@ if test -d ${srcdir}/libcilkrts; then
fi
fi
+# Disable liboffloadmic on unsupported systems.
+if test -d ${srcdir}/liboffloadmic; then
+ if test x$enable_liboffloadmic != xno; then
+ AC_MSG_CHECKING([for liboffloadmic support])
+ if (srcdir=${srcdir}/liboffloadmic; \
+ . ${srcdir}/configure.tgt; \
+ test -n "$UNSUPPORTED")
+ then
+ AC_MSG_RESULT([no])
+ noconfigdirs="$noconfigdirs target-liboffloadmic"
+ else
+ AC_MSG_RESULT([yes])
+ fi
+ fi
+fi
+
# Disable libitm on unsupported systems.
if test -d ${srcdir}/libitm; then
if test x$enable_libitm = x; then
@@ -2045,7 +2116,7 @@ case ,${enable_languages},:${enable_objc_gc} in
;;
esac
-# Disable libcilkrts, libitm, libsanitizer, libvtv if we're not building C++
+# Disable libcilkrts, libitm, libsanitizer, libvtv, liboffloadmic if we're not building C++
case ,${enable_languages}, in
*,c++,*)
# Disable libcilkrts, libitm, libsanitizer if we're not building libstdc++
@@ -2057,7 +2128,7 @@ case ,${enable_languages}, in
esac
;;
*)
- noconfigdirs="$noconfigdirs target-libcilkrts target-libitm target-libsanitizer target-libvtv"
+ noconfigdirs="$noconfigdirs target-libcilkrts target-liboffloadmic target-libitm target-libsanitizer target-libvtv"
;;
esac
diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index 2484d86e20d..60257c48e07 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,8 @@
+2014-11-14 Tom de Vries <tom@codesourcery.com>
+
+ * mklog: Move reading of .diff file up and add comment. Copy diff_lines
+ to orig_diff_lines. Use orig_diff_lines when appending patch.
+
2014-11-11 David Malcolm <dmalcolm@redhat.com>
* ChangeLog.jit: New.
diff --git a/contrib/mklog b/contrib/mklog
index 8412d38fbf6..840f6f8c266 100755
--- a/contrib/mklog
+++ b/contrib/mklog
@@ -132,15 +132,23 @@ sub is_top_level {
return $function && $function !~ /^[\s{]/;
}
+# Read contents of .diff file
+open (DFILE, $diff) or die "Could not open file $diff for reading";
+chomp (my @diff_lines = <DFILE>);
+close (DFILE);
+
+# Array diff_lines is modified by the log generation, so save a copy in
+# orig_diff_lines if needed.
+if ($inline) {
+ @orig_diff_lines = @diff_lines;
+}
+
# For every file in the .diff print all the function names in ChangeLog
# format.
%cl_entries = ();
$change_msg = undef;
$look_for_funs = 0;
$clname = get_clname('');
-open (DFILE, $diff) or die "Could not open file $diff for reading";
-chomp (my @diff_lines = <DFILE>);
-close (DFILE);
$line_idx = 0;
foreach (@diff_lines) {
# Stop processing functions if we found a new file.
@@ -313,7 +321,7 @@ foreach my $clname (keys %cl_entries) {
if ($inline) {
# Append the patch to the log
- foreach (@diff_lines) {
+ foreach (@orig_diff_lines) {
print OUTPUTFILE "$_\n";
}
}
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a15bfd2c5cc..f7587e1c388 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,865 @@
+2014-11-14 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ * config/rs6000/predicates.md (easy_fp_constant): Delete redunant
+ tests for 0.0.
+
+ * config/rs6000/vector.md (VEC_R): Move secondary reload support
+ insns to rs6000.md from vector.md.
+ (reload_<VEC_R:mode>_<P:mptrsize>_store): Likewise.
+ (reload_<VEC_R:mode>_<P:mptrsize>_load): Likewise.
+ (vec_reload_and_plus_<mptrsize>): Likewise.
+
+ * config/rs6000/rs6000.md (Fa): New mode attribute to give
+ constraint for the Altivec registers for a type.
+ (RELOAD): New mode iterator for all of the types that have
+ secondary reload address support to load up a base register.
+ (extendsfdf2_fpr): Use correct constraint.
+ (copysign<mode>3_fcpsgn): For SFmode, use correct xscpsgndp
+ instruction.
+ (floatsi<mode>2_lfiwax): Add support for -mupper-regs-{sf,df}.
+ Generate the non-VSX instruction if all registers were FPRs. Do
+ not use the patterns in vsx.md for scalar operations.
+ (floatsi<mode>2_lfiwax_mem): Likewise.
+ (floatunssi<mode>2_lfiwzx): Likewise.
+ (floatunssi<mode>2_lfiwzx_mem): Likewise.
+ (fix_trunc<mode>di2_fctidz): Likewise.
+ (fixuns_trunc<mode>di2_fctiduz): Likewise.
+ (fctiwz_<mode>): Likewise.
+ (fctiwuz_<mode>): Likewise.
+ (friz): Likewise.
+ (floatdidf2_fpr): Likewise.
+ (floatdidf2_mem): Likewise.
+ (floatunsdidf2): Likewise.
+ (floatunsdidf2_fcfidu): Likewise.
+ (floatunsdidf2_mem): Likewise.
+ (floatdisf2_fcfids): Likewise.
+ (floatdisf2_mem): Likewise.
+ (floatdisf2_internal1): Add explicit test for not FCFIDS to make
+ it more obvious that the code is for pre-ISA 2.06 machines.
+ (floatdisf2_internal2): Likewise.
+ (floatunsdisf2_fcfidus): Add support for -mupper-regs-{sf,df}.
+ Generate the non-VSX instruction if all registers were FPRs. Do
+ not use the patterns in vsx.md for scalar operations.
+ (floatunsdisf2_mem): Likewise.
+ (reload_<RELOAD:mode>_<P:mptrsize>_store): Move the reload
+ handlers here from vector.md, and expand the types we generate
+ reload handlers for.
+ (reload_<RELOAD:mode>_<P:mptrsize>_load): Likewise.
+ (vec_reload_and_plus_<mptrsize>): Likewise.
+
+ * config/rs6000/vsx.md (vsx_float<VSi><mode>2): Only provide the
+ vector forms of the instructions. Move VSX scalar forms to
+ rs6000.md, and add support for -mupper-regs-sf.
+ (vsx_floatuns<VSi><mode>2): Likewise.
+ (vsx_fix_trunc<mode><VSi>2): Likewise.
+ (vsx_fixuns_trunc<mode><VSi>2): Likewise.
+ (vsx_float_fix_<mode>2): Delete DF version, rename to
+ vsx_float_fix_v2df2.
+ (vsx_float_fix_v2df2): Likewise.
+
+2014-11-14 Martin Jambor <mjambor@suse.cz>
+
+ * ipa-prop.h (jump_func_type): Removed value IPA_JF_KNOWN_TYPE.
+ (ipa_pass_through_data): Removed field type_preserved.
+ (ipa_ancestor_jf_data): removed fields type and type_preserved.
+ (ipa_jump_func): Removed field known_type.
+ (ipa_get_jf_known_type_offset): Removed.
+ (ipa_get_jf_known_type_base_type): Likewise.
+ (ipa_get_jf_known_type_component_type): Likewise.
+ (ipa_get_jf_ancestor_type): Likewise.
+ * ipa-cp.c (print_ipcp_constant_value): Removed BINFO handling.
+ (ipa_get_jf_pass_through_result): Likewise.
+ (ipa_get_jf_ancestor_result): Always build ptr_node_type accesses.
+ (values_equal_for_ipcp_p): Removed BINFO handling.
+ (ipa_get_indirect_edge_target_1): Updated comment.
+ * ipa-prop.c (ipa_print_node_jump_functions_for_edge): Removed handling
+ of IPA_JF_KNOWN_TYPE jump functions. Do not print removed fields.
+ (ipa_set_jf_known_type): Removed.
+ (ipa_set_jf_simple_pass_through): Do not set removed fields. Update
+ all callers.
+ (ipa_set_jf_arith_pass_through): Likewise.
+ (ipa_set_ancestor_jf): Likewise.
+ (ipa_binfo_from_known_type_jfunc): Removed.
+ (prop_type_change_info): Removed fields known_current_type and
+ multiple_types_encountered.
+ (extr_type_from_vtbl_ptr_store): Removed.
+ (check_stmt_for_type_change): Do not attempt to identify changed type.
+ (detect_type_change_from_memory_writes): Do not set the removed fields,
+ always set jfunc to unknown.
+ (compute_complex_assign_jump_func): Do not detect dynamic type change.
+ (compute_complex_ancestor_jump_func): Likewise.
+ (compute_known_type_jump_func): Removed.
+ (ipa_compute_jump_functions_for_edge): Do not detect dynamic type
+ change. Do not comute known type jump functions.
+ (combine_known_type_and_ancestor_jfs): Removed.
+ (update_jump_functions_after_inlining): Removed handling of
+ IPA_JF_KNOWN_TYPE jump functions. Do not set removed fields.
+ (ipa_write_jump_function): Do not stream removed fields or known type
+ jump functions.
+ (ipa_read_jump_function): Likewise.
+
+2014-11-14 Vladimir Makarov <vmakarov@redhat.com>
+
+ * lra-int.h (lra_create_live_ranges): Add parameter.
+ * lra-lives.c (temp_bitmap): Move higher.
+ (initiate_live_solver): Move temp_bitmap initialization into
+ lra_live_ranges_init.
+ (finish_live_solver): Move temp_bitmap clearing into
+ live_ranges_finish.
+ (process_bb_lives): Add parameter. Use it to control live info
+ update and dead insn elimination. Pass it to mark_regno_live and
+ mark_regno_dead.
+ (lra_create_live_ranges): Add parameter. Pass it to
+ process_bb_lives.
+ (lra_live_ranges_init, lra_live_ranges_finish): See changes in
+ initiate_live_solver and finish_live_solver.
+ * lra-remat.c (do_remat): Process insn non-operand hard regs too.
+ Use temp_bitmap to update avail_cands.
+ * lra.c (lra): Pass new parameter to lra_create_live_ranges. Move
+ check with lra_need_for_spill_p after live range pass. Switch on
+ rematerialization pass.
+
+2014-11-14 Martin Jambor <mjambor@suse.cz>
+
+ * ipa-prop.h (ipa_get_jf_pass_through_type_preserved): use
+ agg_preserved flag instead.
+ (ipa_get_jf_ancestor_type_preserved): Likewise.
+ (ipa_node_params): Rename known_vals to known_csts, update all users.
+ New field known_contexts.
+ (ipa_get_indirect_edge_target): Update prototype.
+ (ipcp_poly_ctx_values_pool): Declare.
+ (ipa_context_from_jfunc): Likewise.
+ * ipa-inline.h (estimate_ipcp_clone_size_and_time): Updated prototype.
+ * cgraph.h (ipa_polymorphic_call_context): New method equal_to. New
+ parameter newline of method dump.
+ * ipa-cp.c (ctxlat): New field.
+ (ipcp_values_pool): Renamed to ipcp_cst_values_pool, updated all users.
+ (ipcp_poly_ctx_values_pool):New variable.
+ (ipa_get_poly_ctx_lat): New function.
+ (print_ipcp_constant_value): New overloaded function for contexts.
+ (print_all_lattices): Also print contexts.
+ (ipa_topo_info): New field contexts;
+ (set_all_contains_variable): Also set the flag in the context lattice.
+ (initialize_node_lattices): Likewise for flag bottom.
+ (ipa_get_jf_ancestor_result): Removed BINFO handling.
+ (ipa_value_from_jfunc): Likewise.
+ (ipa_context_from_jfunc): New function.
+ (values_equal_for_ipcp_p): New overloaded function for contexts.
+ (allocate_and_init_ipcp_value): Construct the value.
+ (allocate_and_init_ipcp_value): New overloaded function for contexts.
+ (propagate_scalar_accross_jump_function): Removed handling of
+ KNOWN_TYPE jump functions.
+ (propagate_context_accross_jump_function): New function.
+ (propagate_constants_accross_call): Also propagate contexts.
+ (ipa_get_indirect_edge_target_1): Work on contexts rather than BINFOs.
+ (ipa_get_indirect_edge_target): Likewise.
+ (devirtualization_time_bonus): Likewise.
+ (gather_context_independent_values): Create and populate known_contexts
+ vector rather than known_binfos.
+ (perform_estimation_of_a_value): Work on contexts rather than BINFOs.
+ (estimate_local_effects): Likewise.
+ (add_all_node_vals_to_toposort): Also add contexts to teir topological
+ sort.
+ (ipcp_propagate_stage): Also propagate effects of contexts.
+ (ipcp_discover_new_direct_edges): Receive and pass known_contexts to
+ ipa_get_indirect_edge_target_1.
+ (cgraph_edge_brings_value_p): New overloaded function for contexts.
+ (create_specialized_node): Work on contexts rather than BINFOs.
+ (find_more_contexts_for_caller_subset): New function.
+ (known_contexts_useful_p): New function.
+ (copy_useful_known_contexts): Likewise.
+ (modify_known_vectors_with_val): Likewise.
+ (ipcp_val_in_agg_replacements_p): Renamed to
+ ipcp_val_agg_replacement_ok_p, return true for all offset indicating
+ non-aggregate.
+ (ipcp_val_agg_replacement_ok_p): New overloaded function for contexts.
+ (decide_about_value): Work on contexts rather than BINFOs.
+ (decide_whether_version_node): Likewise.
+ (ipcp_driver): Initialize the new alloc pool.
+ * ipa-prop.c (ipa_print_node_jump_functions_for_edge): Prettify
+ printing of edge contexts.
+ (ipa_set_ancestor_jf): Replace assert with conditional setting of
+ type_preserved to false.
+ (update_jump_functions_after_inlining): Use access function instead of
+ reading agg_preserved directly. Store combined context in the ancestor
+ case.
+ (try_make_edge_direct_virtual_call): Work on contexts rather than
+ BINFOs.
+ (update_indirect_edges_after_inlining): Get context from
+ ipa_context_from_jfunc.
+ (ipa_free_node_params_substructures): Free also known_contexts.
+ (ipa_free_all_structures_after_ipa_cp): Free the new alloc pool.
+ (ipa_free_all_structures_after_iinln): Likewise.
+ * ipa-inline-analysis.c (evaluate_properties_for_edge): Work on
+ contexts rather than BINFOs.
+ (estimate_edge_devirt_benefit): Likewise.
+ (estimate_edge_size_and_time): Likewise.
+ (estimate_calls_size_and_time): Likewise.
+ (estimate_node_size_and_time): Likewise.
+ (estimate_ipcp_clone_size_and_time): Likewise.
+ (do_estimate_edge_time): Likewise.
+ (do_estimate_edge_size): Likewise.
+ (do_estimate_edge_hints): Likewise.
+ * ipa-polymorphic-call.c (ipa_polymorphic_call_context::dump): New
+ parameter newline, ouput newline only when it is set.
+ (ipa_polymorphic_call_context::equal_to): New method.
+
+2014-11-14 Martin Jambor <mjambor@suse.cz>
+
+ * ipa-cp.c (ipcp_value_source): Converted to a template class. All
+ users converted to the same specialization as the using class/function
+ or specialization on tree.
+ (ipcp_value): Likewise.
+ (ipcp_lattice): Likewise.
+ (ipcp_agg_lattice): Now derived from tree specialization of
+ ipcp_lattice.
+ (values_topo): Moved to new class value_topo_info.
+ (ipa_lat_is_single_const): Turned into ipcp_lattice::is_single_const.
+ Updated all callers.
+ (print_lattice): Turned into ipcp_lattice::print. Updated all
+ callers.
+ (value_topo_info): New class template.
+ (ipa_topo_info): New field constants. New constructor.
+ (build_toporder_info): Do not clear stack_top, only checkign assert
+ it.
+ (set_lattice_to_bottom): Turned into ipcp_lattice::set_to_bottom.
+ Updated all callers.
+ (set_lattice_contains_variable): Turned into
+ ipcp_lattice::set_contains_variable. Updated all callers.
+ (add_value_source): Turned into ipcp_value::add_source. Updated all
+ callers.
+ (allocate_and_init_ipcp_value): New function.
+ (add_value_to_lattice): Turned into ipcp_lattice::add_value. Last
+ parameter got default a value. Updated all callers.
+ (add_scalar_value_to_lattice): Removed, users converted to using
+ ipcp_lattice::add_value with default value of the last parameter.
+ (add_val_to_toposort): Turned to value_topo_info::add_val. Updated
+ all callers.
+ (propagate_effects): Made method of value_topo_info.
+ (cgraph_edge_brings_value_p): Now a template function.
+ (get_info_about_necessary_edges): Likewise.
+ (gather_edges_for_value): Likewise.
+ (perhaps_add_new_callers): Likewise.
+ (decide_about_value): Likewise.
+ * ipa-prop.h (ipcp_lattice): Remove fowrward declaration.
+
+2014-11-14 Jakub Jelinek <jakub@redhat.com>
+
+ * doc/install.texi (--with-diagnostics-color=): Document.
+
+ * tree-ssa.dce.c (eliminate_unnecessary_stmts): Eliminate
+ IFN_GOMP_SIMD_LANE without lhs as useless.
+
+ * ipa-pure-const.c (struct funct_state_d): Add can_free field.
+ (varying_state): Add true for can_free.
+ (check_call): For builtin or internal !nonfreeing_call_p set
+ local->can_free.
+ (check_stmt): For asm volatile and asm with "memory" set
+ local->can_free.
+ (analyze_function): Clear local->can_free initially, continue
+ calling check_stmt until all flags are computed, dump can_free
+ flag.
+ (pure_const_write_summary): Write can_free flag.
+ (pure_const_read_summary): Read it back.
+ (propagate_pure_const): Propagate also can_free flag, set
+ w->nonfreeing_fn if it is false after propagation.
+ * cgraph.h (cgraph_node): Add nonfreeing_fn member.
+ * gimple.c: Include ipa-ref.h, lto-streamer.h and cgraph.h.
+ (nonfreeing_call_p): Return cgraph nonfreeing_fn flag if set.
+ Also return true for IFN_ABNORMAL_DISPATCHER.
+ * cgraph.c (cgraph_node::dump): Dump nonfreeing_fn flag.
+ * lto-cgraph.c (lto_output_node): Write nonfreeing_fn flag.
+ (input_overwrite_node): Read it back.
+
+2014-11-14 Jakub Jelinek <jakub@redhat.com>
+ Marek Polacek <polacek@redhat.com>
+
+ * sanopt.c: Include tree-ssa-operands.h.
+ (struct sanopt_info): Add has_freeing_call_p,
+ has_freeing_call_computed_p, imm_dom_path_with_freeing_call_p,
+ imm_dom_path_with_freeing_call_computed_p, freeing_call_events,
+ being_visited_p fields.
+ (struct sanopt_ctx): Add asan_check_map field.
+ (imm_dom_path_with_freeing_call, maybe_optimize_ubsan_null_ifn,
+ maybe_optimize_asan_check_ifn): New functions.
+ (sanopt_optimize_walker): Use them, optimize even ASAN_CHECK
+ internal calls.
+ (pass_sanopt::execute): Call sanopt_optimize even for
+ -fsanitize=address.
+ * gimple.c (nonfreeing_call_p): Return true for non-ECF_LEAF
+ internal calls.
+
+2014-11-14 Alan Lawrence <alan.lawrence@arm.com>
+
+ * tree-vect-loop.c (vect_create_epilog_for_reduction): Move code for
+ 'if (extract_scalar_result)' to the only place that it is true.
+
+2014-11-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config.gcc (default_gnu_indirect_function): Set to yes
+ for i[34567]86-*-linux* and x86_64-*-linux* if not targeting
+ Android nor uclibc.
+
+2014-11-14 Felix Yang <felix.yang@huawei.com>
+ Jiji Jiang <jiangjiji@huawei.com>
+
+ * config/aarch64/aarch64-simd.md (*aarch64_simd_ld1r<mode>): Use
+ VALL mode iterator instead of VALLDI.
+
+
+2014-11-14 Jan Hubicka <hubicka@ucw.cz>
+
+ * optc-save-gen.awk: Output cl_target_option_eq,
+ cl_target_option_hash, cl_target_option_stream_out,
+ cl_target_option_stream_in functions.
+ * opth-gen.awk: Output prototypes for
+ cl_target_option_eq and cl_target_option_hash.
+ * lto-streamer.h (cl_target_option_stream_out,
+ cl_target_option_stream_in): Declare.
+ * tree.c (cl_option_hash_hash): Use cl_target_option_hash.
+ (cl_option_hash_eq): Use cl_target_option_eq.
+ * tree-streamer-in.c (unpack_value_fields): Stream in
+ TREE_TARGET_OPTION.
+ * lto-streamer-out.c (DFS::DFS_write_tree_body): Follow
+ DECL_FUNCTION_SPECIFIC_TARGET.
+ (hash_tree): Hash TREE_TARGET_OPTION; visit
+ DECL_FUNCTION_SPECIFIC_TARGET.
+ * tree-streamer-out.c (streamer_pack_tree_bitfields): Skip
+ TS_TARGET_OPTION.
+ (streamer_write_tree_body): Output TS_TARGET_OPTION.
+
+2014-11-14 Richard Biener <rguenther@suse.de>
+
+ * gimple-fold.h (gimple_fold_stmt_to_constant_1): Add 2nd
+ valueization hook defaulted to no_follow_ssa_edges.
+ * gimple-fold.c (gimple_fold_stmt_to_constant_1): Pass
+ 2nd valueization hook to gimple_simplify.
+ * tree-ssa-ccp.c (valueize_op_1): New function to be
+ used for gimple_simplify called via gimple_fold_stmt_to_constant_1.
+ (ccp_fold): Adjust.
+ * tree-vrp.c (vrp_valueize_1): New function to be
+ used for gimple_simplify called via gimple_fold_stmt_to_constant_1.
+ (vrp_visit_assignment_or_call): Adjust.
+
+2014-11-14 Marek Polacek <polacek@redhat.com>
+
+ * fold-const.c (fold_negate_expr): Don't fold INTEGER_CST if
+ that overflows when SANITIZE_SI_OVERFLOW is on. Guard -(-A)
+ folding with TYPE_OVERFLOW_SANITIZED.
+
+2014-11-14 Marek Polacek <polacek@redhat.com>
+
+ PR sanitizer/63839
+ * asan.c (ATTR_CONST_NORETURN_NOTHROW_LEAF_LIST,
+ ATTR_COLD_CONST_NORETURN_NOTHROW_LEAF_LIST): Define.
+ * builtin-attrs.def (ATTR_COLD_CONST_NORETURN_NOTHROW_LEAF_LIST):
+ Define.
+ * builtins.c (fold_builtin_0): Don't include ubsan.h. Don't
+ instrument BUILT_IN_UNREACHABLE here.
+ * sanitizer.def (BUILT_IN_UBSAN_HANDLE_BUILTIN_UNREACHABLE): Make
+ const.
+ * sanopt.c (pass_sanopt::execute): Instrument BUILT_IN_UNREACHABLE.
+ * tree-ssa-ccp.c (optimize_unreachable): Bail out if
+ SANITIZE_UNREACHABLE.
+ * ubsan.c (ubsan_instrument_unreachable): Rewrite for GIMPLE.
+ * ubsan.h (ubsan_instrument_unreachable): Adjust declaration.
+
+2014-11-14 Alan Lawrence <alan.lawrence@arm.com>
+
+ * config/rs6000/vector.md (vec_shl_<mode>): Remove.
+ (vec_shr_<mode>): Reverse shift if BYTES_BIG_ENDIAN.
+
+2014-11-14 Alan Lawrence <alan.lawrence@arm.com>
+
+ * optabs.c (shift_amt_for_vec_perm_mask): Remove code conditional on
+ BYTES_BIG_ENDIAN.
+ * tree-vect-loop.c (calc_vec_perm_mask_for_shift,
+ vect_create_epilog_for_reduction): Likewise.
+ * doc/md.texi (vec_shr_m): Clarify direction of shifting.
+
+2014-11-14 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
+
+ PR target/63724
+ * config/aarch64/aarch64.c (aarch64_expand_mov_immediate): Split out
+ numerical immediate handling to...
+ (aarch64_internal_mov_immediate): ...this. New.
+ (aarch64_rtx_costs): Use aarch64_internal_mov_immediate.
+ (aarch64_mov_operand_p): Relax predicate.
+ * config/aarch64/aarch64.md (mov<mode>:GPI): Do not expand CONST_INTs.
+ (*movsi_aarch64): Turn into define_insn_and_split and new alternative
+ for 'n'.
+ (*movdi_aarch64): Likewise.
+
+2014-11-14 Richard Biener <rguenther@suse.de>
+
+ * match.pd: Implement more binary patterns exercised by
+ fold_stmt.
+ * fold-const.c (sing_bit_p): Export.
+ (exact_inverse): Likewise.
+ (fold_binary_loc): Remove patterns here.
+ (tree_unary_nonnegative_warnv_p): Use CASE_CONVERT.
+ * fold-const.h (sing_bit_p): Declare.
+ (exact_inverse): Likewise.
+
+2014-11-14 Marek Polacek <polacek@redhat.com>
+
+ * tree.c (build_common_builtin_nodes): Remove doubled ECF_LEAF.
+
+2014-11-14 Richard Biener <rguenther@suse.de>
+
+ * genmatch.c (add_operator): Allow CONSTRUCTOR.
+ (dt_node::gen_kids): Handle CONSTRUCTOR not as GENERIC.
+ (parser::parse_op): Allow to iterate over predicates.
+
+2014-11-14 Jakub Jelinek <jakub@redhat.com>
+
+ * configure.ac (--with-diagnostics-color): New configure
+ option, default to --with-diagnostics-color=auto.
+ * toplev.c (process_options): Use DIAGNOSTICS_COLOR_DEFAULT
+ to determine -fdiagnostics-color= option default.
+ * doc/invoke.texi (-fdiagnostics-color=): Document new
+ default.
+ * configure: Regenerated.
+ * config.in: Regenerated.
+
+2014-11-13 Teresa Johnson <tejohnson@google.com>
+
+ PR tree-optimization/63841
+ * tree-ssa-strlen.c (strlen_optimize_stmt): Ignore clobbers.
+
+2014-11-14 Bin Cheng <bin.cheng@arm.com>
+
+ * timevar.def (TV_SCHED_FUSION): New time var.
+ * passes.def (pass_sched_fusion): New pass.
+ * config/arm/arm.c (TARGET_SCHED_FUSION_PRIORITY): New.
+ (extract_base_offset_in_addr, fusion_load_store): New.
+ (arm_sched_fusion_priority): New.
+ (arm_option_override): Disable scheduling fusion by default
+ on non-armv7 processors or ldrd/strd isn't preferred.
+ * sched-int.h (struct _haifa_insn_data): New field.
+ (INSN_FUSION_PRIORITY, FUSION_MAX_PRIORITY, sched_fusion): New.
+ * sched-rgn.c (rest_of_handle_sched_fusion): New.
+ (pass_data_sched_fusion, pass_sched_fusion): New.
+ (make_pass_sched_fusion): New.
+ * haifa-sched.c (sched_fusion): New.
+ (insn_cost): Handle sched_fusion.
+ (priority): Handle sched_fusion by calling target hook.
+ (enum rfs_decision): New enum value.
+ (rfs_str): New element for RFS_FUSION.
+ (rank_for_schedule): Support sched_fusion.
+ (schedule_insn, max_issue, prune_ready_list): Handle sched_fusion.
+ (schedule_block, fix_tick_ready): Handle sched_fusion.
+ * common.opt (flag_schedule_fusion): New.
+ * tree-pass.h (make_pass_sched_fusion): New.
+ * target.def (fusion_priority): New.
+ * doc/tm.texi.in (TARGET_SCHED_FUSION_PRIORITY): New.
+ * doc/tm.texi: Regenerated.
+ * doc/invoke.texi (-fschedule-fusion): New.
+
+2014-11-13 Rong Xu <xur@google.com>
+
+ PR debug/63581
+ * cfgrtl.c (emit_barrier_after_bb): Append the barrier to the
+ footer, instead of unconditionally overwritten.
+
+2014-11-14 Martin Jambor <mjambor@suse.cz>
+
+ * cgraph.h (clear_outer_type): Make public. Fix comment.
+ * ipa-devirt.c (possible_polymorphic_call_targets): Use
+ clear_outer_type when resetting the context.
+
+2014-11-13 Dominique Dhumieres <dominiq@lps.ens.fr>
+
+ PR bootstrap/63853
+ * gcc.c (handle_foffload_option): Replace strchrnul with strchr.
+ * lto-wrapper.c (parse_env_var, append_offload_options): Likewise.
+
+2014-11-13 Alan Lawrence <alan.lawrence@arm.com>
+
+ * fold-const.c (const_binop): Remove code handling VEC_RSHIFT_EXPR.
+ * tree-cfg.c (verify_gimple_assign_binary): Likewise.
+ * tree-inline.c (estimate_operator_cost): Likewise.
+ * tree-pretty-print.c (dump_generic_node, op_code_prio, op_symbol_code):
+ Likewise.
+
+ * tree-vect-generic.c (expand_vector_operations_1): Remove assertion
+ against VEC_RSHIFT_EXPR.
+
+ * optabs.h (expand_vec_shift_expr): Remove.
+ * optabs.c (optab_for_tree_code): Remove case VEC_RSHIFT_EXPR.
+ (expand_vec_shift_expr): Remove.
+ * tree.def (VEC_RSHIFT_EXPR): Remove
+
+2014-11-13 Alan Lawrence <alan.lawrence@arm.com>
+
+ * optabs.c (can_vec_perm_p): Update comment, does not consider vec_shr.
+ (shift_amt_for_vec_perm_mask): New.
+ (expand_vec_perm_1): Use vec_shr_optab if second vector is const0_rtx
+ and mask appropriate.
+
+ * tree-vect-loop.c (calc_vec_perm_mask_for_shift): New.
+ (have_whole_vector_shift): New.
+ (vect_model_reduction_cost): Call have_whole_vector_shift instead of
+ looking for vec_shr_optab.
+ (vect_create_epilog_for_reduction): Likewise; also rename local variable
+ have_whole_vector_shift to reduce_with_shift; output VEC_PERM_EXPRs
+ instead of VEC_RSHIFT_EXPRs.
+
+ * tree-vect-stmts.c (vect_gen_perm_mask_checked): Extend comment.
+
+2014-11-13 Alan Lawrence <alan.lawrence@arm.com>
+
+ * tree-vectorizer.h (vect_gen_perm_mask): Remove.
+ (vect_gen_perm_mask_checked, vect_gen_perm_mask_any): New.
+
+ tree_vec_data_refs.c (vect_permute_load_chain, vec_permute_store_chain,
+ vec_shift_permute_load_chain): Replace vect_gen_perm_mask & assert
+ with vect_gen_perm_mask_checked.
+
+ * tree-vect-stmts.c (vectorizable_mask_load_store, vectorizable_load):
+ Likewise.
+
+ (vect_gen_perm_mask_checked): New.
+ (vect_gen_perm_mask): Remove can_vec_perm_p check, rename to...
+ (vect_gen_perm_mask_any): ...this.
+
+ (perm_mask_for_reverse): Call can_vec_perm_p and
+ vect_gen_perm_mask_checked.
+
+2014-11-13 Felix Yang <felix.yang@huawei.com>
+
+ * ipa-utils.h: Fix typo in comments.
+ * ipa-profile.c: Likewise.
+ * tree-ssa-loop-ivcanon.c: Fix typo in comments and debugging dumps.
+
+2014-11-13 Teresa Johnson <tejohnson@google.com>
+
+ PR tree-optimization/63841
+ * tree-ssa-strlen.c (strlen_optimize_stmt): Ignore clobbers.
+
+2014-11-13 Teresa Johnson <tejohnson@google.com>
+
+ PR tree-optimization/63841
+ * tree.c (initializer_zerop): A clobber does not zero initialize.
+
+2014-11-13 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ * optabs.c (prepare_operand): Gracefully fail if the mode of X
+ does not match the operand mode expected by the insn pattern.
+
+2014-11-13 Richard Biener <rguenther@suse.de>
+
+ * match.pd: Add tcc_comparison, inverted_tcc_comparison
+ and inverted_tcc_comparison_with_nans operator lists.
+ Use tcc_comparison in the truth_valued_p predicate definition.
+ Restrict logical_inverted_value with bit_xor to integral types.
+ Build a boolean true for simplifying x |^ !x because of
+ vector types. Implement patterns from forward_propagate_comparison
+ * tree-ssa-forwprop.c (forward_propagate_comparison): Remove.
+ (get_prop_dest_stmt): Likewise.
+ (pass_forwprop::execute): Do not call it.
+ * fold-const.c (fold_unary_loc): Remove the pattern here.
+
+2014-11-13 Ilya Verbin <ilya.verbin@intel.com>
+ Andrey Turetskiy <andrey.turetskiy@intel.com>
+
+ * config.gcc (*-intelmic-* | *-intelmicemul-*): Add i386/t-intelmic to
+ tmake_file.
+ (i[34567]86-*-* | x86_64-*-*): Build mkoffload$(exeext) with the
+ accelerator compiler.
+ * config/i386/intelmic-mkoffload.c: New file.
+ * config/i386/t-intelmic: Ditto.
+
+2014-11-13 Bernd Schmidt <bernds@codesourcery.com>
+ Andrey Turetskiy <andrey.turetskiy@intel.com>
+ Ilya Verbin <ilya.verbin@intel.com>
+
+ * common.opt (foffload, foffload-abi): New options.
+ * config/i386/i386.c (ix86_offload_options): New static function.
+ (TARGET_OFFLOAD_OPTIONS): Define.
+ * coretypes.h (enum offload_abi): New enum.
+ * doc/tm.texi: Regenerate.
+ * doc/tm.texi.in (TARGET_OFFLOAD_OPTIONS): Document.
+ * gcc.c (offload_targets): New static variable.
+ (handle_foffload_option): New static function.
+ (driver_handle_option): Handle OPT_foffload_.
+ (driver::maybe_putenv_OFFLOAD_TARGETS): Set OFFLOAD_TARGET_NAMES
+ according to offload_targets.
+ * hooks.c (hook_charptr_void_null): New hook.
+ * hooks.h (hook_charptr_void_null): Declare.
+ * lto-opts.c: Include lto-section-names.h.
+ (lto_write_options): Append options from target offload_options hook and
+ store them to offload_lto section. Do not store target-specific,
+ driver and diagnostic options in offload_lto section.
+ * lto-wrapper.c (merge_and_complain): Handle OPT_foffload_ and
+ OPT_foffload_abi_.
+ (append_compiler_options, append_linker_options)
+ (append_offload_options): New static functions.
+ (compile_offload_image): Add new arguments with options.
+ Call append_compiler_options and append_offload_options.
+ (compile_images_for_offload_targets): Add new arguments with options.
+ (find_and_merge_options): New static function.
+ (run_gcc): Outline options handling into the new functions:
+ find_and_merge_options, append_compiler_options, append_linker_options.
+ * opts.c (common_handle_option): Don't handle OPT_foffload_.
+ Forbid OPT_foffload_abi_ for non-offload compiler.
+ * target.def (offload_options): New target hook.
+
+2014-11-13 Ilya Verbin <ilya.verbin@intel.com>
+ Bernd Schmidt <bernds@codesourcery.com>
+ Andrey Turetskiy <andrey.turetskiy@intel.com>
+ Michael Zolotukhin <michael.v.zolotukhin@intel.com>
+
+ * gcc.c (spec_host_machine, accel_dir_suffix): New variables.
+ (process_command): Tweak path construction for the possibility
+ of being configured as an offload compiler.
+ (driver::maybe_putenv_OFFLOAD_TARGETS): New function.
+ (driver::main): Call maybe_putenv_OFFLOAD_TARGETS.
+ (driver::set_up_specs): Tweak path construction for the possibility of
+ being configured as an offload compiler.
+ * lto-wrapper.c (OFFLOAD_TARGET_NAMES_ENV): Define.
+ (offload_names, offloadbegin, offloadend): New static variables.
+ (free_array_of_ptrs, parse_env_var, access_check, compile_offload_image)
+ (compile_images_for_offload_targets, copy_file, find_offloadbeginend):
+ New static functions.
+ (run_gcc): Determine whether offload sections are present. If so, run
+ compile_images_for_offload_targets and return the names of new generated
+ objects to linker. If there are offload sections, but no LTO sections,
+ then return the copies of input objects without link-time recompilation.
+
+2014-11-13 Richard Biener <rguenther@suse.de>
+
+ * genmatch.c (dt_node::gen_kids): Fix placement of break statement.
+
+2014-11-13 Ilya Verbin <ilya.verbin@intel.com>
+ Bernd Schmidt <bernds@codesourcery.com>
+ Andrey Turetskiy <andrey.turetskiy@intel.com>
+ Michael Zolotukhin <michael.v.zolotukhin@intel.com>
+
+ * Makefile.in (GTFILES): Add omp-low.h to list of GC files.
+ * cgraphunit.c: Include omp-low.h.
+ * doc/tm.texi: Regenerate.
+ * doc/tm.texi.in (TARGET_RECORD_OFFLOAD_SYMBOL): Document.
+ * gengtype.c (open_base_files): Add omp-low.h to ifiles.
+ * lto-cgraph.c (output_offload_tables): New function.
+ (input_offload_tables): Likewise.
+ * lto-section-in.c (lto_section_name): Add "offload_table".
+ * lto-section-names.h (OFFLOAD_VAR_TABLE_SECTION_NAME): Define.
+ (OFFLOAD_FUNC_TABLE_SECTION_NAME): Likewise.
+ * lto-streamer-out.c (lto_output): Call output_offload_tables.
+ * lto-streamer.h (lto_section_type): Add LTO_section_offload_table.
+ (output_offload_tables, input_offload_tables): Declare.
+ * omp-low.c: Include common/common-target.h and lto-section-names.h.
+ (offload_funcs, offload_vars): New global <tree, va_gc> vectors.
+ (expand_omp_target): Add child_fn into offload_funcs vector.
+ (add_decls_addresses_to_decl_constructor): New function.
+ (omp_finish_file): Likewise.
+ * omp-low.h (omp_finish_file, offload_funcs, offload_vars): Declare.
+ * target.def (record_offload_symbol): New DEFHOOK.
+ * toplev.c: Include omp-low.h.
+ (compile_file): Call omp_finish_file.
+ * varpool.c: Include omp-low.h.
+ (varpool_node::get_create): Add decl into offload_vars vector.
+
+2014-11-13 Ilya Verbin <ilya.verbin@intel.com>
+ Ilya Tocar <ilya.tocar@intel.com>
+ Andrey Turetskiy <andrey.turetskiy@intel.com>
+ Bernd Schmidt <bernds@codesourcery.com>
+
+ * cgraph.c: Include context.h.
+ (cgraph_node::create): Set node->offloadable and g->have_offload if
+ decl have "omp declare target" attribute.
+ * cgraph.h (symtab_node): Add need_lto_streaming and offloadable flags.
+ * cgraphunit.c: Include lto-section-names.h.
+ (ipa_passes): Call ipa_write_summaries if there is something to write to
+ OFFLOAD_SECTION_NAME_PREFIX sections.
+ (symbol_table::compile): Set flag_generate_lto if there is something to
+ offload.
+ Replace flag_lto with flag_generate_lto before lto_streamer_hooks_init.
+ * context.c (gcc::context::context): Initialize have_offload with false.
+ * context.h (class context): Add have_offload flag.
+ * ipa-inline-analysis.c (inline_generate_summary): Do not exit under
+ flag_generate_lto.
+ (inline_free_summary): Always remove hooks.
+ * lto-cgraph.c (referenced_from_other_partition_p): Ignore references
+ from non-offloadable nodes while streaming a node into offload section.
+ (reachable_from_other_partition_p): Likewise.
+ (select_what_to_stream): New function.
+ (compute_ltrans_boundary): Do not call
+ lto_set_symtab_encoder_in_partition if the node should not be streamed.
+ * lto-section-names.h (OFFLOAD_SECTION_NAME_PREFIX): Define.
+ (section_name_prefix): Declare.
+ * lto-streamer.c (section_name_prefix): New variable.
+ (lto_get_section_name): Use section_name_prefix instead of
+ LTO_SECTION_NAME_PREFIX.
+ * lto-streamer.h (select_what_to_stream): Declare.
+ * omp-low.c: Include context.h.
+ (is_targetreg_ctx): New function.
+ (scan_sharing_clauses): Use offloadable flag, instead of an attribute.
+ (create_omp_child_function, check_omp_nesting_restrictions): Use new
+ is_targetreg_ctx function. Replace usage of "omp declare target"
+ attribute with a cgraph_node flag offloadable.
+ (expand_omp_target): Set mark_force_output for offloadable functions.
+ (lower_omp_critical): Set offloadable flag for omp critical symbol.
+ * passes.c (ipa_write_summaries): New argument offload_lto_mode. Call
+ select_what_to_stream. Do not call lto_set_symtab_encoder_in_partition
+ if the node should not be streamed out.
+ * tree-pass.h (ipa_write_summaries): New bool argument.
+ * varpool.c: Include context.h.
+ (varpool_node::get_create): Set node->offloadable and g->have_offload if
+ decl have "omp declare target" attribute.
+
+2014-11-13 Bernd Schmidt <bernds@codesourcery.com>
+ Thomas Schwinge <thomas@codesourcery.com>
+ Ilya Verbin <ilya.verbin@intel.com>
+ Andrey Turetskiy <andrey.turetskiy@intel.com>
+
+ * Makefile.in (real_target_noncanonical, accel_dir_suffix)
+ (enable_as_accelerator): New variables substituted by configure.
+ (libsubdir, libexecsubdir, unlibsubdir): Tweak for the possibility of
+ being configured as an offload compiler.
+ (DRIVER_DEFINES): Pass new defines DEFAULT_REAL_TARGET_MACHINE and
+ ACCEL_DIR_SUFFIX.
+ (install-cpp, install-common, install_driver, install-gcc-ar): Do not
+ install for the offload compiler.
+ * config.in: Regenerate.
+ * configure: Regenerate.
+ * configure.ac (real_target_noncanonical, accel_dir_suffix)
+ (enable_as_accelerator): Compute new variables.
+ (ACCEL_COMPILER): Define if the compiler is built as the accel compiler.
+ (OFFLOAD_TARGETS): List of target names suitable for offloading.
+ (ENABLE_OFFLOADING): Define if list of offload targets is not empty.
+ * doc/install.texi (Options specification): Document
+ --enable-as-accelerator-for and --enable-offload-targets.
+
+2014-11-13 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR tree-optimization/63828
+ * ipa-polymorphic-call.c (possible_placement_new): Check
+ POINTER_SIZE, instead of BITS_PER_WORD, for pointer size.
+
+2014-11-13 Eric Botcazou <ebotcazou@adacore.com>
+
+ * doc/tm.texi.in (SELECT_CC_MODE): Update example.
+ (REVERSIBLE_CC_MODE): Fix example.
+ (REVERSE_CONDITION): Fix typo.
+ * doc/tm.texi: Regenerate.
+
+2014-11-13 Tom de Vries <tom@codesourcery.com>
+
+ * omp-low.c (pass_data_expand_omp): Set properties_provided to
+ PROP_gimple_eomp.
+ (pass_expand_omp::gate): Remove function. Move gate expression to ...
+ (pass_expand_omp::execute): ... here, as new variable gate. Add early
+ exit if gate is false.
+ (pass_data pass_data_expand_omp_ssa): New pass_data.
+ (class pass_expand_omp_ssa): New pass.
+ (make_pass_expand_omp_ssa): New function.
+ * passes.def (pass_parallelize_loops): Use PUSH_INSERT_PASSES_WITHIN
+ instead of NEXT_PASS.
+ (pass_expand_omp_ssa): Add after pass_parallelize_loops.
+ * tree-parloops.c (gen_parallel_loop): Remove call to omp_expand_local.
+ (pass_parallelize_loops::execute): Don't do cleanups TODO_cleanup_cfg
+ and TODO_rebuild_alias yet. Add TODO_update_ssa. Set
+ cfun->omp_expand_needed.
+ * tree-pass.h: Add define PROP_gimple_eomp.
+ (make_pass_expand_omp_ssa): Declare.
+
+2014-11-13 Marek Polacek <polacek@redhat.com>
+
+ * tree.h (TYPE_OVERFLOW_SANITIZED): Define.
+ * fold-const.c (fold_binary_loc): Use it.
+ * match.pd: Likewise.
+
+2014-11-14 Kirill Yukhin <kirill.yukhin@intel.com>
+
+ * lra-lives.c (struct bb_data): Rename to ...
+ (struct bb_data_pseudos): ... this.
+ (initiate_live_solver): Update struct name.
+
+2014-11-13 Richard Biener <rguenther@suse.de>
+
+ * match.pd: Implement conditional expression patterns.
+ * tree-ssa-forwprop.c (forward_propagate_into_cond): Remove
+ them here.
+ (combine_cond_exprs): Remove.
+ (pass_forwprop::execute): Do not call combine_cond_exprs.
+ * fold-const.c (fold_ternary_loc): Remove patterns here.
+ (pedantic_omit_one_operand_loc): Remove.
+
+2014-12-13 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/61559
+ * match.pd: Implement bswap patterns for transforms checked by
+ gcc.dg/builtin-bswap-8.c.
+
+2014-11-13 Vladimir Makarov <vmakarov@redhat.com>
+
+ * lra.c (lra): Switch off rematerialization pass.
+
+2014-11-12 Vladimir Makarov <vmakarov@redhat.com>
+
+ * common.opt (flra-remat): New.
+ * opts.c (default_options_table): Add entry for flra_remat.
+ * timevar_def (TV_LRA_REMAT): New.
+ * doc/invoke.texi (-flra-remat): Add description of the new
+ option.
+ * doc/passes.texi (-flra-remat): Remove lra-equivs.c and
+ lra-saves.c. Add lra-remat.c.
+ * Makefile.in (OBJS): Add lra-remat.o.
+ * lra-remat.c: New file.
+ * lra.c: Add info about the rematerialization pass in the top
+ comment.
+ (collect_non_operand_hard_regs, add_regs_to_insn_regno_info):
+ Process unallocatable regs too.
+ (lra_constraint_new_insn_uid_start): Remove.
+ (lra): Add code for calling rematerialization sub-pass.
+ * lra-int.h (lra_constraint_new_insn_uid_start): Remove.
+ (lra_constrain_insn, lra_remat): New prototypes.
+ (lra_eliminate_regs_1): Add parameter.
+ * lra-lives.c (make_hard_regno_born, make_hard_regno_dead):
+ Process unallocatable hard regs too.
+ (process_bb_lives): Ditto.
+ * lra-spills.c (remove_pseudos): Add argument to
+ lra_eliminate_regs_1 call.
+ * lra-eliminations.c (lra_eliminate_regs_1): Add parameter. Use it
+ for sp offset calculation.
+ (lra_eliminate_regs): Add argument for lra_eliminate_regs_1 call.
+ (eliminate_regs_in_insn): Add parameter. Use it for sp offset
+ calculation.
+ (process_insn_for_elimination): Add argument for
+ eliminate_regs_in_insn call.
+ * lra-constraints.c (get_equiv_with_elimination): Add argument
+ for lra_eliminate_regs_1 call.
+ (process_addr_reg): Add parameter. Use it.
+ (process_address_1): Ditto. Add argument for process_addr_reg
+ call.
+ (process_address): Ditto.
+ (curr_insn_transform): Add parameter. Use it. Add argument for
+ process_address calls.
+ (lra_constrain_insn): New function.
+ (lra_constraints): Add argument for curr_insn_transform call.
+
+2014-11-13 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ * opts-global.c (postpone_unknown_option_warning): Fix spelling.
+ (print_ignored_options): Fix quoting.
+ * opts.c (common_handle_option): Likewise.
+ (set_debug_level): Likewise.
+ * toplev.c (process_options): Likewise.
+
+2014-11-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR ipa/63838
+ * ipa-pure-const.c (propagate_nothrow): Walk w->indirect_calls
+ chain instead of node->indirect_calls. Put !can_throw into
+ conditions of all the loops.
+
+2014-11-12 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/i386/i386.c (x86_output_mi_thunk): Use gen_rtx_REG to
+ set pic_offset_table_rtx.
+
2014-11-12 Matthew Fortune <matthew.fortune@imgtec.com>
* common/config/mips/mips-common.c (mips_handle_option): Ensure
@@ -6006,6 +6868,7 @@
(lds_fpscr, sts_fpscr): New insns.
(toggle_sz, toggle_pr): Use SImode for FPSCR_REG instead of PSImode.
+>>>>>>> .r217525
2014-10-17 Eric Botcazou <ebotcazou@adacore.com>
* ipa-inline-transform.c (master_clone_with_noninline_clones_p): New.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index af9a52bbf8b..72baafff67c 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20141112
+20141114
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 3d671c27006..32f307282c2 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -59,6 +59,11 @@ host=@host@
target=@target@
target_noncanonical:=@target_noncanonical@
+# Normally identical to target_noncanonical, except for compilers built
+# as accelerator targets.
+real_target_noncanonical:=@real_target_noncanonical@
+accel_dir_suffix = @accel_dir_suffix@
+
# Sed command to transform gcc to installed name.
program_transform_name := @program_transform_name@
@@ -363,6 +368,8 @@ enable_plugin = @enable_plugin@
enable_host_shared = @enable_host_shared@
+enable_as_accelerator = @enable_as_accelerator@
+
CPPLIB = ../libcpp/libcpp.a
CPPINC = -I$(srcdir)/../libcpp/include
@@ -574,9 +581,9 @@ libexecdir = @libexecdir@
# --------
# Directory in which the compiler finds libraries etc.
-libsubdir = $(libdir)/gcc/$(target_noncanonical)/$(version)
+libsubdir = $(libdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
# Directory in which the compiler finds executables
-libexecsubdir = $(libexecdir)/gcc/$(target_noncanonical)/$(version)
+libexecsubdir = $(libexecdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
# Directory in which all plugin resources are installed
plugin_resourcesdir = $(libsubdir)/plugin
# Directory in which plugin headers are installed
@@ -584,7 +591,11 @@ plugin_includedir = $(plugin_resourcesdir)/include
# Directory in which plugin specific executables are installed
plugin_bindir = $(libexecsubdir)/plugin
# Used to produce a relative $(gcc_tooldir) in gcc.o
+ifeq ($(enable_as_accelerator),yes)
+unlibsubdir = ../../../../..
+else
unlibsubdir = ../../..
+endif
# $(prefix), expressed as a path relative to $(libsubdir).
#
# An explanation of the sed strings:
@@ -1304,6 +1315,7 @@ OBJS = \
lra-constraints.o \
lra-eliminations.o \
lra-lives.o \
+ lra-remat.o \
lra-spills.o \
lto-cgraph.o \
lto-streamer.o \
@@ -1956,9 +1968,11 @@ DRIVER_DEFINES = \
-DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc/\" \
-DSTANDARD_LIBEXEC_PREFIX=\"$(libexecdir)/gcc/\" \
-DDEFAULT_TARGET_VERSION=\"$(version)\" \
+ -DDEFAULT_REAL_TARGET_MACHINE=\"$(real_target_noncanonical)\" \
-DDEFAULT_TARGET_MACHINE=\"$(target_noncanonical)\" \
-DSTANDARD_BINDIR_PREFIX=\"$(bindir)/\" \
-DTOOLDIR_BASE_PREFIX=\"$(libsubdir_to_prefix)$(prefix_to_exec_prefix)\" \
+ -DACCEL_DIR_SUFFIX=\"$(accel_dir_suffix)\" \
@TARGET_SYSTEM_ROOT_DEFINE@ \
$(VALGRIND_DRIVER_DEFINES) \
$(if $(SHLIB),$(if $(filter yes,@enable_shared@),-DENABLE_SHARED_LIBGCC)) \
@@ -2306,6 +2320,7 @@ GTFILES = $(CPP_ID_DATA_H) $(srcdir)/input.h $(srcdir)/coretypes.h \
$(srcdir)/tree-profile.c $(srcdir)/tree-nested.c \
$(srcdir)/tree-parloops.c \
$(srcdir)/omp-low.c \
+ $(srcdir)/omp-low.h \
$(srcdir)/targhooks.c $(out_file) $(srcdir)/passes.c $(srcdir)/cgraphunit.c \
$(srcdir)/cgraphclones.c \
$(srcdir)/tree-phinodes.c \
@@ -3163,12 +3178,14 @@ install-strip: install
# Handle cpp installation.
install-cpp: installdirs cpp$(exeext)
- -rm -f $(DESTDIR)$(bindir)/$(CPP_INSTALL_NAME)$(exeext)
- -$(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(DESTDIR)$(bindir)/$(CPP_INSTALL_NAME)$(exeext)
- -if [ x$(cpp_install_dir) != x ]; then \
- rm -f $(DESTDIR)$(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \
- $(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(DESTDIR)$(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \
- else true; fi
+ -if test "$(enable_as_accelerator)" != "yes" ; then \
+ rm -f $(DESTDIR)$(bindir)/$(CPP_INSTALL_NAME)$(exeext); \
+ $(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(DESTDIR)$(bindir)/$(CPP_INSTALL_NAME)$(exeext); \
+ if [ x$(cpp_install_dir) != x ]; then \
+ rm -f $(DESTDIR)$(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \
+ $(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(DESTDIR)$(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \
+ else true; fi; \
+ fi
# Create the installation directories.
# $(libdir)/gcc/include isn't currently searched by cpp.
@@ -3276,17 +3293,21 @@ install-common: native lang.install-common installdirs
# otherwise override the specs built into the driver.
rm -f $(DESTDIR)$(libsubdir)/specs
# Install gcov if it was compiled.
- -if [ -f gcov$(exeext) ]; \
- then \
+ -if test "$(enable_as_accelerator)" != "yes" ; then \
+ if [ -f gcov$(exeext) ]; \
+ then \
rm -f $(DESTDIR)$(bindir)/$(GCOV_INSTALL_NAME)$(exeext); \
$(INSTALL_PROGRAM) gcov$(exeext) $(DESTDIR)$(bindir)/$(GCOV_INSTALL_NAME)$(exeext); \
+ fi; \
fi
# Install gcov-tool if it was compiled.
- -if [ -f gcov-tool$(exeext) ]; \
- then \
+ -if test "$(enable_as_accelerator)" != "yes" ; then \
+ if [ -f gcov-tool$(exeext) ]; \
+ then \
rm -f $(DESTDIR)$(bindir)/$(GCOV_TOOL_INSTALL_NAME)$(exeext); \
$(INSTALL_PROGRAM) \
gcov-tool$(exeext) $(DESTDIR)$(bindir)/$(GCOV_TOOL_INSTALL_NAME)$(exeext); \
+ fi; \
fi
# Install the driver program as $(target_noncanonical)-gcc,
@@ -3294,17 +3315,19 @@ install-common: native lang.install-common installdirs
install-driver: installdirs xgcc$(exeext)
-rm -f $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext)
-$(INSTALL_PROGRAM) xgcc$(exeext) $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext)
- -if [ "$(GCC_INSTALL_NAME)" != "$(target_noncanonical)-gcc-$(version)" ]; then \
- rm -f $(DESTDIR)$(bindir)/$(FULL_DRIVER_NAME); \
- ( cd $(DESTDIR)$(bindir) && \
- $(LN) $(GCC_INSTALL_NAME)$(exeext) $(FULL_DRIVER_NAME) ); \
- fi
- -if [ ! -f gcc-cross$(exeext) ] \
- && [ "$(GCC_INSTALL_NAME)" != "$(GCC_TARGET_INSTALL_NAME)" ]; then \
- rm -f $(DESTDIR)$(bindir)/$(target_noncanonical)-gcc-tmp$(exeext); \
- ( cd $(DESTDIR)$(bindir) && \
- $(LN) $(GCC_INSTALL_NAME)$(exeext) $(target_noncanonical)-gcc-tmp$(exeext) && \
- mv -f $(target_noncanonical)-gcc-tmp$(exeext) $(GCC_TARGET_INSTALL_NAME)$(exeext) ); \
+ -if test "$(enable_as_accelerator)" != "yes" ; then \
+ if [ "$(GCC_INSTALL_NAME)" != "$(target_noncanonical)-gcc-$(version)" ]; then \
+ rm -f $(DESTDIR)$(bindir)/$(FULL_DRIVER_NAME); \
+ ( cd $(DESTDIR)$(bindir) && \
+ $(LN) $(GCC_INSTALL_NAME)$(exeext) $(FULL_DRIVER_NAME) ); \
+ fi; \
+ if [ ! -f gcc-cross$(exeext) ] \
+ && [ "$(GCC_INSTALL_NAME)" != "$(GCC_TARGET_INSTALL_NAME)" ]; then \
+ rm -f $(DESTDIR)$(bindir)/$(target_noncanonical)-gcc-tmp$(exeext); \
+ ( cd $(DESTDIR)$(bindir) && \
+ $(LN) $(GCC_INSTALL_NAME)$(exeext) $(target_noncanonical)-gcc-tmp$(exeext) && \
+ mv -f $(target_noncanonical)-gcc-tmp$(exeext) $(GCC_TARGET_INSTALL_NAME)$(exeext) ); \
+ fi; \
fi
# Install the info files.
@@ -3501,19 +3524,21 @@ install-lto-wrapper: lto-wrapper$(exeext)
$(INSTALL_PROGRAM) lto-wrapper$(exeext) $(DESTDIR)$(libexecsubdir)/lto-wrapper$(exeext)
install-gcc-ar: installdirs gcc-ar$(exeext) gcc-nm$(exeext) gcc-ranlib$(exeext)
- for i in gcc-ar gcc-nm gcc-ranlib; do \
- install_name=`echo $$i|sed '$(program_transform_name)'` ;\
- target_install_name=$(target_noncanonical)-`echo $$i|sed '$(program_transform_name)'` ; \
- rm -f $(DESTDIR)$(bindir)/$$install_name$(exeext) ; \
- $(INSTALL_PROGRAM) $$i$(exeext) $(DESTDIR)$(bindir)/$$install_name$(exeext) ;\
- if test -f gcc-cross$(exeext); then \
- :; \
- else \
- rm -f $(DESTDIR)$(bindir)/$$target_install_name$(exeext); \
- ( cd $(DESTDIR)$(bindir) && \
- $(LN) $$install_name$(exeext) $$target_install_name$(exeext) ) ; \
- fi ; \
- done
+ if test "$(enable_as_accelerator)" != "yes" ; then \
+ for i in gcc-ar gcc-nm gcc-ranlib; do \
+ install_name=`echo $$i|sed '$(program_transform_name)'` ;\
+ target_install_name=$(target_noncanonical)-`echo $$i|sed '$(program_transform_name)'` ; \
+ rm -f $(DESTDIR)$(bindir)/$$install_name$(exeext) ; \
+ $(INSTALL_PROGRAM) $$i$(exeext) $(DESTDIR)$(bindir)/$$install_name$(exeext) ;\
+ if test -f gcc-cross$(exeext); then \
+ :; \
+ else \
+ rm -f $(DESTDIR)$(bindir)/$$target_install_name$(exeext); \
+ ( cd $(DESTDIR)$(bindir) && \
+ $(LN) $$install_name$(exeext) $$target_install_name$(exeext) ) ; \
+ fi ; \
+ done; \
+ fi
# Cancel installation by deleting the installed files.
uninstall: lang.uninstall
diff --git a/gcc/asan.c b/gcc/asan.c
index 79dede71418..2961b4460de 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -2346,6 +2346,9 @@ initialize_sanitizer_builtins (void)
#define ATTR_TMPURE_NOTHROW_LEAF_LIST ECF_TM_PURE | ATTR_NOTHROW_LEAF_LIST
#undef ATTR_NORETURN_NOTHROW_LEAF_LIST
#define ATTR_NORETURN_NOTHROW_LEAF_LIST ECF_NORETURN | ATTR_NOTHROW_LEAF_LIST
+#undef ATTR_CONST_NORETURN_NOTHROW_LEAF_LIST
+#define ATTR_CONST_NORETURN_NOTHROW_LEAF_LIST \
+ ECF_CONST | ATTR_NORETURN_NOTHROW_LEAF_LIST
#undef ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST
#define ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST \
ECF_TM_PURE | ATTR_NORETURN_NOTHROW_LEAF_LIST
@@ -2355,6 +2358,9 @@ initialize_sanitizer_builtins (void)
#undef ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST
#define ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST \
/* ECF_COLD missing */ ATTR_NORETURN_NOTHROW_LEAF_LIST
+#undef ATTR_COLD_CONST_NORETURN_NOTHROW_LEAF_LIST
+#define ATTR_COLD_CONST_NORETURN_NOTHROW_LEAF_LIST \
+ /* ECF_COLD missing */ ATTR_CONST_NORETURN_NOTHROW_LEAF_LIST
#undef DEF_SANITIZER_BUILTIN
#define DEF_SANITIZER_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
decl = add_builtin_function ("__builtin_" NAME, TYPE, ENUM, \
diff --git a/gcc/builtin-attrs.def b/gcc/builtin-attrs.def
index 9c05a949039..c707367d4e7 100644
--- a/gcc/builtin-attrs.def
+++ b/gcc/builtin-attrs.def
@@ -145,6 +145,8 @@ DEF_ATTR_TREE_LIST (ATTR_SENTINEL_NOTHROW_LIST, ATTR_SENTINEL, \
ATTR_NULL, ATTR_NOTHROW_LIST)
DEF_ATTR_TREE_LIST (ATTR_SENTINEL_NOTHROW_LEAF_LIST, ATTR_SENTINEL, \
ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
+DEF_ATTR_TREE_LIST (ATTR_COLD_CONST_NORETURN_NOTHROW_LEAF_LIST, ATTR_CONST,\
+ ATTR_NULL, ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST)
/* Functions whose pointer parameter(s) are all nonnull. */
DEF_ATTR_TREE_LIST (ATTR_NONNULL_LIST, ATTR_NONNULL, ATTR_NULL, ATTR_NULL)
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 1cd65edb194..311c0e38279 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -64,7 +64,6 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic-core.h"
#include "builtins.h"
#include "asan.h"
-#include "ubsan.h"
#include "cilk.h"
#include "ipa-ref.h"
#include "lto-streamer.h"
@@ -9803,14 +9802,6 @@ fold_builtin_0 (location_t loc, tree fndecl, bool ignore ATTRIBUTE_UNUSED)
case BUILT_IN_CLASSIFY_TYPE:
return fold_builtin_classify_type (NULL_TREE);
- case BUILT_IN_UNREACHABLE:
- if (flag_sanitize & SANITIZE_UNREACHABLE
- && (current_function_decl == NULL
- || !lookup_attribute ("no_sanitize_undefined",
- DECL_ATTRIBUTES (current_function_decl))))
- return ubsan_instrument_unreachable (loc);
- break;
-
default:
break;
}
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 2df8ce3ba84..15d7638795a 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -4659,7 +4659,6 @@ expand_debug_expr (tree exp)
case VEC_PACK_FIX_TRUNC_EXPR:
case VEC_PACK_SAT_EXPR:
case VEC_PACK_TRUNC_EXPR:
- case VEC_RSHIFT_EXPR:
case VEC_UNPACK_FLOAT_HI_EXPR:
case VEC_UNPACK_FLOAT_LO_EXPR:
case VEC_UNPACK_HI_EXPR:
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index f6eb2072d11..42d21d72201 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -1461,7 +1461,24 @@ emit_barrier_after_bb (basic_block bb)
gcc_assert (current_ir_type () == IR_RTL_CFGRTL
|| current_ir_type () == IR_RTL_CFGLAYOUT);
if (current_ir_type () == IR_RTL_CFGLAYOUT)
- BB_FOOTER (bb) = unlink_insn_chain (barrier, barrier);
+ {
+ rtx_insn *insn = unlink_insn_chain (barrier, barrier);
+
+ if (BB_FOOTER (bb))
+ {
+ rtx_insn *footer_tail = BB_FOOTER (bb);
+
+ while (NEXT_INSN (footer_tail))
+ footer_tail = NEXT_INSN (footer_tail);
+ if (!BARRIER_P (footer_tail))
+ {
+ SET_NEXT_INSN (footer_tail) = insn;
+ SET_PREV_INSN (insn) = footer_tail;
+ }
+ }
+ else
+ BB_FOOTER (bb) = insn;
+ }
}
/* Like force_nonfallthru below, but additionally performs redirection
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 7216b897184..a66c9c0ea75 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -81,6 +81,7 @@ along with GCC; see the file COPYING3. If not see
#include "profile.h"
#include "params.h"
#include "tree-chkp.h"
+#include "context.h"
/* FIXME: Only for PROP_loops, but cgraph shouldn't have to know about this. */
#include "tree-pass.h"
@@ -494,6 +495,14 @@ cgraph_node::create (tree decl)
gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
node->decl = decl;
+
+ if (flag_openmp
+ && lookup_attribute ("omp declare target", DECL_ATTRIBUTES (decl)))
+ {
+ node->offloadable = 1;
+ g->have_offload = true;
+ }
+
node->register_symbol ();
if (DECL_CONTEXT (decl) && TREE_CODE (DECL_CONTEXT (decl)) == FUNCTION_DECL)
@@ -1986,6 +1995,8 @@ cgraph_node::dump (FILE *f)
fprintf (f, " tm_clone");
if (icf_merged)
fprintf (f, " icf_merged");
+ if (nonfreeing_fn)
+ fprintf (f, " nonfreeing_fn");
if (DECL_STATIC_CONSTRUCTOR (decl))
fprintf (f," static_constructor (priority:%i)", get_init_priority ());
if (DECL_STATIC_DESTRUCTOR (decl))
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index e2becb96d56..5d949abc722 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -450,6 +450,13 @@ public:
/* Set when init priority is set. */
unsigned in_init_priority_hash : 1;
+ /* Set when symbol needs to be streamed into LTO bytecode for LTO, or in case
+ of offloading, for separate compilation for a different target. */
+ unsigned need_lto_streaming : 1;
+
+ /* Set when symbol can be streamed into bytecode for offloading. */
+ unsigned offloadable : 1;
+
/* Ordering of all symtab entries. */
int order;
@@ -1260,6 +1267,10 @@ public:
/* True when function is clone created for Pointer Bounds Checker
instrumentation. */
unsigned instrumentation_clone : 1;
+ /* True if call to node can't result in a call to free, munmap or
+ other operation that could make previously non-trapping memory
+ accesses trapping. */
+ unsigned nonfreeing_fn : 1;
};
/* A cgraph node set is a collection of cgraph nodes. A cgraph node
@@ -1345,6 +1356,10 @@ public:
/* Make context non-speculative. */
void clear_speculation ();
+ /* Produce context specifying all derrived types of OTR_TYPE. If OTR_TYPE is
+ NULL, the context is set to dummy "I know nothing" setting. */
+ void clear_outer_type (tree otr_type = NULL);
+
/* Walk container types and modify context to point to actual class
containing OTR_TYPE (if non-NULL) as base class.
Return true if resulting context is valid.
@@ -1372,9 +1387,12 @@ public:
/* Return TRUE if context is fully useless. */
bool useless_p () const;
+ /* Return TRUE if this context conveys the same information as X. */
+ bool equal_to (const ipa_polymorphic_call_context &x) const;
- /* Dump human readable context to F. */
- void dump (FILE *f) const;
+ /* Dump human readable context to F. If NEWLINE is true, it will be
+ terminated by a newline. */
+ void dump (FILE *f, bool newline = true) const;
void DEBUG_FUNCTION debug () const;
/* LTO streaming. */
@@ -1385,7 +1403,6 @@ private:
bool combine_speculation_with (tree, HOST_WIDE_INT, bool, tree);
void set_by_decl (tree, HOST_WIDE_INT);
bool set_by_invariant (tree, tree, HOST_WIDE_INT);
- void clear_outer_type (tree otr_type = NULL);
bool speculation_consistent_p (tree, HOST_WIDE_INT, bool, tree);
void make_speculative (tree otr_type = NULL);
};
@@ -2741,9 +2758,8 @@ ipa_polymorphic_call_context::clear_speculation ()
speculative_maybe_derived_type = false;
}
-/* Produce context specifying all derrived types of OTR_TYPE.
- If OTR_TYPE is NULL or type of the OBJ_TYPE_REF, the context is set
- to dummy "I know nothing" setting. */
+/* Produce context specifying all derrived types of OTR_TYPE. If OTR_TYPE is
+ NULL, the context is set to dummy "I know nothing" setting. */
inline void
ipa_polymorphic_call_context::clear_outer_type (tree otr_type)
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 25af2347f42..534c61301d0 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -224,6 +224,8 @@ along with GCC; see the file COPYING3. If not see
#include "gimplify.h"
#include "dbgcnt.h"
#include "tree-chkp.h"
+#include "lto-section-names.h"
+#include "omp-low.h"
/* Queue of cgraph nodes scheduled to be added into cgraph. This is a
secondary queue used during optimization to accommodate passes that
@@ -2079,7 +2081,18 @@ ipa_passes (void)
targetm.asm_out.lto_start ();
if (!in_lto_p)
- ipa_write_summaries ();
+ {
+ if (g->have_offload)
+ {
+ section_name_prefix = OFFLOAD_SECTION_NAME_PREFIX;
+ ipa_write_summaries (true);
+ }
+ if (flag_lto)
+ {
+ section_name_prefix = LTO_SECTION_NAME_PREFIX;
+ ipa_write_summaries (false);
+ }
+ }
if (flag_generate_lto)
targetm.asm_out.lto_end ();
@@ -2163,8 +2176,12 @@ symbol_table::compile (void)
fprintf (stderr, "Performing interprocedural optimizations\n");
state = IPA;
+ /* Offloading requires LTO infrastructure. */
+ if (!in_lto_p && g->have_offload)
+ flag_generate_lto = 1;
+
/* If LTO is enabled, initialize the streamer hooks needed by GIMPLE. */
- if (flag_lto)
+ if (flag_generate_lto)
lto_streamer_hooks_init ();
/* Don't run the IPA passes if there was any error or sorry messages. */
diff --git a/gcc/common.opt b/gcc/common.opt
index 784a4b0a053..06daa43d231 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -1551,6 +1551,10 @@ floop-optimize
Common Ignore
Does nothing. Preserved for backward compatibility.
+flra-remat
+Common Report Var(flag_lra_remat) Optimization
+Do CFG-sensitive rematerialization in LRA
+
flto
Common
Enable link-time optimization.
@@ -1661,6 +1665,23 @@ fnon-call-exceptions
Common Report Var(flag_non_call_exceptions) Optimization
Support synchronous non-call exceptions
+foffload=
+Common Driver Joined MissingArgError(options or targets missing after %qs)
+-foffload=<targets>=<options> Specify offloading targets and options for them
+
+foffload-abi=
+Common Joined RejectNegative Enum(offload_abi) Var(flag_offload_abi) Init(OFFLOAD_ABI_UNSET)
+-foffload-abi=[lp64|ilp32] Set the ABI to use in an offload compiler
+
+Enum
+Name(offload_abi) Type(enum offload_abi) UnknownError(unknown offload ABI %qs)
+
+EnumValue
+Enum(offload_abi) String(ilp32) Value(OFFLOAD_ABI_ILP32)
+
+EnumValue
+Enum(offload_abi) String(lp64) Value(OFFLOAD_ABI_LP64)
+
fomit-frame-pointer
Common Report Var(flag_omit_frame_pointer) Optimization
When possible do not generate stack frames
@@ -1827,6 +1848,10 @@ frename-registers
Common Report Var(flag_rename_registers) Init(2) Optimization
Perform a register renaming optimization pass
+fschedule-fusion
+Common Report Var(flag_schedule_fusion) Init(2) Optimization
+Perform a target dependent instruction fusion optimization pass
+
freorder-blocks
Common Report Var(flag_reorder_blocks) Optimization
Reorder basic blocks to improve code placement
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 0af4a1a851c..bef56e2e54e 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1404,8 +1404,14 @@ i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i
i[34567]86-*-linux*)
tm_file="${tm_file} linux.h linux-android.h"
extra_options="${extra_options} linux-android.opt"
- # Assume modern glibc
- default_gnu_indirect_function=yes
+ # Assume modern glibc if not targeting Android nor uclibc.
+ case ${target} in
+ *-*-*android*|*-*-*uclibc*)
+ ;;
+ *)
+ default_gnu_indirect_function=yes
+ ;;
+ esac
if test x$enable_targets = xall; then
tm_file="${tm_file} i386/x86-64.h i386/gnu-user-common.h i386/gnu-user64.h i386/linux-common.h i386/linux64.h"
tm_defines="${tm_defines} TARGET_BI_ARCH=1"
@@ -1467,8 +1473,14 @@ x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu)
x86_64-*-linux*)
tm_file="${tm_file} linux.h linux-android.h i386/linux-common.h i386/linux64.h"
extra_options="${extra_options} linux-android.opt"
- # Assume modern glibc
- default_gnu_indirect_function=yes
+ # Assume modern glibc if not targeting Android nor uclibc.
+ case ${target} in
+ *-*-*android*|*-*-*uclibc*)
+ ;;
+ *)
+ default_gnu_indirect_function=yes
+ ;;
+ esac
;;
x86_64-*-kfreebsd*-gnu)
tm_file="${tm_file} kfreebsd-gnu.h i386/kfreebsd-gnu64.h"
@@ -2884,6 +2896,13 @@ powerpc*-*-* | rs6000-*-*)
tm_file="${tm_file} rs6000/option-defaults.h"
esac
+# Build mkoffload tool
+case ${target} in
+*-intelmic-* | *-intelmicemul-*)
+ tmake_file="${tmake_file} i386/t-intelmic"
+ ;;
+esac
+
if [ "$target_has_targetcm" = "no" ]; then
c_target_objs="$c_target_objs default-c.o"
cxx_target_objs="$cxx_target_objs default-c.o"
@@ -4279,3 +4298,11 @@ then
target_cpu_default=$target_cpu_default2
fi
fi
+
+case ${target} in
+i[34567]86-*-* | x86_64-*-*)
+ if test x$enable_as_accelerator = xyes; then
+ extra_programs="mkoffload\$(exeext)"
+ fi
+ ;;
+esac
diff --git a/gcc/config.in b/gcc/config.in
index 520b5f71faf..6cfda75b0b3 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -1,5 +1,11 @@
/* config.in. Generated from configure.ac by autoheader. */
+/* Define if this compiler should be built as the offload target compiler. */
+#ifndef USED_FOR_TARGET
+#undef ACCEL_COMPILER
+#endif
+
+
/* Define if building universal (internal helper macro) */
#ifndef USED_FOR_TARGET
#undef AC_APPLE_UNIVERSAL_BUILD
@@ -51,6 +57,12 @@
#endif
+/* The default for -fdiagnostics-color option */
+#ifndef USED_FOR_TARGET
+#undef DIAGNOSTICS_COLOR_DEFAULT
+#endif
+
+
/* Define if you want assertions enabled. This is a cheap check. */
#ifndef USED_FOR_TARGET
#undef ENABLE_ASSERT_CHECKING
@@ -144,6 +156,12 @@
#endif
+/* Define this to enable support for offloading. */
+#ifndef USED_FOR_TARGET
+#undef ENABLE_OFFLOADING
+#endif
+
+
/* Define to enable plugin support. */
#ifndef USED_FOR_TARGET
#undef ENABLE_PLUGIN
@@ -260,6 +278,12 @@
#endif
+/* Define if your assembler supports .module. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_AS_DOT_MODULE
+#endif
+
+
/* Define if your assembler supports DSPR1 mult. */
#ifndef USED_FOR_TARGET
#undef HAVE_AS_DSPR1_MULT
@@ -472,12 +496,6 @@
#endif
-/* Define if the assembler understands .module. */
-#ifndef USED_FOR_TARGET
-#undef HAVE_AS_DOT_MODULE
-#endif
-
-
/* Define if your assembler supports the -no-mul-bug-abort option. */
#ifndef USED_FOR_TARGET
#undef HAVE_AS_NO_MUL_BUG_ABORT_OPTION
@@ -1786,6 +1804,12 @@
#endif
+/* Define to hold the list of target names suitable for offloading. */
+#ifndef USED_FOR_TARGET
+#undef OFFLOAD_TARGETS
+#endif
+
+
/* Define to the address where bug reports for this package should be sent. */
#ifndef USED_FOR_TARGET
#undef PACKAGE_BUGREPORT
diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md
index 1a9e0dee1f7..7f4d46ede51 100644
--- a/gcc/config/aarch64/aarch64-simd.md
+++ b/gcc/config/aarch64/aarch64-simd.md
@@ -4729,8 +4729,8 @@
})
(define_insn "*aarch64_simd_ld1r<mode>"
- [(set (match_operand:VALLDI 0 "register_operand" "=w")
- (vec_duplicate:VALLDI
+ [(set (match_operand:VALL 0 "register_operand" "=w")
+ (vec_duplicate:VALL
(match_operand:<VEL> 1 "aarch64_simd_struct_operand" "Utv")))]
"TARGET_SIMD"
"ld1r\\t{%0.<Vtype>}, %1"
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 07f75e14f36..92937bb87b4 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -1046,10 +1046,10 @@ aarch64_add_offset (machine_mode mode, rtx temp, rtx reg, HOST_WIDE_INT offset)
return plus_constant (mode, reg, offset);
}
-void
-aarch64_expand_mov_immediate (rtx dest, rtx imm)
+static int
+aarch64_internal_mov_immediate (rtx dest, rtx imm, bool generate,
+ machine_mode mode)
{
- machine_mode mode = GET_MODE (dest);
unsigned HOST_WIDE_INT mask;
int i;
bool first;
@@ -1057,85 +1057,14 @@ aarch64_expand_mov_immediate (rtx dest, rtx imm)
bool subtargets;
rtx subtarget;
int one_match, zero_match, first_not_ffff_match;
-
- gcc_assert (mode == SImode || mode == DImode);
-
- /* Check on what type of symbol it is. */
- if (GET_CODE (imm) == SYMBOL_REF
- || GET_CODE (imm) == LABEL_REF
- || GET_CODE (imm) == CONST)
- {
- rtx mem, base, offset;
- enum aarch64_symbol_type sty;
-
- /* If we have (const (plus symbol offset)), separate out the offset
- before we start classifying the symbol. */
- split_const (imm, &base, &offset);
-
- sty = aarch64_classify_symbol (base, SYMBOL_CONTEXT_ADR);
- switch (sty)
- {
- case SYMBOL_FORCE_TO_MEM:
- if (offset != const0_rtx
- && targetm.cannot_force_const_mem (mode, imm))
- {
- gcc_assert (can_create_pseudo_p ());
- base = aarch64_force_temporary (mode, dest, base);
- base = aarch64_add_offset (mode, NULL, base, INTVAL (offset));
- aarch64_emit_move (dest, base);
- return;
- }
- mem = force_const_mem (ptr_mode, imm);
- gcc_assert (mem);
- if (mode != ptr_mode)
- mem = gen_rtx_ZERO_EXTEND (mode, mem);
- emit_insn (gen_rtx_SET (VOIDmode, dest, mem));
- return;
-
- case SYMBOL_SMALL_TLSGD:
- case SYMBOL_SMALL_TLSDESC:
- case SYMBOL_SMALL_GOTTPREL:
- case SYMBOL_SMALL_GOT:
- case SYMBOL_TINY_GOT:
- if (offset != const0_rtx)
- {
- gcc_assert(can_create_pseudo_p ());
- base = aarch64_force_temporary (mode, dest, base);
- base = aarch64_add_offset (mode, NULL, base, INTVAL (offset));
- aarch64_emit_move (dest, base);
- return;
- }
- /* FALLTHRU */
-
- case SYMBOL_SMALL_TPREL:
- case SYMBOL_SMALL_ABSOLUTE:
- case SYMBOL_TINY_ABSOLUTE:
- aarch64_load_symref_appropriately (dest, imm, sty);
- return;
-
- default:
- gcc_unreachable ();
- }
- }
+ int num_insns = 0;
if (CONST_INT_P (imm) && aarch64_move_imm (INTVAL (imm), mode))
{
- emit_insn (gen_rtx_SET (VOIDmode, dest, imm));
- return;
- }
-
- if (!CONST_INT_P (imm))
- {
- if (GET_CODE (imm) == HIGH)
+ if (generate)
emit_insn (gen_rtx_SET (VOIDmode, dest, imm));
- else
- {
- rtx mem = force_const_mem (mode, imm);
- gcc_assert (mem);
- emit_insn (gen_rtx_SET (VOIDmode, dest, mem));
- }
-
- return;
+ num_insns++;
+ return num_insns;
}
if (mode == SImode)
@@ -1143,10 +1072,15 @@ aarch64_expand_mov_immediate (rtx dest, rtx imm)
/* We know we can't do this in 1 insn, and we must be able to do it
in two; so don't mess around looking for sequences that don't buy
us anything. */
- emit_insn (gen_rtx_SET (VOIDmode, dest, GEN_INT (INTVAL (imm) & 0xffff)));
- emit_insn (gen_insv_immsi (dest, GEN_INT (16),
- GEN_INT ((INTVAL (imm) >> 16) & 0xffff)));
- return;
+ if (generate)
+ {
+ emit_insn (gen_rtx_SET (VOIDmode, dest,
+ GEN_INT (INTVAL (imm) & 0xffff)));
+ emit_insn (gen_insv_immsi (dest, GEN_INT (16),
+ GEN_INT ((INTVAL (imm) >> 16) & 0xffff)));
+ }
+ num_insns += 2;
+ return num_insns;
}
/* Remaining cases are all for DImode. */
@@ -1176,11 +1110,15 @@ aarch64_expand_mov_immediate (rtx dest, rtx imm)
{
/* Set one of the quarters and then insert back into result. */
mask = 0xffffll << first_not_ffff_match;
- emit_insn (gen_rtx_SET (VOIDmode, dest, GEN_INT (val | mask)));
- emit_insn (gen_insv_immdi (dest, GEN_INT (first_not_ffff_match),
- GEN_INT ((val >> first_not_ffff_match)
- & 0xffff)));
- return;
+ if (generate)
+ {
+ emit_insn (gen_rtx_SET (VOIDmode, dest, GEN_INT (val | mask)));
+ emit_insn (gen_insv_immdi (dest, GEN_INT (first_not_ffff_match),
+ GEN_INT ((val >> first_not_ffff_match)
+ & 0xffff)));
+ }
+ num_insns += 2;
+ return num_insns;
}
if (zero_match == 2)
@@ -1193,42 +1131,55 @@ aarch64_expand_mov_immediate (rtx dest, rtx imm)
if (aarch64_uimm12_shift (val - (val & mask)))
{
- subtarget = subtargets ? gen_reg_rtx (DImode) : dest;
-
- emit_insn (gen_rtx_SET (VOIDmode, subtarget, GEN_INT (val & mask)));
- emit_insn (gen_adddi3 (dest, subtarget,
- GEN_INT (val - (val & mask))));
- return;
+ if (generate)
+ {
+ subtarget = subtargets ? gen_reg_rtx (DImode) : dest;
+ emit_insn (gen_rtx_SET (VOIDmode, subtarget,
+ GEN_INT (val & mask)));
+ emit_insn (gen_adddi3 (dest, subtarget,
+ GEN_INT (val - (val & mask))));
+ }
+ num_insns += 2;
+ return num_insns;
}
else if (aarch64_uimm12_shift (-(val - ((val + comp) & mask))))
{
- subtarget = subtargets ? gen_reg_rtx (DImode) : dest;
-
- emit_insn (gen_rtx_SET (VOIDmode, subtarget,
- GEN_INT ((val + comp) & mask)));
- emit_insn (gen_adddi3 (dest, subtarget,
- GEN_INT (val - ((val + comp) & mask))));
- return;
+ if (generate)
+ {
+ subtarget = subtargets ? gen_reg_rtx (DImode) : dest;
+ emit_insn (gen_rtx_SET (VOIDmode, subtarget,
+ GEN_INT ((val + comp) & mask)));
+ emit_insn (gen_adddi3 (dest, subtarget,
+ GEN_INT (val - ((val + comp) & mask))));
+ }
+ num_insns += 2;
+ return num_insns;
}
else if (aarch64_uimm12_shift (val - ((val - comp) | ~mask)))
{
- subtarget = subtargets ? gen_reg_rtx (DImode) : dest;
-
- emit_insn (gen_rtx_SET (VOIDmode, subtarget,
- GEN_INT ((val - comp) | ~mask)));
- emit_insn (gen_adddi3 (dest, subtarget,
- GEN_INT (val - ((val - comp) | ~mask))));
- return;
+ if (generate)
+ {
+ subtarget = subtargets ? gen_reg_rtx (DImode) : dest;
+ emit_insn (gen_rtx_SET (VOIDmode, subtarget,
+ GEN_INT ((val - comp) | ~mask)));
+ emit_insn (gen_adddi3 (dest, subtarget,
+ GEN_INT (val - ((val - comp) | ~mask))));
+ }
+ num_insns += 2;
+ return num_insns;
}
else if (aarch64_uimm12_shift (-(val - (val | ~mask))))
{
- subtarget = subtargets ? gen_reg_rtx (DImode) : dest;
-
- emit_insn (gen_rtx_SET (VOIDmode, subtarget,
- GEN_INT (val | ~mask)));
- emit_insn (gen_adddi3 (dest, subtarget,
- GEN_INT (val - (val | ~mask))));
- return;
+ if (generate)
+ {
+ subtarget = subtargets ? gen_reg_rtx (DImode) : dest;
+ emit_insn (gen_rtx_SET (VOIDmode, subtarget,
+ GEN_INT (val | ~mask)));
+ emit_insn (gen_adddi3 (dest, subtarget,
+ GEN_INT (val - (val | ~mask))));
+ }
+ num_insns += 2;
+ return num_insns;
}
}
@@ -1242,23 +1193,31 @@ aarch64_expand_mov_immediate (rtx dest, rtx imm)
if (aarch64_uimm12_shift (val - aarch64_bitmasks[i])
|| aarch64_uimm12_shift (-val + aarch64_bitmasks[i]))
{
- subtarget = subtargets ? gen_reg_rtx (DImode) : dest;
- emit_insn (gen_rtx_SET (VOIDmode, subtarget,
- GEN_INT (aarch64_bitmasks[i])));
- emit_insn (gen_adddi3 (dest, subtarget,
- GEN_INT (val - aarch64_bitmasks[i])));
- return;
+ if (generate)
+ {
+ subtarget = subtargets ? gen_reg_rtx (DImode) : dest;
+ emit_insn (gen_rtx_SET (VOIDmode, subtarget,
+ GEN_INT (aarch64_bitmasks[i])));
+ emit_insn (gen_adddi3 (dest, subtarget,
+ GEN_INT (val - aarch64_bitmasks[i])));
+ }
+ num_insns += 2;
+ return num_insns;
}
for (j = 0; j < 64; j += 16, mask <<= 16)
{
if ((aarch64_bitmasks[i] & ~mask) == (val & ~mask))
{
- emit_insn (gen_rtx_SET (VOIDmode, dest,
- GEN_INT (aarch64_bitmasks[i])));
- emit_insn (gen_insv_immdi (dest, GEN_INT (j),
- GEN_INT ((val >> j) & 0xffff)));
- return;
+ if (generate)
+ {
+ emit_insn (gen_rtx_SET (VOIDmode, dest,
+ GEN_INT (aarch64_bitmasks[i])));
+ emit_insn (gen_insv_immdi (dest, GEN_INT (j),
+ GEN_INT ((val >> j) & 0xffff)));
+ }
+ num_insns += 2;
+ return num_insns;
}
}
}
@@ -1273,12 +1232,16 @@ aarch64_expand_mov_immediate (rtx dest, rtx imm)
for (j = i + 1; j < AARCH64_NUM_BITMASKS; j++)
if (val == (aarch64_bitmasks[i] | aarch64_bitmasks[j]))
{
- subtarget = subtargets ? gen_reg_rtx (mode) : dest;
- emit_insn (gen_rtx_SET (VOIDmode, subtarget,
- GEN_INT (aarch64_bitmasks[i])));
- emit_insn (gen_iordi3 (dest, subtarget,
- GEN_INT (aarch64_bitmasks[j])));
- return;
+ if (generate)
+ {
+ subtarget = subtargets ? gen_reg_rtx (mode) : dest;
+ emit_insn (gen_rtx_SET (VOIDmode, subtarget,
+ GEN_INT (aarch64_bitmasks[i])));
+ emit_insn (gen_iordi3 (dest, subtarget,
+ GEN_INT (aarch64_bitmasks[j])));
+ }
+ num_insns += 2;
+ return num_insns;
}
}
else if ((val & aarch64_bitmasks[i]) == val)
@@ -1288,13 +1251,16 @@ aarch64_expand_mov_immediate (rtx dest, rtx imm)
for (j = i + 1; j < AARCH64_NUM_BITMASKS; j++)
if (val == (aarch64_bitmasks[j] & aarch64_bitmasks[i]))
{
-
- subtarget = subtargets ? gen_reg_rtx (mode) : dest;
- emit_insn (gen_rtx_SET (VOIDmode, subtarget,
- GEN_INT (aarch64_bitmasks[j])));
- emit_insn (gen_anddi3 (dest, subtarget,
- GEN_INT (aarch64_bitmasks[i])));
- return;
+ if (generate)
+ {
+ subtarget = subtargets ? gen_reg_rtx (mode) : dest;
+ emit_insn (gen_rtx_SET (VOIDmode, subtarget,
+ GEN_INT (aarch64_bitmasks[j])));
+ emit_insn (gen_anddi3 (dest, subtarget,
+ GEN_INT (aarch64_bitmasks[i])));
+ }
+ num_insns += 2;
+ return num_insns;
}
}
}
@@ -1303,18 +1269,24 @@ aarch64_expand_mov_immediate (rtx dest, rtx imm)
{
/* Set either first three quarters or all but the third. */
mask = 0xffffll << (16 - first_not_ffff_match);
- emit_insn (gen_rtx_SET (VOIDmode, dest,
- GEN_INT (val | mask | 0xffffffff00000000ull)));
+ if (generate)
+ emit_insn (gen_rtx_SET (VOIDmode, dest,
+ GEN_INT (val | mask | 0xffffffff00000000ull)));
+ num_insns ++;
/* Now insert other two quarters. */
for (i = first_not_ffff_match + 16, mask <<= (first_not_ffff_match << 1);
i < 64; i += 16, mask <<= 16)
{
if ((val & mask) != mask)
- emit_insn (gen_insv_immdi (dest, GEN_INT (i),
- GEN_INT ((val >> i) & 0xffff)));
+ {
+ if (generate)
+ emit_insn (gen_insv_immdi (dest, GEN_INT (i),
+ GEN_INT ((val >> i) & 0xffff)));
+ num_insns ++;
+ }
}
- return;
+ return num_insns;
}
simple_sequence:
@@ -1326,15 +1298,106 @@ aarch64_expand_mov_immediate (rtx dest, rtx imm)
{
if (first)
{
- emit_insn (gen_rtx_SET (VOIDmode, dest,
- GEN_INT (val & mask)));
+ if (generate)
+ emit_insn (gen_rtx_SET (VOIDmode, dest,
+ GEN_INT (val & mask)));
+ num_insns ++;
first = false;
}
else
- emit_insn (gen_insv_immdi (dest, GEN_INT (i),
- GEN_INT ((val >> i) & 0xffff)));
+ {
+ if (generate)
+ emit_insn (gen_insv_immdi (dest, GEN_INT (i),
+ GEN_INT ((val >> i) & 0xffff)));
+ num_insns ++;
+ }
+ }
+ }
+
+ return num_insns;
+}
+
+
+void
+aarch64_expand_mov_immediate (rtx dest, rtx imm)
+{
+ machine_mode mode = GET_MODE (dest);
+
+ gcc_assert (mode == SImode || mode == DImode);
+
+ /* Check on what type of symbol it is. */
+ if (GET_CODE (imm) == SYMBOL_REF
+ || GET_CODE (imm) == LABEL_REF
+ || GET_CODE (imm) == CONST)
+ {
+ rtx mem, base, offset;
+ enum aarch64_symbol_type sty;
+
+ /* If we have (const (plus symbol offset)), separate out the offset
+ before we start classifying the symbol. */
+ split_const (imm, &base, &offset);
+
+ sty = aarch64_classify_symbol (base, SYMBOL_CONTEXT_ADR);
+ switch (sty)
+ {
+ case SYMBOL_FORCE_TO_MEM:
+ if (offset != const0_rtx
+ && targetm.cannot_force_const_mem (mode, imm))
+ {
+ gcc_assert (can_create_pseudo_p ());
+ base = aarch64_force_temporary (mode, dest, base);
+ base = aarch64_add_offset (mode, NULL, base, INTVAL (offset));
+ aarch64_emit_move (dest, base);
+ return;
+ }
+ mem = force_const_mem (ptr_mode, imm);
+ gcc_assert (mem);
+ if (mode != ptr_mode)
+ mem = gen_rtx_ZERO_EXTEND (mode, mem);
+ emit_insn (gen_rtx_SET (VOIDmode, dest, mem));
+ return;
+
+ case SYMBOL_SMALL_TLSGD:
+ case SYMBOL_SMALL_TLSDESC:
+ case SYMBOL_SMALL_GOTTPREL:
+ case SYMBOL_SMALL_GOT:
+ case SYMBOL_TINY_GOT:
+ if (offset != const0_rtx)
+ {
+ gcc_assert(can_create_pseudo_p ());
+ base = aarch64_force_temporary (mode, dest, base);
+ base = aarch64_add_offset (mode, NULL, base, INTVAL (offset));
+ aarch64_emit_move (dest, base);
+ return;
+ }
+ /* FALLTHRU */
+
+ case SYMBOL_SMALL_TPREL:
+ case SYMBOL_SMALL_ABSOLUTE:
+ case SYMBOL_TINY_ABSOLUTE:
+ aarch64_load_symref_appropriately (dest, imm, sty);
+ return;
+
+ default:
+ gcc_unreachable ();
+ }
+ }
+
+ if (!CONST_INT_P (imm))
+ {
+ if (GET_CODE (imm) == HIGH)
+ emit_insn (gen_rtx_SET (VOIDmode, dest, imm));
+ else
+ {
+ rtx mem = force_const_mem (mode, imm);
+ gcc_assert (mem);
+ emit_insn (gen_rtx_SET (VOIDmode, dest, mem));
}
+
+ return;
}
+
+ aarch64_internal_mov_immediate (dest, imm, true, GET_MODE (dest));
}
static bool
@@ -5240,9 +5303,8 @@ aarch64_rtx_costs (rtx x, int code, int outer ATTRIBUTE_UNUSED,
proportionally expensive to the number of instructions
required to build that constant. This is true whether we
are compiling for SPEED or otherwise. */
- *cost = COSTS_N_INSNS (aarch64_build_constant (0,
- INTVAL (x),
- false));
+ *cost = COSTS_N_INSNS (aarch64_internal_mov_immediate
+ (NULL_RTX, x, false, mode));
}
return true;
@@ -8041,7 +8103,7 @@ aarch64_mov_operand_p (rtx x,
&& aarch64_valid_symref (XEXP (x, 0), GET_MODE (XEXP (x, 0))))
return true;
- if (CONST_INT_P (x) && aarch64_move_imm (INTVAL (x), mode))
+ if (CONST_INT_P (x))
return true;
if (GET_CODE (x) == SYMBOL_REF && mode == DImode && CONSTANT_ADDRESS_P (x))
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index 17570ba026b..142e8b10597 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -746,17 +746,20 @@
if (GET_CODE (operands[0]) == MEM && operands[1] != const0_rtx)
operands[1] = force_reg (<MODE>mode, operands[1]);
- if (CONSTANT_P (operands[1]))
- {
- aarch64_expand_mov_immediate (operands[0], operands[1]);
- DONE;
- }
+ /* FIXME: RR we still need to fix up what we are doing with
+ symbol_refs and other types of constants. */
+ if (CONSTANT_P (operands[1])
+ && !CONST_INT_P (operands[1]))
+ {
+ aarch64_expand_mov_immediate (operands[0], operands[1]);
+ DONE;
+ }
"
)
-(define_insn "*movsi_aarch64"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=r,k,r,r,r,*w,m, m,r,r ,*w, r,*w")
- (match_operand:SI 1 "aarch64_mov_operand" " r,r,k,M,m, m,rZ,*w,S,Ush,rZ,*w,*w"))]
+(define_insn_and_split "*movsi_aarch64"
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=r,k,r,r,r,r,*w,m, m,r,r ,*w, r,*w")
+ (match_operand:SI 1 "aarch64_mov_operand" " r,r,k,M,n,m, m,rZ,*w,S,Ush,rZ,*w,*w"))]
"(register_operand (operands[0], SImode)
|| aarch64_reg_or_zero (operands[1], SImode))"
"@
@@ -764,6 +767,7 @@
mov\\t%w0, %w1
mov\\t%w0, %w1
mov\\t%w0, %1
+ #
ldr\\t%w0, %1
ldr\\t%s0, %1
str\\t%w1, %0
@@ -773,14 +777,20 @@
fmov\\t%s0, %w1
fmov\\t%w0, %s1
fmov\\t%s0, %s1"
- [(set_attr "type" "mov_reg,mov_reg,mov_reg,mov_imm,load1,load1,store1,store1,\
+ "CONST_INT_P (operands[1]) && !aarch64_move_imm (INTVAL (operands[1]), SImode)"
+ [(const_int 0)]
+ "{
+ aarch64_expand_mov_immediate (operands[0], operands[1]);
+ DONE;
+ }"
+ [(set_attr "type" "mov_reg,mov_reg,mov_reg,mov_imm,mov_imm,load1,load1,store1,store1,\
adr,adr,f_mcr,f_mrc,fmov")
- (set_attr "fp" "*,*,*,*,*,yes,*,yes,*,*,yes,yes,yes")]
+ (set_attr "fp" "*,*,*,*,*,*,yes,*,yes,*,*,yes,yes,yes")]
)
-(define_insn "*movdi_aarch64"
- [(set (match_operand:DI 0 "nonimmediate_operand" "=r,k,r,r,r,*w,m, m,r,r, *w, r,*w,w")
- (match_operand:DI 1 "aarch64_mov_operand" " r,r,k,N,m, m,rZ,*w,S,Ush,rZ,*w,*w,Dd"))]
+(define_insn_and_split "*movdi_aarch64"
+ [(set (match_operand:DI 0 "nonimmediate_operand" "=r,k,r,r,r,r,*w,m, m,r,r, *w, r,*w,w")
+ (match_operand:DI 1 "aarch64_mov_operand" " r,r,k,N,n,m, m,rZ,*w,S,Ush,rZ,*w,*w,Dd"))]
"(register_operand (operands[0], DImode)
|| aarch64_reg_or_zero (operands[1], DImode))"
"@
@@ -788,6 +798,7 @@
mov\\t%0, %x1
mov\\t%x0, %1
mov\\t%x0, %1
+ #
ldr\\t%x0, %1
ldr\\t%d0, %1
str\\t%x1, %0
@@ -798,10 +809,16 @@
fmov\\t%x0, %d1
fmov\\t%d0, %d1
movi\\t%d0, %1"
- [(set_attr "type" "mov_reg,mov_reg,mov_reg,mov_imm,load1,load1,store1,store1,\
+ "(CONST_INT_P (operands[1]) && !aarch64_move_imm (INTVAL (operands[1]), DImode))"
+ [(const_int 0)]
+ "{
+ aarch64_expand_mov_immediate (operands[0], operands[1]);
+ DONE;
+ }"
+ [(set_attr "type" "mov_reg,mov_reg,mov_reg,mov_imm,mov_imm,load1,load1,store1,store1,\
adr,adr,f_mcr,f_mrc,fmov,fmov")
- (set_attr "fp" "*,*,*,*,*,yes,*,yes,*,*,yes,yes,yes,*")
- (set_attr "simd" "*,*,*,*,*,*,*,*,*,*,*,*,*,yes")]
+ (set_attr "fp" "*,*,*,*,*,*,yes,*,yes,*,*,yes,yes,yes,*")
+ (set_attr "simd" "*,*,*,*,*,*,*,*,*,*,*,*,*,*,yes")]
)
(define_insn "insv_imm<mode>"
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 3f2ddd4adb3..f9c98ac24ae 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -311,6 +311,8 @@ static unsigned arm_add_stmt_cost (void *data, int count,
static void arm_canonicalize_comparison (int *code, rtx *op0, rtx *op1,
bool op0_preserve_value);
static unsigned HOST_WIDE_INT arm_asan_shadow_offset (void);
+
+static void arm_sched_fusion_priority (rtx_insn *, int, int *, int*);
/* Table of machine attributes. */
static const struct attribute_spec arm_attribute_table[] =
@@ -708,6 +710,9 @@ static const struct attribute_spec arm_attribute_table[] =
#undef TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS
#define TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS true
+#undef TARGET_SCHED_FUSION_PRIORITY
+#define TARGET_SCHED_FUSION_PRIORITY arm_sched_fusion_priority
+
struct gcc_target targetm = TARGET_INITIALIZER;
/* Obstack for minipool constant handling. */
@@ -3168,6 +3173,12 @@ arm_option_override (void)
if (TARGET_THUMB2)
inline_asm_unified = 1;
+ /* Disable scheduling fusion by default if it's not armv7 processor
+ or doesn't prefer ldrd/strd. */
+ if (flag_schedule_fusion == 2
+ && (!arm_arch7 || !current_tune->prefer_ldrd_strd))
+ flag_schedule_fusion = 0;
+
/* Register global variables with the garbage collector. */
arm_add_gc_roots ();
}
@@ -32350,4 +32361,124 @@ arm_is_constant_pool_ref (rtx x)
&& CONSTANT_POOL_ADDRESS_P (XEXP (x, 0)));
}
+/* If MEM is in the form of [base+offset], extract the two parts
+ of address and set to BASE and OFFSET, otherwise return false
+ after clearing BASE and OFFSET. */
+
+static bool
+extract_base_offset_in_addr (rtx mem, rtx *base, rtx *offset)
+{
+ rtx addr;
+
+ gcc_assert (MEM_P (mem));
+
+ addr = XEXP (mem, 0);
+
+ /* Strip off const from addresses like (const (addr)). */
+ if (GET_CODE (addr) == CONST)
+ addr = XEXP (addr, 0);
+
+ if (GET_CODE (addr) == REG)
+ {
+ *base = addr;
+ *offset = const0_rtx;
+ return true;
+ }
+
+ if (GET_CODE (addr) == PLUS
+ && GET_CODE (XEXP (addr, 0)) == REG
+ && CONST_INT_P (XEXP (addr, 1)))
+ {
+ *base = XEXP (addr, 0);
+ *offset = XEXP (addr, 1);
+ return true;
+ }
+
+ *base = NULL_RTX;
+ *offset = NULL_RTX;
+
+ return false;
+}
+
+/* If INSN is a load or store of address in the form of [base+offset],
+ extract the two parts and set to BASE and OFFSET. IS_LOAD is set
+ to TRUE if it's a load. Return TRUE if INSN is such an instruction,
+ otherwise return FALSE. */
+
+static bool
+fusion_load_store (rtx_insn *insn, rtx *base, rtx *offset, bool *is_load)
+{
+ rtx x, dest, src;
+
+ gcc_assert (INSN_P (insn));
+ x = PATTERN (insn);
+ if (GET_CODE (x) != SET)
+ return false;
+
+ src = SET_SRC (x);
+ dest = SET_DEST (x);
+ if (GET_CODE (src) == REG && GET_CODE (dest) == MEM)
+ {
+ *is_load = false;
+ extract_base_offset_in_addr (dest, base, offset);
+ }
+ else if (GET_CODE (src) == MEM && GET_CODE (dest) == REG)
+ {
+ *is_load = true;
+ extract_base_offset_in_addr (src, base, offset);
+ }
+ else
+ return false;
+
+ return (*base != NULL_RTX && *offset != NULL_RTX);
+}
+
+/* Implement the TARGET_SCHED_FUSION_PRIORITY hook.
+
+ Currently we only support to fuse ldr or str instructions, so FUSION_PRI
+ and PRI are only calculated for these instructions. For other instruction,
+ FUSION_PRI and PRI are simply set to MAX_PRI. In the future, other kind
+ instruction fusion can be supported by returning different priorities.
+
+ It's important that irrelevant instructions get the largest FUSION_PRI. */
+
+static void
+arm_sched_fusion_priority (rtx_insn *insn, int max_pri,
+ int *fusion_pri, int *pri)
+{
+ int tmp, off_val;
+ bool is_load;
+ rtx base, offset;
+
+ gcc_assert (INSN_P (insn));
+
+ tmp = max_pri - 1;
+ if (!fusion_load_store (insn, &base, &offset, &is_load))
+ {
+ *pri = tmp;
+ *fusion_pri = tmp;
+ return;
+ }
+
+ /* Load goes first. */
+ if (is_load)
+ *fusion_pri = tmp - 1;
+ else
+ *fusion_pri = tmp - 2;
+
+ tmp /= 2;
+
+ /* INSN with smaller base register goes first. */
+ tmp -= ((REGNO (base) & 0xff) << 20);
+
+ /* INSN with smaller offset goes first. */
+ off_val = (int)(INTVAL (offset));
+ if (off_val >= 0)
+ tmp -= (off_val & 0xfffff);
+ else
+ tmp += ((- off_val) & 0xfffff);
+
+ *pri = tmp;
+ return;
+}
#include "gt-arm.h"
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 3d7e057e64a..3400ca3d577 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -4335,6 +4335,15 @@ ix86_option_override (void)
register_pass (&insert_vzeroupper_info);
}
+/* Implement the TARGET_OFFLOAD_OPTIONS hook. */
+static char *
+ix86_offload_options (void)
+{
+ if (TARGET_LP64)
+ return xstrdup ("-foffload-abi=lp64");
+ return xstrdup ("-foffload-abi=ilp32");
+}
+
/* Update register usage after having seen the compiler flags. */
static void
@@ -42697,7 +42706,7 @@ x86_output_mi_thunk (FILE *file, tree, HOST_WIDE_INT delta,
// uninitialized. Since FUNCTION is local and calling it
// doesn't go through PLT, we use scratch register %r11 as
// PIC register and initialize it here.
- SET_REGNO (pic_offset_table_rtx, R11_REG);
+ pic_offset_table_rtx = gen_rtx_REG (Pmode, R11_REG);
ix86_init_large_pic_reg (tmp_regno);
fnaddr = legitimize_pic_address (fnaddr,
gen_rtx_REG (Pmode, tmp_regno));
@@ -51673,6 +51682,10 @@ ix86_initialize_bounds (tree var, tree lb, tree ub, tree *stmts)
#undef TARGET_SETUP_INCOMING_VARARG_BOUNDS
#define TARGET_SETUP_INCOMING_VARARG_BOUNDS ix86_setup_incoming_vararg_bounds
+#undef TARGET_OFFLOAD_OPTIONS
+#define TARGET_OFFLOAD_OPTIONS \
+ ix86_offload_options
+
struct gcc_target targetm = TARGET_INITIALIZER;
#include "gt-i386.h"
diff --git a/gcc/config/i386/intelmic-mkoffload.c b/gcc/config/i386/intelmic-mkoffload.c
new file mode 100644
index 00000000000..c972f56a50e
--- /dev/null
+++ b/gcc/config/i386/intelmic-mkoffload.c
@@ -0,0 +1,541 @@
+/* Offload image generation tool for Intel MIC devices.
+
+ Copyright (C) 2014 Free Software Foundation, Inc.
+
+ Contributed by Ilya Verbin <ilya.verbin@intel.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
+ <http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include <libgen.h>
+#include "system.h"
+#include "coretypes.h"
+#include "obstack.h"
+#include "intl.h"
+#include "diagnostic.h"
+#include "collect-utils.h"
+#include <libgomp_target.h>
+
+const char tool_name[] = "intelmic mkoffload";
+
+const char image_section_name[] = ".gnu.offload_images";
+const char *symbols[3] = { "__offload_image_intelmic_start",
+ "__offload_image_intelmic_end",
+ "__offload_image_intelmic_size" };
+const char *out_obj_filename = NULL;
+
+int num_temps = 0;
+const int MAX_NUM_TEMPS = 10;
+const char *temp_files[MAX_NUM_TEMPS];
+
+/* Shows if we should compile binaries for i386 instead of x86-64. */
+bool target_ilp32 = false;
+
+/* Delete tempfiles and exit function. */
+void
+tool_cleanup (bool from_signal ATTRIBUTE_UNUSED)
+{
+ for (int i = 0; i < num_temps; i++)
+ maybe_unlink (temp_files[i]);
+}
+
+static void
+mkoffload_atexit (void)
+{
+ tool_cleanup (false);
+}
+
+/* Unlink FILE unless we are debugging. */
+void
+maybe_unlink (const char *file)
+{
+ if (debug)
+ notice ("[Leaving %s]\n", file);
+ else
+ unlink_if_ordinary (file);
+}
+
+/* Add or change the value of an environment variable, outputting the
+ change to standard error if in verbose mode. */
+static void
+xputenv (const char *string)
+{
+ if (verbose)
+ fprintf (stderr, "%s\n", string);
+ putenv (CONST_CAST (char *, string));
+}
+
+/* Parse STR, saving found tokens into PVALUES and return their number.
+ Tokens are assumed to be delimited by ':'. */
+static unsigned
+parse_env_var (const char *str, char ***pvalues)
+{
+ const char *curval, *nextval;
+ char **values;
+ unsigned num = 1, i;
+
+ curval = strchr (str, ':');
+ while (curval)
+ {
+ num++;
+ curval = strchr (curval + 1, ':');
+ }
+
+ values = (char **) xmalloc (num * sizeof (char *));
+ curval = str;
+ nextval = strchr (curval, ':');
+ if (nextval == NULL)
+ nextval = strchr (curval, '\0');
+
+ for (i = 0; i < num; i++)
+ {
+ int l = nextval - curval;
+ values[i] = (char *) xmalloc (l + 1);
+ memcpy (values[i], curval, l);
+ values[i][l] = 0;
+ curval = nextval + 1;
+ nextval = strchr (curval, ':');
+ if (nextval == NULL)
+ nextval = strchr (curval, '\0');
+ }
+ *pvalues = values;
+ return num;
+}
+
+/* Auxiliary function that frees elements of PTR and PTR itself.
+ N is number of elements to be freed. If PTR is NULL, nothing is freed.
+ If an element is NULL, subsequent elements are not freed. */
+static void
+free_array_of_ptrs (void **ptr, unsigned n)
+{
+ unsigned i;
+ if (!ptr)
+ return;
+ for (i = 0; i < n; i++)
+ {
+ if (!ptr[i])
+ break;
+ free (ptr[i]);
+ }
+ free (ptr);
+ return;
+}
+
+/* Check whether NAME can be accessed in MODE. This is like access,
+ except that it never considers directories to be executable. */
+static int
+access_check (const char *name, int mode)
+{
+ if (mode == X_OK)
+ {
+ struct stat st;
+
+ if (stat (name, &st) < 0 || S_ISDIR (st.st_mode))
+ return -1;
+ }
+
+ return access (name, mode);
+}
+
+/* Find target compiler using a path from COLLECT_GCC or COMPILER_PATH. */
+static char *
+find_target_compiler (const char *name)
+{
+ bool found = false;
+ char **paths = NULL;
+ unsigned n_paths, i;
+ const char *collect_path = dirname (ASTRDUP (getenv ("COLLECT_GCC")));
+ size_t len = strlen (collect_path) + 1 + strlen (name) + 1;
+ char *target_compiler = XNEWVEC (char, len);
+ sprintf (target_compiler, "%s/%s", collect_path, name);
+ if (access_check (target_compiler, X_OK) == 0)
+ {
+ found = true;
+ goto out;
+ }
+
+ n_paths = parse_env_var (getenv ("COMPILER_PATH"), &paths);
+ for (i = 0; i < n_paths; i++)
+ {
+ len = strlen (paths[i]) + 1 + strlen (name) + 1;
+ target_compiler = XRESIZEVEC (char, target_compiler, len);
+ sprintf (target_compiler, "%s/%s", paths[i], name);
+ if (access_check (target_compiler, X_OK) == 0)
+ {
+ found = true;
+ break;
+ }
+ }
+
+out:
+ free_array_of_ptrs ((void **) paths, n_paths);
+ return found ? target_compiler : NULL;
+}
+
+static void
+compile_for_target (struct obstack *argv_obstack)
+{
+ if (target_ilp32)
+ obstack_ptr_grow (argv_obstack, "-m32");
+ obstack_ptr_grow (argv_obstack, NULL);
+ char **argv = XOBFINISH (argv_obstack, char **);
+
+ /* Save environment variables. */
+ const char *epath = getenv ("GCC_EXEC_PREFIX");
+ const char *cpath = getenv ("COMPILER_PATH");
+ const char *lpath = getenv ("LIBRARY_PATH");
+ const char *rpath = getenv ("LD_RUN_PATH");
+ unsetenv ("GCC_EXEC_PREFIX");
+ unsetenv ("COMPILER_PATH");
+ unsetenv ("LIBRARY_PATH");
+ unsetenv ("LD_RUN_PATH");
+
+ fork_execute (argv[0], argv, false);
+ obstack_free (argv_obstack, NULL);
+
+ /* Restore environment variables. */
+ xputenv (concat ("GCC_EXEC_PREFIX=", epath, NULL));
+ xputenv (concat ("COMPILER_PATH=", cpath, NULL));
+ xputenv (concat ("LIBRARY_PATH=", lpath, NULL));
+ xputenv (concat ("LD_RUN_PATH=", rpath, NULL));
+}
+
+/* Generates object file with the descriptor for the target library. */
+static const char *
+generate_target_descr_file (const char *target_compiler)
+{
+ const char *src_filename = make_temp_file ("_target_descr.c");
+ const char *obj_filename = make_temp_file ("_target_descr.o");
+ temp_files[num_temps++] = src_filename;
+ temp_files[num_temps++] = obj_filename;
+ FILE *src_file = fopen (src_filename, "w");
+
+ if (!src_file)
+ fatal_error ("cannot open '%s'", src_filename);
+
+ fprintf (src_file,
+ "extern void *__offload_funcs_end[];\n"
+ "extern void *__offload_vars_end[];\n\n"
+
+ "void *__offload_func_table[0]\n"
+ "__attribute__ ((__used__, visibility (\"hidden\"),\n"
+ "section (\".gnu.offload_funcs\"))) = { };\n\n"
+
+ "void *__offload_var_table[0]\n"
+ "__attribute__ ((__used__, visibility (\"hidden\"),\n"
+ "section (\".gnu.offload_vars\"))) = { };\n\n"
+
+ "void *__OFFLOAD_TARGET_TABLE__[]\n"
+ "__attribute__ ((__used__, visibility (\"hidden\"))) = {\n"
+ " &__offload_func_table, &__offload_funcs_end,\n"
+ " &__offload_var_table, &__offload_vars_end\n"
+ "};\n\n");
+
+ fprintf (src_file,
+ "#ifdef __cplusplus\n"
+ "extern \"C\"\n"
+ "#endif\n"
+ "void target_register_lib (const void *);\n\n"
+
+ "__attribute__((constructor))\n"
+ "static void\n"
+ "init (void)\n"
+ "{\n"
+ " target_register_lib (__OFFLOAD_TARGET_TABLE__);\n"
+ "}\n");
+ fclose (src_file);
+
+ struct obstack argv_obstack;
+ obstack_init (&argv_obstack);
+ obstack_ptr_grow (&argv_obstack, target_compiler);
+ obstack_ptr_grow (&argv_obstack, "-c");
+ obstack_ptr_grow (&argv_obstack, "-shared");
+ obstack_ptr_grow (&argv_obstack, "-fPIC");
+ obstack_ptr_grow (&argv_obstack, src_filename);
+ obstack_ptr_grow (&argv_obstack, "-o");
+ obstack_ptr_grow (&argv_obstack, obj_filename);
+ compile_for_target (&argv_obstack);
+
+ return obj_filename;
+}
+
+/* Generates object file with __offload_*_end symbols for the target
+ library. */
+static const char *
+generate_target_offloadend_file (const char *target_compiler)
+{
+ const char *src_filename = make_temp_file ("_target_offloadend.c");
+ const char *obj_filename = make_temp_file ("_target_offloadend.o");
+ temp_files[num_temps++] = src_filename;
+ temp_files[num_temps++] = obj_filename;
+ FILE *src_file = fopen (src_filename, "w");
+
+ if (!src_file)
+ fatal_error ("cannot open '%s'", src_filename);
+
+ fprintf (src_file,
+ "void *__offload_funcs_end[0]\n"
+ "__attribute__ ((__used__, visibility (\"hidden\"),\n"
+ "section (\".gnu.offload_funcs\"))) = { };\n\n"
+
+ "void *__offload_vars_end[0]\n"
+ "__attribute__ ((__used__, visibility (\"hidden\"),\n"
+ "section (\".gnu.offload_vars\"))) = { };\n");
+ fclose (src_file);
+
+ struct obstack argv_obstack;
+ obstack_init (&argv_obstack);
+ obstack_ptr_grow (&argv_obstack, target_compiler);
+ obstack_ptr_grow (&argv_obstack, "-c");
+ obstack_ptr_grow (&argv_obstack, "-shared");
+ obstack_ptr_grow (&argv_obstack, "-fPIC");
+ obstack_ptr_grow (&argv_obstack, src_filename);
+ obstack_ptr_grow (&argv_obstack, "-o");
+ obstack_ptr_grow (&argv_obstack, obj_filename);
+ compile_for_target (&argv_obstack);
+
+ return obj_filename;
+}
+
+/* Generates object file with the host side descriptor. */
+static const char *
+generate_host_descr_file (const char *host_compiler)
+{
+ const char *src_filename = make_temp_file ("_host_descr.c");
+ const char *obj_filename = make_temp_file ("_host_descr.o");
+ temp_files[num_temps++] = src_filename;
+ temp_files[num_temps++] = obj_filename;
+ FILE *src_file = fopen (src_filename, "w");
+
+ if (!src_file)
+ fatal_error ("cannot open '%s'", src_filename);
+
+ fprintf (src_file,
+ "extern void *__OFFLOAD_TABLE__;\n"
+ "extern void *__offload_image_intelmic_start;\n"
+ "extern void *__offload_image_intelmic_end;\n\n"
+
+ "static const void *__offload_target_data[] = {\n"
+ " &__offload_image_intelmic_start, &__offload_image_intelmic_end\n"
+ "};\n\n");
+
+ fprintf (src_file,
+ "#ifdef __cplusplus\n"
+ "extern \"C\"\n"
+ "#endif\n"
+ "void GOMP_offload_register (void *, int, void *);\n\n"
+
+ "__attribute__((constructor))\n"
+ "static void\n"
+ "init (void)\n"
+ "{\n"
+ " GOMP_offload_register (&__OFFLOAD_TABLE__, %d, __offload_target_data);\n"
+ "}\n", OFFLOAD_TARGET_TYPE_INTEL_MIC);
+ fclose (src_file);
+
+ unsigned new_argc = 0;
+ const char *new_argv[9];
+ new_argv[new_argc++] = host_compiler;
+ new_argv[new_argc++] = "-c";
+ new_argv[new_argc++] = "-fPIC";
+ new_argv[new_argc++] = "-shared";
+ if (target_ilp32)
+ new_argv[new_argc++] = "-m32";
+ new_argv[new_argc++] = src_filename;
+ new_argv[new_argc++] = "-o";
+ new_argv[new_argc++] = obj_filename;
+ new_argv[new_argc++] = NULL;
+
+ fork_execute (new_argv[0], CONST_CAST (char **, new_argv), false);
+
+ return obj_filename;
+}
+
+static const char *
+prepare_target_image (const char *target_compiler, int argc, char **argv)
+{
+ const char *target_descr_filename
+ = generate_target_descr_file (target_compiler);
+ const char *target_offloadend_filename
+ = generate_target_offloadend_file (target_compiler);
+
+ char *opt1
+ = XALLOCAVEC (char, sizeof ("-Wl,") + strlen (target_descr_filename));
+ char *opt2
+ = XALLOCAVEC (char, sizeof ("-Wl,") + strlen (target_offloadend_filename));
+ sprintf (opt1, "-Wl,%s", target_descr_filename);
+ sprintf (opt2, "-Wl,%s", target_offloadend_filename);
+
+ const char *target_so_filename = make_temp_file ("_offload_intelmic.so");
+ temp_files[num_temps++] = target_so_filename;
+ struct obstack argv_obstack;
+ obstack_init (&argv_obstack);
+ obstack_ptr_grow (&argv_obstack, target_compiler);
+ obstack_ptr_grow (&argv_obstack, "-xlto");
+ obstack_ptr_grow (&argv_obstack, "-fopenmp");
+ obstack_ptr_grow (&argv_obstack, "-shared");
+ obstack_ptr_grow (&argv_obstack, "-fPIC");
+ obstack_ptr_grow (&argv_obstack, opt1);
+ for (int i = 1; i < argc; i++)
+ {
+ if (!strcmp (argv[i], "-o") && i + 1 != argc)
+ out_obj_filename = argv[++i];
+ else
+ obstack_ptr_grow (&argv_obstack, argv[i]);
+ }
+ if (!out_obj_filename)
+ fatal_error ("output file not specified");
+ obstack_ptr_grow (&argv_obstack, opt2);
+ obstack_ptr_grow (&argv_obstack, "-o");
+ obstack_ptr_grow (&argv_obstack, target_so_filename);
+ compile_for_target (&argv_obstack);
+
+ /* Run objcopy. */
+ char *rename_section_opt
+ = XALLOCAVEC (char, sizeof (".data=") + strlen (image_section_name));
+ sprintf (rename_section_opt, ".data=%s", image_section_name);
+ const char *objcopy_argv[11];
+ objcopy_argv[0] = "objcopy";
+ objcopy_argv[1] = "-B";
+ objcopy_argv[2] = "i386";
+ objcopy_argv[3] = "-I";
+ objcopy_argv[4] = "binary";
+ objcopy_argv[5] = "-O";
+ if (target_ilp32)
+ objcopy_argv[6] = "elf32-i386";
+ else
+ objcopy_argv[6] = "elf64-x86-64";
+ objcopy_argv[7] = target_so_filename;
+ objcopy_argv[8] = "--rename-section";
+ objcopy_argv[9] = rename_section_opt;
+ objcopy_argv[10] = NULL;
+ fork_execute (objcopy_argv[0], CONST_CAST (char **, objcopy_argv), false);
+
+ /* Objcopy has created symbols, containing the input file name with
+ special characters replaced with '_'. We are going to rename these
+ new symbols. */
+ size_t symbol_name_len = strlen (target_so_filename);
+ char *symbol_name = XALLOCAVEC (char, symbol_name_len + 1);
+ for (size_t i = 0; i <= symbol_name_len; i++)
+ {
+ char c = target_so_filename[i];
+ if ((c == '/') || (c == '.'))
+ c = '_';
+ symbol_name[i] = c;
+ }
+
+ char *opt_for_objcopy[3];
+ opt_for_objcopy[0] = XALLOCAVEC (char, sizeof ("_binary__start=")
+ + symbol_name_len
+ + strlen (symbols[0]));
+ opt_for_objcopy[1] = XALLOCAVEC (char, sizeof ("_binary__end=")
+ + symbol_name_len
+ + strlen (symbols[1]));
+ opt_for_objcopy[2] = XALLOCAVEC (char, sizeof ("_binary__size=")
+ + symbol_name_len
+ + strlen (symbols[2]));
+ sprintf (opt_for_objcopy[0], "_binary_%s_start=%s", symbol_name, symbols[0]);
+ sprintf (opt_for_objcopy[1], "_binary_%s_end=%s", symbol_name, symbols[1]);
+ sprintf (opt_for_objcopy[2], "_binary_%s_size=%s", symbol_name, symbols[2]);
+
+ objcopy_argv[0] = "objcopy";
+ objcopy_argv[1] = target_so_filename;
+ objcopy_argv[2] = "--redefine-sym";
+ objcopy_argv[3] = opt_for_objcopy[0];
+ objcopy_argv[4] = "--redefine-sym";
+ objcopy_argv[5] = opt_for_objcopy[1];
+ objcopy_argv[6] = "--redefine-sym";
+ objcopy_argv[7] = opt_for_objcopy[2];
+ objcopy_argv[8] = NULL;
+ fork_execute (objcopy_argv[0], CONST_CAST (char **, objcopy_argv), false);
+
+ return target_so_filename;
+}
+
+int
+main (int argc, char **argv)
+{
+ progname = "mkoffload-intelmic";
+ gcc_init_libintl ();
+ diagnostic_initialize (global_dc, 0);
+
+ if (atexit (mkoffload_atexit) != 0)
+ fatal_error ("atexit failed");
+
+ const char *host_compiler = getenv ("COLLECT_GCC");
+ if (!host_compiler)
+ fatal_error ("COLLECT_GCC must be set");
+
+ const char *target_driver_name
+ = DEFAULT_REAL_TARGET_MACHINE "-accel-" DEFAULT_TARGET_MACHINE "-gcc";
+ char *target_compiler = find_target_compiler (target_driver_name);
+ if (target_compiler == NULL)
+ fatal_error ("offload compiler %s not found", target_driver_name);
+
+ /* 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);
+
+ /* Find out whether we should compile binaries for i386 or x86-64. */
+ for (int i = argc - 1; i > 0; i--)
+ if (strncmp (argv[i], "-foffload-abi=", sizeof ("-foffload-abi=") - 1) == 0)
+ {
+ if (strstr (argv[i], "ilp32"))
+ target_ilp32 = true;
+ else if (!strstr (argv[i], "lp64"))
+ fatal_error ("unrecognizable argument of option -foffload-abi");
+ break;
+ }
+
+ const char *target_so_filename
+ = prepare_target_image (target_compiler, argc, argv);
+
+ const char *host_descr_filename = generate_host_descr_file (host_compiler);
+
+ /* Perform partial linking for the target image and host side descriptor.
+ As a result we'll get a finalized object file with all offload data. */
+ unsigned new_argc = 0;
+ const char *new_argv[9];
+ new_argv[new_argc++] = "ld";
+ if (target_ilp32)
+ {
+ new_argv[new_argc++] = "-m";
+ new_argv[new_argc++] = "elf_i386";
+ }
+ new_argv[new_argc++] = "--relocatable";
+ new_argv[new_argc++] = host_descr_filename;
+ new_argv[new_argc++] = target_so_filename;
+ new_argv[new_argc++] = "-o";
+ new_argv[new_argc++] = out_obj_filename;
+ new_argv[new_argc++] = NULL;
+ fork_execute (new_argv[0], CONST_CAST (char **, new_argv), false);
+
+ /* Run objcopy on the resultant object file to localize generated symbols
+ to avoid conflicting between different DSO and an executable. */
+ new_argv[0] = "objcopy";
+ new_argv[1] = "-L";
+ new_argv[2] = symbols[0];
+ new_argv[3] = "-L";
+ new_argv[4] = symbols[1];
+ new_argv[5] = "-L";
+ new_argv[6] = symbols[2];
+ new_argv[7] = out_obj_filename;
+ new_argv[8] = NULL;
+ fork_execute (new_argv[0], CONST_CAST (char **, new_argv), false);
+
+ return 0;
+}
diff --git a/gcc/config/i386/t-intelmic b/gcc/config/i386/t-intelmic
new file mode 100644
index 00000000000..8b36e0d00a8
--- /dev/null
+++ b/gcc/config/i386/t-intelmic
@@ -0,0 +1,9 @@
+mkoffload.o: $(srcdir)/config/i386/intelmic-mkoffload.c | insn-modes.h
+ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
+ -I$(srcdir)/../libgomp \
+ -DDEFAULT_REAL_TARGET_MACHINE=\"$(real_target_noncanonical)\" \
+ -DDEFAULT_TARGET_MACHINE=\"$(target_noncanonical)\" \
+ $< $(OUTPUT_OPTION)
+
+mkoffload$(exeext): mkoffload.o collect-utils.o libcommon-target.a $(LIBIBERTY) $(LIBDEPS)
+ $(COMPILER) -o $@ mkoffload.o collect-utils.o libcommon-target.a $(LIBIBERTY) $(LIBS)
diff --git a/gcc/config/rs6000/vector.md b/gcc/config/rs6000/vector.md
index 0e3636fd542..e2946bd6e31 100644
--- a/gcc/config/rs6000/vector.md
+++ b/gcc/config/rs6000/vector.md
@@ -913,53 +913,11 @@
"VECTOR_MEM_VSX_P (<MODE>mode) && TARGET_ALLOW_MOVMISALIGN"
"")
-
-;; Vector shift left in bits. Currently supported ony for shift
-;; amounts that can be expressed as byte shifts (divisible by 8).
-;; General shift amounts can be supported using vslo + vsl. We're
-;; not expecting to see these yet (the vectorizer currently
-;; generates only shifts divisible by byte_size).
-(define_expand "vec_shl_<mode>"
- [(match_operand:VEC_L 0 "vlogical_operand" "")
- (match_operand:VEC_L 1 "vlogical_operand" "")
- (match_operand:QI 2 "reg_or_short_operand" "")]
- "TARGET_ALTIVEC"
- "
-{
- rtx bitshift = operands[2];
- rtx shift;
- rtx insn;
- HOST_WIDE_INT bitshift_val;
- HOST_WIDE_INT byteshift_val;
-
- if (! CONSTANT_P (bitshift))
- FAIL;
- bitshift_val = INTVAL (bitshift);
- if (bitshift_val & 0x7)
- FAIL;
- byteshift_val = bitshift_val >> 3;
- if (TARGET_VSX && (byteshift_val & 0x3) == 0)
- {
- shift = gen_rtx_CONST_INT (QImode, byteshift_val >> 2);
- insn = gen_vsx_xxsldwi_<mode> (operands[0], operands[1], operands[1],
- shift);
- }
- else
- {
- shift = gen_rtx_CONST_INT (QImode, byteshift_val);
- insn = gen_altivec_vsldoi_<mode> (operands[0], operands[1], operands[1],
- shift);
- }
-
- emit_insn (insn);
- DONE;
-}")
-
;; Vector shift right in bits. Currently supported ony for shift
;; amounts that can be expressed as byte shifts (divisible by 8).
;; General shift amounts can be supported using vsro + vsr. We're
;; not expecting to see these yet (the vectorizer currently
-;; generates only shifts divisible by byte_size).
+;; generates only shifts by a whole number of vector elements).
(define_expand "vec_shr_<mode>"
[(match_operand:VEC_L 0 "vlogical_operand" "")
(match_operand:VEC_L 1 "vlogical_operand" "")
@@ -978,7 +936,9 @@
bitshift_val = INTVAL (bitshift);
if (bitshift_val & 0x7)
FAIL;
- byteshift_val = 16 - (bitshift_val >> 3);
+ byteshift_val = (bitshift_val >> 3);
+ if (!BYTES_BIG_ENDIAN)
+ byteshift_val = 16 - byteshift_val;
if (TARGET_VSX && (byteshift_val & 0x3) == 0)
{
shift = gen_rtx_CONST_INT (QImode, byteshift_val >> 2);
diff --git a/gcc/configure b/gcc/configure
index 064b438304a..8e62ee7233f 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -760,6 +760,9 @@ LN
LN_S
AWK
SET_MAKE
+accel_dir_suffix
+real_target_noncanonical
+enable_as_accelerator
REPORT_BUGS_TEXI
REPORT_BUGS_TO
PKGVERSION
@@ -933,6 +936,7 @@ enable_plugin
enable_host_shared
enable_libquadmath_support
with_linker_hash_style
+with_diagnostics_color
'
ac_precious_vars='build_alias
host_alias
@@ -1705,6 +1709,11 @@ Optional Packages:
--with-system-zlib use installed libz
--with-linker-hash-style={sysv,gnu,both}
specify the linker hash style
+ --with-diagnostics-color={never,auto,auto-if-env,always}
+ specify the default of -fdiagnostics-color option
+ auto-if-env stands for -fdiagnostics-color=auto if
+ GCC_COLOR environment variable is present and
+ -fdiagnostics-color=never otherwise
Some influential environment variables:
CC C compiler command
@@ -3198,6 +3207,10 @@ esac
+# Used for constructing correct paths for offload compilers.
+real_target_noncanonical=${target_noncanonical}
+accel_dir_suffix=
+
# Determine the target- and build-specific subdirectories
# post-stage1 host modules use a different CC_FOR_BUILD so, in order to
@@ -7395,6 +7408,45 @@ else
fi
+if test x"$enable_as_accelerator_for" != x; then
+
+$as_echo "#define ACCEL_COMPILER 1" >>confdefs.h
+
+ enable_as_accelerator=yes
+ case "${target}" in
+ *-intelmicemul-*)
+ # In this case we expect offload compiler to be built as native, so we
+ # need to rename the driver to avoid clashes with host's drivers.
+ program_transform_name="s&^&${target}-&" ;;
+ esac
+ sedscript="s#${target_noncanonical}#${enable_as_accelerator_for}-accel-${target_noncanonical}#"
+ program_transform_name=`echo $program_transform_name | sed $sedscript`
+ accel_dir_suffix=/accel/${target_noncanonical}
+ real_target_noncanonical=${enable_as_accelerator_for}
+fi
+
+
+
+
+for tgt in `echo $enable_offload_targets | sed 's/,/ /g'`; do
+ tgt=`echo $tgt | sed 's/=.*//'`
+ if test x"$offload_targets" = x; then
+ offload_targets=$tgt
+ else
+ offload_targets="$offload_targets:$tgt"
+ fi
+done
+
+cat >>confdefs.h <<_ACEOF
+#define OFFLOAD_TARGETS "$offload_targets"
+_ACEOF
+
+if test x"$offload_targets" != x; then
+
+$as_echo "#define ENABLE_OFFLOADING 1" >>confdefs.h
+
+fi
+
# Check whether --with-multilib-list was given.
if test "${with_multilib_list+set}" = set; then :
@@ -18094,7 +18146,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 18097 "configure"
+#line 18149 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -18200,7 +18252,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 18203 "configure"
+#line 18255 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -28248,6 +28300,37 @@ _ACEOF
fi
+# Specify what should be the default of -fdiagnostics-color option.
+
+# Check whether --with-diagnostics-color was given.
+if test "${with_diagnostics_color+set}" = set; then :
+ withval=$with_diagnostics_color; case x"$withval" in
+ xnever)
+ DIAGNOSTICS_COLOR_DEFAULT=DIAGNOSTICS_COLOR_NO
+ ;;
+ xauto)
+ DIAGNOSTICS_COLOR_DEFAULT=DIAGNOSTICS_COLOR_AUTO
+ ;;
+ xauto-if-env)
+ DIAGNOSTICS_COLOR_DEFAULT=-1
+ ;;
+ xalways)
+ DIAGNOSTICS_COLOR_DEFAULT=DIAGNOSTICS_COLOR_YES
+ ;;
+ *)
+ as_fn_error "$withval is an invalid option to --with-diagnostics-color" "$LINENO" 5
+ ;;
+ esac
+else
+ DIAGNOSTICS_COLOR_DEFAULT=DIAGNOSTICS_COLOR_AUTO
+fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define DIAGNOSTICS_COLOR_DEFAULT $DIAGNOSTICS_COLOR_DEFAULT
+_ACEOF
+
+
# Generate gcc-driver-name.h containing GCC_DRIVER_NAME for the benefit
# of jit/jit-playback.c.
cat > gcc-driver-name.h <<EOF
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 8be5479591e..f6e7ec3529e 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -38,6 +38,10 @@ AC_CANONICAL_TARGET
# Determine the noncanonical target name, for directory use.
ACX_NONCANONICAL_TARGET
+# Used for constructing correct paths for offload compilers.
+real_target_noncanonical=${target_noncanonical}
+accel_dir_suffix=
+
# Determine the target- and build-specific subdirectories
GCC_TOPLEV_SUBDIRS
@@ -883,6 +887,40 @@ AC_ARG_ENABLE(languages,
esac],
[enable_languages=c])
+if test x"$enable_as_accelerator_for" != x; then
+ AC_DEFINE(ACCEL_COMPILER, 1,
+ [Define if this compiler should be built as the offload target compiler.])
+ enable_as_accelerator=yes
+ case "${target}" in
+ *-intelmicemul-*)
+ # In this case we expect offload compiler to be built as native, so we
+ # need to rename the driver to avoid clashes with host's drivers.
+ program_transform_name="s&^&${target}-&" ;;
+ esac
+ sedscript="s#${target_noncanonical}#${enable_as_accelerator_for}-accel-${target_noncanonical}#"
+ program_transform_name=`echo $program_transform_name | sed $sedscript`
+ accel_dir_suffix=/accel/${target_noncanonical}
+ real_target_noncanonical=${enable_as_accelerator_for}
+fi
+AC_SUBST(enable_as_accelerator)
+AC_SUBST(real_target_noncanonical)
+AC_SUBST(accel_dir_suffix)
+
+for tgt in `echo $enable_offload_targets | sed 's/,/ /g'`; do
+ tgt=`echo $tgt | sed 's/=.*//'`
+ if test x"$offload_targets" = x; then
+ offload_targets=$tgt
+ else
+ offload_targets="$offload_targets:$tgt"
+ fi
+done
+AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets",
+ [Define to hold the list of target names suitable for offloading.])
+if test x"$offload_targets" != x; then
+ AC_DEFINE(ENABLE_OFFLOADING, 1,
+ [Define this to enable support for offloading.])
+fi
+
AC_ARG_WITH(multilib-list,
[AS_HELP_STRING([--with-multilib-list], [select multilibs (AArch64, SH and x86-64 only)])],
:,
@@ -5613,6 +5651,34 @@ if test x"${LINKER_HASH_STYLE}" != x; then
[The linker hash style])
fi
+# Specify what should be the default of -fdiagnostics-color option.
+AC_ARG_WITH([diagnostics-color],
+[AC_HELP_STRING([--with-diagnostics-color={never,auto,auto-if-env,always}],
+ [specify the default of -fdiagnostics-color option
+ auto-if-env stands for -fdiagnostics-color=auto if
+ GCC_COLOR environment variable is present and
+ -fdiagnostics-color=never otherwise])],
+[case x"$withval" in
+ xnever)
+ DIAGNOSTICS_COLOR_DEFAULT=DIAGNOSTICS_COLOR_NO
+ ;;
+ xauto)
+ DIAGNOSTICS_COLOR_DEFAULT=DIAGNOSTICS_COLOR_AUTO
+ ;;
+ xauto-if-env)
+ DIAGNOSTICS_COLOR_DEFAULT=-1
+ ;;
+ xalways)
+ DIAGNOSTICS_COLOR_DEFAULT=DIAGNOSTICS_COLOR_YES
+ ;;
+ *)
+ AC_MSG_ERROR([$withval is an invalid option to --with-diagnostics-color])
+ ;;
+ esac],
+[DIAGNOSTICS_COLOR_DEFAULT=DIAGNOSTICS_COLOR_AUTO])
+AC_DEFINE_UNQUOTED(DIAGNOSTICS_COLOR_DEFAULT, $DIAGNOSTICS_COLOR_DEFAULT,
+ [The default for -fdiagnostics-color option])
+
# Generate gcc-driver-name.h containing GCC_DRIVER_NAME for the benefit
# of jit/jit-playback.c.
cat > gcc-driver-name.h <<EOF
diff --git a/gcc/context.c b/gcc/context.c
index 5339e28a98b..9279be40dd7 100644
--- a/gcc/context.c
+++ b/gcc/context.c
@@ -30,6 +30,8 @@ gcc::context *g;
gcc::context::context ()
{
+ have_offload = false;
+
/* The pass manager's constructor uses the dump manager (to set up
dumps for the various passes), so the dump manager must be set up
before the pass manager. */
diff --git a/gcc/context.h b/gcc/context.h
index b8fb439f1af..689ae5ad187 100644
--- a/gcc/context.h
+++ b/gcc/context.h
@@ -33,6 +33,9 @@ class context
public:
context ();
+ /* The flag shows if there are symbols to be streamed for offloading. */
+ bool have_offload;
+
/* Pass-management. */
pass_manager *get_passes () { gcc_assert (m_passes); return m_passes; }
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index f66e0941c76..a21359d7ddd 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -132,6 +132,13 @@ enum tls_model {
TLS_MODEL_LOCAL_EXEC
};
+/* Types of ABI for an offload compiler. */
+enum offload_abi {
+ OFFLOAD_ABI_UNSET,
+ OFFLOAD_ABI_LP64,
+ OFFLOAD_ABI_ILP32
+};
+
/* Types of unwind/exception handling info that can be generated. */
enum unwind_info_type
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index abb9ffb2380..5311649d12d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,62 @@
+2014-11-14 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * semantics.c (end_maybe_infinite_loop): Use fold_non_dependent_expr.
+ * parser.c (cp_parser_omp_clause_collapse): Likewise.
+ (cp_parser_enumerator_definition): Don't call
+ instantiate_non_dependent_expr...
+ * decl.c (build_enumerator): ... call fold_non_dependent_expr here.
+ * typeck2.c (massage_init_elt): Use fold_non_dependent_expr.
+ * constexpr.c (maybe_constant_value): Allow VIEW_CONVERT_EXPR in
+ the final gcc_assert.
+
+ * constexpr.c (fold_non_dependent_expr): Add.
+ * cp-tree.h (fold_non_dependent_expr): Declare it.
+ * call.c (null_ptr_cst_p): Use it.
+ * pt.c (tsubst_copy_and_build, build_non_dependent_expr): Likewise.
+ * semantics.c (begin_maybe_infinite_loop): Likewise.
+ * typeck.c (cp_build_binary_op): Likewise.
+ * typeck2.c (check_narrowing): Likewise.
+
+ * pt.c (fold_non_dependent_expr): Rename to
+ instantiate_non_dependent_expr.
+ (fold_non_dependent_expr_sfinae): Rename to
+ instantiate_non_dependent_expr_sfinae.
+ (convert_nontype_argument, build_non_dependent_expr): Adjust.
+ * decl.c (compute_array_index_type): Likewise.
+ * parser.c (cp_parser_parenthesized_expression_list,
+ cp_parser_enumerator_definition, cp_parser_omp_clause_collapse):
+ Likewise.
+ * semantics.c (end_maybe_infinite_loop, finish_static_assert):
+ Likewise.
+ * typeck.c (cxx_alignas_expr): Likewise.
+ * typeck2.c (store_init_value, massage_init_elt): Likewise.
+ * call.c: Adjust comments.
+ * class.c: Likewise.
+ * constexpr.c: Likewise.
+ * decl2.c: Likewise.
+ * tree.c: Likewise.
+
+2014-11-14 Jonathan Wakely <jwakely@redhat.com>
+
+ * mangle.c (find_substitution): Look for abi_tag on class templates.
+
+2014-11-13 Bernd Schmidt <bernds@codesourcery.com>
+ Thomas Schwinge <thomas@codesourcery.com>
+ Ilya Verbin <ilya.verbin@intel.com>
+ Andrey Turetskiy <andrey.turetskiy@intel.com>
+
+ * Make-lang.in (c++.install-common): Do not install for the offload
+ compiler.
+
+2014-11-13 Kai Tietz <ktietz@redhat.com>
+
+ * cp-tree.h (cp_build_function_call): Remove prototype.
+ (cp_build_addr_expr_strict): Likewise.
+ (build_typed_address): Likewise.
+ * typeck.c (build_typed_address): Removed.
+ (cp_build_addr_expr_strict): Make static.
+ (cp_build_function_call): Likewise.
+
2014-11-12 Paolo Carlini <paolo.carlini@oracle.com>
DR 1510
diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
index 1c8fa668096..a58819a6e32 100644
--- a/gcc/cp/Make-lang.in
+++ b/gcc/cp/Make-lang.in
@@ -164,21 +164,23 @@ check_g++_parallelize = 10000
# Install the driver program as $(target)-g++ and $(target)-c++, and
# also as g++ and c++ if native.
c++.install-common: installdirs
- -rm -f $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext)
- -$(INSTALL_PROGRAM) xg++$(exeext) $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext)
- -chmod a+x $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext)
- -rm -f $(DESTDIR)$(bindir)/$(CXX_INSTALL_NAME)$(exeext)
- -( cd $(DESTDIR)$(bindir) && \
- $(LN) $(GXX_INSTALL_NAME)$(exeext) $(CXX_INSTALL_NAME)$(exeext) )
- -if [ -f cc1plus$(exeext) ] ; then \
- if [ ! -f g++-cross$(exeext) ] ; then \
- rm -f $(DESTDIR)$(bindir)/$(GXX_TARGET_INSTALL_NAME)$(exeext); \
- ( cd $(DESTDIR)$(bindir) && \
- $(LN) $(GXX_INSTALL_NAME)$(exeext) $(GXX_TARGET_INSTALL_NAME)$(exeext) ); \
- rm -f $(DESTDIR)$(bindir)/$(CXX_TARGET_INSTALL_NAME)$(exeext); \
- ( cd $(DESTDIR)$(bindir) && \
- $(LN) $(CXX_INSTALL_NAME)$(exeext) $(CXX_TARGET_INSTALL_NAME)$(exeext) ); \
- fi ; \
+ -if test "$(enable_as_accelerator)" != "yes" ; then \
+ rm -f $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
+ $(INSTALL_PROGRAM) xg++$(exeext) $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
+ chmod a+x $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
+ rm -f $(DESTDIR)$(bindir)/$(CXX_INSTALL_NAME)$(exeext); \
+ ( cd $(DESTDIR)$(bindir) && \
+ $(LN) $(GXX_INSTALL_NAME)$(exeext) $(CXX_INSTALL_NAME)$(exeext) ); \
+ if [ -f cc1plus$(exeext) ] ; then \
+ if [ ! -f g++-cross$(exeext) ] ; then \
+ rm -f $(DESTDIR)$(bindir)/$(GXX_TARGET_INSTALL_NAME)$(exeext); \
+ ( cd $(DESTDIR)$(bindir) && \
+ $(LN) $(GXX_INSTALL_NAME)$(exeext) $(GXX_TARGET_INSTALL_NAME)$(exeext) ); \
+ rm -f $(DESTDIR)$(bindir)/$(CXX_TARGET_INSTALL_NAME)$(exeext); \
+ ( cd $(DESTDIR)$(bindir) && \
+ $(LN) $(CXX_INSTALL_NAME)$(exeext) $(CXX_TARGET_INSTALL_NAME)$(exeext) ); \
+ fi ; \
+ fi; \
fi
# We can't use links because not everyone supports them. So just copy the
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index bf191cadfd4..4f0b1725da2 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -572,7 +572,7 @@ null_ptr_cst_p (tree t)
{
/* Core issue 903 says only literal 0 is a null pointer constant. */
if (cxx_dialect < cxx11)
- t = maybe_constant_value (fold_non_dependent_expr_sfinae (t, tf_none));
+ t = fold_non_dependent_expr (t);
STRIP_NOPS (t);
if (integer_zerop (t) && !TREE_OVERFLOW (t))
return true;
@@ -7437,8 +7437,8 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
return error_mark_node;
if (DECL_VINDEX (fn) && (flags & LOOKUP_NONVIRTUAL) == 0
- /* Don't mess with virtual lookup in fold_non_dependent_expr; virtual
- functions can't be constexpr. */
+ /* Don't mess with virtual lookup in instantiate_non_dependent_expr;
+ virtual functions can't be constexpr. */
&& !in_template_function ())
{
tree t;
@@ -9361,7 +9361,7 @@ perform_implicit_conversion_flags (tree type, tree expr,
type of non-dependent expressions, so we do not have to
perform the actual conversion. But for initializers, we
need to be able to perform it at instantiation
- (or fold_non_dependent_expr) time. */
+ (or instantiate_non_dependent_expr) time. */
expr = build1 (IMPLICIT_CONV_EXPR, type, expr);
if (!(flags & LOOKUP_ONLYCONVERTING))
IMPLICIT_CONV_EXPR_DIRECT_INIT (expr) = true;
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index ce1d07c90ef..c83c8adfab2 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -359,9 +359,9 @@ build_base_path (enum tree_code code,
/* Don't bother with the calculations inside sizeof; they'll ICE if the
source type is incomplete and the pointer value doesn't matter. In a
- template (even in fold_non_dependent_expr), we don't have vtables set
- up properly yet, and the value doesn't matter there either; we're just
- interested in the result of overload resolution. */
+ template (even in instantiate_non_dependent_expr), we don't have vtables
+ set up properly yet, and the value doesn't matter there either; we're
+ just interested in the result of overload resolution. */
if (cp_unevaluated_operand != 0
|| in_template_function ())
{
@@ -6933,7 +6933,8 @@ resolves_to_fixed_type_p (tree instance, int* nonnull)
tree fixed;
/* processing_template_decl can be false in a template if we're in
- fold_non_dependent_expr, but we still want to suppress this check. */
+ instantiate_non_dependent_expr, but we still want to suppress
+ this check. */
if (in_template_function ())
{
/* In a template we only care about the type of the result. */
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 3901e9a53da..d30bf635d84 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -2908,12 +2908,83 @@ maybe_constant_value (tree t, tree decl)
/* cp_tree_equal looks through NOPs, so allow them. */
gcc_assert (r == t
|| CONVERT_EXPR_P (t)
+ || TREE_CODE (t) == VIEW_CONVERT_EXPR
|| (TREE_CONSTANT (t) && !TREE_CONSTANT (r))
|| !cp_tree_equal (r, t));
#endif
return r;
}
+/* Like maybe_constant_value but first fully instantiate the argument.
+
+ Note: this is equivalent to instantiate_non_dependent_expr_sfinae
+ (t, tf_none) followed by maybe_constant_value but is more efficient,
+ because calls instantiation_dependent_expression_p and
+ potential_constant_expression at most once. */
+
+tree
+fold_non_dependent_expr (tree t)
+{
+ if (t == NULL_TREE)
+ return NULL_TREE;
+
+ /* If we're in a template, but T isn't value dependent, simplify
+ it. We're supposed to treat:
+
+ template <typename T> void f(T[1 + 1]);
+ template <typename T> void f(T[2]);
+
+ as two declarations of the same function, for example. */
+ if (processing_template_decl)
+ {
+ if (!instantiation_dependent_expression_p (t)
+ && potential_constant_expression (t))
+ {
+ HOST_WIDE_INT saved_processing_template_decl;
+
+ saved_processing_template_decl = processing_template_decl;
+ processing_template_decl = 0;
+ t = tsubst_copy_and_build (t,
+ /*args=*/NULL_TREE,
+ tf_none,
+ /*in_decl=*/NULL_TREE,
+ /*function_p=*/false,
+ /*integral_constant_expression_p=*/true);
+ processing_template_decl = saved_processing_template_decl;
+
+ if (type_unknown_p (t)
+ || BRACE_ENCLOSED_INITIALIZER_P (t))
+ {
+ if (TREE_OVERFLOW_P (t))
+ {
+ t = build_nop (TREE_TYPE (t), t);
+ TREE_CONSTANT (t) = false;
+ }
+ return t;
+ }
+
+ tree r = cxx_eval_outermost_constant_expr (t, true, NULL_TREE);
+#ifdef ENABLE_CHECKING
+ /* cp_tree_equal looks through NOPs, so allow them. */
+ gcc_assert (r == t
+ || CONVERT_EXPR_P (t)
+ || TREE_CODE (t) == VIEW_CONVERT_EXPR
+ || (TREE_CONSTANT (t) && !TREE_CONSTANT (r))
+ || !cp_tree_equal (r, t));
+#endif
+ return r;
+ }
+ else if (TREE_OVERFLOW_P (t))
+ {
+ t = build_nop (TREE_TYPE (t), t);
+ TREE_CONSTANT (t) = false;
+ }
+ return t;
+ }
+
+ return maybe_constant_value (t);
+}
+
/* Like maybe_constant_value, but returns a CONSTRUCTOR directly, rather
than wrapped in a TARGET_EXPR. */
@@ -3386,7 +3457,7 @@ potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags)
if (!potential_constant_expression_1 (denom, rval, flags))
return false;
/* We can't call cxx_eval_outermost_constant_expr on an expression
- that hasn't been through fold_non_dependent_expr yet. */
+ that hasn't been through instantiate_non_dependent_expr yet. */
if (!processing_template_decl)
denom = cxx_eval_outermost_constant_expr (denom, true);
if (integer_zerop (denom))
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 82243609870..b69c7369589 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -5690,8 +5690,8 @@ extern tree template_for_substitution (tree);
extern tree build_non_dependent_expr (tree);
extern void make_args_non_dependent (vec<tree, va_gc> *);
extern bool reregister_specialization (tree, tree, tree);
-extern tree fold_non_dependent_expr (tree);
-extern tree fold_non_dependent_expr_sfinae (tree, tsubst_flags_t);
+extern tree instantiate_non_dependent_expr (tree);
+extern tree instantiate_non_dependent_expr_sfinae (tree, tsubst_flags_t);
extern bool alias_type_or_template_p (tree);
extern bool alias_template_specialization_p (const_tree);
extern bool dependent_alias_template_spec_p (const_tree);
@@ -6136,7 +6136,6 @@ extern tree build_array_ref (location_t, tree, tree);
extern tree cp_build_array_ref (location_t, tree, tree,
tsubst_flags_t);
extern tree get_member_function_from_ptrfunc (tree *, tree, tsubst_flags_t);
-extern tree cp_build_function_call (tree, tree, tsubst_flags_t);
extern tree cp_build_function_call_nary (tree, tsubst_flags_t, ...)
ATTRIBUTE_SENTINEL;
extern tree cp_build_function_call_vec (tree, vec<tree, va_gc> **,
@@ -6152,7 +6151,6 @@ extern tree build_x_unary_op (location_t,
enum tree_code, tree,
tsubst_flags_t);
extern tree cp_build_addr_expr (tree, tsubst_flags_t);
-extern tree cp_build_addr_expr_strict (tree, tsubst_flags_t);
extern tree cp_build_unary_op (enum tree_code, tree, int,
tsubst_flags_t);
extern tree unary_complex_lvalue (enum tree_code, tree);
@@ -6212,7 +6210,6 @@ extern tree build_x_vec_perm_expr (location_t,
extern tree build_simple_component_ref (tree, tree);
extern tree build_ptrmemfunc_access_expr (tree, tree);
extern tree build_address (tree);
-extern tree build_typed_address (tree, tree);
extern tree build_nop (tree, tree);
extern tree non_reference (tree);
extern tree lookup_anon_field (tree, tree);
@@ -6334,6 +6331,7 @@ extern bool require_potential_rvalue_constant_expression (tree);
extern tree cxx_constant_value (tree, tree = NULL_TREE);
extern tree maybe_constant_value (tree, tree = NULL_TREE);
extern tree maybe_constant_init (tree, tree = NULL_TREE);
+extern tree fold_non_dependent_expr (tree);
extern bool is_sub_constant_expr (tree);
extern bool reduced_constant_expression_p (tree);
extern bool is_instantiation_of_constexpr (tree);
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 9ca32e37d95..1ef97637426 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -8356,7 +8356,7 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain)
NOP_EXPR with TREE_SIDE_EFFECTS; don't fold in that case. */;
else
{
- size = fold_non_dependent_expr_sfinae (size, complain);
+ size = instantiate_non_dependent_expr_sfinae (size, complain);
if (CLASS_TYPE_P (type)
&& CLASSTYPE_LITERAL_P (type))
@@ -12999,6 +12999,11 @@ build_enumerator (tree name, tree value, tree enumtype, location_t loc)
tree context;
tree type;
+ /* integral_constant_value will pull out this expression, so make sure
+ it's folded as appropriate. */
+ if (processing_template_decl)
+ value = fold_non_dependent_expr (value);
+
/* If the VALUE was erroneous, pretend it wasn't there; that will
result in the enum being assigned the next value in sequence. */
if (value == error_mark_node)
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index ff407101f08..1b686ef95ae 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -4951,7 +4951,7 @@ mark_used (tree decl, tsubst_flags_t complain)
if (processing_template_decl)
return true;
- /* Check this too in case we're within fold_non_dependent_expr. */
+ /* Check this too in case we're within instantiate_non_dependent_expr. */
if (DECL_TEMPLATE_INFO (decl)
&& uses_template_parms (DECL_TI_ARGS (decl)))
return true;
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 048c957519b..576ad1d1978 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -609,7 +609,7 @@ find_substitution (tree node)
}
tree tags = NULL_TREE;
- if (OVERLOAD_TYPE_P (node))
+ if (OVERLOAD_TYPE_P (node) || DECL_CLASS_TEMPLATE_P (node))
tags = lookup_attribute ("abi_tag", TYPE_ATTRIBUTES (type));
/* Now check the list of available substitutions for this mangling
operation. */
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 93520bc4ecf..3ab65a91556 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -6886,7 +6886,7 @@ cp_parser_parenthesized_expression_list (cp_parser* parser,
}
if (fold_expr_p)
- expr = fold_non_dependent_expr (expr);
+ expr = instantiate_non_dependent_expr (expr);
/* If we have an ellipsis, then this is an expression
expansion. */
@@ -15996,10 +15996,6 @@ cp_parser_enumerator_definition (cp_parser* parser, tree type)
if (check_for_bare_parameter_packs (value))
value = error_mark_node;
- /* integral_constant_value will pull out this expression, so make sure
- it's folded as appropriate. */
- value = fold_non_dependent_expr (value);
-
/* Create the enumerator. */
build_enumerator (identifier, value, type, loc);
}
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index f408680abbf..1ee3dc11906 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -5216,7 +5216,7 @@ redeclare_class_template (tree type, tree parms)
(possibly simplified) expression. */
tree
-fold_non_dependent_expr_sfinae (tree expr, tsubst_flags_t complain)
+instantiate_non_dependent_expr_sfinae (tree expr, tsubst_flags_t complain)
{
if (expr == NULL_TREE)
return NULL_TREE;
@@ -5248,9 +5248,9 @@ fold_non_dependent_expr_sfinae (tree expr, tsubst_flags_t complain)
}
tree
-fold_non_dependent_expr (tree expr)
+instantiate_non_dependent_expr (tree expr)
{
- return fold_non_dependent_expr_sfinae (expr, tf_error);
+ return instantiate_non_dependent_expr_sfinae (expr, tf_error);
}
/* Return TRUE iff T is a type alias, a TEMPLATE_DECL for an alias
@@ -5740,7 +5740,7 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain)
&& has_value_dependent_address (expr))
/* If we want the address and it's value-dependent, don't fold. */;
else if (!type_unknown_p (expr))
- expr = fold_non_dependent_expr_sfinae (expr, complain);
+ expr = instantiate_non_dependent_expr_sfinae (expr, complain);
if (error_operand_p (expr))
return error_mark_node;
expr_type = TREE_TYPE (expr);
@@ -8314,7 +8314,7 @@ uses_template_parms (tree t)
/* Returns true iff current_function_decl is an incompletely instantiated
template. Useful instead of processing_template_decl because the latter
- is set to 0 during fold_non_dependent_expr. */
+ is set to 0 during instantiate_non_dependent_expr. */
bool
in_template_function (void)
@@ -15138,8 +15138,7 @@ tsubst_copy_and_build (tree t,
case COND_EXPR:
{
tree cond = RECUR (TREE_OPERAND (t, 0));
- tree folded_cond = (maybe_constant_value
- (fold_non_dependent_expr_sfinae (cond, tf_none)));
+ tree folded_cond = fold_non_dependent_expr (cond);
tree exp1, exp2;
if (TREE_CODE (folded_cond) == INTEGER_CST)
@@ -21110,7 +21109,7 @@ value_dependent_expression_p (tree expression)
case STMT_EXPR:
/* Treat a GNU statement expression as dependent to avoid crashing
- under fold_non_dependent_expr; it can't be constant. */
+ under instantiate_non_dependent_expr; it can't be constant. */
return true;
default:
@@ -21864,7 +21863,7 @@ build_non_dependent_expr (tree expr)
/* Try to get a constant value for all non-dependent expressions in
order to expose bugs in *_dependent_expression_p and constexpr. */
if (cxx_dialect >= cxx11)
- maybe_constant_value (fold_non_dependent_expr_sfinae (expr, tf_none));
+ fold_non_dependent_expr (expr);
#endif
/* Preserve OVERLOADs; the functions must be available to resolve
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index ebd9a43b949..6888121d5d0 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -511,8 +511,7 @@ begin_maybe_infinite_loop (tree cond)
bool maybe_infinite = true;
if (cond)
{
- cond = fold_non_dependent_expr_sfinae (cond, tf_none);
- cond = maybe_constant_value (cond);
+ cond = fold_non_dependent_expr (cond);
maybe_infinite = integer_nonzerop (cond);
}
vec_safe_push (cp_function_chain->infinite_loops,
@@ -543,7 +542,6 @@ end_maybe_infinite_loop (tree cond)
if (current != NULL_TREE)
{
cond = fold_non_dependent_expr (cond);
- cond = maybe_constant_value (cond);
if (integer_nonzerop (cond))
current_function_infinite_loop = 1;
}
@@ -7043,7 +7041,7 @@ finish_static_assert (tree condition, tree message, location_t location,
}
/* Fold the expression and convert it to a boolean value. */
- condition = fold_non_dependent_expr (condition);
+ condition = instantiate_non_dependent_expr (condition);
condition = cp_convert (boolean_type_node, condition, tf_warning_or_error);
condition = maybe_constant_value (condition);
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index e0c2af1576c..21cecc2e39c 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -4143,7 +4143,7 @@ fold_if_not_in_template (tree expr)
/* In the body of a template, there is never any need to call
"fold". We will call fold later when actually instantiating the
template. Integral constant expressions in templates will be
- evaluated via fold_non_dependent_expr, as necessary. */
+ evaluated via instantiate_non_dependent_expr, as necessary. */
if (processing_template_decl)
return expr;
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 1f443ef0b1d..05bc916cdc7 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -42,6 +42,8 @@ along with GCC; see the file COPYING3. If not see
#include "c-family/c-ubsan.h"
#include "params.h"
+static tree cp_build_addr_expr_strict (tree, tsubst_flags_t);
+static tree cp_build_function_call (tree, tree, tsubst_flags_t);
static tree pfn_from_ptrmemfunc (tree);
static tree delta_from_ptrmemfunc (tree);
static tree convert_for_assignment (tree, tree, impl_conv_rhs, tree, int,
@@ -1785,7 +1787,7 @@ cxx_alignas_expr (tree e)
/* Leave value-dependent expression alone for now. */
return e;
- e = fold_non_dependent_expr (e);
+ e = instantiate_non_dependent_expr (e);
e = mark_rvalue_use (e);
/* [dcl.align]/2 says:
@@ -3400,7 +3402,7 @@ build_function_call_vec (location_t /*loc*/, vec<location_t> /*arg_loc*/,
/* Build a function call using a tree list of arguments. */
-tree
+static tree
cp_build_function_call (tree function, tree params, tsubst_flags_t complain)
{
vec<tree, va_gc> *vec;
@@ -4133,8 +4135,7 @@ cp_build_binary_op (location_t location,
|| code1 == COMPLEX_TYPE || code1 == VECTOR_TYPE))
{
enum tree_code tcode0 = code0, tcode1 = code1;
- tree cop1 = fold_non_dependent_expr_sfinae (op1, tf_none);
- cop1 = maybe_constant_value (cop1);
+ tree cop1 = fold_non_dependent_expr (op1);
doing_div_or_mod = true;
warn_for_div_by_zero (location, cop1);
@@ -4173,8 +4174,7 @@ cp_build_binary_op (location_t location,
case TRUNC_MOD_EXPR:
case FLOOR_MOD_EXPR:
{
- tree cop1 = fold_non_dependent_expr_sfinae (op1, tf_none);
- cop1 = maybe_constant_value (cop1);
+ tree cop1 = fold_non_dependent_expr (op1);
doing_div_or_mod = true;
warn_for_div_by_zero (location, cop1);
}
@@ -4268,8 +4268,7 @@ cp_build_binary_op (location_t location,
}
else if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE)
{
- tree const_op1 = fold_non_dependent_expr_sfinae (op1, tf_none);
- const_op1 = maybe_constant_value (const_op1);
+ tree const_op1 = fold_non_dependent_expr (op1);
if (TREE_CODE (const_op1) != INTEGER_CST)
const_op1 = op1;
result_type = type0;
@@ -4318,8 +4317,7 @@ cp_build_binary_op (location_t location,
}
else if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE)
{
- tree const_op1 = fold_non_dependent_expr_sfinae (op1, tf_none);
- const_op1 = maybe_constant_value (const_op1);
+ tree const_op1 = fold_non_dependent_expr (op1);
if (TREE_CODE (const_op1) != INTEGER_CST)
const_op1 = op1;
result_type = type0;
@@ -4991,10 +4989,8 @@ cp_build_binary_op (location_t location,
/* OP0 and/or OP1 might have side-effects. */
op0 = cp_save_expr (op0);
op1 = cp_save_expr (op1);
- op0 = maybe_constant_value (fold_non_dependent_expr_sfinae (op0,
- tf_none));
- op1 = maybe_constant_value (fold_non_dependent_expr_sfinae (op1,
- tf_none));
+ op0 = fold_non_dependent_expr (op0);
+ op1 = fold_non_dependent_expr (op1);
if (doing_div_or_mod && (flag_sanitize & (SANITIZE_DIVIDE
| SANITIZE_FLOAT_DIVIDE)))
{
@@ -5322,19 +5318,6 @@ build_address (tree t)
return t;
}
-/* Returns the address of T with type TYPE. */
-
-tree
-build_typed_address (tree t, tree type)
-{
- if (error_operand_p (t) || !cxx_mark_addressable (t))
- return error_mark_node;
- t = build_fold_addr_expr_with_type (t, type);
- if (TREE_CODE (t) != ADDR_EXPR)
- t = rvalue (t);
- return t;
-}
-
/* Return a NOP_EXPR converting EXPR to TYPE. */
tree
@@ -5628,7 +5611,7 @@ cp_build_addr_expr (tree arg, tsubst_flags_t complain)
/* Take the address of ARG, but only if it's an lvalue. */
-tree
+static tree
cp_build_addr_expr_strict (tree arg, tsubst_flags_t complain)
{
return cp_build_addr_expr_1 (arg, 1, complain);
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index d57f75dadc5..01a0671341e 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -797,7 +797,7 @@ store_init_value (tree decl, tree init, vec<tree, va_gc>** cleanups, int flags)
if (decl_maybe_constant_var_p (decl) || TREE_STATIC (decl))
{
bool const_init;
- value = fold_non_dependent_expr (value);
+ value = instantiate_non_dependent_expr (value);
if (DECL_DECLARED_CONSTEXPR_P (decl)
|| DECL_IN_AGGR_P (decl))
{
@@ -872,7 +872,7 @@ check_narrowing (tree type, tree init, tsubst_flags_t complain)
return ok;
}
- init = maybe_constant_value (fold_non_dependent_expr_sfinae (init, tf_none));
+ init = fold_non_dependent_expr (init);
if (TREE_CODE (type) == INTEGER_TYPE
&& TREE_CODE (ftype) == REAL_TYPE)
@@ -1176,7 +1176,7 @@ massage_init_elt (tree type, tree init, tsubst_flags_t complain)
init = TARGET_EXPR_INITIAL (init);
/* When we defer constant folding within a statement, we may want to
defer this folding as well. */
- tree t = fold_non_dependent_expr_sfinae (init, complain);
+ tree t = fold_non_dependent_expr (init);
t = maybe_constant_init (t);
if (TREE_CONSTANT (t))
init = t;
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index f314cf20978..e9ea4a2fbc4 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -1795,6 +1795,15 @@ static data members and inline function local statics. Enabled by
default for a toolchain with an assembler that accepts it and
GLIBC 2.11 or above, otherwise disabled.
+@item --with-diagnostics-color=@var{choice}
+Tells GCC to use @var{choice} as the default for @option{-fdiagnostics-color=}
+option (if not used explicitly on the command line). @var{choice}
+can be one of @samp{never}, @samp{auto}, @samp{always}, and @samp{auto-if-env}
+where @samp{auto} is the default. @samp{auto-if-env} means that
+@option{-fdiagnostics-color=auto} will be the default if @code{GCC_COLORS}
+is present and non-empty in the environment, and
+@option{-fdiagnostics-color=never} otherwise.
+
@item --enable-lto
@itemx --disable-lto
Enable support for link-time optimization (LTO). This is enabled by
@@ -1845,6 +1854,20 @@ If GCC is configured with some multilibs that use glibc and some that
do not, this option applies only to the multilibs that use glibc.
However, such configurations may not work well as not all the relevant
configuration in GCC is on a per-multilib basis.
+
+@item --enable-as-accelerator-for=@var{target}
+Build as offload target compiler. Specify offload host triple by @var{target}.
+
+@item --enable-offload-targets=@var{target1}[=@var{path1}],@dots{},@var{targetN}[=@var{pathN}]
+Enable offloading to targets @var{target1}, @dots{}, @var{targetN}.
+Offload compilers are expected to be already installed. Default search
+path for them is @file{@var{exec-prefix}}, but it can be changed by
+specifying paths @var{path1}, @dots{}, @var{pathN}.
+
+@smallexample
+% @var{srcdir}/configure \
+ --enable-offload-target=i686-unknown-linux-gnu=/path/to/i686/compiler,x86_64-pc-linux-gnu
+@end smallexample
@end table
@subheading Cross-Compiler-Specific Options
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index b70ecf00bd6..9846a73079d 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -392,7 +392,7 @@ Objective-C and Objective-C++ Dialects}.
-fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
-fivopts -fkeep-inline-functions -fkeep-static-consts -flive-range-shrinkage @gol
-floop-block -floop-interchange -floop-strip-mine -floop-nest-optimize @gol
--floop-parallelize-all -flto -flto-compression-level @gol
+-floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
-flto-partition=@var{alg} -flto-report -flto-report-wpa -fmerge-all-constants @gol
-fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
-fmove-loop-invariants -fno-branch-count-reg @gol
@@ -406,7 +406,7 @@ Objective-C and Objective-C++ Dialects}.
-fprofile-correction -fprofile-dir=@var{path} -fprofile-generate @gol
-fprofile-generate=@var{path} @gol
-fprofile-use -fprofile-use=@var{path} -fprofile-values -fprofile-reorder-functions @gol
--freciprocal-math -free -frename-registers -freorder-blocks @gol
+-freciprocal-math -free -frename-registers -fschedule-fusion -freorder-blocks @gol
-freorder-blocks-and-partition -freorder-functions @gol
-frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
-frounding-math -fsched2-use-superblocks -fsched-pressure @gol
@@ -3106,8 +3106,10 @@ a message which is too long to fit on a single line.
@cindex highlight, color, colour
@vindex GCC_COLORS @r{environment variable}
Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
-or @samp{auto}. The default is @samp{never} if @env{GCC_COLORS} environment
-variable isn't present in the environment, and @samp{auto} otherwise.
+or @samp{auto}. The default depends on how the compiler has been configured,
+it can be any of the above @var{WHEN} options or also @samp{never}
+if @env{GCC_COLORS} environment variable isn't present in the environment,
+and @samp{auto} otherwise.
@samp{auto} means to use color only when the standard error is a terminal.
The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
aliases for @option{-fdiagnostics-color=always} and
@@ -7185,6 +7187,7 @@ also turns on the following optimization flags:
-fipa-sra @gol
-fipa-icf @gol
-fisolate-erroneous-paths-dereference @gol
+-flra-remat @gol
-foptimize-sibling-calls @gol
-foptimize-strlen @gol
-fpartial-inlining @gol
@@ -7813,6 +7816,14 @@ Control the verbosity of the dump file for the integrated register allocator.
The default value is 5. If the value @var{n} is greater or equal to 10,
the dump output is sent to stderr using the same format as @var{n} minus 10.
+@item -flra-remat
+@opindex fcaller-saves
+Enable CFG-sensitive rematerialization in LRA. Instead of loading
+values of spilled pseudos, LRA tries to rematerialize (recalculate)
+values if it is profitable.
+
+Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
+
@item -fdelayed-branch
@opindex fdelayed-branch
If supported for the target machine, attempt to reorder instructions
@@ -9568,6 +9579,14 @@ a ``home register''.
Enabled by default with @option{-funroll-loops} and @option{-fpeel-loops}.
+@item -fschedule-fusion
+@opindex fschedule-fusion
+Performs a target dependent pass over the instruction stream to schedule
+instructions of same type together because target machine can execute them
+more efficiently if they are adjacent to each other in the instruction flow.
+
+Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
+
@item -ftracer
@opindex ftracer
Perform tail duplication to enlarge superblock size. This transformation
diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
index 6404147579e..b8e5ac522b7 100644
--- a/gcc/doc/md.texi
+++ b/gcc/doc/md.texi
@@ -4798,7 +4798,7 @@ of a wider mode.)
@cindex @code{vec_shr_@var{m}} instruction pattern
@item @samp{vec_shr_@var{m}}
-Whole vector right shift in bits.
+Whole vector right shift in bits, i.e. towards element 0.
Operand 1 is a vector to be shifted.
Operand 2 is an integer shift amount in bits.
Operand 0 is where the resulting shifted vector is stored.
diff --git a/gcc/doc/passes.texi b/gcc/doc/passes.texi
index 0ab8f21caec..090eb0a6cbc 100644
--- a/gcc/doc/passes.texi
+++ b/gcc/doc/passes.texi
@@ -911,10 +911,10 @@ Source files are @file{reload.c} and @file{reload1.c}, plus the header
This pass is a modern replacement of the reload pass. Source files
are @file{lra.c}, @file{lra-assign.c}, @file{lra-coalesce.c},
@file{lra-constraints.c}, @file{lra-eliminations.c},
-@file{lra-equivs.c}, @file{lra-lives.c}, @file{lra-saves.c},
-@file{lra-spills.c}, the header @file{lra-int.h} used for
-communication between them, and the header @file{lra.h} used for
-communication between LRA and the rest of compiler.
+@file{lra-lives.c}, @file{lra-remat.c}, @file{lra-spills.c}, the
+header @file{lra-int.h} used for communication between them, and the
+header @file{lra.h} used for communication between LRA and the rest of
+compiler.
Unlike the reload pass, intermediate LRA decisions are reflected in
RTL as much as possible. This reduces the number of target-dependent
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 33a5a9744e5..8d137f5cf1e 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -5941,10 +5941,11 @@ for comparisons whose argument is a @code{plus}:
@smallexample
#define SELECT_CC_MODE(OP,X,Y) \
- (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
- ? ((OP == EQ || OP == NE) ? CCFPmode : CCFPEmode) \
- : ((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS \
- || GET_CODE (X) == NEG) \
+ (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
+ ? ((OP == LT || OP == LE || OP == GT || OP == GE) \
+ ? CCFPEmode : CCFPmode) \
+ : ((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS \
+ || GET_CODE (X) == NEG || GET_CODE (x) == ASHIFT) \
? CC_NOOVmode : CCmode))
@end smallexample
@@ -5987,10 +5988,11 @@ then @code{REVERSIBLE_CC_MODE (@var{mode})} must be zero.
You need not define this macro if it would always returns zero or if the
floating-point format is anything other than @code{IEEE_FLOAT_FORMAT}.
For example, here is the definition used on the SPARC, where floating-point
-inequality comparisons are always given @code{CCFPEmode}:
+inequality comparisons are given either @code{CCFPEmode} or @code{CCFPmode}:
@smallexample
-#define REVERSIBLE_CC_MODE(MODE) ((MODE) != CCFPEmode)
+#define REVERSIBLE_CC_MODE(MODE) \
+ ((MODE) != CCFPEmode && (MODE) != CCFPmode)
@end smallexample
@end defmac
@@ -6000,7 +6002,7 @@ comparison done in CC_MODE @var{mode}. The macro is used only in case
@code{REVERSIBLE_CC_MODE (@var{mode})} is nonzero. Define this macro in case
machine has some non-standard way how to reverse certain conditionals. For
instance in case all floating point conditions are non-trapping, compiler may
-freely convert unordered compares to ordered one. Then definition may look
+freely convert unordered compares to ordered ones. Then definition may look
like:
@smallexample
@@ -6769,6 +6771,76 @@ This hook is called by tree reassociator to determine a level of
parallelism required in output calculations chain.
@end deftypefn
+@deftypefn {Target Hook} void TARGET_SCHED_FUSION_PRIORITY (rtx_insn *@var{insn}, int @var{max_pri}, int *@var{fusion_pri}, int *@var{pri})
+This hook is called by scheduling fusion pass. It calculates fusion
+priorities for each instruction passed in by parameter. The priorities
+are returned via pointer parameters.
+
+@var{insn} is the instruction whose priorities need to be calculated.
+@var{max_pri} is the maximum priority can be returned in any cases.
+@var{fusion_pri} is the pointer parameter through which @var{insn}'s
+fusion priority should be calculated and returned.
+@var{pri} is the pointer parameter through which @var{insn}'s priority
+should be calculated and returned.
+
+Same @var{fusion_pri} should be returned for instructions which should
+be scheduled together. Different @var{pri} should be returned for
+instructions with same @var{fusion_pri}. @var{fusion_pri} is the major
+sort key, @var{pri} is the minor sort key. All instructions will be
+scheduled according to the two priorities. All priorities calculated
+should be between 0 (exclusive) and @var{max_pri} (inclusive). To avoid
+false dependencies, @var{fusion_pri} of instructions which need to be
+scheduled together should be smaller than @var{fusion_pri} of irrelevant
+instructions.
+
+Given below example:
+
+ ldr r10, [r1, 4]
+ add r4, r4, r10
+ ldr r15, [r2, 8]
+ sub r5, r5, r15
+ ldr r11, [r1, 0]
+ add r4, r4, r11
+ ldr r16, [r2, 12]
+ sub r5, r5, r16
+
+On targets like ARM/AArch64, the two pairs of consecutive loads should be
+merged. Since peephole2 pass can't help in this case unless consecutive
+loads are actually next to each other in instruction flow. That's where
+this scheduling fusion pass works. This hook calculates priority for each
+instruction based on its fustion type, like:
+
+ ldr r10, [r1, 4] ; fusion_pri=99, pri=96
+ add r4, r4, r10 ; fusion_pri=100, pri=100
+ ldr r15, [r2, 8] ; fusion_pri=98, pri=92
+ sub r5, r5, r15 ; fusion_pri=100, pri=100
+ ldr r11, [r1, 0] ; fusion_pri=99, pri=100
+ add r4, r4, r11 ; fusion_pri=100, pri=100
+ ldr r16, [r2, 12] ; fusion_pri=98, pri=88
+ sub r5, r5, r16 ; fusion_pri=100, pri=100
+
+Scheduling fusion pass then sorts all ready to issue instructions according
+to the priorities. As a result, instructions of same fusion type will be
+pushed together in instruction flow, like:
+
+ ldr r11, [r1, 0]
+ ldr r10, [r1, 4]
+ ldr r15, [r2, 8]
+ ldr r16, [r2, 12]
+ add r4, r4, r10
+ sub r5, r5, r15
+ add r4, r4, r11
+ sub r5, r5, r16
+
+Now peephole2 pass can simply merge the two pairs of loads.
+
+Since scheduling fusion pass relies on peephole2 to do real fusion
+work, it is only enabled by default when peephole2 is in effect.
+
+This is firstly introduced on ARM/AArch64 targets, please refer to
+the hook implementation for how different fusion types are supported.
+@end deftypefn
+
@node Sections
@section Dividing the Output into Sections (Texts, Data, @dots{})
@c the above section title is WAY too long. maybe cut the part between
@@ -11394,6 +11466,21 @@ If defined, this function returns an appropriate alignment in bits for an atomic
ISO C11 requires atomic compound assignments that may raise floating-point exceptions to raise exceptions corresponding to the arithmetic operation whose result was successfully stored in a compare-and-exchange sequence. This requires code equivalent to calls to @code{feholdexcept}, @code{feclearexcept} and @code{feupdateenv} to be generated at appropriate points in the compare-and-exchange sequence. This hook should set @code{*@var{hold}} to an expression equivalent to the call to @code{feholdexcept}, @code{*@var{clear}} to an expression equivalent to the call to @code{feclearexcept} and @code{*@var{update}} to an expression equivalent to the call to @code{feupdateenv}. The three expressions are @code{NULL_TREE} on entry to the hook and may be left as @code{NULL_TREE} if no code is required in a particular place. The default implementation leaves all three expressions as @code{NULL_TREE}. The @code{__atomic_feraiseexcept} function from @code{libatomic} may be of use as part of the code generated in @code{*@var{update}}.
@end deftypefn
+@deftypefn {Target Hook} void TARGET_RECORD_OFFLOAD_SYMBOL (tree)
+Used when offloaded functions are seen in the compilation unit and no named
+sections are available. It is called once for each symbol that must be
+recorded in the offload function and variable table.
+@end deftypefn
+
+@deftypefn {Target Hook} {char *} TARGET_OFFLOAD_OPTIONS (void)
+Used when writing out the list of options into an LTO file. It should
+translate any relevant target-specific options (such as the ABI in use)
+into one of the @option{-foffload} options that exist as a common interface
+to express such options. It should return a string containing these options,
+separated by spaces, which the caller will free.
+
+@end deftypefn
+
@defmac TARGET_SUPPORTS_WIDE_INT
On older ports, large integers are stored in @code{CONST_DOUBLE} rtl
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 068aa31ba32..7c58a323c6d 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -4441,10 +4441,11 @@ for comparisons whose argument is a @code{plus}:
@smallexample
#define SELECT_CC_MODE(OP,X,Y) \
- (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
- ? ((OP == EQ || OP == NE) ? CCFPmode : CCFPEmode) \
- : ((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS \
- || GET_CODE (X) == NEG) \
+ (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
+ ? ((OP == LT || OP == LE || OP == GT || OP == GE) \
+ ? CCFPEmode : CCFPmode) \
+ : ((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS \
+ || GET_CODE (X) == NEG || GET_CODE (x) == ASHIFT) \
? CC_NOOVmode : CCmode))
@end smallexample
@@ -4467,10 +4468,11 @@ then @code{REVERSIBLE_CC_MODE (@var{mode})} must be zero.
You need not define this macro if it would always returns zero or if the
floating-point format is anything other than @code{IEEE_FLOAT_FORMAT}.
For example, here is the definition used on the SPARC, where floating-point
-inequality comparisons are always given @code{CCFPEmode}:
+inequality comparisons are given either @code{CCFPEmode} or @code{CCFPmode}:
@smallexample
-#define REVERSIBLE_CC_MODE(MODE) ((MODE) != CCFPEmode)
+#define REVERSIBLE_CC_MODE(MODE) \
+ ((MODE) != CCFPEmode && (MODE) != CCFPmode)
@end smallexample
@end defmac
@@ -4480,7 +4482,7 @@ comparison done in CC_MODE @var{mode}. The macro is used only in case
@code{REVERSIBLE_CC_MODE (@var{mode})} is nonzero. Define this macro in case
machine has some non-standard way how to reverse certain conditionals. For
instance in case all floating point conditions are non-trapping, compiler may
-freely convert unordered compares to ordered one. Then definition may look
+freely convert unordered compares to ordered ones. Then definition may look
like:
@smallexample
@@ -4809,6 +4811,8 @@ them: try the first ones in this list first.
@hook TARGET_SCHED_REASSOCIATION_WIDTH
+@hook TARGET_SCHED_FUSION_PRIORITY
+
@node Sections
@section Dividing the Output into Sections (Texts, Data, @dots{})
@c the above section title is WAY too long. maybe cut the part between
@@ -8167,6 +8171,10 @@ and the associated definitions of those functions.
@hook TARGET_ATOMIC_ASSIGN_EXPAND_FENV
+@hook TARGET_RECORD_OFFLOAD_SYMBOL
+
+@hook TARGET_OFFLOAD_OPTIONS
+
@defmac TARGET_SUPPORTS_WIDE_INT
On older ports, large integers are stored in @code{CONST_DOUBLE} rtl
diff --git a/gcc/expr.c b/gcc/expr.c
index 2e7f839f316..930549f8a46 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -9142,12 +9142,6 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode,
return temp;
}
- case VEC_RSHIFT_EXPR:
- {
- target = expand_vec_shift_expr (ops, target);
- return target;
- }
-
case VEC_UNPACK_HI_EXPR:
case VEC_UNPACK_LO_EXPR:
{
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 4321b1ea1d2..7dbbadd859b 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -121,7 +121,6 @@ static enum tree_code compcode_to_comparison (enum comparison_code);
static int operand_equal_for_comparison_p (tree, tree, tree);
static int twoval_comparison_p (tree, tree *, tree *, int *);
static tree eval_subst (location_t, tree, tree, tree, tree, tree);
-static tree pedantic_omit_one_operand_loc (location_t, tree, tree, tree);
static tree distribute_bit_expr (location_t, enum tree_code, tree, tree, tree);
static tree make_bit_field_ref (location_t, tree, tree,
HOST_WIDE_INT, HOST_WIDE_INT, int);
@@ -131,7 +130,6 @@ static tree decode_field_reference (location_t, tree, HOST_WIDE_INT *,
HOST_WIDE_INT *,
machine_mode *, int *, int *,
tree *, tree *);
-static tree sign_bit_p (tree, const_tree);
static int simple_operand_p (const_tree);
static bool simple_operand_p_2 (tree);
static tree range_binop (enum tree_code, tree, tree, int, tree, int);
@@ -556,7 +554,8 @@ fold_negate_expr (location_t loc, tree t)
case INTEGER_CST:
tem = fold_negate_const (t, type);
if (TREE_OVERFLOW (tem) == TREE_OVERFLOW (t)
- || !TYPE_OVERFLOW_TRAPS (type))
+ || (!TYPE_OVERFLOW_TRAPS (type)
+ && (flag_sanitize & SANITIZE_SI_OVERFLOW) == 0))
return tem;
break;
@@ -613,7 +612,9 @@ fold_negate_expr (location_t loc, tree t)
break;
case NEGATE_EXPR:
- return TREE_OPERAND (t, 0);
+ if (!TYPE_OVERFLOW_SANITIZED (type))
+ return TREE_OPERAND (t, 0);
+ break;
case PLUS_EXPR:
if (!HONOR_SIGN_DEPENDENT_ROUNDING (TYPE_MODE (type))
@@ -1419,44 +1420,17 @@ const_binop (enum tree_code code, tree arg1, tree arg2)
int count = TYPE_VECTOR_SUBPARTS (type), i;
tree *elts = XALLOCAVEC (tree, count);
- if (code == VEC_RSHIFT_EXPR)
+ for (i = 0; i < count; i++)
{
- if (!tree_fits_uhwi_p (arg2))
- return NULL_TREE;
+ tree elem1 = VECTOR_CST_ELT (arg1, i);
- unsigned HOST_WIDE_INT shiftc = tree_to_uhwi (arg2);
- unsigned HOST_WIDE_INT outerc = tree_to_uhwi (TYPE_SIZE (type));
- unsigned HOST_WIDE_INT innerc
- = tree_to_uhwi (TYPE_SIZE (TREE_TYPE (type)));
- if (shiftc >= outerc || (shiftc % innerc) != 0)
+ elts[i] = const_binop (code, elem1, arg2);
+
+ /* It is possible that const_binop cannot handle the given
+ code and return NULL_TREE. */
+ if (elts[i] == NULL_TREE)
return NULL_TREE;
- int offset = shiftc / innerc;
- /* The direction of VEC_RSHIFT_EXPR is endian dependent.
- For reductions, if !BYTES_BIG_ENDIAN then compiler picks first
- vector element, but last element if BYTES_BIG_ENDIAN. */
- if (BYTES_BIG_ENDIAN)
- offset = -offset;
- tree zero = build_zero_cst (TREE_TYPE (type));
- for (i = 0; i < count; i++)
- {
- if (i + offset < 0 || i + offset >= count)
- elts[i] = zero;
- else
- elts[i] = VECTOR_CST_ELT (arg1, i + offset);
- }
}
- else
- for (i = 0; i < count; i++)
- {
- tree elem1 = VECTOR_CST_ELT (arg1, i);
-
- elts[i] = const_binop (code, elem1, arg2);
-
- /* It is possible that const_binop cannot handle the given
- code and return NULL_TREE */
- if (elts[i] == NULL_TREE)
- return NULL_TREE;
- }
return build_vector (type, elts);
}
@@ -3074,27 +3048,6 @@ omit_one_operand_loc (location_t loc, tree type, tree result, tree omitted)
return non_lvalue_loc (loc, t);
}
-/* Similar, but call pedantic_non_lvalue instead of non_lvalue. */
-
-static tree
-pedantic_omit_one_operand_loc (location_t loc, tree type, tree result,
- tree omitted)
-{
- tree t = fold_convert_loc (loc, type, result);
-
- /* If the resulting operand is an empty statement, just return the omitted
- statement casted to void. */
- if (IS_EMPTY_STMT (t) && TREE_SIDE_EFFECTS (omitted))
- return build1_loc (loc, NOP_EXPR, void_type_node,
- fold_ignored_result (omitted));
-
- if (TREE_SIDE_EFFECTS (omitted))
- return build2_loc (loc, COMPOUND_EXPR, type,
- fold_ignored_result (omitted), t);
-
- return pedantic_non_lvalue_loc (loc, t);
-}
-
/* Return a tree for the case when the result of an expression is RESULT
converted to TYPE and OMITTED1 and OMITTED2 were previously operands
of the expression but are now not needed.
@@ -3700,7 +3653,7 @@ all_ones_mask_p (const_tree mask, unsigned int size)
The return value is the (sub)expression whose sign bit is VAL,
or NULL_TREE otherwise. */
-static tree
+tree
sign_bit_p (tree exp, const_tree val)
{
int width;
@@ -7960,18 +7913,6 @@ fold_unary_loc (location_t loc, enum tree_code code, tree type, tree op0)
if (i == count)
return build_vector (type, elements);
}
- else if (COMPARISON_CLASS_P (arg0)
- && (VECTOR_TYPE_P (type)
- || (INTEGRAL_TYPE_P (type) && TYPE_PRECISION (type) == 1)))
- {
- tree op_type = TREE_TYPE (TREE_OPERAND (arg0, 0));
- enum tree_code subcode = invert_tree_comparison (TREE_CODE (arg0),
- HONOR_NANS (TYPE_MODE (op_type)));
- if (subcode != ERROR_MARK)
- return build2_loc (loc, subcode, type, TREE_OPERAND (arg0, 0),
- TREE_OPERAND (arg0, 1));
- }
-
return NULL_TREE;
@@ -9535,7 +9476,7 @@ fold_addr_of_array_ref_difference (location_t loc, tree type,
/* If the real or vector real constant CST of type TYPE has an exact
inverse, return it, else return NULL. */
-static tree
+tree
exact_inverse (tree type, tree cst)
{
REAL_VALUE_TYPE r;
@@ -10024,25 +9965,6 @@ fold_binary_loc (location_t loc,
}
else
{
- /* See if ARG1 is zero and X + ARG1 reduces to X. */
- if (fold_real_zero_addition_p (TREE_TYPE (arg0), arg1, 0))
- return non_lvalue_loc (loc, fold_convert_loc (loc, type, arg0));
-
- /* Likewise if the operands are reversed. */
- if (fold_real_zero_addition_p (TREE_TYPE (arg1), arg0, 0))
- return non_lvalue_loc (loc, fold_convert_loc (loc, type, arg1));
-
- /* Convert X + -C into X - C. */
- if (TREE_CODE (arg1) == REAL_CST
- && REAL_VALUE_NEGATIVE (TREE_REAL_CST (arg1)))
- {
- tem = fold_negate_const (arg1, type);
- if (!TREE_OVERFLOW (arg1) || !flag_trapping_math)
- return fold_build2_loc (loc, MINUS_EXPR, type,
- fold_convert_loc (loc, type, arg0),
- fold_convert_loc (loc, type, tem));
- }
-
/* Fold __complex__ ( x, 0 ) + __complex__ ( 0, y )
to __complex__ ( x, y ). This is not the same for SNaNs or
if signed zeros are involved. */
@@ -10084,12 +10006,6 @@ fold_binary_loc (location_t loc,
&& (tem = distribute_real_division (loc, code, type, arg0, arg1)))
return tem;
- /* Convert x+x into x*2.0. */
- if (operand_equal_p (arg0, arg1, 0)
- && SCALAR_FLOAT_TYPE_P (type))
- return fold_build2_loc (loc, MULT_EXPR, type, arg0,
- build_real (type, dconst2));
-
/* Convert a + (b*c + d*e) into (a + b*c) + d*e.
We associate floats only if the user has specified
-fassociative-math. */
@@ -10442,9 +10358,6 @@ fold_binary_loc (location_t loc,
if (! FLOAT_TYPE_P (type))
{
- if (integer_zerop (arg0))
- return negate_expr (fold_convert_loc (loc, type, arg1));
-
/* Fold A - (A & B) into ~B & A. */
if (!TREE_SIDE_EFFECTS (arg0)
&& TREE_CODE (arg1) == BIT_AND_EXPR)
@@ -10489,16 +10402,6 @@ fold_binary_loc (location_t loc,
}
}
- /* See if ARG1 is zero and X - ARG1 reduces to X. */
- else if (fold_real_zero_addition_p (TREE_TYPE (arg0), arg1, 1))
- return non_lvalue_loc (loc, fold_convert_loc (loc, type, arg0));
-
- /* (ARG0 - ARG1) is the same as (-ARG1 + ARG0). So check whether
- ARG0 is zero and X + ARG0 reduces to X, since that would mean
- (-ARG1 + ARG0) reduces to -ARG1. */
- else if (fold_real_zero_addition_p (TREE_TYPE (arg1), arg0, 0))
- return negate_expr (fold_convert_loc (loc, type, arg1));
-
/* Fold __complex__ ( x, 0 ) - __complex__ ( 0, y ) to
__complex__ ( x, -y ). This is not the same for SNaNs or if
signed zeros are involved. */
@@ -10538,9 +10441,7 @@ fold_binary_loc (location_t loc,
/* A - B -> A + (-B) if B is easily negatable. */
if (negate_expr_p (arg1)
- && (!INTEGRAL_TYPE_P (type)
- || TYPE_OVERFLOW_WRAPS (type)
- || (flag_sanitize & SANITIZE_SI_OVERFLOW) == 0)
+ && !TYPE_OVERFLOW_SANITIZED (type)
&& ((FLOAT_TYPE_P (type)
/* Avoid this transformation if B is a positive REAL_CST. */
&& (TREE_CODE (arg1) != REAL_CST
@@ -10616,11 +10517,6 @@ fold_binary_loc (location_t loc,
if (! FLOAT_TYPE_P (type))
{
- /* Transform x * -1 into -x. Make sure to do the negation
- on the original operand with conversions not stripped
- because we can only strip non-sign-changing conversions. */
- if (integer_minus_onep (arg1))
- return fold_convert_loc (loc, type, negate_expr (op0));
/* Transform x * -C into -x * C if x is easily negatable. */
if (TREE_CODE (arg1) == INTEGER_CST
&& tree_int_cst_sgn (arg1) == -1
@@ -10684,29 +10580,6 @@ fold_binary_loc (location_t loc,
}
else
{
- /* Maybe fold x * 0 to 0. The expressions aren't the same
- when x is NaN, since x * 0 is also NaN. Nor are they the
- same in modes with signed zeros, since multiplying a
- negative value by 0 gives -0, not +0. */
- if (!HONOR_NANS (TYPE_MODE (TREE_TYPE (arg0)))
- && !HONOR_SIGNED_ZEROS (TYPE_MODE (TREE_TYPE (arg0)))
- && real_zerop (arg1))
- return omit_one_operand_loc (loc, type, arg1, arg0);
- /* In IEEE floating point, x*1 is not equivalent to x for snans.
- Likewise for complex arithmetic with signed zeros. */
- if (!HONOR_SNANS (TYPE_MODE (TREE_TYPE (arg0)))
- && (!HONOR_SIGNED_ZEROS (TYPE_MODE (TREE_TYPE (arg0)))
- || !COMPLEX_FLOAT_TYPE_P (TREE_TYPE (arg0)))
- && real_onep (arg1))
- return non_lvalue_loc (loc, fold_convert_loc (loc, type, arg0));
-
- /* Transform x * -1.0 into -x. */
- if (!HONOR_SNANS (TYPE_MODE (TREE_TYPE (arg0)))
- && (!HONOR_SIGNED_ZEROS (TYPE_MODE (TREE_TYPE (arg0)))
- || !COMPLEX_FLOAT_TYPE_P (TREE_TYPE (arg0)))
- && real_minus_onep (arg1))
- return fold_convert_loc (loc, type, negate_expr (arg0));
-
/* Convert (C1/X)*C2 into (C1*C2)/X. This transformation may change
the result for floating point types due to rounding so it is applied
only if -fassociative-math was specify. */
@@ -11585,33 +11458,6 @@ fold_binary_loc (location_t loc,
&& real_zerop (arg1))
return NULL_TREE;
- /* Optimize A / A to 1.0 if we don't care about
- NaNs or Infinities. Skip the transformation
- for non-real operands. */
- if (SCALAR_FLOAT_TYPE_P (TREE_TYPE (arg0))
- && ! HONOR_NANS (TYPE_MODE (TREE_TYPE (arg0)))
- && ! HONOR_INFINITIES (TYPE_MODE (TREE_TYPE (arg0)))
- && operand_equal_p (arg0, arg1, 0))
- {
- tree r = build_real (TREE_TYPE (arg0), dconst1);
-
- return omit_two_operands_loc (loc, type, r, arg0, arg1);
- }
-
- /* The complex version of the above A / A optimization. */
- if (COMPLEX_FLOAT_TYPE_P (TREE_TYPE (arg0))
- && operand_equal_p (arg0, arg1, 0))
- {
- tree elem_type = TREE_TYPE (TREE_TYPE (arg0));
- if (! HONOR_NANS (TYPE_MODE (elem_type))
- && ! HONOR_INFINITIES (TYPE_MODE (elem_type)))
- {
- tree r = build_real (elem_type, dconst1);
- /* omit_two_operands will call fold_convert for us. */
- return omit_two_operands_loc (loc, type, r, arg0, arg1);
- }
- }
-
/* (-A) / (-B) -> A / B */
if (TREE_CODE (arg0) == NEGATE_EXPR && negate_expr_p (arg1))
return fold_build2_loc (loc, RDIV_EXPR, type,
@@ -11622,42 +11468,6 @@ fold_binary_loc (location_t loc,
negate_expr (arg0),
TREE_OPERAND (arg1, 0));
- /* In IEEE floating point, x/1 is not equivalent to x for snans. */
- if (!HONOR_SNANS (TYPE_MODE (TREE_TYPE (arg0)))
- && real_onep (arg1))
- return non_lvalue_loc (loc, fold_convert_loc (loc, type, arg0));
-
- /* In IEEE floating point, x/-1 is not equivalent to -x for snans. */
- if (!HONOR_SNANS (TYPE_MODE (TREE_TYPE (arg0)))
- && real_minus_onep (arg1))
- return non_lvalue_loc (loc, fold_convert_loc (loc, type,
- negate_expr (arg0)));
-
- /* If ARG1 is a constant, we can convert this to a multiply by the
- reciprocal. This does not have the same rounding properties,
- so only do this if -freciprocal-math. We can actually
- always safely do it if ARG1 is a power of two, but it's hard to
- tell if it is or not in a portable manner. */
- if (optimize
- && (TREE_CODE (arg1) == REAL_CST
- || (TREE_CODE (arg1) == COMPLEX_CST
- && COMPLEX_FLOAT_TYPE_P (TREE_TYPE (arg1)))
- || (TREE_CODE (arg1) == VECTOR_CST
- && VECTOR_FLOAT_TYPE_P (TREE_TYPE (arg1)))))
- {
- if (flag_reciprocal_math
- && 0 != (tem = const_binop (code, build_one_cst (type), arg1)))
- return fold_build2_loc (loc, MULT_EXPR, type, arg0, tem);
- /* Find the reciprocal if optimizing and the result is exact.
- TODO: Complex reciprocal not implemented. */
- if (TREE_CODE (arg1) != COMPLEX_CST)
- {
- tree inverse = exact_inverse (TREE_TYPE (arg0), arg1);
-
- if (inverse)
- return fold_build2_loc (loc, MULT_EXPR, type, arg0, inverse);
- }
- }
/* Convert A/B/C to A/(B*C). */
if (flag_reciprocal_math
&& TREE_CODE (arg0) == RDIV_EXPR)
@@ -11880,13 +11690,6 @@ fold_binary_loc (location_t loc,
}
}
- /* For unsigned integral types, FLOOR_DIV_EXPR is the same as
- TRUNC_DIV_EXPR. Rewrite into the latter in this case. */
- if (INTEGRAL_TYPE_P (type)
- && TYPE_UNSIGNED (type)
- && code == FLOOR_DIV_EXPR)
- return fold_build2_loc (loc, TRUNC_DIV_EXPR, type, op0, op1);
-
/* Fall through */
case ROUND_DIV_EXPR:
@@ -11894,11 +11697,6 @@ fold_binary_loc (location_t loc,
case EXACT_DIV_EXPR:
if (integer_zerop (arg1))
return NULL_TREE;
- /* X / -1 is -X. */
- if (!TYPE_UNSIGNED (type)
- && TREE_CODE (arg1) == INTEGER_CST
- && wi::eq_p (arg1, -1))
- return fold_convert_loc (loc, type, negate_expr (arg0));
/* Convert -A / -B to A / B when the type is signed and overflow is
undefined. */
@@ -11961,26 +11759,6 @@ fold_binary_loc (location_t loc,
case FLOOR_MOD_EXPR:
case ROUND_MOD_EXPR:
case TRUNC_MOD_EXPR:
- /* X % -1 is zero. */
- if (!TYPE_UNSIGNED (type)
- && TREE_CODE (arg1) == INTEGER_CST
- && wi::eq_p (arg1, -1))
- return omit_one_operand_loc (loc, type, integer_zero_node, arg0);
-
- /* X % -C is the same as X % C. */
- if (code == TRUNC_MOD_EXPR
- && TYPE_SIGN (type) == SIGNED
- && TREE_CODE (arg1) == INTEGER_CST
- && !TREE_OVERFLOW (arg1)
- && wi::neg_p (arg1)
- && !TYPE_OVERFLOW_TRAPS (type)
- /* Avoid this transformation if C is INT_MIN, i.e. C == -C. */
- && !sign_bit_p (arg1, arg1))
- return fold_build2_loc (loc, code, type,
- fold_convert_loc (loc, type, arg0),
- fold_convert_loc (loc, type,
- negate_expr (arg1)));
-
/* X % -Y is the same as X % Y. */
if (code == TRUNC_MOD_EXPR
&& !TYPE_UNSIGNED (type)
@@ -12034,30 +11812,8 @@ fold_binary_loc (location_t loc,
case LROTATE_EXPR:
case RROTATE_EXPR:
- if (integer_all_onesp (arg0))
- return omit_one_operand_loc (loc, type, arg0, arg1);
- goto shift;
-
case RSHIFT_EXPR:
- /* Optimize -1 >> x for arithmetic right shifts. */
- if (integer_all_onesp (arg0) && !TYPE_UNSIGNED (type)
- && tree_expr_nonnegative_p (arg1))
- return omit_one_operand_loc (loc, type, arg0, arg1);
- /* ... fall through ... */
-
case LSHIFT_EXPR:
- shift:
- if (integer_zerop (arg1))
- return non_lvalue_loc (loc, fold_convert_loc (loc, type, arg0));
- if (integer_zerop (arg0))
- return omit_one_operand_loc (loc, type, arg0, arg1);
-
- /* Prefer vector1 << scalar to vector1 << vector2
- if vector2 is uniform. */
- if (VECTOR_TYPE_P (TREE_TYPE (arg1))
- && (tem = uniform_vector_p (arg1)) != NULL_TREE)
- return fold_build2_loc (loc, code, type, op0, tem);
-
/* Since negative shift count is not well-defined,
don't try to compute it in the compiler. */
if (TREE_CODE (arg1) == INTEGER_CST && tree_int_cst_sgn (arg1) < 0)
@@ -12117,15 +11873,6 @@ fold_binary_loc (location_t loc,
}
}
- /* Rewrite an LROTATE_EXPR by a constant into an
- RROTATE_EXPR by a new constant. */
- if (code == LROTATE_EXPR && TREE_CODE (arg1) == INTEGER_CST)
- {
- tree tem = build_int_cst (TREE_TYPE (arg1), prec);
- tem = const_binop (MINUS_EXPR, tem, arg1);
- return fold_build2_loc (loc, RROTATE_EXPR, type, op0, tem);
- }
-
/* If we have a rotate of a bit operation with the rotate count and
the second operand of the bit operation both constant,
permute the two operations. */
@@ -12173,23 +11920,12 @@ fold_binary_loc (location_t loc,
return NULL_TREE;
case MIN_EXPR:
- if (operand_equal_p (arg0, arg1, 0))
- return omit_one_operand_loc (loc, type, arg0, arg1);
- if (INTEGRAL_TYPE_P (type)
- && operand_equal_p (arg1, TYPE_MIN_VALUE (type), OEP_ONLY_CONST))
- return omit_one_operand_loc (loc, type, arg1, arg0);
tem = fold_minmax (loc, MIN_EXPR, type, arg0, arg1);
if (tem)
return tem;
goto associate;
case MAX_EXPR:
- if (operand_equal_p (arg0, arg1, 0))
- return omit_one_operand_loc (loc, type, arg0, arg1);
- if (INTEGRAL_TYPE_P (type)
- && TYPE_MAX_VALUE (type)
- && operand_equal_p (arg1, TYPE_MAX_VALUE (type), OEP_ONLY_CONST))
- return omit_one_operand_loc (loc, type, arg1, arg0);
tem = fold_minmax (loc, MAX_EXPR, type, arg0, arg1);
if (tem)
return tem;
@@ -13553,11 +13289,6 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type,
}
else if (TREE_CODE (arg0) == VECTOR_CST)
{
- if (integer_all_onesp (arg0))
- return pedantic_omit_one_operand_loc (loc, type, arg1, arg2);
- if (integer_zerop (arg0))
- return pedantic_omit_one_operand_loc (loc, type, arg2, arg1);
-
if ((TREE_CODE (arg1) == VECTOR_CST
|| TREE_CODE (arg1) == CONSTRUCTOR)
&& (TREE_CODE (arg2) == VECTOR_CST
@@ -13582,9 +13313,6 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type,
}
}
- if (operand_equal_p (arg1, op2, 0))
- return pedantic_omit_one_operand_loc (loc, type, arg1, arg0);
-
/* If we have A op B ? A : C, we may be able to convert this to a
simpler expression, depending on the operation and the values
of B and C. Signed zeros prevent all of these transformations,
@@ -14870,7 +14598,7 @@ tree_unary_nonnegative_warnv_p (enum tree_code code, tree type, tree op0,
return tree_expr_nonnegative_warnv_p (op0,
strict_overflow_p);
- case NOP_EXPR:
+ CASE_CONVERT:
{
tree inner_type = TREE_TYPE (op0);
tree outer_type = type;
diff --git a/gcc/fold-const.h b/gcc/fold-const.h
index b440ca11881..09ece6735c7 100644
--- a/gcc/fold-const.h
+++ b/gcc/fold-const.h
@@ -167,5 +167,7 @@ extern tree make_range_step (location_t, enum tree_code, tree, tree, tree,
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 tree sign_bit_p (tree, const_tree);
+extern tree exact_inverse (tree, tree);
#endif // GCC_FOLD_CONST_H
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 7fd573cd39c..ec1b7b5b6cf 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,11 @@
+2014-11-13 Bernd Schmidt <bernds@codesourcery.com>
+ Thomas Schwinge <thomas@codesourcery.com>
+ Ilya Verbin <ilya.verbin@intel.com>
+ Andrey Turetskiy <andrey.turetskiy@intel.com>
+
+ * Make-lang.in (fortran.install-common): Do not install for the offload
+ compiler.
+
2014-11-11 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR fortran/44054
diff --git a/gcc/fortran/Make-lang.in b/gcc/fortran/Make-lang.in
index ca0a4e603af..3621b4f1202 100644
--- a/gcc/fortran/Make-lang.in
+++ b/gcc/fortran/Make-lang.in
@@ -235,14 +235,16 @@ install-finclude-dir: installdirs
# Install the driver program as $(target)-gfortran, and also as gfortran
# if native.
fortran.install-common: install-finclude-dir installdirs
- -if [ -f f951$(exeext) ] ; then \
- rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
- $(INSTALL_PROGRAM) gfortran$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
- chmod a+x $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
- if [ ! -f gfortran-cross$(exeext) ] ; then \
- rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
- $(LN) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
- fi ; \
+ -if test "$(enable_as_accelerator)" != "yes" ; then \
+ if [ -f f951$(exeext) ] ; then \
+ rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
+ $(INSTALL_PROGRAM) gfortran$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
+ chmod a+x $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
+ if [ ! -f gfortran-cross$(exeext) ] ; then \
+ rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
+ $(LN) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
+ fi ; \
+ fi; \
fi
fortran.install-plugin:
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 7e6af22a7c3..653ca8db9f6 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -157,6 +157,11 @@ static const char *const spec_version = DEFAULT_TARGET_VERSION;
/* The target machine. */
static const char *spec_machine = DEFAULT_TARGET_MACHINE;
+static const char *spec_host_machine = DEFAULT_REAL_TARGET_MACHINE;
+
+/* List of offload targets. */
+
+static char *offload_targets = NULL;
/* Nonzero if cross-compiling.
When -b is used, the value comes from the `specs' file. */
@@ -1296,6 +1301,9 @@ static const char *const standard_startfile_prefix_2
relative to the driver. */
static const char *const tooldir_base_prefix = TOOLDIR_BASE_PREFIX;
+/* A prefix to be used when this is an accelerator compiler. */
+static const char *const accel_dir_suffix = ACCEL_DIR_SUFFIX;
+
/* Subdirectory to use for locating libraries. Set by
set_multilib_dir based on the compilation options. */
@@ -3354,6 +3362,100 @@ driver_wrong_lang_callback (const struct cl_decoded_option *decoded,
static const char *spec_lang = 0;
static int last_language_n_infiles;
+/* Parse -foffload option argument. */
+
+static void
+handle_foffload_option (const char *arg)
+{
+ const char *c, *cur, *n, *next, *end;
+ char *target;
+
+ /* If option argument starts with '-' then no target is specified and we
+ do not need to parse it. */
+ if (arg[0] == '-')
+ return;
+
+ end = strchr (arg, '=');
+ if (end == NULL)
+ end = strchr (arg, '\0');
+ cur = arg;
+
+ while (cur < end)
+ {
+ next = strchr (cur, ',');
+ if (next == NULL)
+ next = strchr (cur, '\0');
+ next = (next > end) ? end : next;
+
+ target = XNEWVEC (char, next - cur + 1);
+ strncpy (target, cur, next - cur);
+ target[next - cur] = '\0';
+
+ /* If 'disable' is passed to the option, stop parsing the option and clean
+ the list of offload targets. */
+ if (strcmp (target, "disable") == 0)
+ {
+ free (offload_targets);
+ offload_targets = xstrdup ("");
+ break;
+ }
+
+ /* Check that GCC is configured to support the offload target. */
+ c = OFFLOAD_TARGETS;
+ while (c)
+ {
+ n = strchr (c, ',');
+ if (n == NULL)
+ n = strchr (c, '\0');
+
+ if (strlen (target) == (size_t) (n - c)
+ && strncmp (target, c, n - c) == 0)
+ break;
+
+ c = *n ? n + 1 : NULL;
+ }
+
+ if (!c)
+ fatal_error ("GCC is not configured to support %s as offload target",
+ target);
+
+ if (!offload_targets)
+ offload_targets = xstrdup (target);
+ else
+ {
+ /* Check that the target hasn't already presented in the list. */
+ c = offload_targets;
+ do
+ {
+ n = strchr (c, ':');
+ if (n == NULL)
+ n = strchr (c, '\0');
+
+ if (strlen (target) == (size_t) (n - c)
+ && strncmp (c, target, n - c) == 0)
+ break;
+
+ c = n + 1;
+ }
+ while (*n);
+
+ /* If duplicate is not found, append the target to the list. */
+ if (c > n)
+ {
+ offload_targets
+ = XRESIZEVEC (char, offload_targets,
+ strlen (offload_targets) + strlen (target) + 2);
+ if (strlen (offload_targets) != 0)
+ strcat (offload_targets, ":");
+ strcat (offload_targets, target);
+ }
+ }
+
+ cur = next + 1;
+ XDELETEVEC (target);
+ }
+}
+
/* Handle a driver option; arguments and return value as for
handle_option. */
@@ -3731,6 +3833,10 @@ driver_handle_option (struct gcc_options *opts,
flag_wpa = "";
break;
+ case OPT_foffload_:
+ handle_foffload_option (arg);
+ break;
+
default:
/* Various driver options need no special processing at this
point, having been handled in a prescan above or being
@@ -4129,15 +4235,15 @@ process_command (unsigned int decoded_options_count,
}
gcc_assert (!IS_ABSOLUTE_PATH (tooldir_base_prefix));
- tooldir_prefix2 = concat (tooldir_base_prefix, spec_machine,
+ tooldir_prefix2 = concat (tooldir_base_prefix, spec_host_machine,
dir_separator_str, NULL);
/* Look for tools relative to the location from which the driver is
running, or, if that is not available, the configured prefix. */
tooldir_prefix
= concat (gcc_exec_prefix ? gcc_exec_prefix : standard_exec_prefix,
- spec_machine, dir_separator_str,
- spec_version, dir_separator_str, tooldir_prefix2, NULL);
+ spec_host_machine, dir_separator_str, spec_version,
+ accel_dir_suffix, dir_separator_str, tooldir_prefix2, NULL);
free (tooldir_prefix2);
add_prefix (&exec_prefixes,
@@ -6749,6 +6855,7 @@ class driver
void set_up_specs () const;
void putenv_COLLECT_GCC (const char *argv0) const;
void maybe_putenv_COLLECT_LTO_WRAPPER () const;
+ void maybe_putenv_OFFLOAD_TARGETS () const;
void handle_unrecognized_options () const;
int maybe_print_and_exit () const;
bool prepare_infiles ();
@@ -6791,6 +6898,7 @@ driver::main (int argc, char **argv)
set_up_specs ();
putenv_COLLECT_GCC (argv[0]);
maybe_putenv_COLLECT_LTO_WRAPPER ();
+ maybe_putenv_OFFLOAD_TARGETS ();
handle_unrecognized_options ();
if (!maybe_print_and_exit ())
@@ -6960,6 +7068,7 @@ driver::build_multilib_strings () const
void
driver::set_up_specs () const
{
+ const char *spec_machine_suffix;
char *specs_file;
size_t i;
@@ -6983,8 +7092,8 @@ driver::set_up_specs () const
/* Read specs from a file if there is one. */
- machine_suffix = concat (spec_machine, dir_separator_str,
- spec_version, dir_separator_str, NULL);
+ machine_suffix = concat (spec_host_machine, dir_separator_str, spec_version,
+ accel_dir_suffix, dir_separator_str, NULL);
just_machine_suffix = concat (spec_machine, dir_separator_str, NULL);
specs_file = find_a_file (&startfile_prefixes, "specs", R_OK, true);
@@ -6994,13 +7103,18 @@ driver::set_up_specs () const
else
init_spec ();
- /* We need to check standard_exec_prefix/just_machine_suffix/specs
+#ifdef ACCEL_COMPILER
+ spec_machine_suffix = machine_suffix;
+#else
+ spec_machine_suffix = just_machine_suffix;
+#endif
+
+ /* We need to check standard_exec_prefix/spec_machine_suffix/specs
for any override of as, ld and libraries. */
specs_file = (char *) alloca (strlen (standard_exec_prefix)
- + strlen (just_machine_suffix) + sizeof ("specs"));
-
+ + strlen (spec_machine_suffix) + sizeof ("specs"));
strcpy (specs_file, standard_exec_prefix);
- strcat (specs_file, just_machine_suffix);
+ strcat (specs_file, spec_machine_suffix);
strcat (specs_file, "specs");
if (access (specs_file, R_OK) == 0)
read_specs (specs_file, true, false);
@@ -7182,8 +7296,9 @@ driver::set_up_specs () const
/* If we have a GCC_EXEC_PREFIX envvar, modify it for cpp's sake. */
if (gcc_exec_prefix)
- gcc_exec_prefix = concat (gcc_exec_prefix, spec_machine, dir_separator_str,
- spec_version, dir_separator_str, NULL);
+ gcc_exec_prefix = concat (gcc_exec_prefix, spec_host_machine,
+ dir_separator_str, spec_version,
+ accel_dir_suffix, dir_separator_str, NULL);
/* Now we have the specs.
Set the `valid' bits for switches that match anything in any spec. */
@@ -7234,6 +7349,29 @@ driver::maybe_putenv_COLLECT_LTO_WRAPPER () const
}
+/* Set up to remember the names of offload targets. */
+
+void
+driver::maybe_putenv_OFFLOAD_TARGETS () const
+{
+ const char *targets = offload_targets;
+
+ /* If no targets specified by -foffload, use all available targets. */
+ if (!targets)
+ targets = OFFLOAD_TARGETS;
+
+ if (strlen (targets) > 0)
+ {
+ obstack_grow (&collect_obstack, "OFFLOAD_TARGET_NAMES=",
+ sizeof ("OFFLOAD_TARGET_NAMES=") - 1);
+ obstack_grow (&collect_obstack, targets,
+ strlen (targets) + 1);
+ xputenv (XOBFINISH (&collect_obstack, char *));
+ }
+
+ free (offload_targets);
+}
+
/* Reject switches that no pass was interested in. */
void
diff --git a/gcc/gengtype.c b/gcc/gengtype.c
index fac83ee84d2..71159b05fa7 100644
--- a/gcc/gengtype.c
+++ b/gcc/gengtype.c
@@ -1843,7 +1843,7 @@ open_base_files (void)
"tree-ssa.h", "reload.h", "cpp-id-data.h", "tree-chrec.h",
"except.h", "output.h", "cfgloop.h", "target.h", "lto-streamer.h",
"target-globals.h", "ipa-ref.h", "cgraph.h", "ipa-prop.h",
- "ipa-inline.h", "dwarf2out.h", NULL
+ "ipa-inline.h", "dwarf2out.h", "omp-low.h", NULL
};
const char *const *ifp;
outf_p gtype_desc_c;
diff --git a/gcc/genmatch.c b/gcc/genmatch.c
index 0e4208f17e7..fdd02a5358a 100644
--- a/gcc/genmatch.c
+++ b/gcc/genmatch.c
@@ -310,7 +310,9 @@ add_operator (enum tree_code code, const char *id,
/* For {REAL,IMAG}PART_EXPR and VIEW_CONVERT_EXPR. */
&& strcmp (tcc, "tcc_reference") != 0
/* To have INTEGER_CST and friends as "predicate operators". */
- && strcmp (tcc, "tcc_constant") != 0)
+ && strcmp (tcc, "tcc_constant") != 0
+ /* And allow CONSTRUCTOR for vector initializers. */
+ && !(code == CONSTRUCTOR))
return;
operator_id *op = new operator_id (code, id, nargs, tcc);
id_base **slot = operators->find_slot_with_hash (op, op->hashval, INSERT);
@@ -2013,7 +2015,8 @@ dt_node::gen_kids (FILE *f, bool gimple)
dt_operand *op = as_a<dt_operand *> (kids[i]);
if (expr *e = dyn_cast <expr *> (op->op))
{
- if (e->ops.length () == 0)
+ if (e->ops.length () == 0
+ && (!gimple || !(*e->operation == CONSTRUCTOR)))
generic_exprs.safe_push (op);
else if (e->operation->kind == id_base::FN)
{
@@ -2124,8 +2127,8 @@ dt_node::gen_kids (FILE *f, bool gimple)
"}\n");
}
- fprintf (f, "break;\n"
- "}\n");
+ fprintf (f, "}\n"
+ "break;\n");
}
for (unsigned i = 0; i < generic_exprs.length (); ++i)
@@ -3030,6 +3033,14 @@ parser::parse_op ()
expression. */
op = new expr (opr);
}
+ else if (user_id *code = dyn_cast <user_id *> (opr))
+ {
+ if (code->nargs != 0)
+ fatal_at (token, "using an operator with operands as predicate");
+ /* Parse the zero-operand operator "predicates" as
+ expression. */
+ op = new expr (opr);
+ }
else if (predicate_id *p = dyn_cast <predicate_id *> (opr))
op = new predicate (p);
else
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index aeb180370d8..acdadcd8827 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -4467,7 +4467,8 @@ maybe_fold_or_comparisons (enum tree_code code1, tree op1a, tree op1b,
to avoid the indirect function call overhead. */
tree
-gimple_fold_stmt_to_constant_1 (gimple stmt, tree (*valueize) (tree))
+gimple_fold_stmt_to_constant_1 (gimple stmt, tree (*valueize) (tree),
+ tree (*gvalueize) (tree))
{
code_helper rcode;
tree ops[3] = {};
@@ -4475,7 +4476,7 @@ gimple_fold_stmt_to_constant_1 (gimple stmt, tree (*valueize) (tree))
edges if there are intermediate VARYING defs. For this reason
do not follow SSA edges here even though SCCVN can technically
just deal fine with that. */
- if (gimple_simplify (stmt, &rcode, ops, NULL, no_follow_ssa_edges)
+ if (gimple_simplify (stmt, &rcode, ops, NULL, gvalueize)
&& rcode.is_tree_code ()
&& (TREE_CODE_LENGTH ((tree_code) rcode) == 0
|| ((tree_code) rcode) == ADDR_EXPR)
diff --git a/gcc/gimple-fold.h b/gcc/gimple-fold.h
index f42ff0264e3..a38848f3396 100644
--- a/gcc/gimple-fold.h
+++ b/gcc/gimple-fold.h
@@ -36,7 +36,8 @@ extern bool arith_overflowed_p (enum tree_code, const_tree, const_tree,
const_tree);
extern tree no_follow_ssa_edges (tree);
extern tree follow_single_use_edges (tree);
-extern tree gimple_fold_stmt_to_constant_1 (gimple, tree (*) (tree));
+extern tree gimple_fold_stmt_to_constant_1 (gimple, tree (*) (tree),
+ tree (*) (tree) = no_follow_ssa_edges);
extern tree gimple_fold_stmt_to_constant (gimple, tree (*) (tree));
extern tree fold_const_aggregate_ref_1 (tree, tree (*) (tree));
extern tree fold_const_aggregate_ref (tree);
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 62f172b5a68..f8459a448cb 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -58,6 +58,9 @@ along with GCC; see the file COPYING3. If not see
#include "bitmap.h"
#include "stringpool.h"
#include "tree-ssanames.h"
+#include "ipa-ref.h"
+#include "lto-streamer.h"
+#include "cgraph.h"
/* All the tuples have their operand vector (if present) at the very bottom
@@ -2538,8 +2541,28 @@ nonfreeing_call_p (gimple call)
default:
return true;
}
+ else if (gimple_call_internal_p (call))
+ switch (gimple_call_internal_fn (call))
+ {
+ case IFN_ABNORMAL_DISPATCHER:
+ return true;
+ default:
+ if (gimple_call_flags (call) & ECF_LEAF)
+ return true;
+ return false;
+ }
- return false;
+ tree fndecl = gimple_call_fndecl (call);
+ if (!fndecl)
+ return false;
+ struct cgraph_node *n = cgraph_node::get (fndecl);
+ if (!n)
+ return false;
+ enum availability availability;
+ n = n->function_symbol (&availability);
+ if (!n || availability <= AVAIL_INTERPOSABLE)
+ return false;
+ return n->nonfreeing_fn;
}
/* Callback for walk_stmt_load_store_ops.
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index 712464639a5..dba5ea0f9c9 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -12791,6 +12791,16 @@ Composite_literal_expression::lower_struct(Gogo* gogo, Type* type)
{
case EXPRESSION_UNKNOWN_REFERENCE:
name = name_expr->unknown_expression()->name();
+ if (type->named_type() != NULL)
+ {
+ // If the named object found for this field name comes from a
+ // different package than the struct it is a part of, do not count
+ // this incorrect lookup as a usage of the object's package.
+ no = name_expr->unknown_expression()->named_object();
+ if (no->package() != NULL
+ && no->package() != type->named_type()->named_object()->package())
+ no->package()->forget_usage(name_expr);
+ }
break;
case EXPRESSION_CONST_REFERENCE:
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc
index d6ba272dbd4..7c318ab1b89 100644
--- a/gcc/go/gofrontend/gogo.cc
+++ b/gcc/go/gofrontend/gogo.cc
@@ -1412,7 +1412,7 @@ Gogo::lookup(const std::string& name, Named_object** pfunction) const
if (ret != NULL)
{
if (ret->package() != NULL)
- ret->package()->set_used();
+ ret->package()->note_usage();
return ret;
}
}
@@ -7426,6 +7426,36 @@ Package::set_priority(int priority)
this->priority_ = priority;
}
+// Forget a given usage. If forgetting this usage means this package becomes
+// unused, report that error.
+
+void
+Package::forget_usage(Expression* usage) const
+{
+ if (this->fake_uses_.empty())
+ return;
+
+ std::set<Expression*>::iterator p = this->fake_uses_.find(usage);
+ go_assert(p != this->fake_uses_.end());
+ this->fake_uses_.erase(p);
+
+ if (this->fake_uses_.empty())
+ error_at(this->location(), "imported and not used: %s",
+ Gogo::message_name(this->package_name()).c_str());
+}
+
+// Clear the used field for the next file. If the only usages of this package
+// are possibly fake, keep the fake usages for lowering.
+
+void
+Package::clear_used()
+{
+ if (this->used_ > this->fake_uses_.size())
+ this->fake_uses_.clear();
+
+ this->used_ = 0;
+}
+
// Determine types of constants. Everything else in a package
// (variables, function declarations) should already have a fixed
// type. Constants may have abstract types.
diff --git a/gcc/go/gofrontend/gogo.h b/gcc/go/gofrontend/gogo.h
index 4453d13c835..10aea696c26 100644
--- a/gcc/go/gofrontend/gogo.h
+++ b/gcc/go/gofrontend/gogo.h
@@ -2645,17 +2645,25 @@ class Package
// Whether some symbol from the package was used.
bool
used() const
- { return this->used_; }
+ { return this->used_ > 0; }
// Note that some symbol from this package was used.
void
- set_used() const
- { this->used_ = true; }
+ note_usage() const
+ { this->used_++; }
+
+ // Note that USAGE might be a fake usage of this package.
+ void
+ note_fake_usage(Expression* usage) const
+ { this->fake_uses_.insert(usage); }
+
+ // Forget a given USAGE of this package.
+ void
+ forget_usage(Expression* usage) const;
// Clear the used field for the next file.
void
- clear_used()
- { this->used_ = false; }
+ clear_used();
// Whether this package was imported in the current file.
bool
@@ -2749,10 +2757,12 @@ class Package
int priority_;
// The location of the import statement.
Location location_;
- // True if some name from this package was used. This is mutable
- // because we can use a package even if we have a const pointer to
- // it.
- mutable bool used_;
+ // The amount of times some name from this package was used. This is mutable
+ // because we can use a package even if we have a const pointer to it.
+ mutable size_t used_;
+ // A set of possibly fake uses of this package. This is mutable because we
+ // can track fake uses of a package even if we have a const pointer to it.
+ mutable std::set<Expression*> fake_uses_;
// True if this package was imported in the current file.
bool is_imported_;
// True if this package was imported with a name of "_".
diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc
index d806b4789f1..57310250c79 100644
--- a/gcc/go/gofrontend/parse.cc
+++ b/gcc/go/gofrontend/parse.cc
@@ -199,7 +199,7 @@ Parse::qualified_ident(std::string* pname, Named_object** ppackage)
return false;
}
- package->package_value()->set_used();
+ package->package_value()->note_usage();
token = this->advance_token();
if (!token->is_identifier())
@@ -2401,7 +2401,7 @@ Parse::operand(bool may_be_sink, bool* is_parenthesized)
return Expression::make_error(location);
}
package = named_object->package_value();
- package->set_used();
+ package->note_usage();
id = this->peek_token()->identifier();
is_exported = this->peek_token()->is_identifier_exported();
packed = this->gogo_->pack_hidden_name(id, is_exported);
@@ -3242,9 +3242,12 @@ Parse::id_to_expression(const std::string& name, Location location,
case Named_object::NAMED_OBJECT_TYPE_DECLARATION:
{
// These cases can arise for a field name in a composite
- // literal.
+ // literal. Keep track of these as they might be fake uses of
+ // the related package.
Unknown_expression* ue =
Expression::make_unknown_reference(named_object, location);
+ if (named_object->package() != NULL)
+ named_object->package()->note_fake_usage(ue);
if (this->is_erroneous_function_)
ue->set_no_error_message();
return ue;
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index db3187e491f..4fb97fb69a3 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -1391,6 +1391,9 @@ insn_cost (rtx_insn *insn)
{
int cost;
+ if (sched_fusion)
+ return 0;
+
if (sel_sched_p ())
{
if (recog_memoized (insn) < 0)
@@ -1603,6 +1606,8 @@ dep_list_size (rtx insn, sd_list_types_def list)
return nodbgcount;
}
+bool sched_fusion;
+
/* Compute the priority number for INSN. */
static int
priority (rtx_insn *insn)
@@ -1617,7 +1622,15 @@ priority (rtx_insn *insn)
{
int this_priority = -1;
- if (dep_list_size (insn, SD_LIST_FORW) == 0)
+ if (sched_fusion)
+ {
+ int this_fusion_priority;
+
+ targetm.sched.fusion_priority (insn, FUSION_MAX_PRIORITY,
+ &this_fusion_priority, &this_priority);
+ INSN_FUSION_PRIORITY (insn) = this_fusion_priority;
+ }
+ else if (dep_list_size (insn, SD_LIST_FORW) == 0)
/* ??? We should set INSN_PRIORITY to insn_cost when and insn has
some forward deps but all of them are ignored by
contributes_to_priority hook. At the moment we set priority of
@@ -2548,7 +2561,7 @@ enum rfs_decision {
RFS_SCHED_GROUP, RFS_PRESSURE_DELAY, RFS_PRESSURE_TICK,
RFS_FEEDS_BACKTRACK_INSN, RFS_PRIORITY, RFS_SPECULATION,
RFS_SCHED_RANK, RFS_LAST_INSN, RFS_PRESSURE_INDEX,
- RFS_DEP_COUNT, RFS_TIE, RFS_N };
+ RFS_DEP_COUNT, RFS_TIE, RFS_FUSION, RFS_N };
/* Corresponding strings for print outs. */
static const char *rfs_str[RFS_N] = {
@@ -2556,7 +2569,7 @@ static const char *rfs_str[RFS_N] = {
"RFS_SCHED_GROUP", "RFS_PRESSURE_DELAY", "RFS_PRESSURE_TICK",
"RFS_FEEDS_BACKTRACK_INSN", "RFS_PRIORITY", "RFS_SPECULATION",
"RFS_SCHED_RANK", "RFS_LAST_INSN", "RFS_PRESSURE_INDEX",
- "RFS_DEP_COUNT", "RFS_TIE" };
+ "RFS_DEP_COUNT", "RFS_TIE", "RFS_FUSION" };
/* Statistical breakdown of rank_for_schedule decisions. */
typedef struct { unsigned stats[RFS_N]; } rank_for_schedule_stats_t;
@@ -2627,6 +2640,55 @@ rank_for_schedule (const void *x, const void *y)
/* Make sure that priority of TMP and TMP2 are initialized. */
gcc_assert (INSN_PRIORITY_KNOWN (tmp) && INSN_PRIORITY_KNOWN (tmp2));
+ if (sched_fusion)
+ {
+ /* The instruction that has the same fusion priority as the last
+ instruction is the instruction we picked next. If that is not
+ the case, we sort ready list firstly by fusion priority, then
+ by priority, and at last by INSN_LUID. */
+ int a = INSN_FUSION_PRIORITY (tmp);
+ int b = INSN_FUSION_PRIORITY (tmp2);
+ int last = -1;
+
+ if (last_nondebug_scheduled_insn
+ && !NOTE_P (last_nondebug_scheduled_insn)
+ && BLOCK_FOR_INSN (tmp)
+ == BLOCK_FOR_INSN (last_nondebug_scheduled_insn))
+ last = INSN_FUSION_PRIORITY (last_nondebug_scheduled_insn);
+
+ if (a != last && b != last)
+ {
+ if (a == b)
+ {
+ a = INSN_PRIORITY (tmp);
+ b = INSN_PRIORITY (tmp2);
+ }
+ if (a != b)
+ return rfs_result (RFS_FUSION, b - a, tmp, tmp2);
+ else
+ return rfs_result (RFS_FUSION,
+ INSN_LUID (tmp) - INSN_LUID (tmp2), tmp, tmp2);
+ }
+ else if (a == b)
+ {
+ gcc_assert (last_nondebug_scheduled_insn
+ && !NOTE_P (last_nondebug_scheduled_insn));
+ last = INSN_PRIORITY (last_nondebug_scheduled_insn);
+
+ a = abs (INSN_PRIORITY (tmp) - last);
+ b = abs (INSN_PRIORITY (tmp2) - last);
+ if (a != b)
+ return rfs_result (RFS_FUSION, a - b, tmp, tmp2);
+ else
+ return rfs_result (RFS_FUSION,
+ INSN_LUID (tmp) - INSN_LUID (tmp2), tmp, tmp2);
+ }
+ else if (a == last)
+ return rfs_result (RFS_FUSION, -1, tmp, tmp2);
+ else
+ return rfs_result (RFS_FUSION, 1, tmp, tmp2);
+ }
+
if (sched_pressure != SCHED_PRESSURE_NONE)
{
/* Prefer insn whose scheduling results in the smallest register
@@ -4007,8 +4069,8 @@ schedule_insn (rtx_insn *insn)
gcc_assert (INSN_TICK (insn) >= MIN_TICK);
if (INSN_TICK (insn) > clock_var)
/* INSN has been prematurely moved from the queue to the ready list.
- This is possible only if following flag is set. */
- gcc_assert (flag_sched_stalled_insns);
+ This is possible only if following flags are set. */
+ gcc_assert (flag_sched_stalled_insns || sched_fusion);
/* ??? Probably, if INSN is scheduled prematurely, we should leave
INSN_TICK untouched. This is a machine-dependent issue, actually. */
@@ -5500,6 +5562,9 @@ max_issue (struct ready_list *ready, int privileged_n, state_t state,
struct choice_entry *top;
rtx_insn *insn;
+ if (sched_fusion)
+ return 0;
+
n_ready = ready->n_ready;
gcc_assert (dfa_lookahead >= 1 && privileged_n >= 0
&& privileged_n <= n_ready);
@@ -5848,6 +5913,9 @@ prune_ready_list (state_t temp_state, bool first_cycle_insn_p,
bool sched_group_found = false;
int min_cost_group = 1;
+ if (sched_fusion)
+ return;
+
for (i = 0; i < ready.n_ready; i++)
{
rtx_insn *insn = ready_element (&ready, i);
@@ -6059,7 +6127,7 @@ schedule_block (basic_block *target_bb, state_t init_state)
rtx_insn *tail = PREV_INSN (next_tail);
if ((current_sched_info->flags & DONT_BREAK_DEPENDENCIES) == 0
- && sched_pressure != SCHED_PRESSURE_MODEL)
+ && sched_pressure != SCHED_PRESSURE_MODEL && !sched_fusion)
find_modifiable_mems (head, tail);
/* We used to have code to avoid getting parameters moved from hard
@@ -6455,7 +6523,7 @@ schedule_block (basic_block *target_bb, state_t init_state)
{
memcpy (temp_state, curr_state, dfa_state_size);
cost = state_transition (curr_state, insn);
- if (sched_pressure != SCHED_PRESSURE_WEIGHTED)
+ if (sched_pressure != SCHED_PRESSURE_WEIGHTED && !sched_fusion)
gcc_assert (cost < 0);
if (memcmp (temp_state, curr_state, dfa_state_size) != 0)
cycle_issued_insns++;
@@ -7288,7 +7356,7 @@ fix_tick_ready (rtx_insn *next)
INSN_TICK (next) = tick;
delay = tick - clock_var;
- if (delay <= 0 || sched_pressure != SCHED_PRESSURE_NONE)
+ if (delay <= 0 || sched_pressure != SCHED_PRESSURE_NONE || sched_fusion)
delay = QUEUE_READY;
change_queue_index (next, delay);
diff --git a/gcc/hooks.c b/gcc/hooks.c
index 356c64c9d92..f698d1d2e9e 100644
--- a/gcc/hooks.c
+++ b/gcc/hooks.c
@@ -386,13 +386,20 @@ hook_tree_tree_tree_tree_3rd_identity (tree a ATTRIBUTE_UNUSED,
return c;
}
-/* Generic hook that takes no arguments and returns a NULL string. */
+/* Generic hook that takes no arguments and returns a NULL const string. */
const char *
hook_constcharptr_void_null (void)
{
return NULL;
}
+/* Generic hook that takes no arguments and returns a NULL string. */
+char *
+hook_charptr_void_null (void)
+{
+ return NULL;
+}
+
/* Generic hook that takes a tree and returns a NULL string. */
const char *
hook_constcharptr_const_tree_null (const_tree t ATTRIBUTE_UNUSED)
diff --git a/gcc/hooks.h b/gcc/hooks.h
index 5e4f95b0f0a..b1b312d176a 100644
--- a/gcc/hooks.h
+++ b/gcc/hooks.h
@@ -106,6 +106,7 @@ extern rtx hook_rtx_rtx_identity (rtx);
extern rtx hook_rtx_rtx_null (rtx);
extern rtx hook_rtx_tree_int_null (tree, int);
+extern char *hook_charptr_void_null (void);
extern const char *hook_constcharptr_void_null (void);
extern const char *hook_constcharptr_const_tree_null (const_tree);
extern const char *hook_constcharptr_const_rtx_insn_null (const rtx_insn *);
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 47f9f5cea09..0529f174615 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -134,61 +134,73 @@ along with GCC; see the file COPYING3. If not see
#include "ipa-inline.h"
#include "ipa-utils.h"
-struct ipcp_value;
+template <typename valtype> class ipcp_value;
/* Describes a particular source for an IPA-CP value. */
-struct ipcp_value_source
+template <typename valtype>
+class ipcp_value_source
{
+public:
/* Aggregate offset of the source, negative if the source is scalar value of
the argument itself. */
HOST_WIDE_INT offset;
/* The incoming edge that brought the value. */
- struct cgraph_edge *cs;
+ cgraph_edge *cs;
/* If the jump function that resulted into his value was a pass-through or an
ancestor, this is the ipcp_value of the caller from which the described
value has been derived. Otherwise it is NULL. */
- struct ipcp_value *val;
+ ipcp_value<valtype> *val;
/* Next pointer in a linked list of sources of a value. */
- struct ipcp_value_source *next;
+ ipcp_value_source *next;
/* If the jump function that resulted into his value was a pass-through or an
ancestor, this is the index of the parameter of the caller the jump
function references. */
int index;
};
+/* Common ancestor for all ipcp_value instantiations. */
+
+class ipcp_value_base
+{
+public:
+ /* Time benefit and size cost that specializing the function for this value
+ would bring about in this function alone. */
+ int local_time_benefit, local_size_cost;
+ /* Time benefit and size cost that specializing the function for this value
+ can bring about in it's callees (transitively). */
+ int prop_time_benefit, prop_size_cost;
+};
+
/* Describes one particular value stored in struct ipcp_lattice. */
-struct ipcp_value
+template <typename valtype>
+class ipcp_value : public ipcp_value_base
{
- /* The actual value for the given parameter. This is either an IPA invariant
- or a TREE_BINFO describing a type that can be used for
- devirtualization. */
- tree value;
+public:
+ /* The actual value for the given parameter. */
+ valtype value;
/* The list of sources from which this value originates. */
- struct ipcp_value_source *sources;
+ ipcp_value_source <valtype> *sources;
/* Next pointers in a linked list of all values in a lattice. */
- struct ipcp_value *next;
+ ipcp_value *next;
/* Next pointers in a linked list of values in a strongly connected component
of values. */
- struct ipcp_value *scc_next;
+ ipcp_value *scc_next;
/* Next pointers in a linked list of SCCs of values sorted topologically
according their sources. */
- struct ipcp_value *topo_next;
+ ipcp_value *topo_next;
/* A specialized node created for this value, NULL if none has been (so far)
created. */
- struct cgraph_node *spec_node;
+ cgraph_node *spec_node;
/* Depth first search number and low link for topological sorting of
values. */
int dfs, low_link;
- /* Time benefit and size cost that specializing the function for this value
- would bring about in this function alone. */
- int local_time_benefit, local_size_cost;
- /* Time benefit and size cost that specializing the function for this value
- can bring about in it's callees (transitively). */
- int prop_time_benefit, prop_size_cost;
/* True if this valye is currently on the topo-sort stack. */
bool on_stack;
+
+ void add_source (cgraph_edge *cs, ipcp_value *src_val, int src_idx,
+ HOST_WIDE_INT offset);
};
/* Lattice describing potential values of a formal parameter of a function, or
@@ -197,12 +209,14 @@ struct ipcp_value
by a lattice with the bottom flag set. In that case, values and
contains_variable flag should be disregarded. */
-struct ipcp_lattice
+template <typename valtype>
+class ipcp_lattice
{
+public:
/* The list of known values and types in this lattice. Note that values are
not deallocated if a lattice is set to bottom because there may be value
sources referencing them. */
- struct ipcp_value *values;
+ ipcp_value<valtype> *values;
/* Number of known values and types in this lattice. */
int values_count;
/* The lattice contains a variable component (in addition to values). */
@@ -210,12 +224,22 @@ struct ipcp_lattice
/* The value of the lattice is bottom (i.e. variable and unusable for any
propagation). */
bool bottom;
+
+ inline bool is_single_const ();
+ inline bool set_to_bottom ();
+ inline bool set_contains_variable ();
+ bool add_value (valtype newval, cgraph_edge *cs,
+ ipcp_value<valtype> *src_val = NULL,
+ int src_idx = 0, HOST_WIDE_INT offset = -1);
+ void print (FILE * f, bool dump_sources, bool dump_benefits);
};
-/* Lattice with an offset to describe a part of an aggregate. */
+/* Lattice of tree values with an offset to describe a part of an
+ aggregate. */
-struct ipcp_agg_lattice : public ipcp_lattice
+class ipcp_agg_lattice : public ipcp_lattice<tree>
{
+public:
/* Offset that is being described by this lattice. */
HOST_WIDE_INT offset;
/* Size so that we don't have to re-compute it every time we traverse the
@@ -229,12 +253,15 @@ struct ipcp_agg_lattice : public ipcp_lattice
aggregates that are passed in the parameter or by a reference in a parameter
plus some other useful flags. */
-struct ipcp_param_lattices
+class ipcp_param_lattices
{
+public:
/* Lattice describing the value of the parameter itself. */
- struct ipcp_lattice itself;
+ ipcp_lattice<tree> itself;
+ /* Lattice describing the the polymorphic contexts of a parameter. */
+ ipcp_lattice<ipa_polymorphic_call_context> ctxlat;
/* Lattices describing aggregate parts. */
- struct ipcp_agg_lattice *aggs;
+ ipcp_agg_lattice *aggs;
/* Number of aggregate lattices */
int aggs_count;
/* True if aggregate data were passed by reference (as opposed to by
@@ -253,7 +280,8 @@ struct ipcp_param_lattices
/* Allocation pools for values and their sources in ipa-cp. */
-alloc_pool ipcp_values_pool;
+alloc_pool ipcp_cst_values_pool;
+alloc_pool ipcp_poly_ctx_values_pool;
alloc_pool ipcp_sources_pool;
alloc_pool ipcp_agg_lattice_pool;
@@ -265,10 +293,6 @@ static gcov_type max_count;
static long overall_size, max_new_size;
-/* Head of the linked list of topologically sorted values. */
-
-static struct ipcp_value *values_topo;
-
/* Return the param lattices structure corresponding to the Ith formal
parameter of the function described by INFO. */
static inline struct ipcp_param_lattices *
@@ -282,22 +306,30 @@ ipa_get_parm_lattices (struct ipa_node_params *info, int i)
/* Return the lattice corresponding to the scalar value of the Ith formal
parameter of the function described by INFO. */
-static inline struct ipcp_lattice *
+static inline ipcp_lattice<tree> *
ipa_get_scalar_lat (struct ipa_node_params *info, int i)
{
struct ipcp_param_lattices *plats = ipa_get_parm_lattices (info, i);
return &plats->itself;
}
+/* Return the lattice corresponding to the scalar value of the Ith formal
+ parameter of the function described by INFO. */
+static inline ipcp_lattice<ipa_polymorphic_call_context> *
+ipa_get_poly_ctx_lat (struct ipa_node_params *info, int i)
+{
+ struct ipcp_param_lattices *plats = ipa_get_parm_lattices (info, i);
+ return &plats->ctxlat;
+}
+
/* Return whether LAT is a lattice with a single constant and without an
undefined value. */
-static inline bool
-ipa_lat_is_single_const (struct ipcp_lattice *lat)
+template <typename valtype>
+inline bool
+ipcp_lattice<valtype>::is_single_const ()
{
- if (lat->bottom
- || lat->contains_variable
- || lat->values_count != 1)
+ if (bottom || contains_variable || values_count != 1)
return false;
else
return true;
@@ -308,12 +340,7 @@ ipa_lat_is_single_const (struct ipcp_lattice *lat)
static void
print_ipcp_constant_value (FILE * f, tree v)
{
- if (TREE_CODE (v) == TREE_BINFO)
- {
- fprintf (f, "BINFO ");
- print_generic_expr (f, BINFO_TYPE (v), 0);
- }
- else if (TREE_CODE (v) == ADDR_EXPR
+ if (TREE_CODE (v) == ADDR_EXPR
&& TREE_CODE (TREE_OPERAND (v, 0)) == CONST_DECL)
{
fprintf (f, "& ");
@@ -323,28 +350,36 @@ print_ipcp_constant_value (FILE * f, tree v)
print_generic_expr (f, v, 0);
}
-/* Print a lattice LAT to F. */
+/* Print V which is extracted from a value in a lattice to F. */
static void
-print_lattice (FILE * f, struct ipcp_lattice *lat,
- bool dump_sources, bool dump_benefits)
+print_ipcp_constant_value (FILE * f, ipa_polymorphic_call_context v)
+{
+ v.dump(f, false);
+}
+
+/* Print a lattice LAT to F. */
+
+template <typename valtype>
+void
+ipcp_lattice<valtype>::print (FILE * f, bool dump_sources, bool dump_benefits)
{
- struct ipcp_value *val;
+ ipcp_value<valtype> *val;
bool prev = false;
- if (lat->bottom)
+ if (bottom)
{
fprintf (f, "BOTTOM\n");
return;
}
- if (!lat->values_count && !lat->contains_variable)
+ if (!values_count && !contains_variable)
{
fprintf (f, "TOP\n");
return;
}
- if (lat->contains_variable)
+ if (contains_variable)
{
fprintf (f, "VARIABLE");
prev = true;
@@ -352,7 +387,7 @@ print_lattice (FILE * f, struct ipcp_lattice *lat,
fprintf (f, "\n");
}
- for (val = lat->values; val; val = val->next)
+ for (val = values; val; val = val->next)
{
if (dump_benefits && prev)
fprintf (f, " ");
@@ -365,7 +400,7 @@ print_lattice (FILE * f, struct ipcp_lattice *lat,
if (dump_sources)
{
- struct ipcp_value_source *s;
+ ipcp_value_source<valtype> *s;
fprintf (f, " [from:");
for (s = val->sources; s; s = s->next)
@@ -406,8 +441,9 @@ print_all_lattices (FILE * f, bool dump_sources, bool dump_benefits)
struct ipcp_agg_lattice *aglat;
struct ipcp_param_lattices *plats = ipa_get_parm_lattices (info, i);
fprintf (f, " param [%d]: ", i);
- print_lattice (f, &plats->itself, dump_sources, dump_benefits);
-
+ plats->itself.print (f, dump_sources, dump_benefits);
+ fprintf (f, " ctxs: ");
+ plats->ctxlat.print (f, dump_sources, dump_benefits);
if (plats->virt_call)
fprintf (f, " virt_call flag set\n");
@@ -422,7 +458,7 @@ print_all_lattices (FILE * f, bool dump_sources, bool dump_benefits)
{
fprintf (f, " %soffset " HOST_WIDE_INT_PRINT_DEC ": ",
plats->aggs_by_ref ? "ref " : "", aglat->offset);
- print_lattice (f, aglat, dump_sources, dump_benefits);
+ aglat->print (f, dump_sources, dump_benefits);
}
}
}
@@ -586,14 +622,44 @@ ipcp_cloning_candidate_p (struct cgraph_node *node)
return true;
}
+template <typename valtype>
+class value_topo_info
+{
+public:
+ /* Head of the linked list of topologically sorted values. */
+ ipcp_value<valtype> *values_topo;
+ /* Stack for creating SCCs, represented by a linked list too. */
+ ipcp_value<valtype> *stack;
+ /* Counter driving the algorithm in add_val_to_toposort. */
+ int dfs_counter;
+
+ value_topo_info () : values_topo (NULL), stack (NULL), dfs_counter (0)
+ {}
+ void add_val (ipcp_value<valtype> *cur_val);
+ void propagate_effects ();
+};
+
/* Arrays representing a topological ordering of call graph nodes and a stack
- of noes used during constant propagation. */
+ of nodes used during constant propagation and also data required to perform
+ topological sort of values and propagation of benefits in the determined
+ order. */
-struct ipa_topo_info
+class ipa_topo_info
{
+public:
+ /* Array with obtained topological order of cgraph nodes. */
struct cgraph_node **order;
+ /* Stack of cgraph nodes used during propagation within SCC until all values
+ in the SCC stabilize. */
struct cgraph_node **stack;
int nnodes, stack_top;
+
+ value_topo_info<tree> constants;
+ value_topo_info<ipa_polymorphic_call_context> contexts;
+
+ ipa_topo_info () : order(NULL), stack(NULL), nnodes(0), stack_top(0),
+ constants ()
+ {}
};
/* Allocate the arrays in TOPO and topologically sort the nodes into order. */
@@ -604,7 +670,7 @@ build_toporder_info (struct ipa_topo_info *topo)
topo->order = XCNEWVEC (struct cgraph_node *, symtab->cgraph_count);
topo->stack = XCNEWVEC (struct cgraph_node *, symtab->cgraph_count);
- topo->stack_top = 0;
+ gcc_checking_assert (topo->stack_top == 0);
topo->nnodes = ipa_reduced_postorder (topo->order, true, true, NULL);
}
@@ -652,22 +718,24 @@ pop_node_from_stack (struct ipa_topo_info *topo)
/* Set lattice LAT to bottom and return true if it previously was not set as
such. */
-static inline bool
-set_lattice_to_bottom (struct ipcp_lattice *lat)
+template <typename valtype>
+inline bool
+ipcp_lattice<valtype>::set_to_bottom ()
{
- bool ret = !lat->bottom;
- lat->bottom = true;
+ bool ret = !bottom;
+ bottom = true;
return ret;
}
/* Mark lattice as containing an unknown value and return true if it previously
was not marked as such. */
-static inline bool
-set_lattice_contains_variable (struct ipcp_lattice *lat)
+template <typename valtype>
+inline bool
+ipcp_lattice<valtype>::set_contains_variable ()
{
- bool ret = !lat->contains_variable;
- lat->contains_variable = true;
+ bool ret = !contains_variable;
+ contains_variable = true;
return ret;
}
@@ -699,9 +767,10 @@ set_agg_lats_contain_variable (struct ipcp_param_lattices *plats)
static inline bool
set_all_contains_variable (struct ipcp_param_lattices *plats)
{
- bool ret = !plats->itself.contains_variable || !plats->aggs_contain_variable;
- plats->itself.contains_variable = true;
- plats->aggs_contain_variable = true;
+ bool ret;
+ ret = plats->itself.set_contains_variable ();
+ ret |= plats->ctxlat.set_contains_variable ();
+ ret |= set_agg_lats_contain_variable (plats);
return ret;
}
@@ -735,7 +804,8 @@ initialize_node_lattices (struct cgraph_node *node)
struct ipcp_param_lattices *plats = ipa_get_parm_lattices (info, i);
if (disable)
{
- set_lattice_to_bottom (&plats->itself);
+ plats->itself.set_to_bottom ();
+ plats->ctxlat.set_to_bottom ();
set_agg_lats_to_bottom (plats);
}
else
@@ -767,21 +837,10 @@ ipa_get_jf_pass_through_result (struct ipa_jump_func *jfunc, tree input)
{
tree restype, res;
- if (TREE_CODE (input) == TREE_BINFO)
- {
- if (ipa_get_jf_pass_through_type_preserved (jfunc))
- {
- gcc_checking_assert (ipa_get_jf_pass_through_operation (jfunc)
- == NOP_EXPR);
- return input;
- }
- return NULL_TREE;
- }
-
+ gcc_checking_assert (is_gimple_ip_invariant (input));
if (ipa_get_jf_pass_through_operation (jfunc) == NOP_EXPR)
return input;
- gcc_checking_assert (is_gimple_ip_invariant (input));
if (TREE_CODE_CLASS (ipa_get_jf_pass_through_operation (jfunc))
== tcc_comparison)
restype = boolean_type_node;
@@ -802,44 +861,22 @@ ipa_get_jf_pass_through_result (struct ipa_jump_func *jfunc, tree input)
static tree
ipa_get_jf_ancestor_result (struct ipa_jump_func *jfunc, tree input)
{
- if (TREE_CODE (input) == TREE_BINFO)
- {
- if (!ipa_get_jf_ancestor_type_preserved (jfunc))
- return NULL;
- /* FIXME: At LTO we can't propagate to non-polymorphic type, because
- we have no ODR equivalency on those. This should be fixed by
- propagating on types rather than binfos that would make type
- matching here unnecesary. */
- if (in_lto_p
- && (TREE_CODE (ipa_get_jf_ancestor_type (jfunc)) != RECORD_TYPE
- || !TYPE_BINFO (ipa_get_jf_ancestor_type (jfunc))
- || !BINFO_VTABLE (TYPE_BINFO (ipa_get_jf_ancestor_type (jfunc)))))
- {
- if (!ipa_get_jf_ancestor_offset (jfunc))
- return input;
- return NULL;
- }
- return get_binfo_at_offset (input,
- ipa_get_jf_ancestor_offset (jfunc),
- ipa_get_jf_ancestor_type (jfunc));
- }
- else if (TREE_CODE (input) == ADDR_EXPR)
+ gcc_checking_assert (TREE_CODE (input) != TREE_BINFO);
+ if (TREE_CODE (input) == ADDR_EXPR)
{
tree t = TREE_OPERAND (input, 0);
t = build_ref_for_offset (EXPR_LOCATION (t), t,
ipa_get_jf_ancestor_offset (jfunc),
- ipa_get_jf_ancestor_type (jfunc)
- ? ipa_get_jf_ancestor_type (jfunc)
- : ptr_type_node, NULL, false);
+ ptr_type_node, NULL, false);
return build_fold_addr_expr (t);
}
else
return NULL_TREE;
}
-/* Determine whether JFUNC evaluates to a known value (that is either a
- constant or a binfo) and if so, return it. Otherwise return NULL. INFO
- describes the caller node so that pass-through jump functions can be
+/* Determine whether JFUNC evaluates to a single known constant value and if
+ so, return it. Otherwise return NULL. INFO describes the caller node or
+ the one it is inlined to, so that pass-through jump functions can be
evaluated. */
tree
@@ -847,8 +884,6 @@ ipa_value_from_jfunc (struct ipa_node_params *info, struct ipa_jump_func *jfunc)
{
if (jfunc->type == IPA_JF_CONST)
return ipa_get_jf_constant (jfunc);
- else if (jfunc->type == IPA_JF_KNOWN_TYPE)
- return ipa_binfo_from_known_type_jfunc (jfunc);
else if (jfunc->type == IPA_JF_PASS_THROUGH
|| jfunc->type == IPA_JF_ANCESTOR)
{
@@ -861,10 +896,10 @@ ipa_value_from_jfunc (struct ipa_node_params *info, struct ipa_jump_func *jfunc)
idx = ipa_get_jf_ancestor_formal_id (jfunc);
if (info->ipcp_orig_node)
- input = info->known_vals[idx];
+ input = info->known_csts[idx];
else
{
- struct ipcp_lattice *lat;
+ ipcp_lattice<tree> *lat;
if (!info->lattices)
{
@@ -872,7 +907,7 @@ ipa_value_from_jfunc (struct ipa_node_params *info, struct ipa_jump_func *jfunc)
return NULL_TREE;
}
lat = ipa_get_scalar_lat (info, idx);
- if (!ipa_lat_is_single_const (lat))
+ if (!lat->is_single_const ())
return NULL_TREE;
input = lat->values->value;
}
@@ -889,6 +924,68 @@ ipa_value_from_jfunc (struct ipa_node_params *info, struct ipa_jump_func *jfunc)
return NULL_TREE;
}
+/* Determie whether JFUNC evaluates to single known polymorphic context, given
+ that INFO describes the caller node or the one it is inlined to, CS is the
+ call graph edge corresponding to JFUNC and CSIDX index of the described
+ parameter. */
+
+ipa_polymorphic_call_context
+ipa_context_from_jfunc (ipa_node_params *info, cgraph_edge *cs, int csidx,
+ ipa_jump_func *jfunc)
+{
+ ipa_edge_args *args = IPA_EDGE_REF (cs);
+ ipa_polymorphic_call_context ctx;
+ ipa_polymorphic_call_context *edge_ctx
+ = cs ? ipa_get_ith_polymorhic_call_context (args, csidx) : NULL;
+
+ if (edge_ctx && !edge_ctx->useless_p ())
+ ctx = *edge_ctx;
+
+ if (jfunc->type == IPA_JF_PASS_THROUGH
+ || jfunc->type == IPA_JF_ANCESTOR)
+ {
+ ipa_polymorphic_call_context srcctx;
+ int srcidx;
+ if (jfunc->type == IPA_JF_PASS_THROUGH)
+ {
+ if (ipa_get_jf_pass_through_operation (jfunc) != NOP_EXPR
+ || !ipa_get_jf_pass_through_type_preserved (jfunc))
+ return ctx;
+ srcidx = ipa_get_jf_pass_through_formal_id (jfunc);
+ }
+ else
+ {
+ if (!ipa_get_jf_ancestor_type_preserved (jfunc))
+ return ctx;
+ srcidx = ipa_get_jf_ancestor_formal_id (jfunc);
+ }
+ if (info->ipcp_orig_node)
+ {
+ if (info->known_contexts.exists ())
+ srcctx = info->known_contexts[srcidx];
+ }
+ else
+ {
+ if (!info->lattices)
+ {
+ gcc_checking_assert (!flag_ipa_cp);
+ return ctx;
+ }
+ ipcp_lattice<ipa_polymorphic_call_context> *lat;
+ lat = ipa_get_poly_ctx_lat (info, srcidx);
+ if (!lat->is_single_const ())
+ return ctx;
+ srcctx = lat->values->value;
+ }
+ if (srcctx.useless_p ())
+ return ctx;
+ if (jfunc->type == IPA_JF_ANCESTOR)
+ srcctx.offset_by (ipa_get_jf_ancestor_offset (jfunc));
+ ctx.combine_with (srcctx);
+ }
+
+ return ctx;
+}
/* If checking is enabled, verify that no lattice is in the TOP state, i.e. not
bottom, not containing a variable component and without any known value at
@@ -906,7 +1003,7 @@ ipcp_verify_propagated_values (void)
for (i = 0; i < count; i++)
{
- struct ipcp_lattice *lat = ipa_get_scalar_lat (info, i);
+ ipcp_lattice<tree> *lat = ipa_get_scalar_lat (info, i);
if (!lat->bottom
&& !lat->contains_variable
@@ -936,9 +1033,6 @@ values_equal_for_ipcp_p (tree x, tree y)
if (x == y)
return true;
- if (TREE_CODE (x) == TREE_BINFO || TREE_CODE (y) == TREE_BINFO)
- return false;
-
if (TREE_CODE (x) == ADDR_EXPR
&& TREE_CODE (y) == ADDR_EXPR
&& TREE_CODE (TREE_OPERAND (x, 0)) == CONST_DECL
@@ -949,48 +1043,90 @@ values_equal_for_ipcp_p (tree x, tree y)
return operand_equal_p (x, y, 0);
}
-/* Add a new value source to VAL, marking that a value comes from edge CS and
- (if the underlying jump function is a pass-through or an ancestor one) from
- a caller value SRC_VAL of a caller parameter described by SRC_INDEX. OFFSET
- is negative if the source was the scalar value of the parameter itself or
- the offset within an aggregate. */
+/* Return true iff X and Y should be considered equal contexts by IPA-CP. */
-static void
-add_value_source (struct ipcp_value *val, struct cgraph_edge *cs,
- struct ipcp_value *src_val, int src_idx, HOST_WIDE_INT offset)
+static bool
+values_equal_for_ipcp_p (ipa_polymorphic_call_context x,
+ ipa_polymorphic_call_context y)
+{
+ return x.equal_to (y);
+}
+
+
+/* Add a new value source to the value represented by THIS, marking that a
+ value comes from edge CS and (if the underlying jump function is a
+ pass-through or an ancestor one) from a caller value SRC_VAL of a caller
+ parameter described by SRC_INDEX. OFFSET is negative if the source was the
+ scalar value of the parameter itself or the offset within an aggregate. */
+
+template <typename valtype>
+void
+ipcp_value<valtype>::add_source (cgraph_edge *cs, ipcp_value *src_val,
+ int src_idx, HOST_WIDE_INT offset)
{
- struct ipcp_value_source *src;
+ ipcp_value_source<valtype> *src;
- src = (struct ipcp_value_source *) pool_alloc (ipcp_sources_pool);
+ src = new (pool_alloc (ipcp_sources_pool)) ipcp_value_source<valtype>;
src->offset = offset;
src->cs = cs;
src->val = src_val;
src->index = src_idx;
- src->next = val->sources;
- val->sources = src;
+ src->next = sources;
+ sources = src;
}
-/* Try to add NEWVAL to LAT, potentially creating a new struct ipcp_value for
- it. CS, SRC_VAL SRC_INDEX and OFFSET are meant for add_value_source and
- have the same meaning. */
+/* Allocate a new ipcp_value holding a tree constant, initialize its value to
+ SOURCE and clear all other fields. */
-static bool
-add_value_to_lattice (struct ipcp_lattice *lat, tree newval,
- struct cgraph_edge *cs, struct ipcp_value *src_val,
- int src_idx, HOST_WIDE_INT offset)
+static ipcp_value<tree> *
+allocate_and_init_ipcp_value (tree source)
+{
+ ipcp_value<tree> *val;
+
+ val = new (pool_alloc (ipcp_cst_values_pool)) ipcp_value<tree>;
+ memset (val, 0, sizeof (*val));
+ val->value = source;
+ return val;
+}
+
+/* Allocate a new ipcp_value holding a polymorphic context, initialize its
+ value to SOURCE and clear all other fields. */
+
+static ipcp_value<ipa_polymorphic_call_context> *
+allocate_and_init_ipcp_value (ipa_polymorphic_call_context source)
{
- struct ipcp_value *val;
+ ipcp_value<ipa_polymorphic_call_context> *val;
+
+ val = new (pool_alloc (ipcp_poly_ctx_values_pool))
+ ipcp_value<ipa_polymorphic_call_context>;
+ memset (val, 0, sizeof (*val));
+ val->value = source;
+ return val;
+}
+
+/* Try to add NEWVAL to LAT, potentially creating a new ipcp_value for it. CS,
+ SRC_VAL SRC_INDEX and OFFSET are meant for add_source and have the same
+ meaning. OFFSET -1 means the source is scalar and not a part of an
+ aggregate. */
- if (lat->bottom)
+template <typename valtype>
+bool
+ipcp_lattice<valtype>::add_value (valtype newval, cgraph_edge *cs,
+ ipcp_value<valtype> *src_val,
+ int src_idx, HOST_WIDE_INT offset)
+{
+ ipcp_value<valtype> *val;
+
+ if (bottom)
return false;
- for (val = lat->values; val; val = val->next)
+ for (val = values; val; val = val->next)
if (values_equal_for_ipcp_p (val->value, newval))
{
if (ipa_edge_within_scc (cs))
{
- struct ipcp_value_source *s;
+ ipcp_value_source<valtype> *s;
for (s = val->sources; s ; s = s->next)
if (s->cs == cs)
break;
@@ -998,63 +1134,48 @@ add_value_to_lattice (struct ipcp_lattice *lat, tree newval,
return false;
}
- add_value_source (val, cs, src_val, src_idx, offset);
+ val->add_source (cs, src_val, src_idx, offset);
return false;
}
- if (lat->values_count == PARAM_VALUE (PARAM_IPA_CP_VALUE_LIST_SIZE))
+ if (values_count == PARAM_VALUE (PARAM_IPA_CP_VALUE_LIST_SIZE))
{
/* We can only free sources, not the values themselves, because sources
of other values in this this SCC might point to them. */
- for (val = lat->values; val; val = val->next)
+ for (val = values; val; val = val->next)
{
while (val->sources)
{
- struct ipcp_value_source *src = val->sources;
+ ipcp_value_source<valtype> *src = val->sources;
val->sources = src->next;
pool_free (ipcp_sources_pool, src);
}
}
- lat->values = NULL;
- return set_lattice_to_bottom (lat);
+ values = NULL;
+ return set_to_bottom ();
}
- lat->values_count++;
- val = (struct ipcp_value *) pool_alloc (ipcp_values_pool);
- memset (val, 0, sizeof (*val));
-
- add_value_source (val, cs, src_val, src_idx, offset);
- val->value = newval;
- val->next = lat->values;
- lat->values = val;
+ values_count++;
+ val = allocate_and_init_ipcp_value (newval);
+ val->add_source (cs, src_val, src_idx, offset);
+ val->next = values;
+ values = val;
return true;
}
-/* Like above but passes a special value of offset to distinguish that the
- origin is the scalar value of the parameter rather than a part of an
- aggregate. */
-
-static inline bool
-add_scalar_value_to_lattice (struct ipcp_lattice *lat, tree newval,
- struct cgraph_edge *cs,
- struct ipcp_value *src_val, int src_idx)
-{
- return add_value_to_lattice (lat, newval, cs, src_val, src_idx, -1);
-}
-
/* Propagate values through a pass-through jump function JFUNC associated with
edge CS, taking values from SRC_LAT and putting them into DEST_LAT. SRC_IDX
is the index of the source parameter. */
static bool
-propagate_vals_accross_pass_through (struct cgraph_edge *cs,
- struct ipa_jump_func *jfunc,
- struct ipcp_lattice *src_lat,
- struct ipcp_lattice *dest_lat,
+propagate_vals_accross_pass_through (cgraph_edge *cs,
+ ipa_jump_func *jfunc,
+ ipcp_lattice<tree> *src_lat,
+ ipcp_lattice<tree> *dest_lat,
int src_idx)
{
- struct ipcp_value *src_val;
+ ipcp_value<tree> *src_val;
bool ret = false;
/* Do not create new values when propagating within an SCC because if there
@@ -1062,17 +1183,16 @@ propagate_vals_accross_pass_through (struct cgraph_edge *cs,
number of them and we would just make lattices bottom. */
if ((ipa_get_jf_pass_through_operation (jfunc) != NOP_EXPR)
&& ipa_edge_within_scc (cs))
- ret = set_lattice_contains_variable (dest_lat);
+ ret = dest_lat->set_contains_variable ();
else
for (src_val = src_lat->values; src_val; src_val = src_val->next)
{
tree cstval = ipa_get_jf_pass_through_result (jfunc, src_val->value);
if (cstval)
- ret |= add_scalar_value_to_lattice (dest_lat, cstval, cs, src_val,
- src_idx);
+ ret |= dest_lat->add_value (cstval, cs, src_val, src_idx);
else
- ret |= set_lattice_contains_variable (dest_lat);
+ ret |= dest_lat->set_contains_variable ();
}
return ret;
@@ -1085,24 +1205,24 @@ propagate_vals_accross_pass_through (struct cgraph_edge *cs,
static bool
propagate_vals_accross_ancestor (struct cgraph_edge *cs,
struct ipa_jump_func *jfunc,
- struct ipcp_lattice *src_lat,
- struct ipcp_lattice *dest_lat,
+ ipcp_lattice<tree> *src_lat,
+ ipcp_lattice<tree> *dest_lat,
int src_idx)
{
- struct ipcp_value *src_val;
+ ipcp_value<tree> *src_val;
bool ret = false;
if (ipa_edge_within_scc (cs))
- return set_lattice_contains_variable (dest_lat);
+ return dest_lat->set_contains_variable ();
for (src_val = src_lat->values; src_val; src_val = src_val->next)
{
tree t = ipa_get_jf_ancestor_result (jfunc, src_val->value);
if (t)
- ret |= add_scalar_value_to_lattice (dest_lat, t, cs, src_val, src_idx);
+ ret |= dest_lat->add_value (t, cs, src_val, src_idx);
else
- ret |= set_lattice_contains_variable (dest_lat);
+ ret |= dest_lat->set_contains_variable ();
}
return ret;
@@ -1114,31 +1234,21 @@ propagate_vals_accross_ancestor (struct cgraph_edge *cs,
static bool
propagate_scalar_accross_jump_function (struct cgraph_edge *cs,
struct ipa_jump_func *jfunc,
- struct ipcp_lattice *dest_lat)
+ ipcp_lattice<tree> *dest_lat)
{
if (dest_lat->bottom)
return false;
- if (jfunc->type == IPA_JF_CONST
- || jfunc->type == IPA_JF_KNOWN_TYPE)
+ if (jfunc->type == IPA_JF_CONST)
{
- tree val;
-
- if (jfunc->type == IPA_JF_KNOWN_TYPE)
- {
- val = ipa_binfo_from_known_type_jfunc (jfunc);
- if (!val)
- return set_lattice_contains_variable (dest_lat);
- }
- else
- val = ipa_get_jf_constant (jfunc);
- return add_scalar_value_to_lattice (dest_lat, val, cs, NULL, 0);
+ tree val = ipa_get_jf_constant (jfunc);
+ return dest_lat->add_value (val, cs, NULL, 0);
}
else if (jfunc->type == IPA_JF_PASS_THROUGH
|| jfunc->type == IPA_JF_ANCESTOR)
{
struct ipa_node_params *caller_info = IPA_NODE_REF (cs->caller);
- struct ipcp_lattice *src_lat;
+ ipcp_lattice<tree> *src_lat;
int src_idx;
bool ret;
@@ -1149,13 +1259,13 @@ propagate_scalar_accross_jump_function (struct cgraph_edge *cs,
src_lat = ipa_get_scalar_lat (caller_info, src_idx);
if (src_lat->bottom)
- return set_lattice_contains_variable (dest_lat);
+ return dest_lat->set_contains_variable ();
/* If we would need to clone the caller and cannot, do not propagate. */
if (!ipcp_versionable_function_p (cs->caller)
&& (src_lat->contains_variable
|| (src_lat->values_count > 1)))
- return set_lattice_contains_variable (dest_lat);
+ return dest_lat->set_contains_variable ();
if (jfunc->type == IPA_JF_PASS_THROUGH)
ret = propagate_vals_accross_pass_through (cs, jfunc, src_lat,
@@ -1165,14 +1275,101 @@ propagate_scalar_accross_jump_function (struct cgraph_edge *cs,
src_idx);
if (src_lat->contains_variable)
- ret |= set_lattice_contains_variable (dest_lat);
+ ret |= dest_lat->set_contains_variable ();
return ret;
}
/* TODO: We currently do not handle member method pointers in IPA-CP (we only
use it for indirect inlining), we should propagate them too. */
- return set_lattice_contains_variable (dest_lat);
+ return dest_lat->set_contains_variable ();
+}
+
+/* Propagate scalar values across jump function JFUNC that is associated with
+ edge CS and describes argument IDX and put the values into DEST_LAT. */
+
+static bool
+propagate_context_accross_jump_function (cgraph_edge *cs,
+ ipa_jump_func *jfunc, int idx,
+ ipcp_lattice<ipa_polymorphic_call_context> *dest_lat)
+{
+ ipa_edge_args *args = IPA_EDGE_REF (cs);
+ if (dest_lat->bottom)
+ return false;
+ bool ret = false;
+ bool added_sth = false;
+
+ ipa_polymorphic_call_context edge_ctx, *edge_ctx_ptr
+ = ipa_get_ith_polymorhic_call_context (args, idx);
+
+ if (edge_ctx_ptr)
+ {
+ edge_ctx = *edge_ctx_ptr;
+ edge_ctx.clear_speculation ();
+ }
+
+ if (jfunc->type == IPA_JF_PASS_THROUGH
+ || jfunc->type == IPA_JF_ANCESTOR)
+ {
+ struct ipa_node_params *caller_info = IPA_NODE_REF (cs->caller);
+ int src_idx;
+ ipcp_lattice<ipa_polymorphic_call_context> *src_lat;
+
+ /* TODO: Once we figure out how to propagate speculations, it will
+ probably be a good idea to switch to speculation if type_preserved is
+ not set instead of punting. */
+ if (jfunc->type == IPA_JF_PASS_THROUGH)
+ {
+ if (ipa_get_jf_pass_through_operation (jfunc) != NOP_EXPR
+ || !ipa_get_jf_pass_through_type_preserved (jfunc))
+ goto prop_fail;
+ src_idx = ipa_get_jf_pass_through_formal_id (jfunc);
+ }
+ else
+ {
+ if (!ipa_get_jf_ancestor_type_preserved (jfunc))
+ goto prop_fail;
+ src_idx = ipa_get_jf_ancestor_formal_id (jfunc);
+ }
+
+ src_lat = ipa_get_poly_ctx_lat (caller_info, src_idx);
+ /* If we would need to clone the caller and cannot, do not propagate. */
+ if (!ipcp_versionable_function_p (cs->caller)
+ && (src_lat->contains_variable
+ || (src_lat->values_count > 1)))
+ goto prop_fail;
+ if (src_lat->contains_variable)
+ ret |= dest_lat->set_contains_variable ();
+
+ ipcp_value<ipa_polymorphic_call_context> *src_val;
+ for (src_val = src_lat->values; src_val; src_val = src_val->next)
+ {
+ ipa_polymorphic_call_context cur = src_val->value;
+ if (jfunc->type == IPA_JF_ANCESTOR)
+ cur.offset_by (ipa_get_jf_ancestor_offset (jfunc));
+ /* TODO: Perhaps attempt to look up some used OTR type? */
+ cur.clear_speculation ();
+ if (!edge_ctx.useless_p ())
+ cur.combine_with (edge_ctx);
+ if (!cur.useless_p ())
+ {
+ ret |= dest_lat->add_value (cur, cs, src_val, src_idx);
+ added_sth = true;
+ }
+ }
+
+ }
+
+ prop_fail:
+ if (!added_sth)
+ {
+ if (!edge_ctx.useless_p ())
+ ret |= dest_lat->add_value (edge_ctx, cs);
+ else
+ ret |= dest_lat->set_contains_variable ();
+ }
+
+ return ret;
}
/* If DEST_PLATS already has aggregate items, check that aggs_by_ref matches
@@ -1222,7 +1419,7 @@ merge_agg_lats_step (struct ipcp_param_lattices *dest_plats,
set_agg_lats_to_bottom (dest_plats);
return false;
}
- *change |= set_lattice_contains_variable (**aglat);
+ *change |= (**aglat)->set_contains_variable ();
*aglat = &(**aglat)->next;
}
@@ -1273,7 +1470,7 @@ set_chain_of_aglats_contains_variable (struct ipcp_agg_lattice *aglat)
bool ret = false;
while (aglat)
{
- ret |= set_lattice_contains_variable (aglat);
+ ret |= aglat->set_contains_variable ();
aglat = aglat->next;
}
return ret;
@@ -1318,16 +1515,16 @@ merge_aggregate_lattices (struct cgraph_edge *cs,
dst_aglat = &(*dst_aglat)->next;
if (src_aglat->bottom)
{
- ret |= set_lattice_contains_variable (new_al);
+ ret |= new_al->set_contains_variable ();
continue;
}
if (src_aglat->contains_variable)
- ret |= set_lattice_contains_variable (new_al);
- for (struct ipcp_value *val = src_aglat->values;
+ ret |= new_al->set_contains_variable ();
+ for (ipcp_value<tree> *val = src_aglat->values;
val;
val = val->next)
- ret |= add_value_to_lattice (new_al, val->value, cs, val, src_idx,
- src_aglat->offset);
+ ret |= new_al->add_value (val->value, cs, val, src_idx,
+ src_aglat->offset);
}
else if (dest_plats->aggs_bottom)
return true;
@@ -1424,7 +1621,7 @@ propagate_aggs_accross_jump_function (struct cgraph_edge *cs,
if (merge_agg_lats_step (dest_plats, item->offset, val_size,
&aglat, pre_existing, &ret))
{
- ret |= add_value_to_lattice (*aglat, item->value, cs, NULL, 0, 0);
+ ret |= (*aglat)->add_value (item->value, cs, NULL, 0, 0);
aglat = &(*aglat)->next;
}
else if (dest_plats->aggs_bottom)
@@ -1509,6 +1706,8 @@ propagate_constants_accross_call (struct cgraph_edge *cs)
{
ret |= propagate_scalar_accross_jump_function (cs, jump_func,
&dest_plats->itself);
+ ret |= propagate_context_accross_jump_function (cs, jump_func, i,
+ &dest_plats->ctxlat);
ret |= propagate_aggs_accross_jump_function (cs, jump_func,
dest_plats);
}
@@ -1520,25 +1719,23 @@ propagate_constants_accross_call (struct cgraph_edge *cs)
}
/* If an indirect edge IE can be turned into a direct one based on KNOWN_VALS
- (which can contain both constants and binfos), KNOWN_BINFOS, KNOWN_AGGS or
- AGG_REPS return the destination. The latter three can be NULL. If AGG_REPS
- is not NULL, KNOWN_AGGS is ignored. */
+ KNOWN_CONTEXTS, KNOWN_AGGS or AGG_REPS return the destination. The latter
+ three can be NULL. If AGG_REPS is not NULL, KNOWN_AGGS is ignored. */
static tree
ipa_get_indirect_edge_target_1 (struct cgraph_edge *ie,
- vec<tree> known_vals,
- vec<tree> known_binfos,
+ vec<tree> known_csts,
+ vec<ipa_polymorphic_call_context> known_contexts,
vec<ipa_agg_jump_function_p> known_aggs,
struct ipa_agg_replacement_value *agg_reps)
{
int param_index = ie->indirect_info->param_index;
- HOST_WIDE_INT token, anc_offset;
- tree otr_type;
+ HOST_WIDE_INT anc_offset;
tree t;
tree target = NULL;
if (param_index == -1
- || known_vals.length () <= (unsigned int) param_index)
+ || known_csts.length () <= (unsigned int) param_index)
return NULL_TREE;
if (!ie->indirect_info->polymorphic)
@@ -1573,7 +1770,7 @@ ipa_get_indirect_edge_target_1 (struct cgraph_edge *ie,
t = NULL;
}
else
- t = known_vals[param_index];
+ t = known_csts[param_index];
if (t &&
TREE_CODE (t) == ADDR_EXPR
@@ -1587,9 +1784,7 @@ ipa_get_indirect_edge_target_1 (struct cgraph_edge *ie,
return NULL_TREE;
gcc_assert (!ie->indirect_info->agg_contents);
- token = ie->indirect_info->otr_token;
anc_offset = ie->indirect_info->offset;
- otr_type = ie->indirect_info->otr_type;
t = NULL;
@@ -1643,42 +1838,43 @@ ipa_get_indirect_edge_target_1 (struct cgraph_edge *ie,
}
}
- /* Did we work out BINFO via type propagation? */
- if (!t && known_binfos.length () > (unsigned int) param_index)
- t = known_binfos[param_index];
- /* Or do we know the constant value of pointer? */
- if (!t)
- t = known_vals[param_index];
+ /* Do we know the constant value of pointer? */
if (!t)
- return NULL_TREE;
+ t = known_csts[param_index];
+
+ gcc_checking_assert (!t || TREE_CODE (t) != TREE_BINFO);
- if (TREE_CODE (t) != TREE_BINFO)
+ ipa_polymorphic_call_context context;
+ if (known_contexts.length () > (unsigned int) param_index)
{
- ipa_polymorphic_call_context context (t, ie->indirect_info->otr_type,
- anc_offset);
- vec <cgraph_node *>targets;
- bool final;
-
- targets = possible_polymorphic_call_targets
- (ie->indirect_info->otr_type,
- ie->indirect_info->otr_token,
- context, &final);
- if (!final || targets.length () > 1)
- return NULL_TREE;
- if (targets.length () == 1)
- target = targets[0]->decl;
- else
- target = ipa_impossible_devirt_target (ie, NULL_TREE);
+ context = known_contexts[param_index];
+ if (t)
+ {
+ ipa_polymorphic_call_context ctx2 = ipa_polymorphic_call_context
+ (t, ie->indirect_info->otr_type, anc_offset);
+ if (!ctx2.useless_p ())
+ context.combine_with (ctx2, ie->indirect_info->otr_type);
+ }
}
+ else if (t)
+ context = ipa_polymorphic_call_context (t, ie->indirect_info->otr_type,
+ anc_offset);
else
- {
- tree binfo;
+ return NULL_TREE;
- binfo = get_binfo_at_offset (t, anc_offset, otr_type);
- if (!binfo)
- return NULL_TREE;
- target = gimple_get_virt_method_for_binfo (token, binfo);
- }
+ vec <cgraph_node *>targets;
+ bool final;
+
+ targets = possible_polymorphic_call_targets
+ (ie->indirect_info->otr_type,
+ ie->indirect_info->otr_token,
+ context, &final);
+ if (!final || targets.length () > 1)
+ return NULL_TREE;
+ if (targets.length () == 1)
+ target = targets[0]->decl;
+ else
+ target = ipa_impossible_devirt_target (ie, NULL_TREE);
if (target && !possible_polymorphic_call_target_p (ie,
cgraph_node::get (target)))
@@ -1688,27 +1884,27 @@ ipa_get_indirect_edge_target_1 (struct cgraph_edge *ie,
}
-/* If an indirect edge IE can be turned into a direct one based on KNOWN_VALS
- (which can contain both constants and binfos), KNOWN_BINFOS (which can be
- NULL) or KNOWN_AGGS (which also can be NULL) return the destination. */
+/* If an indirect edge IE can be turned into a direct one based on KNOWN_CSTS,
+ KNOWN_CONTEXTS (which can be vNULL) or KNOWN_AGGS (which also can be vNULL)
+ return the destination. */
tree
ipa_get_indirect_edge_target (struct cgraph_edge *ie,
- vec<tree> known_vals,
- vec<tree> known_binfos,
+ vec<tree> known_csts,
+ vec<ipa_polymorphic_call_context> known_contexts,
vec<ipa_agg_jump_function_p> known_aggs)
{
- return ipa_get_indirect_edge_target_1 (ie, known_vals, known_binfos,
+ return ipa_get_indirect_edge_target_1 (ie, known_csts, known_contexts,
known_aggs, NULL);
}
/* Calculate devirtualization time bonus for NODE, assuming we know KNOWN_CSTS
- and KNOWN_BINFOS. */
+ and KNOWN_CONTEXTS. */
static int
devirtualization_time_bonus (struct cgraph_node *node,
vec<tree> known_csts,
- vec<tree> known_binfos,
+ vec<ipa_polymorphic_call_context> known_contexts,
vec<ipa_agg_jump_function_p> known_aggs)
{
struct cgraph_edge *ie;
@@ -1721,7 +1917,7 @@ devirtualization_time_bonus (struct cgraph_node *node,
enum availability avail;
tree target;
- target = ipa_get_indirect_edge_target (ie, known_csts, known_binfos,
+ target = ipa_get_indirect_edge_target (ie, known_csts, known_contexts,
known_aggs);
if (!target)
continue;
@@ -1828,7 +2024,7 @@ context_independent_aggregate_values (struct ipcp_param_lattices *plats)
for (struct ipcp_agg_lattice *aglat = plats->aggs;
aglat;
aglat = aglat->next)
- if (ipa_lat_is_single_const (aglat))
+ if (aglat->is_single_const ())
{
struct ipa_agg_jf_item item;
item.offset = aglat->offset;
@@ -1838,25 +2034,27 @@ context_independent_aggregate_values (struct ipcp_param_lattices *plats)
return res;
}
-/* Allocate KNOWN_CSTS, KNOWN_BINFOS and, if non-NULL, KNOWN_AGGS and populate
- them with values of parameters that are known independent of the context.
- INFO describes the function. If REMOVABLE_PARAMS_COST is non-NULL, the
- movement cost of all removable parameters will be stored in it. */
+/* Allocate KNOWN_CSTS, KNOWN_CONTEXTS and, if non-NULL, KNOWN_AGGS and
+ populate them with values of parameters that are known independent of the
+ context. INFO describes the function. If REMOVABLE_PARAMS_COST is
+ non-NULL, the movement cost of all removable parameters will be stored in
+ it. */
static bool
gather_context_independent_values (struct ipa_node_params *info,
- vec<tree> *known_csts,
- vec<tree> *known_binfos,
- vec<ipa_agg_jump_function> *known_aggs,
- int *removable_params_cost)
+ vec<tree> *known_csts,
+ vec<ipa_polymorphic_call_context>
+ *known_contexts,
+ vec<ipa_agg_jump_function> *known_aggs,
+ int *removable_params_cost)
{
int i, count = ipa_get_param_count (info);
bool ret = false;
known_csts->create (0);
- known_binfos->create (0);
+ known_contexts->create (0);
known_csts->safe_grow_cleared (count);
- known_binfos->safe_grow_cleared (count);
+ known_contexts->safe_grow_cleared (count);
if (known_aggs)
{
known_aggs->create (0);
@@ -1869,33 +2067,30 @@ gather_context_independent_values (struct ipa_node_params *info,
for (i = 0; i < count ; i++)
{
struct ipcp_param_lattices *plats = ipa_get_parm_lattices (info, i);
- struct ipcp_lattice *lat = &plats->itself;
+ ipcp_lattice<tree> *lat = &plats->itself;
- if (ipa_lat_is_single_const (lat))
+ if (lat->is_single_const ())
{
- struct ipcp_value *val = lat->values;
- if (TREE_CODE (val->value) != TREE_BINFO)
- {
- (*known_csts)[i] = val->value;
- if (removable_params_cost)
- *removable_params_cost
- += estimate_move_cost (TREE_TYPE (val->value), false);
- ret = true;
- }
- else if (plats->virt_call)
- {
- (*known_binfos)[i] = val->value;
- ret = true;
- }
- else if (removable_params_cost
- && !ipa_is_param_used (info, i))
- *removable_params_cost += ipa_get_param_move_cost (info, i);
+ ipcp_value<tree> *val = lat->values;
+ gcc_checking_assert (TREE_CODE (val->value) != TREE_BINFO);
+ (*known_csts)[i] = val->value;
+ if (removable_params_cost)
+ *removable_params_cost
+ += estimate_move_cost (TREE_TYPE (val->value), false);
+ ret = true;
}
else if (removable_params_cost
&& !ipa_is_param_used (info, i))
*removable_params_cost
+= ipa_get_param_move_cost (info, i);
+ ipcp_lattice<ipa_polymorphic_call_context> *ctxlat = &plats->ctxlat;
+ if (ctxlat->is_single_const ())
+ {
+ (*known_contexts)[i] = ctxlat->values->value;
+ ret = true;
+ }
+
if (known_aggs)
{
vec<ipa_agg_jf_item, va_gc> *agg_items;
@@ -1932,6 +2127,43 @@ agg_jmp_p_vec_for_t_vec (vec<ipa_agg_jump_function> known_aggs)
return ret;
}
+/* Perform time and size measurement of NODE with the context given in
+ KNOWN_CSTS, KNOWN_CONTEXTS and KNOWN_AGGS, calculate the benefit and cost
+ given BASE_TIME of the node without specialization, REMOVABLE_PARAMS_COST of
+ all context-independent removable parameters and EST_MOVE_COST of estimated
+ movement of the considered parameter and store it into VAL. */
+
+static void
+perform_estimation_of_a_value (cgraph_node *node, vec<tree> known_csts,
+ vec<ipa_polymorphic_call_context> known_contexts,
+ vec<ipa_agg_jump_function_p> known_aggs_ptrs,
+ int base_time, int removable_params_cost,
+ int est_move_cost, ipcp_value_base *val)
+{
+ int time, size, time_benefit;
+ inline_hints hints;
+
+ estimate_ipcp_clone_size_and_time (node, known_csts, known_contexts,
+ known_aggs_ptrs, &size, &time,
+ &hints);
+ time_benefit = base_time - time
+ + devirtualization_time_bonus (node, known_csts, known_contexts,
+ known_aggs_ptrs)
+ + hint_time_bonus (hints)
+ + removable_params_cost + est_move_cost;
+
+ gcc_checking_assert (size >=0);
+ /* The inliner-heuristics based estimates may think that in certain
+ contexts some functions do not have any size at all but we want
+ all specializations to have at least a tiny cost, not least not to
+ divide by zero. */
+ if (size == 0)
+ size = 1;
+
+ val->local_time_benefit = time_benefit;
+ val->local_size_cost = size;
+}
+
/* Iterate over known values of parameters of NODE and estimate the local
effects in terms of time and size they have. */
@@ -1940,7 +2172,8 @@ estimate_local_effects (struct cgraph_node *node)
{
struct ipa_node_params *info = IPA_NODE_REF (node);
int i, count = ipa_get_param_count (info);
- vec<tree> known_csts, known_binfos;
+ vec<tree> known_csts;
+ vec<ipa_polymorphic_call_context> known_contexts;
vec<ipa_agg_jump_function> known_aggs;
vec<ipa_agg_jump_function_p> known_aggs_ptrs;
bool always_const;
@@ -1955,7 +2188,7 @@ estimate_local_effects (struct cgraph_node *node)
node->name (), node->order, base_time);
always_const = gather_context_independent_values (info, &known_csts,
- &known_binfos, &known_aggs,
+ &known_contexts, &known_aggs,
&removable_params_cost);
known_aggs_ptrs = agg_jmp_p_vec_for_t_vec (known_aggs);
if (always_const)
@@ -1967,9 +2200,9 @@ estimate_local_effects (struct cgraph_node *node)
init_caller_stats (&stats);
node->call_for_symbol_thunks_and_aliases (gather_caller_stats, &stats,
false);
- estimate_ipcp_clone_size_and_time (node, known_csts, known_binfos,
+ estimate_ipcp_clone_size_and_time (node, known_csts, known_contexts,
known_aggs_ptrs, &size, &time, &hints);
- time -= devirtualization_time_bonus (node, known_csts, known_binfos,
+ time -= devirtualization_time_bonus (node, known_csts, known_contexts,
known_aggs_ptrs);
time -= hint_time_bonus (hints);
time -= removable_params_cost;
@@ -2013,68 +2246,70 @@ estimate_local_effects (struct cgraph_node *node)
for (i = 0; i < count ; i++)
{
struct ipcp_param_lattices *plats = ipa_get_parm_lattices (info, i);
- struct ipcp_lattice *lat = &plats->itself;
- struct ipcp_value *val;
- int emc;
+ ipcp_lattice<tree> *lat = &plats->itself;
+ ipcp_value<tree> *val;
if (lat->bottom
|| !lat->values
- || known_csts[i]
- || known_binfos[i])
+ || known_csts[i])
continue;
for (val = lat->values; val; val = val->next)
{
- int time, size, time_benefit;
- inline_hints hints;
+ gcc_checking_assert (TREE_CODE (val->value) != TREE_BINFO);
+ known_csts[i] = val->value;
- if (TREE_CODE (val->value) != TREE_BINFO)
- {
- known_csts[i] = val->value;
- known_binfos[i] = NULL_TREE;
- emc = estimate_move_cost (TREE_TYPE (val->value), true);
- }
- else if (plats->virt_call)
+ int emc = estimate_move_cost (TREE_TYPE (val->value), true);
+ perform_estimation_of_a_value (node, known_csts, known_contexts,
+ known_aggs_ptrs, base_time,
+ removable_params_cost, emc, val);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
{
- known_csts[i] = NULL_TREE;
- known_binfos[i] = val->value;
- emc = 0;
+ fprintf (dump_file, " - estimates for value ");
+ print_ipcp_constant_value (dump_file, val->value);
+ fprintf (dump_file, " for ");
+ ipa_dump_param (dump_file, info, i);
+ fprintf (dump_file, ": time_benefit: %i, size: %i\n",
+ val->local_time_benefit, val->local_size_cost);
}
- else
- continue;
+ }
+ known_csts[i] = NULL_TREE;
+ }
+
+ for (i = 0; i < count; i++)
+ {
+ struct ipcp_param_lattices *plats = ipa_get_parm_lattices (info, i);
+
+ if (!plats->virt_call)
+ continue;
+
+ ipcp_lattice<ipa_polymorphic_call_context> *ctxlat = &plats->ctxlat;
+ ipcp_value<ipa_polymorphic_call_context> *val;
+
+ if (ctxlat->bottom
+ || !ctxlat->values
+ || !known_contexts[i].useless_p ())
+ continue;
- estimate_ipcp_clone_size_and_time (node, known_csts, known_binfos,
- known_aggs_ptrs, &size, &time,
- &hints);
- time_benefit = base_time - time
- + devirtualization_time_bonus (node, known_csts, known_binfos,
- known_aggs_ptrs)
- + hint_time_bonus (hints)
- + removable_params_cost + emc;
-
- gcc_checking_assert (size >=0);
- /* The inliner-heuristics based estimates may think that in certain
- contexts some functions do not have any size at all but we want
- all specializations to have at least a tiny cost, not least not to
- divide by zero. */
- if (size == 0)
- size = 1;
+ for (val = ctxlat->values; val; val = val->next)
+ {
+ known_contexts[i] = val->value;
+ perform_estimation_of_a_value (node, known_csts, known_contexts,
+ known_aggs_ptrs, base_time,
+ removable_params_cost, 0, val);
if (dump_file && (dump_flags & TDF_DETAILS))
{
- fprintf (dump_file, " - estimates for value ");
+ fprintf (dump_file, " - estimates for polymorphic context ");
print_ipcp_constant_value (dump_file, val->value);
fprintf (dump_file, " for ");
ipa_dump_param (dump_file, info, i);
fprintf (dump_file, ": time_benefit: %i, size: %i\n",
- time_benefit, size);
+ val->local_time_benefit, val->local_size_cost);
}
-
- val->local_time_benefit = time_benefit;
- val->local_size_cost = size;
}
- known_binfos[i] = NULL_TREE;
- known_csts[i] = NULL_TREE;
+ known_contexts[i] = ipa_polymorphic_call_context ();
}
for (i = 0; i < count ; i++)
@@ -2089,33 +2324,24 @@ estimate_local_effects (struct cgraph_node *node)
ajf = &known_aggs[i];
for (aglat = plats->aggs; aglat; aglat = aglat->next)
{
- struct ipcp_value *val;
+ ipcp_value<tree> *val;
if (aglat->bottom || !aglat->values
/* If the following is true, the one value is in known_aggs. */
|| (!plats->aggs_contain_variable
- && ipa_lat_is_single_const (aglat)))
+ && aglat->is_single_const ()))
continue;
for (val = aglat->values; val; val = val->next)
{
- int time, size, time_benefit;
struct ipa_agg_jf_item item;
- inline_hints hints;
item.offset = aglat->offset;
item.value = val->value;
vec_safe_push (ajf->items, item);
- estimate_ipcp_clone_size_and_time (node, known_csts, known_binfos,
- known_aggs_ptrs, &size, &time,
- &hints);
- time_benefit = base_time - time
- + devirtualization_time_bonus (node, known_csts, known_binfos,
- known_aggs_ptrs)
- + hint_time_bonus (hints);
- gcc_checking_assert (size >=0);
- if (size == 0)
- size = 1;
+ perform_estimation_of_a_value (node, known_csts, known_contexts,
+ known_aggs_ptrs, base_time,
+ removable_params_cost, 0, val);
if (dump_file && (dump_flags & TDF_DETAILS))
{
@@ -2124,13 +2350,12 @@ estimate_local_effects (struct cgraph_node *node)
fprintf (dump_file, " for ");
ipa_dump_param (dump_file, info, i);
fprintf (dump_file, "[%soffset: " HOST_WIDE_INT_PRINT_DEC
- "]: time_benefit: %i, size: %i\n",
- plats->aggs_by_ref ? "ref " : "",
- aglat->offset, time_benefit, size);
+ "]: time_benefit: %i, size: %i\n",
+ plats->aggs_by_ref ? "ref " : "",
+ aglat->offset,
+ val->local_time_benefit, val->local_size_cost);
}
- val->local_time_benefit = time_benefit;
- val->local_size_cost = size;
ajf->items->pop ();
}
}
@@ -2140,7 +2365,7 @@ estimate_local_effects (struct cgraph_node *node)
vec_free (known_aggs[i].items);
known_csts.release ();
- known_binfos.release ();
+ known_contexts.release ();
known_aggs.release ();
known_aggs_ptrs.release ();
}
@@ -2149,12 +2374,11 @@ estimate_local_effects (struct cgraph_node *node)
/* Add value CUR_VAL and all yet-unsorted values it is dependent on to the
topological sort of values. */
-static void
-add_val_to_toposort (struct ipcp_value *cur_val)
+template <typename valtype>
+void
+value_topo_info<valtype>::add_val (ipcp_value<valtype> *cur_val)
{
- static int dfs_counter = 0;
- static struct ipcp_value *stack;
- struct ipcp_value_source *src;
+ ipcp_value_source<valtype> *src;
if (cur_val->dfs)
return;
@@ -2172,7 +2396,7 @@ add_val_to_toposort (struct ipcp_value *cur_val)
{
if (src->val->dfs == 0)
{
- add_val_to_toposort (src->val);
+ add_val (src->val);
if (src->val->low_link < cur_val->low_link)
cur_val->low_link = src->val->low_link;
}
@@ -2183,7 +2407,7 @@ add_val_to_toposort (struct ipcp_value *cur_val)
if (cur_val->dfs == cur_val->low_link)
{
- struct ipcp_value *v, *scc_list = NULL;
+ ipcp_value<valtype> *v, *scc_list = NULL;
do
{
@@ -2205,7 +2429,7 @@ add_val_to_toposort (struct ipcp_value *cur_val)
they are not there yet. */
static void
-add_all_node_vals_to_toposort (struct cgraph_node *node)
+add_all_node_vals_to_toposort (cgraph_node *node, ipa_topo_info *topo)
{
struct ipa_node_params *info = IPA_NODE_REF (node);
int i, count = ipa_get_param_count (info);
@@ -2213,19 +2437,32 @@ add_all_node_vals_to_toposort (struct cgraph_node *node)
for (i = 0; i < count ; i++)
{
struct ipcp_param_lattices *plats = ipa_get_parm_lattices (info, i);
- struct ipcp_lattice *lat = &plats->itself;
+ ipcp_lattice<tree> *lat = &plats->itself;
struct ipcp_agg_lattice *aglat;
- struct ipcp_value *val;
if (!lat->bottom)
- for (val = lat->values; val; val = val->next)
- add_val_to_toposort (val);
+ {
+ ipcp_value<tree> *val;
+ for (val = lat->values; val; val = val->next)
+ topo->constants.add_val (val);
+ }
if (!plats->aggs_bottom)
for (aglat = plats->aggs; aglat; aglat = aglat->next)
if (!aglat->bottom)
- for (val = aglat->values; val; val = val->next)
- add_val_to_toposort (val);
+ {
+ ipcp_value<tree> *val;
+ for (val = aglat->values; val; val = val->next)
+ topo->constants.add_val (val);
+ }
+
+ ipcp_lattice<ipa_polymorphic_call_context> *ctxlat = &plats->ctxlat;
+ if (!ctxlat->bottom)
+ {
+ ipcp_value<ipa_polymorphic_call_context> *ctxval;
+ for (ctxval = ctxlat->values; ctxval; ctxval = ctxval->next)
+ topo->contexts.add_val (ctxval);
+ }
}
}
@@ -2271,7 +2508,7 @@ propagate_constants_topo (struct ipa_topo_info *topo)
struct cgraph_edge *cs;
estimate_local_effects (v);
- add_all_node_vals_to_toposort (v);
+ add_all_node_vals_to_toposort (v, topo);
for (cs = v->callees; cs; cs = cs->next_callee)
if (!ipa_edge_within_scc (cs))
propagate_constants_accross_call (cs);
@@ -2297,15 +2534,16 @@ safe_add (int a, int b)
/* Propagate the estimated effects of individual values along the topological
from the dependent values to those they depend on. */
-static void
-propagate_effects (void)
+template <typename valtype>
+void
+value_topo_info<valtype>::propagate_effects ()
{
- struct ipcp_value *base;
+ ipcp_value<valtype> *base;
for (base = values_topo; base; base = base->topo_next)
{
- struct ipcp_value_source *src;
- struct ipcp_value *val;
+ ipcp_value_source<valtype> *src;
+ ipcp_value<valtype> *val;
int time = 0, size = 0;
for (val = base; val; val = val->scc_next)
@@ -2329,8 +2567,8 @@ propagate_effects (void)
}
-/* Propagate constants, binfos and their effects from the summaries
- interprocedurally. */
+/* Propagate constants, polymorphic contexts and their effects from the
+ summaries interprocedurally. */
static void
ipcp_propagate_stage (struct ipa_topo_info *topo)
@@ -2374,7 +2612,8 @@ ipcp_propagate_stage (struct ipa_topo_info *topo)
#ifdef ENABLE_CHECKING
ipcp_verify_propagated_values ();
#endif
- propagate_effects ();
+ topo->constants.propagate_effects ();
+ topo->contexts.propagate_effects ();
if (dump_file)
{
@@ -2384,11 +2623,13 @@ ipcp_propagate_stage (struct ipa_topo_info *topo)
}
/* Discover newly direct outgoing edges from NODE which is a new clone with
- known KNOWN_VALS and make them direct. */
+ known KNOWN_CSTS and make them direct. */
static void
ipcp_discover_new_direct_edges (struct cgraph_node *node,
- vec<tree> known_vals,
+ vec<tree> known_csts,
+ vec<ipa_polymorphic_call_context>
+ known_contexts,
struct ipa_agg_replacement_value *aggvals)
{
struct cgraph_edge *ie, *next_ie;
@@ -2399,8 +2640,8 @@ ipcp_discover_new_direct_edges (struct cgraph_node *node,
tree target;
next_ie = ie->next_callee;
- target = ipa_get_indirect_edge_target_1 (ie, known_vals, vNULL, vNULL,
- aggvals);
+ target = ipa_get_indirect_edge_target_1 (ie, known_csts, known_contexts,
+ vNULL, aggvals);
if (target)
{
bool agg_contents = ie->indirect_info->agg_contents;
@@ -2513,7 +2754,7 @@ get_clone_agg_value (struct cgraph_node *node, HOST_WIDE_INT offset,
static bool
cgraph_edge_brings_value_p (struct cgraph_edge *cs,
- struct ipcp_value_source *src)
+ ipcp_value_source<tree> *src)
{
struct ipa_node_params *caller_info = IPA_NODE_REF (cs->caller);
cgraph_node *real_dest = cs->callee->function_symbol ();
@@ -2529,7 +2770,7 @@ cgraph_edge_brings_value_p (struct cgraph_edge *cs,
{
tree t;
if (src->offset == -1)
- t = caller_info->known_vals[src->index];
+ t = caller_info->known_csts[src->index];
else
t = get_clone_agg_value (cs->caller, src->offset, src->index);
return (t != NULL_TREE
@@ -2541,7 +2782,7 @@ cgraph_edge_brings_value_p (struct cgraph_edge *cs,
struct ipcp_param_lattices *plats = ipa_get_parm_lattices (caller_info,
src->index);
if (src->offset == -1)
- return (ipa_lat_is_single_const (&plats->itself)
+ return (plats->itself.is_single_const ()
&& values_equal_for_ipcp_p (src->val->value,
plats->itself.values->value));
else
@@ -2550,7 +2791,7 @@ cgraph_edge_brings_value_p (struct cgraph_edge *cs,
return false;
for (aglat = plats->aggs; aglat; aglat = aglat->next)
if (aglat->offset == src->offset)
- return (ipa_lat_is_single_const (aglat)
+ return (aglat->is_single_const ()
&& values_equal_for_ipcp_p (src->val->value,
aglat->values->value));
}
@@ -2558,6 +2799,35 @@ cgraph_edge_brings_value_p (struct cgraph_edge *cs,
}
}
+/* Return true if edge CS does bring about the value described by SRC. */
+
+static bool
+cgraph_edge_brings_value_p (struct cgraph_edge *cs,
+ ipcp_value_source<ipa_polymorphic_call_context>
+ *src)
+{
+ struct ipa_node_params *caller_info = IPA_NODE_REF (cs->caller);
+ cgraph_node *real_dest = cs->callee->function_symbol ();
+ struct ipa_node_params *dst_info = IPA_NODE_REF (real_dest);
+
+ if ((dst_info->ipcp_orig_node && !dst_info->is_all_contexts_clone)
+ || caller_info->node_dead)
+ return false;
+ if (!src->val)
+ return true;
+
+ if (caller_info->ipcp_orig_node)
+ return (caller_info->known_contexts.length () > (unsigned) src->index)
+ && values_equal_for_ipcp_p (src->val->value,
+ caller_info->known_contexts[src->index]);
+
+ struct ipcp_param_lattices *plats = ipa_get_parm_lattices (caller_info,
+ src->index);
+ return plats->ctxlat.is_single_const ()
+ && values_equal_for_ipcp_p (src->val->value,
+ plats->ctxlat.values->value);
+}
+
/* Get the next clone in the linked list of clones of an edge. */
static inline struct cgraph_edge *
@@ -2570,11 +2840,12 @@ get_next_cgraph_edge_clone (struct cgraph_edge *cs)
edge frequency and their number into *FREQUENCY and *CALLER_COUNT
respectively. */
+template <typename valtype>
static bool
-get_info_about_necessary_edges (struct ipcp_value *val, int *freq_sum,
+get_info_about_necessary_edges (ipcp_value<valtype> *val, int *freq_sum,
gcov_type *count_sum, int *caller_count)
{
- struct ipcp_value_source *src;
+ ipcp_value_source<valtype> *src;
int freq = 0, count = 0;
gcov_type cnt = 0;
bool hot = false;
@@ -2604,10 +2875,11 @@ get_info_about_necessary_edges (struct ipcp_value *val, int *freq_sum,
/* Return a vector of incoming edges that do bring value VAL. It is assumed
their number is known and equal to CALLER_COUNT. */
+template <typename valtype>
static vec<cgraph_edge *>
-gather_edges_for_value (struct ipcp_value *val, int caller_count)
+gather_edges_for_value (ipcp_value<valtype> *val, int caller_count)
{
- struct ipcp_value_source *src;
+ ipcp_value_source<valtype> *src;
vec<cgraph_edge *> ret;
ret.create (caller_count);
@@ -2785,12 +3057,14 @@ update_specialized_profile (struct cgraph_node *new_node,
dump_profile_updates (orig_node, new_node);
}
-/* Create a specialized version of NODE with known constants and types of
- parameters in KNOWN_VALS and redirect all edges in CALLERS to it. */
+/* Create a specialized version of NODE with known constants in KNOWN_CSTS,
+ known contexts in KNOWN_CONTEXTS and known aggregate values in AGGVALS and
+ redirect all edges in CALLERS to it. */
static struct cgraph_node *
create_specialized_node (struct cgraph_node *node,
- vec<tree> known_vals,
+ vec<tree> known_csts,
+ vec<ipa_polymorphic_call_context> known_contexts,
struct ipa_agg_replacement_value *aggvals,
vec<cgraph_edge *> callers)
{
@@ -2808,10 +3082,9 @@ create_specialized_node (struct cgraph_node *node,
args_to_skip = BITMAP_GGC_ALLOC ();
for (i = 0; i < count; i++)
{
- tree t = known_vals[i];
+ tree t = known_csts[i];
- if ((t && TREE_CODE (t) != TREE_BINFO)
- || !ipa_is_param_used (info, i))
+ if (t || !ipa_is_param_used (info, i))
bitmap_set_bit (args_to_skip, i);
}
}
@@ -2824,11 +3097,12 @@ create_specialized_node (struct cgraph_node *node,
for (i = 0; i < count ; i++)
{
- tree t = known_vals[i];
- if (t && TREE_CODE (t) != TREE_BINFO)
+ tree t = known_csts[i];
+ if (t)
{
struct ipa_replace_map *replace_map;
+ gcc_checking_assert (TREE_CODE (t) != TREE_BINFO);
replace_map = get_replacement_map (info, t, i);
if (replace_map)
vec_safe_push (replace_trees, replace_map);
@@ -2845,6 +3119,15 @@ create_specialized_node (struct cgraph_node *node,
{
fprintf (dump_file, " the new node is %s/%i.\n",
new_node->name (), new_node->order);
+ if (known_contexts.exists ())
+ {
+ for (i = 0; i < count ; i++)
+ if (!known_contexts[i].useless_p ())
+ {
+ fprintf (dump_file, " known ctx %i is ", i);
+ known_contexts[i].dump (dump_file);
+ }
+ }
if (aggvals)
ipa_dump_agg_replacement_values (dump_file, aggvals);
}
@@ -2852,21 +3135,21 @@ create_specialized_node (struct cgraph_node *node,
update_profiling_info (node, new_node);
new_info = IPA_NODE_REF (new_node);
new_info->ipcp_orig_node = node;
- new_info->known_vals = known_vals;
+ new_info->known_csts = known_csts;
+ new_info->known_contexts = known_contexts;
- ipcp_discover_new_direct_edges (new_node, known_vals, aggvals);
+ ipcp_discover_new_direct_edges (new_node, known_csts, known_contexts, aggvals);
callers.release ();
return new_node;
}
/* Given a NODE, and a subset of its CALLERS, try to populate blanks slots in
- KNOWN_VALS with constants and types that are also known for all of the
- CALLERS. */
+ KNOWN_CSTS with constants that are also known for all of the CALLERS. */
static void
find_more_scalar_values_for_callers_subset (struct cgraph_node *node,
- vec<tree> known_vals,
+ vec<tree> known_csts,
vec<cgraph_edge *> callers)
{
struct ipa_node_params *info = IPA_NODE_REF (node);
@@ -2878,7 +3161,7 @@ find_more_scalar_values_for_callers_subset (struct cgraph_node *node,
tree newval = NULL_TREE;
int j;
- if (ipa_get_scalar_lat (info, i)->bottom || known_vals[i])
+ if (ipa_get_scalar_lat (info, i)->bottom || known_csts[i])
continue;
FOR_EACH_VEC_ELT (callers, j, cs)
@@ -2915,11 +3198,80 @@ find_more_scalar_values_for_callers_subset (struct cgraph_node *node,
fprintf (dump_file, "\n");
}
- known_vals[i] = newval;
+ known_csts[i] = newval;
}
}
}
+/* Given a NODE and a subset of its CALLERS, try to populate plank slots in
+ KNOWN_CONTEXTS with polymorphic contexts that are also known for all of the
+ CALLERS. */
+
+static void
+find_more_contexts_for_caller_subset (cgraph_node *node,
+ vec<ipa_polymorphic_call_context>
+ *known_contexts,
+ vec<cgraph_edge *> callers)
+{
+ ipa_node_params *info = IPA_NODE_REF (node);
+ int i, count = ipa_get_param_count (info);
+
+ for (i = 0; i < count ; i++)
+ {
+ cgraph_edge *cs;
+
+ if (ipa_get_poly_ctx_lat (info, i)->bottom
+ || (known_contexts->exists ()
+ && !(*known_contexts)[i].useless_p ()))
+ continue;
+
+ ipa_polymorphic_call_context newval;
+ bool found = false;
+ int j;
+
+ FOR_EACH_VEC_ELT (callers, j, cs)
+ {
+ if (i >= ipa_get_cs_argument_count (IPA_EDGE_REF (cs)))
+ return;
+ ipa_jump_func *jfunc = ipa_get_ith_jump_func (IPA_EDGE_REF (cs),
+ i);
+ ipa_polymorphic_call_context ctx;
+ ctx = ipa_context_from_jfunc (IPA_NODE_REF (cs->caller), cs, i,
+ jfunc);
+ ctx.clear_speculation ();
+ if (ctx.useless_p ()
+ || (found && !values_equal_for_ipcp_p (newval, ctx)))
+ {
+ found = false;
+ break;
+ }
+ else if (!found)
+ {
+ found = true;
+ newval = ctx;
+ }
+ }
+
+ if (found)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, " adding an extra known polymorphic "
+ "context ");
+ print_ipcp_constant_value (dump_file, newval);
+ fprintf (dump_file, " for ");
+ ipa_dump_param (dump_file, info, i);
+ fprintf (dump_file, "\n");
+ }
+
+ if (!known_contexts->exists ())
+ known_contexts->safe_grow_cleared (ipa_get_param_count (info));
+ (*known_contexts)[i] = newval;
+ }
+
+ }
+}
+
/* Go through PLATS and create a vector of values consisting of values and
offsets (minus OFFSET) of lattices that contain only a single value. */
@@ -2932,7 +3284,7 @@ copy_plats_to_inter (struct ipcp_param_lattices *plats, HOST_WIDE_INT offset)
return vNULL;
for (struct ipcp_agg_lattice *aglat = plats->aggs; aglat; aglat = aglat->next)
- if (ipa_lat_is_single_const (aglat))
+ if (aglat->is_single_const ())
{
struct ipa_agg_jf_item ti;
ti.offset = aglat->offset - offset;
@@ -3293,7 +3645,7 @@ cgraph_edge_brings_all_scalars_for_node (struct cgraph_edge *cs,
struct ipa_jump_func *jump_func;
tree val, t;
- val = dest_info->known_vals[i];
+ val = dest_info->known_csts[i];
if (!val)
continue;
@@ -3385,10 +3737,11 @@ cgraph_edge_brings_all_agg_vals_for_node (struct cgraph_edge *cs,
all other criteria such that they can be redirected the the special node.
This function can therefore redirect the final edge in a SCC. */
+template <typename valtype>
static void
-perhaps_add_new_callers (struct cgraph_node *node, struct ipcp_value *val)
+perhaps_add_new_callers (cgraph_node *node, ipcp_value<valtype> *val)
{
- struct ipcp_value_source *src;
+ ipcp_value_source<valtype> *src;
gcov_type redirected_sum = 0;
for (src = val->sources; src; src = src->next)
@@ -3426,28 +3779,70 @@ perhaps_add_new_callers (struct cgraph_node *node, struct ipcp_value *val)
update_specialized_profile (val->spec_node, node, redirected_sum);
}
+/* Return true if KNOWN_CONTEXTS contain at least one useful context. */
+
+static bool
+known_contexts_useful_p (vec<ipa_polymorphic_call_context> known_contexts)
+{
+ ipa_polymorphic_call_context *ctx;
+ int i;
+
+ FOR_EACH_VEC_ELT (known_contexts, i, ctx)
+ if (!ctx->useless_p ())
+ return true;
+ return false;
+}
+
+/* Return a copy of KNOWN_CSTS if it is not empty, otherwise return vNULL. */
+
+static vec<ipa_polymorphic_call_context>
+copy_useful_known_contexts (vec<ipa_polymorphic_call_context> known_contexts)
+{
+ if (known_contexts_useful_p (known_contexts))
+ return known_contexts.copy ();
+ else
+ return vNULL;
+}
-/* Copy KNOWN_BINFOS to KNOWN_VALS. */
+/* Copy KNOWN_CSTS and modify the copy according to VAL and INDEX. If
+ non-empty, replace KNOWN_CONTEXTS with its copy too. */
static void
-move_binfos_to_values (vec<tree> known_vals,
- vec<tree> known_binfos)
+modify_known_vectors_with_val (vec<tree> *known_csts,
+ vec<ipa_polymorphic_call_context> *known_contexts,
+ ipcp_value<tree> *val,
+ int index)
{
- tree t;
- int i;
+ *known_csts = known_csts->copy ();
+ *known_contexts = copy_useful_known_contexts (*known_contexts);
+ (*known_csts)[index] = val->value;
+}
+
+/* Replace KNOWN_CSTS with its copy. Also copy KNOWN_CONTEXTS and modify the
+ copy according to VAL and INDEX. */
- for (i = 0; known_binfos.iterate (i, &t); i++)
- if (t)
- known_vals[i] = t;
+static void
+modify_known_vectors_with_val (vec<tree> *known_csts,
+ vec<ipa_polymorphic_call_context> *known_contexts,
+ ipcp_value<ipa_polymorphic_call_context> *val,
+ int index)
+{
+ *known_csts = known_csts->copy ();
+ *known_contexts = known_contexts->copy ();
+ (*known_contexts)[index] = val->value;
}
-/* Return true if there is a replacement equivalent to VALUE, INDEX and OFFSET
- among those in the AGGVALS list. */
+/* Return true if OFFSET indicates this was not an aggregate value or there is
+ a replacement equivalent to VALUE, INDEX and OFFSET among those in the
+ AGGVALS list. */
DEBUG_FUNCTION bool
-ipcp_val_in_agg_replacements_p (struct ipa_agg_replacement_value *aggvals,
- int index, HOST_WIDE_INT offset, tree value)
+ipcp_val_agg_replacement_ok_p (ipa_agg_replacement_value *aggvals,
+ int index, HOST_WIDE_INT offset, tree value)
{
+ if (offset == -1)
+ return true;
+
while (aggvals)
{
if (aggvals->index == index
@@ -3459,21 +3854,32 @@ ipcp_val_in_agg_replacements_p (struct ipa_agg_replacement_value *aggvals,
return false;
}
+/* Return true if offset is minus one because source of a polymorphic contect
+ cannot be an aggregate value. */
+
+DEBUG_FUNCTION bool
+ipcp_val_agg_replacement_ok_p (ipa_agg_replacement_value *,
+ int , HOST_WIDE_INT offset,
+ ipa_polymorphic_call_context)
+{
+ return offset == -1;
+}
+
/* Decide wheter to create a special version of NODE for value VAL of parameter
at the given INDEX. If OFFSET is -1, the value is for the parameter itself,
otherwise it is stored at the given OFFSET of the parameter. KNOWN_CSTS,
- KNOWN_BINFOS and KNOWN_AGGS describe the other already known values. */
+ KNOWN_CONTEXTS and KNOWN_AGGS describe the other already known values. */
+template <typename valtype>
static bool
decide_about_value (struct cgraph_node *node, int index, HOST_WIDE_INT offset,
- struct ipcp_value *val, vec<tree> known_csts,
- vec<tree> known_binfos)
+ ipcp_value<valtype> *val, vec<tree> known_csts,
+ vec<ipa_polymorphic_call_context> known_contexts)
{
struct ipa_agg_replacement_value *aggvals;
int freq_sum, caller_count;
gcov_type count_sum;
vec<cgraph_edge *> callers;
- vec<tree> kv;
if (val->spec_node)
{
@@ -3519,16 +3925,20 @@ decide_about_value (struct cgraph_node *node, int index, HOST_WIDE_INT offset,
node->name (), node->order);
callers = gather_edges_for_value (val, caller_count);
- kv = known_csts.copy ();
- move_binfos_to_values (kv, known_binfos);
if (offset == -1)
- kv[index] = val->value;
- find_more_scalar_values_for_callers_subset (node, kv, callers);
+ modify_known_vectors_with_val (&known_csts, &known_contexts, val, index);
+ else
+ {
+ known_csts = known_csts.copy ();
+ known_contexts = copy_useful_known_contexts (known_contexts);
+ }
+ find_more_scalar_values_for_callers_subset (node, known_csts, callers);
+ find_more_contexts_for_caller_subset (node, &known_contexts, callers);
aggvals = find_aggregate_values_for_callers_subset (node, callers);
- gcc_checking_assert (offset == -1
- || ipcp_val_in_agg_replacements_p (aggvals, index,
- offset, val->value));
- val->spec_node = create_specialized_node (node, kv, aggvals, callers);
+ gcc_checking_assert (ipcp_val_agg_replacement_ok_p (aggvals, index,
+ offset, val->value));
+ val->spec_node = create_specialized_node (node, known_csts, known_contexts,
+ aggvals, callers);
overall_size += val->local_size_cost;
/* TODO: If for some lattice there is only one other known value
@@ -3544,7 +3954,8 @@ decide_whether_version_node (struct cgraph_node *node)
{
struct ipa_node_params *info = IPA_NODE_REF (node);
int i, count = ipa_get_param_count (info);
- vec<tree> known_csts, known_binfos;
+ vec<tree> known_csts;
+ vec<ipa_polymorphic_call_context> known_contexts;
vec<ipa_agg_jump_function> known_aggs = vNULL;
bool ret = false;
@@ -3555,37 +3966,49 @@ decide_whether_version_node (struct cgraph_node *node)
fprintf (dump_file, "\nEvaluating opportunities for %s/%i.\n",
node->name (), node->order);
- gather_context_independent_values (info, &known_csts, &known_binfos,
+ gather_context_independent_values (info, &known_csts, &known_contexts,
info->do_clone_for_all_contexts ? &known_aggs
: NULL, NULL);
for (i = 0; i < count ;i++)
{
struct ipcp_param_lattices *plats = ipa_get_parm_lattices (info, i);
- struct ipcp_lattice *lat = &plats->itself;
- struct ipcp_value *val;
+ ipcp_lattice<tree> *lat = &plats->itself;
+ ipcp_lattice<ipa_polymorphic_call_context> *ctxlat = &plats->ctxlat;
if (!lat->bottom
- && !known_csts[i]
- && !known_binfos[i])
- for (val = lat->values; val; val = val->next)
- ret |= decide_about_value (node, i, -1, val, known_csts,
- known_binfos);
+ && !known_csts[i])
+ {
+ ipcp_value<tree> *val;
+ for (val = lat->values; val; val = val->next)
+ ret |= decide_about_value (node, i, -1, val, known_csts,
+ known_contexts);
+ }
if (!plats->aggs_bottom)
{
struct ipcp_agg_lattice *aglat;
- struct ipcp_value *val;
+ ipcp_value<tree> *val;
for (aglat = plats->aggs; aglat; aglat = aglat->next)
if (!aglat->bottom && aglat->values
/* If the following is false, the one value is in
known_aggs. */
&& (plats->aggs_contain_variable
- || !ipa_lat_is_single_const (aglat)))
+ || !aglat->is_single_const ()))
for (val = aglat->values; val; val = val->next)
ret |= decide_about_value (node, i, aglat->offset, val,
- known_csts, known_binfos);
+ known_csts, known_contexts);
}
+
+ if (!ctxlat->bottom
+ && known_contexts[i].useless_p ())
+ {
+ ipcp_value<ipa_polymorphic_call_context> *val;
+ for (val = ctxlat->values; val; val = val->next)
+ ret |= decide_about_value (node, i, -1, val, known_csts,
+ known_contexts);
+ }
+
info = IPA_NODE_REF (node);
}
@@ -3600,8 +4023,13 @@ decide_whether_version_node (struct cgraph_node *node)
node->order);
callers = node->collect_callers ();
- move_binfos_to_values (known_csts, known_binfos);
- clone = create_specialized_node (node, known_csts,
+
+ if (!known_contexts_useful_p (known_contexts))
+ {
+ known_contexts.release ();
+ known_contexts = vNULL;
+ }
+ clone = create_specialized_node (node, known_csts, known_contexts,
known_aggs_to_agg_replacement_list (known_aggs),
callers);
info = IPA_NODE_REF (node);
@@ -3613,9 +4041,11 @@ decide_whether_version_node (struct cgraph_node *node)
ret = true;
}
else
- known_csts.release ();
+ {
+ known_csts.release ();
+ known_contexts.release ();
+ }
- known_binfos.release ();
return ret;
}
@@ -3739,10 +4169,13 @@ ipcp_driver (void)
edge_removal_hook_holder =
symtab->add_edge_removal_hook (&ipcp_edge_removal_hook, NULL);
- ipcp_values_pool = create_alloc_pool ("IPA-CP values",
- sizeof (struct ipcp_value), 32);
+ ipcp_cst_values_pool = create_alloc_pool ("IPA-CP constant values",
+ sizeof (ipcp_value<tree>), 32);
+ ipcp_poly_ctx_values_pool = create_alloc_pool
+ ("IPA-CP polymorphic contexts",
+ sizeof (ipcp_value<ipa_polymorphic_call_context>), 32);
ipcp_sources_pool = create_alloc_pool ("IPA-CP value sources",
- sizeof (struct ipcp_value_source), 64);
+ sizeof (ipcp_value_source<tree>), 64);
ipcp_agg_lattice_pool = create_alloc_pool ("IPA_CP aggregate lattices",
sizeof (struct ipcp_agg_lattice),
32);
@@ -3871,5 +4304,4 @@ ipa_cp_c_finalize (void)
max_count = 0;
overall_size = 0;
max_new_size = 0;
- values_topo = NULL;
}
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
index 32c654906b1..5e1f5713122 100644
--- a/gcc/ipa-devirt.c
+++ b/gcc/ipa-devirt.c
@@ -2281,10 +2281,7 @@ possible_polymorphic_call_targets (tree otr_type,
/* Without outer type, we have no use for offset. Just do the
basic search from innter type */
if (!context.outer_type)
- {
- context.outer_type = otr_type;
- context.offset = 0;
- }
+ context.clear_outer_type (otr_type);
/* We need to update our hiearchy if the type does not exist. */
outer_type = get_odr_type (context.outer_type, true);
/* If the type is complete, there are no derivations. */
diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c
index eb1c6ec2d0d..69e06123fee 100644
--- a/gcc/ipa-inline-analysis.c
+++ b/gcc/ipa-inline-analysis.c
@@ -895,7 +895,8 @@ static void
evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p,
clause_t *clause_ptr,
vec<tree> *known_vals_ptr,
- vec<tree> *known_binfos_ptr,
+ vec<ipa_polymorphic_call_context>
+ *known_contexts_ptr,
vec<ipa_agg_jump_function_p> *known_aggs_ptr)
{
struct cgraph_node *callee = e->callee->ultimate_alias_target ();
@@ -907,12 +908,12 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p,
*clause_ptr = inline_p ? 0 : 1 << predicate_not_inlined_condition;
if (known_vals_ptr)
known_vals_ptr->create (0);
- if (known_binfos_ptr)
- known_binfos_ptr->create (0);
+ if (known_contexts_ptr)
+ known_contexts_ptr->create (0);
if (ipa_node_params_vector.exists ()
&& !e->call_stmt_cannot_inline_p
- && ((clause_ptr && info->conds) || known_vals_ptr || known_binfos_ptr))
+ && ((clause_ptr && info->conds) || known_vals_ptr || known_contexts_ptr))
{
struct ipa_node_params *parms_info;
struct ipa_edge_args *args = IPA_EDGE_REF (e);
@@ -928,8 +929,8 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p,
known_vals.safe_grow_cleared (count);
if (count && (info->conds || known_aggs_ptr))
known_aggs.safe_grow_cleared (count);
- if (count && known_binfos_ptr)
- known_binfos_ptr->safe_grow_cleared (count);
+ if (count && known_contexts_ptr)
+ known_contexts_ptr->safe_grow_cleared (count);
for (i = 0; i < count; i++)
{
@@ -937,14 +938,16 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p,
tree cst = ipa_value_from_jfunc (parms_info, jf);
if (cst)
{
- if (known_vals.exists () && TREE_CODE (cst) != TREE_BINFO)
+ gcc_checking_assert (TREE_CODE (cst) != TREE_BINFO);
+ if (known_vals.exists ())
known_vals[i] = cst;
- else if (known_binfos_ptr != NULL
- && TREE_CODE (cst) == TREE_BINFO)
- (*known_binfos_ptr)[i] = cst;
}
else if (inline_p && !es->param[i].change_prob)
known_vals[i] = error_mark_node;
+
+ if (known_contexts_ptr)
+ (*known_contexts_ptr)[i] = ipa_context_from_jfunc (parms_info, e,
+ i, jf);
/* TODO: When IPA-CP starts propagating and merging aggregate jump
functions, use its knowledge of the caller too, just like the
scalar case above. */
@@ -2969,14 +2972,14 @@ make_pass_inline_parameters (gcc::context *ctxt)
}
-/* Estimate benefit devirtualizing indirect edge IE, provided KNOWN_VALS and
- KNOWN_BINFOS. */
+/* Estimate benefit devirtualizing indirect edge IE, provided KNOWN_VALS,
+ KNOWN_CONTEXTS and KNOWN_AGGS. */
static bool
estimate_edge_devirt_benefit (struct cgraph_edge *ie,
int *size, int *time,
vec<tree> known_vals,
- vec<tree> known_binfos,
+ vec<ipa_polymorphic_call_context> known_contexts,
vec<ipa_agg_jump_function_p> known_aggs)
{
tree target;
@@ -2984,12 +2987,12 @@ estimate_edge_devirt_benefit (struct cgraph_edge *ie,
struct inline_summary *isummary;
enum availability avail;
- if (!known_vals.exists () && !known_binfos.exists ())
+ if (!known_vals.exists () && !known_contexts.exists ())
return false;
if (!flag_indirect_inlining)
return false;
- target = ipa_get_indirect_edge_target (ie, known_vals, known_binfos,
+ target = ipa_get_indirect_edge_target (ie, known_vals, known_contexts,
known_aggs);
if (!target)
return false;
@@ -3013,7 +3016,7 @@ estimate_edge_devirt_benefit (struct cgraph_edge *ie,
/* Increase SIZE, MIN_SIZE (if non-NULL) and TIME for size and time needed to
handle edge E with probability PROB.
Set HINTS if edge may be devirtualized.
- KNOWN_VALS, KNOWN_AGGS and KNOWN_BINFOS describe context of the call
+ KNOWN_VALS, KNOWN_AGGS and KNOWN_CONTEXTS describe context of the call
site. */
static inline void
@@ -3021,7 +3024,7 @@ estimate_edge_size_and_time (struct cgraph_edge *e, int *size, int *min_size,
int *time,
int prob,
vec<tree> known_vals,
- vec<tree> known_binfos,
+ vec<ipa_polymorphic_call_context> known_contexts,
vec<ipa_agg_jump_function_p> known_aggs,
inline_hints *hints)
{
@@ -3031,7 +3034,7 @@ estimate_edge_size_and_time (struct cgraph_edge *e, int *size, int *min_size,
int cur_size;
if (!e->callee
&& estimate_edge_devirt_benefit (e, &call_size, &call_time,
- known_vals, known_binfos, known_aggs)
+ known_vals, known_contexts, known_aggs)
&& hints && e->maybe_hot_p ())
*hints |= INLINE_HINT_indirect_call;
cur_size = call_size * INLINE_SIZE_SCALE;
@@ -3047,9 +3050,8 @@ estimate_edge_size_and_time (struct cgraph_edge *e, int *size, int *min_size,
/* Increase SIZE, MIN_SIZE and TIME for size and time needed to handle all
- calls in NODE.
- POSSIBLE_TRUTHS, KNOWN_VALS, KNOWN_AGGS and KNOWN_BINFOS describe context of
- the call site. */
+ calls in NODE. POSSIBLE_TRUTHS, KNOWN_VALS, KNOWN_AGGS and KNOWN_CONTEXTS
+ describe context of the call site. */
static void
estimate_calls_size_and_time (struct cgraph_node *node, int *size,
@@ -3057,7 +3059,7 @@ estimate_calls_size_and_time (struct cgraph_node *node, int *size,
inline_hints *hints,
clause_t possible_truths,
vec<tree> known_vals,
- vec<tree> known_binfos,
+ vec<ipa_polymorphic_call_context> known_contexts,
vec<ipa_agg_jump_function_p> known_aggs)
{
struct cgraph_edge *e;
@@ -3074,14 +3076,14 @@ estimate_calls_size_and_time (struct cgraph_node *node, int *size,
estimate_edge_size_and_time (e, size,
es->predicate ? NULL : min_size,
time, REG_BR_PROB_BASE,
- known_vals, known_binfos,
+ known_vals, known_contexts,
known_aggs, hints);
}
else
estimate_calls_size_and_time (e->callee, size, min_size, time,
hints,
possible_truths,
- known_vals, known_binfos,
+ known_vals, known_contexts,
known_aggs);
}
}
@@ -3093,14 +3095,14 @@ estimate_calls_size_and_time (struct cgraph_node *node, int *size,
estimate_edge_size_and_time (e, size,
es->predicate ? NULL : min_size,
time, REG_BR_PROB_BASE,
- known_vals, known_binfos, known_aggs,
+ known_vals, known_contexts, known_aggs,
hints);
}
}
/* Estimate size and time needed to execute NODE assuming
- POSSIBLE_TRUTHS clause, and KNOWN_VALS, KNOWN_AGGS and KNOWN_BINFOS
+ POSSIBLE_TRUTHS clause, and KNOWN_VALS, KNOWN_AGGS and KNOWN_CONTEXTS
information about NODE's arguments. If non-NULL use also probability
information present in INLINE_PARAM_SUMMARY vector.
Additionally detemine hints determined by the context. Finally compute
@@ -3112,7 +3114,7 @@ static void
estimate_node_size_and_time (struct cgraph_node *node,
clause_t possible_truths,
vec<tree> known_vals,
- vec<tree> known_binfos,
+ vec<ipa_polymorphic_call_context> known_contexts,
vec<ipa_agg_jump_function_p> known_aggs,
int *ret_size, int *ret_min_size, int *ret_time,
inline_hints *ret_hints,
@@ -3189,7 +3191,7 @@ estimate_node_size_and_time (struct cgraph_node *node,
hints |= INLINE_HINT_declared_inline;
estimate_calls_size_and_time (node, &size, &min_size, &time, &hints, possible_truths,
- known_vals, known_binfos, known_aggs);
+ known_vals, known_contexts, known_aggs);
gcc_checking_assert (size >= 0);
gcc_checking_assert (time >= 0);
time = RDIV (time, INLINE_TIME_SCALE);
@@ -3212,13 +3214,14 @@ estimate_node_size_and_time (struct cgraph_node *node,
/* Estimate size and time needed to execute callee of EDGE assuming that
parameters known to be constant at caller of EDGE are propagated.
- KNOWN_VALS and KNOWN_BINFOS are vectors of assumed known constant values
+ KNOWN_VALS and KNOWN_CONTEXTS are vectors of assumed known constant values
and types for parameters. */
void
estimate_ipcp_clone_size_and_time (struct cgraph_node *node,
vec<tree> known_vals,
- vec<tree> known_binfos,
+ vec<ipa_polymorphic_call_context>
+ known_contexts,
vec<ipa_agg_jump_function_p> known_aggs,
int *ret_size, int *ret_time,
inline_hints *hints)
@@ -3227,7 +3230,7 @@ estimate_ipcp_clone_size_and_time (struct cgraph_node *node,
clause = evaluate_conditions_for_known_args (node, false, known_vals,
known_aggs);
- estimate_node_size_and_time (node, clause, known_vals, known_binfos,
+ estimate_node_size_and_time (node, clause, known_vals, known_contexts,
known_aggs, ret_size, NULL, ret_time, hints, vNULL);
}
@@ -3672,7 +3675,7 @@ do_estimate_edge_time (struct cgraph_edge *edge)
struct cgraph_node *callee;
clause_t clause;
vec<tree> known_vals;
- vec<tree> known_binfos;
+ vec<ipa_polymorphic_call_context> known_contexts;
vec<ipa_agg_jump_function_p> known_aggs;
struct inline_edge_summary *es = inline_edge_summary (edge);
int min_size;
@@ -3681,9 +3684,9 @@ do_estimate_edge_time (struct cgraph_edge *edge)
gcc_checking_assert (edge->inline_failed);
evaluate_properties_for_edge (edge, true,
- &clause, &known_vals, &known_binfos,
+ &clause, &known_vals, &known_contexts,
&known_aggs);
- estimate_node_size_and_time (callee, clause, known_vals, known_binfos,
+ estimate_node_size_and_time (callee, clause, known_vals, known_contexts,
known_aggs, &size, &min_size, &time, &hints, es->param);
/* When we have profile feedback, we can quite safely identify hot
@@ -3697,7 +3700,7 @@ do_estimate_edge_time (struct cgraph_edge *edge)
hints |= INLINE_HINT_known_hot;
known_vals.release ();
- known_binfos.release ();
+ known_contexts.release ();
known_aggs.release ();
gcc_checking_assert (size >= 0);
gcc_checking_assert (time >= 0);
@@ -3728,7 +3731,7 @@ do_estimate_edge_size (struct cgraph_edge *edge)
struct cgraph_node *callee;
clause_t clause;
vec<tree> known_vals;
- vec<tree> known_binfos;
+ vec<ipa_polymorphic_call_context> known_contexts;
vec<ipa_agg_jump_function_p> known_aggs;
/* When we do caching, use do_estimate_edge_time to populate the entry. */
@@ -3746,12 +3749,12 @@ do_estimate_edge_size (struct cgraph_edge *edge)
/* Early inliner runs without caching, go ahead and do the dirty work. */
gcc_checking_assert (edge->inline_failed);
evaluate_properties_for_edge (edge, true,
- &clause, &known_vals, &known_binfos,
+ &clause, &known_vals, &known_contexts,
&known_aggs);
- estimate_node_size_and_time (callee, clause, known_vals, known_binfos,
+ estimate_node_size_and_time (callee, clause, known_vals, known_contexts,
known_aggs, &size, NULL, NULL, NULL, vNULL);
known_vals.release ();
- known_binfos.release ();
+ known_contexts.release ();
known_aggs.release ();
return size;
}
@@ -3767,7 +3770,7 @@ do_estimate_edge_hints (struct cgraph_edge *edge)
struct cgraph_node *callee;
clause_t clause;
vec<tree> known_vals;
- vec<tree> known_binfos;
+ vec<ipa_polymorphic_call_context> known_contexts;
vec<ipa_agg_jump_function_p> known_aggs;
/* When we do caching, use do_estimate_edge_time to populate the entry. */
@@ -3785,12 +3788,12 @@ do_estimate_edge_hints (struct cgraph_edge *edge)
/* Early inliner runs without caching, go ahead and do the dirty work. */
gcc_checking_assert (edge->inline_failed);
evaluate_properties_for_edge (edge, true,
- &clause, &known_vals, &known_binfos,
+ &clause, &known_vals, &known_contexts,
&known_aggs);
- estimate_node_size_and_time (callee, clause, known_vals, known_binfos,
+ estimate_node_size_and_time (callee, clause, known_vals, known_contexts,
known_aggs, NULL, NULL, NULL, &hints, vNULL);
known_vals.release ();
- known_binfos.release ();
+ known_contexts.release ();
known_aggs.release ();
hints |= simple_edge_hints (edge);
return hints;
@@ -4024,7 +4027,7 @@ inline_generate_summary (void)
/* When not optimizing, do not bother to analyze. Inlining is still done
because edge redirection needs to happen there. */
- if (!optimize && !flag_lto && !flag_wpa)
+ if (!optimize && !flag_generate_lto && !flag_wpa)
return;
function_insertion_hook_holder =
@@ -4339,11 +4342,6 @@ void
inline_free_summary (void)
{
struct cgraph_node *node;
- if (!inline_edge_summary_vec.exists ())
- return;
- FOR_EACH_DEFINED_FUNCTION (node)
- if (!node->alias)
- reset_inline_summary (node);
if (function_insertion_hook_holder)
symtab->remove_cgraph_insertion_hook (function_insertion_hook_holder);
function_insertion_hook_holder = NULL;
@@ -4359,6 +4357,11 @@ inline_free_summary (void)
if (edge_duplication_hook_holder)
symtab->remove_edge_duplication_hook (edge_duplication_hook_holder);
edge_duplication_hook_holder = NULL;
+ if (!inline_edge_summary_vec.exists ())
+ return;
+ FOR_EACH_DEFINED_FUNCTION (node)
+ if (!node->alias)
+ reset_inline_summary (node);
vec_free (inline_summary_vec);
inline_edge_summary_vec.release ();
if (edge_predicate_pool)
diff --git a/gcc/ipa-inline.h b/gcc/ipa-inline.h
index 2ac6e4e93cb..4ba626441a2 100644
--- a/gcc/ipa-inline.h
+++ b/gcc/ipa-inline.h
@@ -223,7 +223,8 @@ void initialize_inline_failed (struct cgraph_edge *);
int estimate_time_after_inlining (struct cgraph_node *, struct cgraph_edge *);
int estimate_size_after_inlining (struct cgraph_node *, struct cgraph_edge *);
void estimate_ipcp_clone_size_and_time (struct cgraph_node *,
- vec<tree>, vec<tree>,
+ vec<tree>,
+ vec<ipa_polymorphic_call_context>,
vec<ipa_agg_jump_function_p>,
int *, int *, inline_hints *);
int do_estimate_growth (struct cgraph_node *);
diff --git a/gcc/ipa-polymorphic-call.c b/gcc/ipa-polymorphic-call.c
index 33dd1a8c384..f1905f1609a 100644
--- a/gcc/ipa-polymorphic-call.c
+++ b/gcc/ipa-polymorphic-call.c
@@ -106,7 +106,7 @@ possible_placement_new (tree type, tree expected_type,
{
return ((TREE_CODE (type) != RECORD_TYPE
|| !TYPE_BINFO (type)
- || cur_offset >= BITS_PER_WORD
+ || cur_offset >= POINTER_SIZE
|| !polymorphic_type_binfo_p (TYPE_BINFO (type)))
&& (!TYPE_SIZE (type)
|| !tree_fits_shwi_p (TYPE_SIZE (type))
@@ -599,10 +599,11 @@ decl_maybe_in_construction_p (tree base, tree outer_type,
return false;
}
-/* Dump human readable context to F. */
+/* Dump human readable context to F. If NEWLINE is true, it will be terminated
+ by a newline. */
void
-ipa_polymorphic_call_context::dump (FILE *f) const
+ipa_polymorphic_call_context::dump (FILE *f, bool newline) const
{
fprintf (f, " ");
if (invalid)
@@ -634,7 +635,8 @@ ipa_polymorphic_call_context::dump (FILE *f) const
speculative_offset);
}
}
- fprintf(f, "\n");
+ if (newline)
+ fprintf(f, "\n");
}
/* Print context to stderr. */
@@ -2130,3 +2132,47 @@ ipa_polymorphic_call_context::possible_dynamic_type_change (bool in_poly_cdtor,
else if (in_poly_cdtor)
maybe_in_construction = true;
}
+
+/* Return TRUE if this context conveys the same information as OTHER. */
+
+bool
+ipa_polymorphic_call_context::equal_to
+ (const ipa_polymorphic_call_context &x) const
+{
+ if (useless_p ())
+ return x.useless_p ();
+ if (invalid)
+ return x.invalid;
+ if (x.useless_p () || x.invalid)
+ return false;
+
+ if (outer_type)
+ {
+ if (!x.outer_type
+ || !types_odr_comparable (outer_type, x.outer_type)
+ || !types_same_for_odr (outer_type, x.outer_type)
+ || offset != x.offset
+ || maybe_in_construction != x.maybe_in_construction
+ || maybe_derived_type != x.maybe_derived_type
+ || dynamic != x.dynamic)
+ return false;
+ }
+ else if (x.outer_type)
+ return false;
+
+ if (speculative_outer_type)
+ {
+ if (!x.speculative_outer_type
+ || !types_odr_comparable (speculative_outer_type,
+ x.speculative_outer_type)
+ || !types_same_for_odr (speculative_outer_type,
+ x.speculative_outer_type)
+ || speculative_offset != x.speculative_offset
+ || speculative_maybe_derived_type != x.speculative_maybe_derived_type)
+ return false;
+ }
+ else if (x.speculative_outer_type)
+ return false;
+
+ return true;
+}
diff --git a/gcc/ipa-profile.c b/gcc/ipa-profile.c
index b83d1cf7cbc..99d13098534 100644
--- a/gcc/ipa-profile.c
+++ b/gcc/ipa-profile.c
@@ -22,7 +22,7 @@ along with GCC; see the file COPYING3. If not see
- Count histogram construction. This is a histogram analyzing how much
time is spent executing statements with a given execution count read
- from profile feedback. This histogram is complette only with LTO,
+ from profile feedback. This histogram is complete only with LTO,
otherwise it contains information only about the current unit.
Similar histogram is also estimated by coverage runtime. This histogram
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index db85c7d1e7f..f87243ce939 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -303,15 +303,6 @@ ipa_print_node_jump_functions_for_edge (FILE *f, struct cgraph_edge *cs)
fprintf (f, " param %d: ", i);
if (type == IPA_JF_UNKNOWN)
fprintf (f, "UNKNOWN\n");
- else if (type == IPA_JF_KNOWN_TYPE)
- {
- fprintf (f, "KNOWN TYPE: base ");
- print_generic_expr (f, jump_func->value.known_type.base_type, 0);
- fprintf (f, ", offset "HOST_WIDE_INT_PRINT_DEC", component ",
- jump_func->value.known_type.offset);
- print_generic_expr (f, jump_func->value.known_type.component_type, 0);
- fprintf (f, "\n");
- }
else if (type == IPA_JF_CONST)
{
tree val = jump_func->value.constant.value;
@@ -340,21 +331,16 @@ ipa_print_node_jump_functions_for_edge (FILE *f, struct cgraph_edge *cs)
}
if (jump_func->value.pass_through.agg_preserved)
fprintf (f, ", agg_preserved");
- if (jump_func->value.pass_through.type_preserved)
- fprintf (f, ", type_preserved");
fprintf (f, "\n");
}
else if (type == IPA_JF_ANCESTOR)
{
fprintf (f, "ANCESTOR: ");
- fprintf (f, "%d, offset "HOST_WIDE_INT_PRINT_DEC", ",
+ fprintf (f, "%d, offset "HOST_WIDE_INT_PRINT_DEC,
jump_func->value.ancestor.formal_id,
jump_func->value.ancestor.offset);
- print_generic_expr (f, jump_func->value.ancestor.type, 0);
if (jump_func->value.ancestor.agg_preserved)
fprintf (f, ", agg_preserved");
- if (jump_func->value.ancestor.type_preserved)
- fprintf (f, ", type_preserved");
fprintf (f, "\n");
}
@@ -380,8 +366,14 @@ ipa_print_node_jump_functions_for_edge (FILE *f, struct cgraph_edge *cs)
fprintf (f, "\n");
}
}
- if (IPA_EDGE_REF (cs)->polymorphic_call_contexts)
- ipa_get_ith_polymorhic_call_context (IPA_EDGE_REF (cs), i)->dump (f);
+
+ struct ipa_polymorphic_call_context *ctx
+ = ipa_get_ith_polymorhic_call_context (IPA_EDGE_REF (cs), i);
+ if (ctx && !ctx->useless_p ())
+ {
+ fprintf (f, " Context: ");
+ ctx->dump (dump_file);
+ }
}
}
@@ -454,28 +446,6 @@ ipa_print_all_jump_functions (FILE *f)
}
}
-/* Set JFUNC to be a known type jump function. */
-
-static void
-ipa_set_jf_known_type (struct ipa_jump_func *jfunc, HOST_WIDE_INT offset,
- tree base_type, tree component_type)
-{
- /* Recording and propagating main variants increases change that types
- will match. */
- base_type = TYPE_MAIN_VARIANT (base_type);
- component_type = TYPE_MAIN_VARIANT (component_type);
-
- gcc_assert (contains_polymorphic_type_p (base_type)
- && contains_polymorphic_type_p (component_type));
- if (!flag_devirtualize)
- return;
- jfunc->type = IPA_JF_KNOWN_TYPE;
- jfunc->value.known_type.offset = offset,
- jfunc->value.known_type.base_type = base_type;
- jfunc->value.known_type.component_type = component_type;
- gcc_assert (component_type);
-}
-
/* Set JFUNC to be a copy of another jmp (to be used by jump function
combination code). The two functions will share their rdesc. */
@@ -522,14 +492,13 @@ ipa_set_jf_constant (struct ipa_jump_func *jfunc, tree constant,
/* Set JFUNC to be a simple pass-through jump function. */
static void
ipa_set_jf_simple_pass_through (struct ipa_jump_func *jfunc, int formal_id,
- bool agg_preserved, bool type_preserved)
+ bool agg_preserved)
{
jfunc->type = IPA_JF_PASS_THROUGH;
jfunc->value.pass_through.operand = NULL_TREE;
jfunc->value.pass_through.formal_id = formal_id;
jfunc->value.pass_through.operation = NOP_EXPR;
jfunc->value.pass_through.agg_preserved = agg_preserved;
- jfunc->value.pass_through.type_preserved = type_preserved;
}
/* Set JFUNC to be an arithmetic pass through jump function. */
@@ -543,60 +512,18 @@ ipa_set_jf_arith_pass_through (struct ipa_jump_func *jfunc, int formal_id,
jfunc->value.pass_through.formal_id = formal_id;
jfunc->value.pass_through.operation = operation;
jfunc->value.pass_through.agg_preserved = false;
- jfunc->value.pass_through.type_preserved = false;
}
/* Set JFUNC to be an ancestor jump function. */
static void
ipa_set_ancestor_jf (struct ipa_jump_func *jfunc, HOST_WIDE_INT offset,
- tree type, int formal_id, bool agg_preserved,
- bool type_preserved)
+ int formal_id, bool agg_preserved)
{
- if (!flag_devirtualize)
- type_preserved = false;
- if (!type_preserved)
- type = NULL_TREE;
- if (type)
- type = TYPE_MAIN_VARIANT (type);
- gcc_assert (!type_preserved || contains_polymorphic_type_p (type));
jfunc->type = IPA_JF_ANCESTOR;
jfunc->value.ancestor.formal_id = formal_id;
jfunc->value.ancestor.offset = offset;
- jfunc->value.ancestor.type = type_preserved ? type : NULL;
jfunc->value.ancestor.agg_preserved = agg_preserved;
- jfunc->value.ancestor.type_preserved = type_preserved;
-}
-
-/* Extract the acual BINFO being described by JFUNC which must be a known type
- jump function. */
-
-tree
-ipa_binfo_from_known_type_jfunc (struct ipa_jump_func *jfunc)
-{
- if (!RECORD_OR_UNION_TYPE_P (jfunc->value.known_type.base_type))
- return NULL_TREE;
-
- tree base_binfo = TYPE_BINFO (jfunc->value.known_type.base_type);
-
- if (!base_binfo)
- return NULL_TREE;
- /* FIXME: At LTO we can't propagate to non-polymorphic type, because
- we have no ODR equivalency on those. This should be fixed by
- propagating on types rather than binfos that would make type
- matching here unnecesary. */
- if (in_lto_p
- && (TREE_CODE (jfunc->value.known_type.component_type) != RECORD_TYPE
- || !TYPE_BINFO (jfunc->value.known_type.component_type)
- || !BINFO_VTABLE (TYPE_BINFO (jfunc->value.known_type.component_type))))
- {
- if (!jfunc->value.known_type.offset)
- return base_binfo;
- return NULL;
- }
- return get_binfo_at_offset (base_binfo,
- jfunc->value.known_type.offset,
- jfunc->value.known_type.component_type);
}
/* Get IPA BB information about the given BB. FBI is the context of analyzis
@@ -620,14 +547,8 @@ struct prop_type_change_info
/* The declaration or SSA_NAME pointer of the base that we are checking for
type change. */
tree object;
- /* If we actually can tell the type that the object has changed to, it is
- stored in this field. Otherwise it remains NULL_TREE. */
- tree known_current_type;
/* Set to true if dynamic type change has been detected. */
bool type_maybe_changed;
- /* Set to true if multiple types have been encountered. known_current_type
- must be disregarded in that case. */
- bool multiple_types_encountered;
};
/* Return true if STMT can modify a virtual method table pointer.
@@ -695,57 +616,9 @@ stmt_may_be_vtbl_ptr_store (gimple stmt)
return true;
}
-/* If STMT can be proved to be an assignment to the virtual method table
- pointer of ANALYZED_OBJ and the type associated with the new table
- identified, return the type. Otherwise return NULL_TREE. */
-
-static tree
-extr_type_from_vtbl_ptr_store (gimple stmt, struct prop_type_change_info *tci)
-{
- HOST_WIDE_INT offset, size, max_size;
- tree lhs, rhs, base, binfo;
-
- if (!gimple_assign_single_p (stmt))
- return NULL_TREE;
-
- lhs = gimple_assign_lhs (stmt);
- rhs = gimple_assign_rhs1 (stmt);
- if (TREE_CODE (lhs) != COMPONENT_REF
- || !DECL_VIRTUAL_P (TREE_OPERAND (lhs, 1)))
- return NULL_TREE;
-
- base = get_ref_base_and_extent (lhs, &offset, &size, &max_size);
- if (offset != tci->offset
- || size != POINTER_SIZE
- || max_size != POINTER_SIZE)
- return NULL_TREE;
- if (TREE_CODE (base) == MEM_REF)
- {
- if (TREE_CODE (tci->object) != MEM_REF
- || TREE_OPERAND (tci->object, 0) != TREE_OPERAND (base, 0)
- || !tree_int_cst_equal (TREE_OPERAND (tci->object, 1),
- TREE_OPERAND (base, 1)))
- return NULL_TREE;
- }
- else if (tci->object != base)
- return NULL_TREE;
-
- binfo = vtable_pointer_value_to_binfo (rhs);
-
- /* FIXME: vtable_pointer_value_to_binfo may return BINFO of a
- base of outer type. In this case we would need to either
- work on binfos or translate it back to outer type and offset.
- KNOWN_TYPE jump functions are not ready for that, yet. */
- if (!binfo || TYPE_BINFO (BINFO_TYPE (binfo)) != binfo)
- return NULL;
-
- return BINFO_TYPE (binfo);
-}
-
-/* Callback of walk_aliased_vdefs and a helper function for
- detect_type_change to check whether a particular statement may modify
- the virtual table pointer, and if possible also determine the new type of
- the (sub-)object. It stores its result into DATA, which points to a
+/* Callback of walk_aliased_vdefs and a helper function for detect_type_change
+ to check whether a particular statement may modify the virtual table
+ pointerIt stores its result into DATA, which points to a
prop_type_change_info structure. */
static bool
@@ -756,14 +629,6 @@ check_stmt_for_type_change (ao_ref *ao ATTRIBUTE_UNUSED, tree vdef, void *data)
if (stmt_may_be_vtbl_ptr_store (stmt))
{
- tree type;
-
- type = extr_type_from_vtbl_ptr_store (stmt, tci);
- gcc_assert (!type || TYPE_MAIN_VARIANT (type) == type);
- if (tci->type_maybe_changed
- && type != tci->known_current_type)
- tci->multiple_types_encountered = true;
- tci->known_current_type = type;
tci->type_maybe_changed = true;
return true;
}
@@ -878,25 +743,14 @@ detect_type_change_from_memory_writes (tree arg, tree base, tree comp_type,
tci.offset = offset;
tci.object = get_base_address (arg);
- tci.known_current_type = NULL_TREE;
tci.type_maybe_changed = false;
- tci.multiple_types_encountered = false;
walk_aliased_vdefs (&ao, gimple_vuse (call), check_stmt_for_type_change,
&tci, NULL, &entry_reached);
if (!tci.type_maybe_changed)
return false;
- if (!tci.known_current_type
- || tci.multiple_types_encountered
- || offset != 0
- /* When the walk reached function entry, it means that type
- is set along some paths but not along others. */
- || entry_reached)
- jfunc->type = IPA_JF_UNKNOWN;
- else
- ipa_set_jf_known_type (jfunc, 0, tci.known_current_type, comp_type);
-
+ jfunc->type = IPA_JF_UNKNOWN;
return true;
}
@@ -1347,13 +1201,7 @@ compute_complex_assign_jump_func (struct func_body_info *fbi,
else if (gimple_assign_single_p (stmt))
{
bool agg_p = parm_ref_data_pass_through_p (fbi, index, call, tc_ssa);
- bool type_p = false;
-
- if (param_type && POINTER_TYPE_P (param_type))
- type_p = !detect_type_change_ssa (tc_ssa, TREE_TYPE (param_type),
- call, jfunc);
- if (type_p || jfunc->type == IPA_JF_UNKNOWN)
- ipa_set_jf_simple_pass_through (jfunc, index, agg_p, type_p);
+ ipa_set_jf_simple_pass_through (jfunc, index, agg_p);
}
return;
}
@@ -1379,16 +1227,8 @@ compute_complex_assign_jump_func (struct func_body_info *fbi,
/* Dynamic types are changed in constructors and destructors. */
index = ipa_get_param_decl_index (info, SSA_NAME_VAR (ssa));
if (index >= 0 && param_type && POINTER_TYPE_P (param_type))
- {
- bool type_p = (contains_polymorphic_type_p (TREE_TYPE (param_type))
- && !detect_type_change (op1, base, TREE_TYPE (param_type),
- call, jfunc, offset));
- if (type_p || jfunc->type == IPA_JF_UNKNOWN)
- ipa_set_ancestor_jf (jfunc, offset,
- type_p ? TREE_TYPE (param_type) : NULL, index,
- parm_ref_data_pass_through_p (fbi, index,
- call, ssa), type_p);
- }
+ ipa_set_ancestor_jf (jfunc, offset, index,
+ parm_ref_data_pass_through_p (fbi, index, call, ssa));
}
/* Extract the base, offset and MEM_REF expression from a statement ASSIGN if
@@ -1461,7 +1301,7 @@ static void
compute_complex_ancestor_jump_func (struct func_body_info *fbi,
struct ipa_node_params *info,
struct ipa_jump_func *jfunc,
- gimple call, gimple phi, tree param_type)
+ gimple call, gimple phi)
{
HOST_WIDE_INT offset;
gimple assign, cond;
@@ -1513,56 +1353,8 @@ compute_complex_ancestor_jump_func (struct func_body_info *fbi,
return;
}
- bool type_p = false;
- if (param_type && POINTER_TYPE_P (param_type)
- && contains_polymorphic_type_p (TREE_TYPE (param_type)))
- type_p = !detect_type_change (obj, expr, TREE_TYPE (param_type),
- call, jfunc, offset);
- if (type_p || jfunc->type == IPA_JF_UNKNOWN)
- ipa_set_ancestor_jf (jfunc, offset, type_p ? TREE_TYPE (param_type) : NULL,
- index,
- parm_ref_data_pass_through_p (fbi, index, call, parm),
- type_p);
-}
-
-/* Given OP which is passed as an actual argument to a called function,
- determine if it is possible to construct a KNOWN_TYPE jump function for it
- and if so, create one and store it to JFUNC.
- EXPECTED_TYPE represents a type the argument should be in */
-
-static void
-compute_known_type_jump_func (tree op, struct ipa_jump_func *jfunc,
- gimple call, tree expected_type)
-{
- HOST_WIDE_INT offset, size, max_size;
- tree base;
-
- if (!flag_devirtualize
- || TREE_CODE (op) != ADDR_EXPR
- || !contains_polymorphic_type_p (TREE_TYPE (TREE_TYPE (op)))
- /* Be sure expected_type is polymorphic. */
- || !expected_type
- || !contains_polymorphic_type_p (expected_type))
- return;
-
- op = TREE_OPERAND (op, 0);
- base = get_ref_base_and_extent (op, &offset, &size, &max_size);
- if (!DECL_P (base)
- || max_size == -1
- || max_size != size
- || !contains_polymorphic_type_p (TREE_TYPE (base)))
- return;
-
- if (decl_maybe_in_construction_p (base, TREE_TYPE (base),
- call, current_function_decl)
- /* Even if the var seems to be in construction by inline call stack,
- we may work out the actual type by walking memory writes. */
- && (is_global_var (base)
- || detect_type_change (op, base, expected_type, call, jfunc, offset)))
- return;
-
- ipa_set_jf_known_type (jfunc, offset, TREE_TYPE (base),
- expected_type);
+ ipa_set_ancestor_jf (jfunc, offset, index,
+ parm_ref_data_pass_through_p (fbi, index, call, parm));
}
/* Inspect the given TYPE and return true iff it has the same structure (the
@@ -1937,7 +1729,7 @@ ipa_compute_jump_functions_for_edge (struct func_body_info *fbi,
for cycle. */
if (parm_preserved_before_stmt_p (fbi, index, call, arg))
{
- ipa_set_jf_simple_pass_through (jfunc, index, false, false);
+ ipa_set_jf_simple_pass_through (jfunc, index, false);
continue;
}
}
@@ -1948,16 +1740,9 @@ ipa_compute_jump_functions_for_edge (struct func_body_info *fbi,
int index = ipa_get_param_decl_index (info, SSA_NAME_VAR (arg));
if (index >= 0)
{
- bool agg_p, type_p;
+ bool agg_p;
agg_p = parm_ref_data_pass_through_p (fbi, index, call, arg);
- if (param_type && POINTER_TYPE_P (param_type))
- type_p = !detect_type_change_ssa (arg, TREE_TYPE (param_type),
- call, jfunc);
- else
- type_p = false;
- if (type_p || jfunc->type == IPA_JF_UNKNOWN)
- ipa_set_jf_simple_pass_through (jfunc, index, agg_p,
- type_p);
+ ipa_set_jf_simple_pass_through (jfunc, index, agg_p);
}
}
else
@@ -1968,15 +1753,9 @@ ipa_compute_jump_functions_for_edge (struct func_body_info *fbi,
call, stmt, arg, param_type);
else if (gimple_code (stmt) == GIMPLE_PHI)
compute_complex_ancestor_jump_func (fbi, info, jfunc,
- call, stmt, param_type);
+ call, stmt);
}
}
- else
- compute_known_type_jump_func (arg, jfunc, call,
- param_type
- && POINTER_TYPE_P (param_type)
- ? TREE_TYPE (param_type)
- : NULL);
/* If ARG is pointer, we can not use its type to determine the type of aggregate
passed (because type conversions are ignored in gimple). Usually we can
@@ -2601,32 +2380,6 @@ ipa_analyze_node (struct cgraph_node *node)
pop_cfun ();
}
-/* Update the jump function DST when the call graph edge corresponding to SRC is
- is being inlined, knowing that DST is of type ancestor and src of known
- type. */
-
-static void
-combine_known_type_and_ancestor_jfs (struct ipa_jump_func *src,
- struct ipa_jump_func *dst)
-{
- HOST_WIDE_INT combined_offset;
- tree combined_type;
-
- if (!ipa_get_jf_ancestor_type_preserved (dst))
- {
- dst->type = IPA_JF_UNKNOWN;
- return;
- }
-
- combined_offset = ipa_get_jf_known_type_offset (src)
- + ipa_get_jf_ancestor_offset (dst);
- combined_type = ipa_get_jf_ancestor_type (dst);
-
- ipa_set_jf_known_type (dst, combined_offset,
- ipa_get_jf_known_type_base_type (src),
- combined_type);
-}
-
/* Update the jump functions associated with call graph edge E when the call
graph edge CS is being inlined, assuming that E->caller is already (possibly
indirectly) inlined into CS->callee and that E has not been inlined. */
@@ -2669,7 +2422,7 @@ update_jump_functions_after_inlining (struct cgraph_edge *cs,
struct ipa_polymorphic_call_context ctx = *src_ctx;
/* TODO: Make type preserved safe WRT contexts. */
- if (!dst->value.ancestor.agg_preserved)
+ if (!ipa_get_jf_ancestor_type_preserved (dst))
ctx.possible_dynamic_type_change (e->in_polymorphic_cdtor);
ctx.offset_by (dst->value.ancestor.offset);
if (!ctx.useless_p ())
@@ -2678,6 +2431,7 @@ update_jump_functions_after_inlining (struct cgraph_edge *cs,
count);
dst_ctx = ipa_get_ith_polymorhic_call_context (args, i);
}
+ dst_ctx->combine_with (ctx);
}
if (src->agg.items
@@ -2696,16 +2450,12 @@ update_jump_functions_after_inlining (struct cgraph_edge *cs,
item->offset -= dst->value.ancestor.offset;
}
- if (src->type == IPA_JF_KNOWN_TYPE)
- combine_known_type_and_ancestor_jfs (src, dst);
- else if (src->type == IPA_JF_PASS_THROUGH
- && src->value.pass_through.operation == NOP_EXPR)
+ if (src->type == IPA_JF_PASS_THROUGH
+ && src->value.pass_through.operation == NOP_EXPR)
{
dst->value.ancestor.formal_id = src->value.pass_through.formal_id;
dst->value.ancestor.agg_preserved &=
src->value.pass_through.agg_preserved;
- dst->value.ancestor.type_preserved &=
- src->value.pass_through.type_preserved;
}
else if (src->type == IPA_JF_ANCESTOR)
{
@@ -2713,8 +2463,6 @@ update_jump_functions_after_inlining (struct cgraph_edge *cs,
dst->value.ancestor.offset += src->value.ancestor.offset;
dst->value.ancestor.agg_preserved &=
src->value.ancestor.agg_preserved;
- dst->value.ancestor.type_preserved &=
- src->value.ancestor.type_preserved;
}
else
dst->type = IPA_JF_UNKNOWN;
@@ -2739,7 +2487,7 @@ update_jump_functions_after_inlining (struct cgraph_edge *cs,
struct ipa_polymorphic_call_context ctx = *src_ctx;
/* TODO: Make type preserved safe WRT contexts. */
- if (!dst->value.ancestor.agg_preserved)
+ if (!ipa_get_jf_pass_through_type_preserved (dst))
ctx.possible_dynamic_type_change (e->in_polymorphic_cdtor);
if (!ctx.useless_p ())
{
@@ -2757,15 +2505,6 @@ update_jump_functions_after_inlining (struct cgraph_edge *cs,
case IPA_JF_UNKNOWN:
dst->type = IPA_JF_UNKNOWN;
break;
- case IPA_JF_KNOWN_TYPE:
- if (ipa_get_jf_pass_through_type_preserved (dst))
- ipa_set_jf_known_type (dst,
- ipa_get_jf_known_type_offset (src),
- ipa_get_jf_known_type_base_type (src),
- ipa_get_jf_known_type_component_type (src));
- else
- dst->type = IPA_JF_UNKNOWN;
- break;
case IPA_JF_CONST:
ipa_set_jf_cst_copy (dst, src);
break;
@@ -2778,13 +2517,10 @@ update_jump_functions_after_inlining (struct cgraph_edge *cs,
if (operation == NOP_EXPR)
{
- bool agg_p, type_p;
+ bool agg_p;
agg_p = dst_agg_p
&& ipa_get_jf_pass_through_agg_preserved (src);
- type_p = ipa_get_jf_pass_through_type_preserved (src)
- && ipa_get_jf_pass_through_type_preserved (dst);
- ipa_set_jf_simple_pass_through (dst, formal_id,
- agg_p, type_p);
+ ipa_set_jf_simple_pass_through (dst, formal_id, agg_p);
}
else
{
@@ -2796,16 +2532,13 @@ update_jump_functions_after_inlining (struct cgraph_edge *cs,
}
case IPA_JF_ANCESTOR:
{
- bool agg_p, type_p;
+ bool agg_p;
agg_p = dst_agg_p
&& ipa_get_jf_ancestor_agg_preserved (src);
- type_p = ipa_get_jf_ancestor_type_preserved (src)
- && ipa_get_jf_pass_through_type_preserved (dst);
ipa_set_ancestor_jf (dst,
ipa_get_jf_ancestor_offset (src),
- ipa_get_jf_ancestor_type (src),
ipa_get_jf_ancestor_formal_id (src),
- agg_p, type_p);
+ agg_p);
break;
}
default:
@@ -3152,41 +2885,24 @@ ipa_impossible_devirt_target (struct cgraph_edge *ie, tree target)
/* Try to find a destination for indirect edge IE that corresponds to a virtual
call based on a formal parameter which is described by jump function JFUNC
and if it can be determined, make it direct and return the direct edge.
- Otherwise, return NULL. NEW_ROOT_INFO is the node info that JFUNC lattices
- are relative to. */
+ Otherwise, return NULL. CTX describes the polymorphic context that the
+ parameter the call is based on brings along with it. */
static struct cgraph_edge *
try_make_edge_direct_virtual_call (struct cgraph_edge *ie,
struct ipa_jump_func *jfunc,
- struct ipa_node_params *new_root_info,
- struct ipa_polymorphic_call_context *ctx_ptr)
+ struct ipa_polymorphic_call_context ctx)
{
- tree binfo, target = NULL;
+ tree target = NULL;
bool speculative = false;
- bool updated = false;
if (!flag_devirtualize)
return NULL;
- /* If this is call of a function parameter, restrict its type
- based on knowlede of the context. */
- if (ctx_ptr && !ie->indirect_info->by_ref)
- {
- struct ipa_polymorphic_call_context ctx = *ctx_ptr;
-
- ctx.offset_by (ie->indirect_info->offset);
-
- if (ie->indirect_info->vptr_changed)
- ctx.possible_dynamic_type_change (ie->in_polymorphic_cdtor,
- ie->indirect_info->otr_type);
-
- updated = ie->indirect_info->context.combine_with
- (ctx, ie->indirect_info->otr_type);
- }
+ gcc_assert (!ie->indirect_info->by_ref);
/* Try to do lookup via known virtual table pointer value. */
- if (!ie->indirect_info->by_ref
- && (!ie->indirect_info->vptr_changed || flag_devirtualize_speculatively))
+ if (!ie->indirect_info->vptr_changed || flag_devirtualize_speculatively)
{
tree vtable;
unsigned HOST_WIDE_INT offset;
@@ -3217,67 +2933,44 @@ try_make_edge_direct_virtual_call (struct cgraph_edge *ie,
}
}
- binfo = ipa_value_from_jfunc (new_root_info, jfunc);
-
- if (binfo && TREE_CODE (binfo) != TREE_BINFO)
- {
- struct ipa_polymorphic_call_context ctx (binfo,
- ie->indirect_info->otr_type,
- ie->indirect_info->offset);
- updated |= ie->indirect_info->context.combine_with
- (ctx, ie->indirect_info->otr_type);
+ ipa_polymorphic_call_context ie_context (ie);
+ vec <cgraph_node *>targets;
+ bool final;
+
+ ctx.offset_by (ie->indirect_info->offset);
+ if (ie->indirect_info->vptr_changed)
+ ctx.possible_dynamic_type_change (ie->in_polymorphic_cdtor,
+ ie->indirect_info->otr_type);
+ ctx.combine_with (ie_context, ie->indirect_info->otr_type);
+ targets = possible_polymorphic_call_targets
+ (ie->indirect_info->otr_type,
+ ie->indirect_info->otr_token,
+ ctx, &final);
+ if (final && targets.length () <= 1)
+ {
+ if (targets.length () == 1)
+ target = targets[0]->decl;
+ else
+ target = ipa_impossible_devirt_target (ie, NULL_TREE);
}
-
- if (updated)
- {
- ipa_polymorphic_call_context context (ie);
- vec <cgraph_node *>targets;
- bool final;
-
- targets = possible_polymorphic_call_targets
- (ie->indirect_info->otr_type,
- ie->indirect_info->otr_token,
- context, &final);
- if (final && targets.length () <= 1)
+ else if (!target && flag_devirtualize_speculatively
+ && !ie->speculative && ie->maybe_hot_p ())
+ {
+ cgraph_node *n;
+ n = try_speculative_devirtualization (ie->indirect_info->otr_type,
+ ie->indirect_info->otr_token,
+ ie->indirect_info->context);
+ if (n)
{
- if (targets.length () == 1)
- target = targets[0]->decl;
- else
- target = ipa_impossible_devirt_target (ie, NULL_TREE);
- }
- else if (!target && flag_devirtualize_speculatively
- && !ie->speculative && ie->maybe_hot_p ())
- {
- cgraph_node *n = try_speculative_devirtualization (ie->indirect_info->otr_type,
- ie->indirect_info->otr_token,
- ie->indirect_info->context);
- if (n)
- {
- target = n->decl;
- speculative = true;
- }
- }
- }
-
- if (binfo && TREE_CODE (binfo) == TREE_BINFO)
- {
- binfo = get_binfo_at_offset (binfo, ie->indirect_info->offset,
- ie->indirect_info->otr_type);
- if (binfo)
- {
- tree t = gimple_get_virt_method_for_binfo (ie->indirect_info->otr_token,
- binfo);
- if (t)
- {
- target = t;
- speculative = false;
- }
+ target = n->decl;
+ speculative = true;
}
}
if (target)
{
- if (!possible_polymorphic_call_target_p (ie, cgraph_node::get_create (target)))
+ if (!possible_polymorphic_call_target_p
+ (ie, cgraph_node::get_create (target)))
{
if (speculative)
return NULL;
@@ -3336,11 +3029,9 @@ update_indirect_edges_after_inlining (struct cgraph_edge *cs,
new_direct_edge = NULL;
else if (ici->polymorphic)
{
- ipa_polymorphic_call_context *ctx;
- ctx = ipa_get_ith_polymorhic_call_context (top, param_index);
- new_direct_edge = try_make_edge_direct_virtual_call (ie, jfunc,
- new_root_info,
- ctx);
+ ipa_polymorphic_call_context ctx;
+ ctx = ipa_context_from_jfunc (new_root_info, cs, param_index, jfunc);
+ new_direct_edge = try_make_edge_direct_virtual_call (ie, jfunc, ctx);
}
else
new_direct_edge = try_make_edge_direct_simple_call (ie, jfunc,
@@ -3474,7 +3165,7 @@ propagate_controlled_uses (struct cgraph_edge *cs)
{
struct cgraph_node *n;
struct ipa_ref *ref;
- tree t = new_root_info->known_vals[src_idx];
+ tree t = new_root_info->known_csts[src_idx];
if (t && TREE_CODE (t) == ADDR_EXPR
&& TREE_CODE (TREE_OPERAND (t, 0)) == FUNCTION_DECL
@@ -3617,7 +3308,8 @@ ipa_free_node_params_substructures (struct ipa_node_params *info)
free (info->lattices);
/* Lattice values and their sources are deallocated with their alocation
pool. */
- info->known_vals.release ();
+ info->known_csts.release ();
+ info->known_contexts.release ();
memset (info, 0, sizeof (*info));
}
@@ -3892,7 +3584,8 @@ ipa_free_all_structures_after_ipa_cp (void)
ipa_free_all_edge_args ();
ipa_free_all_node_params ();
free_alloc_pool (ipcp_sources_pool);
- free_alloc_pool (ipcp_values_pool);
+ free_alloc_pool (ipcp_cst_values_pool);
+ free_alloc_pool (ipcp_poly_ctx_values_pool);
free_alloc_pool (ipcp_agg_lattice_pool);
ipa_unregister_cgraph_hooks ();
if (ipa_refdesc_pool)
@@ -3911,8 +3604,10 @@ ipa_free_all_structures_after_iinln (void)
ipa_unregister_cgraph_hooks ();
if (ipcp_sources_pool)
free_alloc_pool (ipcp_sources_pool);
- if (ipcp_values_pool)
- free_alloc_pool (ipcp_values_pool);
+ if (ipcp_cst_values_pool)
+ free_alloc_pool (ipcp_cst_values_pool);
+ if (ipcp_poly_ctx_values_pool)
+ free_alloc_pool (ipcp_poly_ctx_values_pool);
if (ipcp_agg_lattice_pool)
free_alloc_pool (ipcp_agg_lattice_pool);
if (ipa_refdesc_pool)
@@ -4712,11 +4407,6 @@ ipa_write_jump_function (struct output_block *ob,
{
case IPA_JF_UNKNOWN:
break;
- case IPA_JF_KNOWN_TYPE:
- streamer_write_uhwi (ob, jump_func->value.known_type.offset);
- stream_write_tree (ob, jump_func->value.known_type.base_type, true);
- stream_write_tree (ob, jump_func->value.known_type.component_type, true);
- break;
case IPA_JF_CONST:
gcc_assert (
EXPR_LOCATION (jump_func->value.constant.value) == UNKNOWN_LOCATION);
@@ -4729,7 +4419,6 @@ ipa_write_jump_function (struct output_block *ob,
streamer_write_uhwi (ob, jump_func->value.pass_through.formal_id);
bp = bitpack_create (ob->main_stream);
bp_pack_value (&bp, jump_func->value.pass_through.agg_preserved, 1);
- bp_pack_value (&bp, jump_func->value.pass_through.type_preserved, 1);
streamer_write_bitpack (&bp);
}
else
@@ -4740,11 +4429,9 @@ ipa_write_jump_function (struct output_block *ob,
break;
case IPA_JF_ANCESTOR:
streamer_write_uhwi (ob, jump_func->value.ancestor.offset);
- stream_write_tree (ob, jump_func->value.ancestor.type, true);
streamer_write_uhwi (ob, jump_func->value.ancestor.formal_id);
bp = bitpack_create (ob->main_stream);
bp_pack_value (&bp, jump_func->value.ancestor.agg_preserved, 1);
- bp_pack_value (&bp, jump_func->value.ancestor.type_preserved, 1);
streamer_write_bitpack (&bp);
break;
}
@@ -4783,15 +4470,6 @@ ipa_read_jump_function (struct lto_input_block *ib,
case IPA_JF_UNKNOWN:
jump_func->type = IPA_JF_UNKNOWN;
break;
- case IPA_JF_KNOWN_TYPE:
- {
- HOST_WIDE_INT offset = streamer_read_uhwi (ib);
- tree base_type = stream_read_tree (ib, data_in);
- tree component_type = stream_read_tree (ib, data_in);
-
- ipa_set_jf_known_type (jump_func, offset, base_type, component_type);
- break;
- }
case IPA_JF_CONST:
ipa_set_jf_constant (jump_func, stream_read_tree (ib, data_in), cs);
break;
@@ -4802,9 +4480,7 @@ ipa_read_jump_function (struct lto_input_block *ib,
int formal_id = streamer_read_uhwi (ib);
struct bitpack_d bp = streamer_read_bitpack (ib);
bool agg_preserved = bp_unpack_value (&bp, 1);
- bool type_preserved = bp_unpack_value (&bp, 1);
- ipa_set_jf_simple_pass_through (jump_func, formal_id, agg_preserved,
- type_preserved);
+ ipa_set_jf_simple_pass_through (jump_func, formal_id, agg_preserved);
}
else
{
@@ -4817,14 +4493,10 @@ ipa_read_jump_function (struct lto_input_block *ib,
case IPA_JF_ANCESTOR:
{
HOST_WIDE_INT offset = streamer_read_uhwi (ib);
- tree type = stream_read_tree (ib, data_in);
int formal_id = streamer_read_uhwi (ib);
struct bitpack_d bp = streamer_read_bitpack (ib);
bool agg_preserved = bp_unpack_value (&bp, 1);
- bool type_preserved = bp_unpack_value (&bp, 1);
-
- ipa_set_ancestor_jf (jump_func, offset, type, formal_id, agg_preserved,
- type_preserved);
+ ipa_set_ancestor_jf (jump_func, offset, formal_id, agg_preserved);
break;
}
}
diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h
index 165fc1a7f45..ed991108363 100644
--- a/gcc/ipa-prop.h
+++ b/gcc/ipa-prop.h
@@ -51,11 +51,6 @@ along with GCC; see the file COPYING3. If not see
parameter or can apply one simple binary operation to it (such jump
functions are called polynomial).
- IPA_JF_KNOWN_TYPE is a special type of an "unknown" function that applies
- only to pointer parameters. It means that even though we cannot prove that
- the passed value is an interprocedural constant, we still know the exact
- type of the containing object which may be valuable for devirtualization.
-
Jump functions are computed in ipa-prop.c by function
update_call_notes_after_inlining. Some information can be lost and jump
functions degraded accordingly when inlining, see
@@ -64,7 +59,6 @@ along with GCC; see the file COPYING3. If not see
enum jump_func_type
{
IPA_JF_UNKNOWN = 0, /* newly allocated and zeroed jump functions default */
- IPA_JF_KNOWN_TYPE, /* represented by field known_type */
IPA_JF_CONST, /* represented by field costant */
IPA_JF_PASS_THROUGH, /* represented by field pass_through */
IPA_JF_ANCESTOR /* represented by field ancestor */
@@ -113,11 +107,6 @@ struct GTY(()) ipa_pass_through_data
ipa_agg_jump_function). The flag is used only when the operation is
NOP_EXPR. */
unsigned agg_preserved : 1;
-
- /* When set to true, we guarantee that, if there is a C++ object pointed to
- by this object, it does not undergo dynamic type change in the course of
- functions decribed by this jump function. */
- unsigned type_preserved : 1;
};
/* Structure holding data required to describe an ancestor pass-through
@@ -127,18 +116,10 @@ struct GTY(()) ipa_ancestor_jf_data
{
/* Offset of the field representing the ancestor. */
HOST_WIDE_INT offset;
- /* Type of the result.
- When TYPE_PRESERVED is false, TYPE is NULL, since it is only
- relevant for the devirtualization machinery. */
- tree type;
/* Number of the caller's formal parameter being passed. */
int formal_id;
/* Flag with the same meaning like agg_preserve in ipa_pass_through_data. */
unsigned agg_preserved : 1;
- /* When set to true, we guarantee that, if there is a C++ object pointed to
- by this object, it does not undergo dynamic type change in the course of
- functions decribed by this jump function. */
- unsigned type_preserved : 1;
};
/* An element in an aggegate part of a jump function describing a known value
@@ -189,7 +170,6 @@ struct GTY (()) ipa_jump_func
functions and member_cst holds constant c++ member functions. */
union jump_func_value
{
- struct ipa_known_type_data GTY ((tag ("IPA_JF_KNOWN_TYPE"))) known_type;
struct ipa_constant_data GTY ((tag ("IPA_JF_CONST"))) constant;
struct ipa_pass_through_data GTY ((tag ("IPA_JF_PASS_THROUGH"))) pass_through;
struct ipa_ancestor_jf_data GTY ((tag ("IPA_JF_ANCESTOR"))) ancestor;
@@ -197,34 +177,6 @@ struct GTY (()) ipa_jump_func
};
-/* Return the offset of the component that is described by a known type jump
- function JFUNC. */
-
-static inline HOST_WIDE_INT
-ipa_get_jf_known_type_offset (struct ipa_jump_func *jfunc)
-{
- gcc_checking_assert (jfunc->type == IPA_JF_KNOWN_TYPE);
- return jfunc->value.known_type.offset;
-}
-
-/* Return the base type of a known type jump function JFUNC. */
-
-static inline tree
-ipa_get_jf_known_type_base_type (struct ipa_jump_func *jfunc)
-{
- gcc_checking_assert (jfunc->type == IPA_JF_KNOWN_TYPE);
- return jfunc->value.known_type.base_type;
-}
-
-/* Return the component type of a known type jump function JFUNC. */
-
-static inline tree
-ipa_get_jf_known_type_component_type (struct ipa_jump_func *jfunc)
-{
- gcc_checking_assert (jfunc->type == IPA_JF_KNOWN_TYPE);
- return jfunc->value.known_type.component_type;
-}
-
/* Return the constant stored in a constant jump functin JFUNC. */
static inline tree
@@ -278,13 +230,14 @@ ipa_get_jf_pass_through_agg_preserved (struct ipa_jump_func *jfunc)
return jfunc->value.pass_through.agg_preserved;
}
-/* Return the type_preserved flag of a pass through jump function JFUNC. */
+/* Return true if pass through jump function JFUNC preserves type
+ information. */
static inline bool
ipa_get_jf_pass_through_type_preserved (struct ipa_jump_func *jfunc)
{
gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
- return jfunc->value.pass_through.type_preserved;
+ return jfunc->value.pass_through.agg_preserved;
}
/* Return the offset of an ancestor jump function JFUNC. */
@@ -296,15 +249,6 @@ ipa_get_jf_ancestor_offset (struct ipa_jump_func *jfunc)
return jfunc->value.ancestor.offset;
}
-/* Return the result type of an ancestor jump function JFUNC. */
-
-static inline tree
-ipa_get_jf_ancestor_type (struct ipa_jump_func *jfunc)
-{
- gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR);
- return jfunc->value.ancestor.type;
-}
-
/* Return the number of the caller's formal parameter that an ancestor jump
function JFUNC refers to. */
@@ -324,13 +268,13 @@ ipa_get_jf_ancestor_agg_preserved (struct ipa_jump_func *jfunc)
return jfunc->value.ancestor.agg_preserved;
}
-/* Return the type_preserved flag of an ancestor jump function JFUNC. */
+/* Return true if ancestor jump function JFUNC presrves type information. */
static inline bool
ipa_get_jf_ancestor_type_preserved (struct ipa_jump_func *jfunc)
{
gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR);
- return jfunc->value.ancestor.type_preserved;
+ return jfunc->value.ancestor.agg_preserved;
}
/* Summary describing a single formal parameter. */
@@ -348,8 +292,6 @@ struct ipa_param_descriptor
unsigned used : 1;
};
-struct ipcp_lattice;
-
/* ipa_node_params stores information related to formal parameters of functions
and some other information for interprocedural passes that operate on
parameters (such as ipa-cp). */
@@ -365,9 +307,12 @@ struct ipa_node_params
/* Only for versioned nodes this field would not be NULL,
it points to the node that IPA cp cloned from. */
struct cgraph_node *ipcp_orig_node;
- /* If this node is an ipa-cp clone, these are the known values that describe
- what it has been specialized for. */
- vec<tree> known_vals;
+ /* If this node is an ipa-cp clone, these are the known constants that
+ describe what it has been specialized for. */
+ vec<tree> known_csts;
+ /* If this node is an ipa-cp clone, these are the known polymorphic contexts
+ that describe what it has been specialized for. */
+ vec<ipa_polymorphic_call_context> known_contexts;
/* Whether the param uses analysis and jump function computation has already
been performed. */
unsigned analysis_done : 1;
@@ -594,7 +539,7 @@ bool ipa_propagate_indirect_call_infos (struct cgraph_edge *cs,
/* Indirect edge and binfo processing. */
tree ipa_get_indirect_edge_target (struct cgraph_edge *ie,
vec<tree> ,
- vec<tree> ,
+ vec<ipa_polymorphic_call_context>,
vec<ipa_agg_jump_function_p> );
struct cgraph_edge *ipa_make_edge_direct_to_target (struct cgraph_edge *, tree,
bool speculative = false);
@@ -617,7 +562,8 @@ void ipa_print_node_jump_functions (FILE *f, struct cgraph_node *node);
void ipa_print_all_jump_functions (FILE * f);
void ipcp_verify_propagated_values (void);
-extern alloc_pool ipcp_values_pool;
+extern alloc_pool ipcp_cst_values_pool;
+extern alloc_pool ipcp_poly_ctx_values_pool;
extern alloc_pool ipcp_sources_pool;
extern alloc_pool ipcp_agg_lattice_pool;
@@ -718,6 +664,10 @@ int ipa_get_param_decl_index (struct ipa_node_params *, tree);
tree ipa_value_from_jfunc (struct ipa_node_params *info,
struct ipa_jump_func *jfunc);
unsigned int ipcp_transform_function (struct cgraph_node *node);
+ipa_polymorphic_call_context ipa_context_from_jfunc (ipa_node_params *,
+ cgraph_edge *,
+ int,
+ ipa_jump_func *);
void ipa_dump_param (FILE *, struct ipa_node_params *info, int i);
bool ipa_modify_expr (tree *, bool, ipa_parm_adjustment_vec);
ipa_parm_adjustment *ipa_get_adjustment_candidate (tree **, bool *,
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index d6999fa6712..a55288d7ba4 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -112,11 +112,15 @@ struct funct_state_d
bool looping;
bool can_throw;
+
+ /* If function can call free, munmap or otherwise make previously
+ non-trapping memory accesses trapping. */
+ bool can_free;
};
/* State used when we know nothing about function. */
static struct funct_state_d varying_state
- = { IPA_NEITHER, IPA_NEITHER, true, true, true };
+ = { IPA_NEITHER, IPA_NEITHER, true, true, true, true };
typedef struct funct_state_d * funct_state;
@@ -559,6 +563,10 @@ check_call (funct_state local, gimple call, bool ipa)
enum pure_const_state_e call_state;
bool call_looping;
+ if (gimple_call_builtin_p (call, BUILT_IN_NORMAL)
+ && !nonfreeing_call_p (call))
+ local->can_free = true;
+
if (special_builtin_state (&call_state, &call_looping, callee_t))
{
worse_state (&local->pure_const_state, &local->looping,
@@ -589,6 +597,8 @@ check_call (funct_state local, gimple call, bool ipa)
break;
}
}
+ else if (gimple_call_internal_p (call) && !nonfreeing_call_p (call))
+ local->can_free = true;
/* When not in IPA mode, we can still handle self recursion. */
if (!ipa && callee_t
@@ -753,6 +763,7 @@ check_stmt (gimple_stmt_iterator *gsip, funct_state local, bool ipa)
fprintf (dump_file, " memory asm clobber is not const/pure\n");
/* Abandon all hope, ye who enter here. */
local->pure_const_state = IPA_NEITHER;
+ local->can_free = true;
}
if (gimple_asm_volatile_p (stmt))
{
@@ -760,7 +771,8 @@ check_stmt (gimple_stmt_iterator *gsip, funct_state local, bool ipa)
fprintf (dump_file, " volatile is not const/pure\n");
/* Abandon all hope, ye who enter here. */
local->pure_const_state = IPA_NEITHER;
- local->looping = true;
+ local->looping = true;
+ local->can_free = true;
}
return;
default:
@@ -785,6 +797,7 @@ analyze_function (struct cgraph_node *fn, bool ipa)
l->looping_previously_known = true;
l->looping = false;
l->can_throw = false;
+ l->can_free = false;
state_from_flags (&l->state_previously_known, &l->looping_previously_known,
flags_from_decl_or_type (fn->decl),
fn->cannot_return_p ());
@@ -815,7 +828,10 @@ analyze_function (struct cgraph_node *fn, bool ipa)
gsi_next (&gsi))
{
check_stmt (&gsi, l, ipa);
- if (l->pure_const_state == IPA_NEITHER && l->looping && l->can_throw)
+ if (l->pure_const_state == IPA_NEITHER
+ && l->looping
+ && l->can_throw
+ && l->can_free)
goto end;
}
}
@@ -882,6 +898,8 @@ end:
fprintf (dump_file, "Function is locally const.\n");
if (l->pure_const_state == IPA_PURE)
fprintf (dump_file, "Function is locally pure.\n");
+ if (l->can_free)
+ fprintf (dump_file, "Function can locally free.\n");
}
return l;
}
@@ -1021,6 +1039,7 @@ pure_const_write_summary (void)
bp_pack_value (&bp, fs->looping_previously_known, 1);
bp_pack_value (&bp, fs->looping, 1);
bp_pack_value (&bp, fs->can_throw, 1);
+ bp_pack_value (&bp, fs->can_free, 1);
streamer_write_bitpack (&bp);
}
}
@@ -1080,6 +1099,7 @@ pure_const_read_summary (void)
fs->looping_previously_known = bp_unpack_value (&bp, 1);
fs->looping = bp_unpack_value (&bp, 1);
fs->can_throw = bp_unpack_value (&bp, 1);
+ fs->can_free = bp_unpack_value (&bp, 1);
if (dump_file)
{
int flags = flags_from_decl_or_type (node->decl);
@@ -1102,6 +1122,8 @@ pure_const_read_summary (void)
fprintf (dump_file," function is previously known looping\n");
if (fs->can_throw)
fprintf (dump_file," function is locally throwing\n");
+ if (fs->can_free)
+ fprintf (dump_file," function can locally free\n");
}
}
@@ -1347,6 +1369,33 @@ propagate_pure_const (void)
pure_const_names [pure_const_state],
looping);
+ /* Find the worst state of can_free for any node in the cycle. */
+ bool can_free = false;
+ w = node;
+ while (w && !can_free)
+ {
+ struct cgraph_edge *e;
+ funct_state w_l = get_function_state (w);
+
+ if (w_l->can_free
+ || w->get_availability () == AVAIL_INTERPOSABLE
+ || w->indirect_calls)
+ can_free = true;
+
+ for (e = w->callees; e && !can_free; e = e->next_callee)
+ {
+ enum availability avail;
+ struct cgraph_node *y = e->callee->function_symbol (&avail);
+
+ if (avail > AVAIL_INTERPOSABLE)
+ can_free = get_function_state (y)->can_free;
+ else
+ can_free = true;
+ }
+ w_info = (struct ipa_dfs_info *) w->aux;
+ w = w_info->next_cycle;
+ }
+
/* Copy back the region's pure_const_state which is shared by
all nodes in the region. */
w = node;
@@ -1356,6 +1405,12 @@ propagate_pure_const (void)
enum pure_const_state_e this_state = pure_const_state;
bool this_looping = looping;
+ w_l->can_free = can_free;
+ w->nonfreeing_fn = !can_free;
+ if (!can_free && dump_file)
+ fprintf (dump_file, "Function found not to call free: %s\n",
+ w->name ());
+
if (w_l->state_previously_known != IPA_NEITHER
&& this_state > w_l->state_previously_known)
{
@@ -1448,7 +1503,7 @@ propagate_nothrow (void)
/* Find the worst state for any node in the cycle. */
w = node;
- while (w)
+ while (w && !can_throw)
{
struct cgraph_edge *e, *ie;
funct_state w_l = get_function_state (w);
@@ -1457,10 +1512,7 @@ propagate_nothrow (void)
|| w->get_availability () == AVAIL_INTERPOSABLE)
can_throw = true;
- if (can_throw)
- break;
-
- for (e = w->callees; e; e = e->next_callee)
+ for (e = w->callees; e && !can_throw; e = e->next_callee)
{
enum availability avail;
struct cgraph_node *y = e->callee->function_symbol (&avail);
@@ -1469,8 +1521,6 @@ propagate_nothrow (void)
{
funct_state y_l = get_function_state (y);
- if (can_throw)
- break;
if (y_l->can_throw && !TREE_NOTHROW (w->decl)
&& e->can_throw_external)
can_throw = true;
@@ -1478,12 +1528,9 @@ propagate_nothrow (void)
else if (e->can_throw_external && !TREE_NOTHROW (y->decl))
can_throw = true;
}
- for (ie = node->indirect_calls; ie; ie = ie->next_callee)
+ for (ie = w->indirect_calls; ie && !can_throw; ie = ie->next_callee)
if (ie->can_throw_external)
- {
- can_throw = true;
- break;
- }
+ can_throw = true;
w_info = (struct ipa_dfs_info *) w->aux;
w = w_info->next_cycle;
}
@@ -1794,5 +1841,3 @@ make_pass_warn_function_noreturn (gcc::context *ctxt)
{
return new pass_warn_function_noreturn (ctxt);
}
-
-
diff --git a/gcc/ipa-utils.h b/gcc/ipa-utils.h
index b3701af7c24..e285722b190 100644
--- a/gcc/ipa-utils.h
+++ b/gcc/ipa-utils.h
@@ -85,7 +85,7 @@ cgraph_node *try_speculative_devirtualization (tree, HOST_WIDE_INT,
ipa_polymorphic_call_context);
/* Return vector containing possible targets of polymorphic call E.
- If COMPLETEP is non-NULL, store true if the list is complette.
+ If COMPLETEP is non-NULL, store true if the list is complete.
CACHE_TOKEN (if non-NULL) will get stored to an unique ID of entry
in the target cache. If user needs to visit every target list
just once, it can memoize them.
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index 73533547942..a67bf8a2f7c 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -506,7 +506,8 @@ get_equiv_with_elimination (rtx x, rtx_insn *insn)
if (x == res || CONSTANT_P (res))
return res;
- return lra_eliminate_regs_1 (insn, res, GET_MODE (res), false, false, true);
+ return lra_eliminate_regs_1 (insn, res, GET_MODE (res),
+ 0, false, false, true);
}
/* Set up curr_operand_mode. */
@@ -1243,12 +1244,16 @@ static bool no_input_reloads_p, no_output_reloads_p;
insn. */
static int curr_swapped;
-/* Arrange for address element *LOC to be a register of class CL.
- Add any input reloads to list BEFORE. AFTER is nonnull if *LOC is an
- automodified value; handle that case by adding the required output
- reloads to list AFTER. Return true if the RTL was changed. */
+/* if CHECK_ONLY_P is false, arrange for address element *LOC to be a
+ register of class CL. Add any input reloads to list BEFORE. AFTER
+ is nonnull if *LOC is an automodified value; handle that case by
+ adding the required output reloads to list AFTER. Return true if
+ the RTL was changed.
+
+ if CHECK_ONLY_P is true, check that the *LOC is a correct address
+ register. Return false if the address register is correct. */
static bool
-process_addr_reg (rtx *loc, rtx_insn **before, rtx_insn **after,
+process_addr_reg (rtx *loc, bool check_only_p, rtx_insn **before, rtx_insn **after,
enum reg_class cl)
{
int regno;
@@ -1265,6 +1270,8 @@ process_addr_reg (rtx *loc, rtx_insn **before, rtx_insn **after,
mode = GET_MODE (reg);
if (! REG_P (reg))
{
+ if (check_only_p)
+ return true;
/* Always reload memory in an address even if the target supports
such addresses. */
new_reg = lra_create_new_reg_with_unique_value (mode, reg, cl, "address");
@@ -1274,7 +1281,8 @@ process_addr_reg (rtx *loc, rtx_insn **before, rtx_insn **after,
{
regno = REGNO (reg);
rclass = get_reg_class (regno);
- if ((*loc = get_equiv_with_elimination (reg, curr_insn)) != reg)
+ if (! check_only_p
+ && (*loc = get_equiv_with_elimination (reg, curr_insn)) != reg)
{
if (lra_dump_file != NULL)
{
@@ -1288,6 +1296,8 @@ process_addr_reg (rtx *loc, rtx_insn **before, rtx_insn **after,
}
if (*loc != reg || ! in_class_p (reg, cl, &new_class))
{
+ if (check_only_p)
+ return true;
reg = *loc;
if (get_reload_reg (after == NULL ? OP_IN : OP_INOUT,
mode, reg, cl, subreg_p, "address", &new_reg))
@@ -1295,6 +1305,8 @@ process_addr_reg (rtx *loc, rtx_insn **before, rtx_insn **after,
}
else if (new_class != NO_REGS && rclass != new_class)
{
+ if (check_only_p)
+ return true;
lra_change_class (regno, new_class, " Change to", true);
return false;
}
@@ -2740,8 +2752,9 @@ equiv_address_substitution (struct address_info *ad)
return change_p;
}
-/* Major function to make reloads for an address in operand NOP.
- The supported cases are:
+/* Major function to make reloads for an address in operand NOP or
+ check its correctness (If CHECK_ONLY_P is true). The supported
+ cases are:
1) an address that existed before LRA started, at which point it
must have been valid. These addresses are subject to elimination
@@ -2761,18 +2774,19 @@ equiv_address_substitution (struct address_info *ad)
address. Return true for any RTL change.
The function is a helper function which does not produce all
- transformations which can be necessary. It does just basic steps.
- To do all necessary transformations use function
- process_address. */
+ transformations (when CHECK_ONLY_P is false) which can be
+ necessary. It does just basic steps. To do all necessary
+ transformations use function process_address. */
static bool
-process_address_1 (int nop, rtx_insn **before, rtx_insn **after)
+process_address_1 (int nop, bool check_only_p,
+ rtx_insn **before, rtx_insn **after)
{
struct address_info ad;
rtx new_reg;
rtx op = *curr_id->operand_loc[nop];
const char *constraint = curr_static_id->operand[nop].constraint;
enum constraint_num cn = lookup_constraint (constraint);
- bool change_p;
+ bool change_p = false;
if (insn_extra_address_constraint (cn))
decompose_lea_address (&ad, curr_id->operand_loc[nop]);
@@ -2783,10 +2797,11 @@ process_address_1 (int nop, rtx_insn **before, rtx_insn **after)
decompose_mem_address (&ad, SUBREG_REG (op));
else
return false;
- change_p = equiv_address_substitution (&ad);
+ if (! check_only_p)
+ change_p = equiv_address_substitution (&ad);
if (ad.base_term != NULL
&& (process_addr_reg
- (ad.base_term, before,
+ (ad.base_term, check_only_p, before,
(ad.autoinc_p
&& !(REG_P (*ad.base_term)
&& find_regno_note (curr_insn, REG_DEAD,
@@ -2800,7 +2815,8 @@ process_address_1 (int nop, rtx_insn **before, rtx_insn **after)
*ad.base_term2 = *ad.base_term;
}
if (ad.index_term != NULL
- && process_addr_reg (ad.index_term, before, NULL, INDEX_REG_CLASS))
+ && process_addr_reg (ad.index_term, check_only_p,
+ before, NULL, INDEX_REG_CLASS))
change_p = true;
/* Target hooks sometimes don't treat extra-constraint addresses as
@@ -2809,6 +2825,9 @@ process_address_1 (int nop, rtx_insn **before, rtx_insn **after)
&& satisfies_address_constraint_p (&ad, cn))
return change_p;
+ if (check_only_p)
+ return change_p;
+
/* There are three cases where the shape of *AD.INNER may now be invalid:
1) the original address was valid, but either elimination or
@@ -2977,15 +2996,24 @@ process_address_1 (int nop, rtx_insn **before, rtx_insn **after)
return true;
}
-/* Do address reloads until it is necessary. Use process_address_1 as
- a helper function. Return true for any RTL changes. */
+/* If CHECK_ONLY_P is false, do address reloads until it is necessary.
+ Use process_address_1 as a helper function. Return true for any
+ RTL changes.
+
+ If CHECK_ONLY_P is true, just check address correctness. Return
+ false if the address correct. */
static bool
-process_address (int nop, rtx_insn **before, rtx_insn **after)
+process_address (int nop, bool check_only_p,
+ rtx_insn **before, rtx_insn **after)
{
bool res = false;
- while (process_address_1 (nop, before, after))
- res = true;
+ while (process_address_1 (nop, check_only_p, before, after))
+ {
+ if (check_only_p)
+ return true;
+ res = true;
+ }
return res;
}
@@ -3157,9 +3185,15 @@ swap_operands (int nop)
model can be changed in future. Make commutative operand exchange
if it is chosen.
- Return true if some RTL changes happened during function call. */
+ if CHECK_ONLY_P is false, do RTL changes to satisfy the
+ constraints. Return true if any change happened during function
+ call.
+
+ If CHECK_ONLY_P is true then don't do any transformation. Just
+ check that the insn satisfies all constraints. If the insn does
+ not satisfy any constraint, return true. */
static bool
-curr_insn_transform (void)
+curr_insn_transform (bool check_only_p)
{
int i, j, k;
int n_operands;
@@ -3226,50 +3260,53 @@ curr_insn_transform (void)
curr_swapped = false;
goal_alt_swapped = false;
- /* Make equivalence substitution and memory subreg elimination
- before address processing because an address legitimacy can
- depend on memory mode. */
- for (i = 0; i < n_operands; i++)
- {
- rtx op = *curr_id->operand_loc[i];
- rtx subst, old = op;
- bool op_change_p = false;
-
- if (GET_CODE (old) == SUBREG)
- old = SUBREG_REG (old);
- subst = get_equiv_with_elimination (old, curr_insn);
- if (subst != old)
- {
- subst = copy_rtx (subst);
- lra_assert (REG_P (old));
- if (GET_CODE (op) == SUBREG)
- SUBREG_REG (op) = subst;
- else
- *curr_id->operand_loc[i] = subst;
- if (lra_dump_file != NULL)
- {
- fprintf (lra_dump_file,
- "Changing pseudo %d in operand %i of insn %u on equiv ",
- REGNO (old), i, INSN_UID (curr_insn));
- dump_value_slim (lra_dump_file, subst, 1);
+ if (! check_only_p)
+ /* Make equivalence substitution and memory subreg elimination
+ before address processing because an address legitimacy can
+ depend on memory mode. */
+ for (i = 0; i < n_operands; i++)
+ {
+ rtx op = *curr_id->operand_loc[i];
+ rtx subst, old = op;
+ bool op_change_p = false;
+
+ if (GET_CODE (old) == SUBREG)
+ old = SUBREG_REG (old);
+ subst = get_equiv_with_elimination (old, curr_insn);
+ if (subst != old)
+ {
+ subst = copy_rtx (subst);
+ lra_assert (REG_P (old));
+ if (GET_CODE (op) == SUBREG)
+ SUBREG_REG (op) = subst;
+ else
+ *curr_id->operand_loc[i] = subst;
+ if (lra_dump_file != NULL)
+ {
+ fprintf (lra_dump_file,
+ "Changing pseudo %d in operand %i of insn %u on equiv ",
+ REGNO (old), i, INSN_UID (curr_insn));
+ dump_value_slim (lra_dump_file, subst, 1);
fprintf (lra_dump_file, "\n");
- }
- op_change_p = change_p = true;
- }
- if (simplify_operand_subreg (i, GET_MODE (old)) || op_change_p)
- {
- change_p = true;
- lra_update_dup (curr_id, i);
- }
- }
+ }
+ op_change_p = change_p = true;
+ }
+ if (simplify_operand_subreg (i, GET_MODE (old)) || op_change_p)
+ {
+ change_p = true;
+ lra_update_dup (curr_id, i);
+ }
+ }
/* Reload address registers and displacements. We do it before
finding an alternative because of memory constraints. */
before = after = NULL;
for (i = 0; i < n_operands; i++)
if (! curr_static_id->operand[i].is_operator
- && process_address (i, &before, &after))
+ && process_address (i, check_only_p, &before, &after))
{
+ if (check_only_p)
+ return true;
change_p = true;
lra_update_dup (curr_id, i);
}
@@ -3279,13 +3316,13 @@ curr_insn_transform (void)
we chose previously may no longer be valid. */
lra_set_used_insn_alternative (curr_insn, -1);
- if (curr_insn_set != NULL_RTX
+ if (! check_only_p && curr_insn_set != NULL_RTX
&& check_and_process_move (&change_p, &sec_mem_p))
return change_p;
try_swapped:
- reused_alternative_num = curr_id->used_insn_alternative;
+ reused_alternative_num = check_only_p ? -1 : curr_id->used_insn_alternative;
if (lra_dump_file != NULL && reused_alternative_num >= 0)
fprintf (lra_dump_file, "Reusing alternative %d for insn #%u\n",
reused_alternative_num, INSN_UID (curr_insn));
@@ -3293,6 +3330,9 @@ curr_insn_transform (void)
if (process_alt_operands (reused_alternative_num))
alt_p = true;
+ if (check_only_p)
+ return ! alt_p || best_losers != 0;
+
/* If insn is commutative (it's safe to exchange a certain pair of
operands) then we need to try each alternative twice, the second
time matching those two operands as if we had exchanged them. To
@@ -3522,7 +3562,7 @@ curr_insn_transform (void)
*curr_id->operand_loc[i] = tem;
lra_update_dup (curr_id, i);
- process_address (i, &before, &after);
+ process_address (i, false, &before, &after);
/* If the alternative accepts constant pool refs directly
there will be no reload needed at all. */
@@ -3746,6 +3786,26 @@ curr_insn_transform (void)
return change_p;
}
+/* Return true if INSN satisfies all constraints. In other words, no
+ reload insns are needed. */
+bool
+lra_constrain_insn (rtx_insn *insn)
+{
+ int saved_new_regno_start = new_regno_start;
+ int saved_new_insn_uid_start = new_insn_uid_start;
+ bool change_p;
+
+ curr_insn = insn;
+ curr_id = lra_get_insn_recog_data (curr_insn);
+ curr_static_id = curr_id->insn_static_data;
+ new_insn_uid_start = get_max_uid ();
+ new_regno_start = max_reg_num ();
+ change_p = curr_insn_transform (true);
+ new_regno_start = saved_new_regno_start;
+ new_insn_uid_start = saved_new_insn_uid_start;
+ return ! change_p;
+}
+
/* Return true if X is in LIST. */
static bool
in_list_p (rtx x, rtx list)
@@ -4238,7 +4298,7 @@ lra_constraints (bool first_p)
curr_static_id = curr_id->insn_static_data;
init_curr_insn_input_reloads ();
init_curr_operand_mode ();
- if (curr_insn_transform ())
+ if (curr_insn_transform (false))
changed_p = true;
/* Check non-transformed insns too for equiv change as USE
or CLOBBER don't need reloads but can contain pseudos
diff --git a/gcc/lra-eliminations.c b/gcc/lra-eliminations.c
index e742ebaf0ad..8ab0222ae50 100644
--- a/gcc/lra-eliminations.c
+++ b/gcc/lra-eliminations.c
@@ -298,7 +298,8 @@ get_elimination (rtx reg)
a change in the offset between the eliminable register and its
substitution if UPDATE_P, or the full offset if FULL_P, or
otherwise zero. If FULL_P, we also use the SP offsets for
- elimination to SP.
+ elimination to SP. If UPDATE_P, use UPDATE_SP_OFFSET for updating
+ offsets of register elimnable to SP.
MEM_MODE is the mode of an enclosing MEM. We need this to know how
much to adjust a register for, e.g., PRE_DEC. Also, if we are
@@ -311,7 +312,8 @@ get_elimination (rtx reg)
sp offset. */
rtx
lra_eliminate_regs_1 (rtx_insn *insn, rtx x, machine_mode mem_mode,
- bool subst_p, bool update_p, bool full_p)
+ bool subst_p, bool update_p,
+ HOST_WIDE_INT update_sp_offset, bool full_p)
{
enum rtx_code code = GET_CODE (x);
struct lra_elim_table *ep;
@@ -346,7 +348,10 @@ lra_eliminate_regs_1 (rtx_insn *insn, rtx x, machine_mode mem_mode,
rtx to = subst_p ? ep->to_rtx : ep->from_rtx;
if (update_p)
- return plus_constant (Pmode, to, ep->offset - ep->previous_offset);
+ return plus_constant (Pmode, to,
+ ep->offset - ep->previous_offset
+ + (ep->to_rtx == stack_pointer_rtx
+ ? update_sp_offset : 0));
else if (full_p)
return plus_constant (Pmode, to,
ep->offset
@@ -373,7 +378,10 @@ lra_eliminate_regs_1 (rtx_insn *insn, rtx x, machine_mode mem_mode,
return gen_rtx_PLUS (Pmode, to, XEXP (x, 1));
offset = (update_p
- ? ep->offset - ep->previous_offset : ep->offset);
+ ? ep->offset - ep->previous_offset
+ + (ep->to_rtx == stack_pointer_rtx
+ ? update_sp_offset : 0)
+ : ep->offset);
if (full_p && insn != NULL_RTX && ep->to_rtx == stack_pointer_rtx)
offset -= lra_get_insn_recog_data (insn)->sp_offset;
if (CONST_INT_P (XEXP (x, 1))
@@ -402,9 +410,11 @@ lra_eliminate_regs_1 (rtx_insn *insn, rtx x, machine_mode mem_mode,
{
rtx new0 = lra_eliminate_regs_1 (insn, XEXP (x, 0), mem_mode,
- subst_p, update_p, full_p);
+ subst_p, update_p,
+ update_sp_offset, full_p);
rtx new1 = lra_eliminate_regs_1 (insn, XEXP (x, 1), mem_mode,
- subst_p, update_p, full_p);
+ subst_p, update_p,
+ update_sp_offset, full_p);
if (new0 != XEXP (x, 0) || new1 != XEXP (x, 1))
return form_sum (new0, new1);
@@ -423,11 +433,12 @@ lra_eliminate_regs_1 (rtx_insn *insn, rtx x, machine_mode mem_mode,
rtx to = subst_p ? ep->to_rtx : ep->from_rtx;
if (update_p)
- return
- plus_constant (Pmode,
- gen_rtx_MULT (Pmode, to, XEXP (x, 1)),
- (ep->offset - ep->previous_offset)
- * INTVAL (XEXP (x, 1)));
+ return plus_constant (Pmode,
+ gen_rtx_MULT (Pmode, to, XEXP (x, 1)),
+ (ep->offset - ep->previous_offset
+ + (ep->to_rtx == stack_pointer_rtx
+ ? update_sp_offset : 0))
+ * INTVAL (XEXP (x, 1)));
else if (full_p)
{
HOST_WIDE_INT offset = ep->offset;
@@ -459,10 +470,12 @@ lra_eliminate_regs_1 (rtx_insn *insn, rtx x, machine_mode mem_mode,
case LE: case LT: case LEU: case LTU:
{
rtx new0 = lra_eliminate_regs_1 (insn, XEXP (x, 0), mem_mode,
- subst_p, update_p, full_p);
+ subst_p, update_p,
+ update_sp_offset, full_p);
rtx new1 = XEXP (x, 1)
? lra_eliminate_regs_1 (insn, XEXP (x, 1), mem_mode,
- subst_p, update_p, full_p) : 0;
+ subst_p, update_p,
+ update_sp_offset, full_p) : 0;
if (new0 != XEXP (x, 0) || new1 != XEXP (x, 1))
return gen_rtx_fmt_ee (code, GET_MODE (x), new0, new1);
@@ -475,7 +488,8 @@ lra_eliminate_regs_1 (rtx_insn *insn, rtx x, machine_mode mem_mode,
if (XEXP (x, 0))
{
new_rtx = lra_eliminate_regs_1 (insn, XEXP (x, 0), mem_mode,
- subst_p, update_p, full_p);
+ subst_p, update_p,
+ update_sp_offset, full_p);
if (new_rtx != XEXP (x, 0))
{
/* If this is a REG_DEAD note, it is not valid anymore.
@@ -484,7 +498,8 @@ lra_eliminate_regs_1 (rtx_insn *insn, rtx x, machine_mode mem_mode,
if (REG_NOTE_KIND (x) == REG_DEAD)
return (XEXP (x, 1)
? lra_eliminate_regs_1 (insn, XEXP (x, 1), mem_mode,
- subst_p, update_p, full_p)
+ subst_p, update_p,
+ update_sp_offset, full_p)
: NULL_RTX);
x = alloc_reg_note (REG_NOTE_KIND (x), new_rtx, XEXP (x, 1));
@@ -501,7 +516,8 @@ lra_eliminate_regs_1 (rtx_insn *insn, rtx x, machine_mode mem_mode,
if (XEXP (x, 1))
{
new_rtx = lra_eliminate_regs_1 (insn, XEXP (x, 1), mem_mode,
- subst_p, update_p, full_p);
+ subst_p, update_p,
+ update_sp_offset, full_p);
if (new_rtx != XEXP (x, 1))
return
gen_rtx_fmt_ee (GET_CODE (x), GET_MODE (x),
@@ -528,8 +544,8 @@ lra_eliminate_regs_1 (rtx_insn *insn, rtx x, machine_mode mem_mode,
&& XEXP (XEXP (x, 1), 0) == XEXP (x, 0))
{
rtx new_rtx = lra_eliminate_regs_1 (insn, XEXP (XEXP (x, 1), 1),
- mem_mode,
- subst_p, update_p, full_p);
+ mem_mode, subst_p, update_p,
+ update_sp_offset, full_p);
if (new_rtx != XEXP (XEXP (x, 1), 1))
return gen_rtx_fmt_ee (code, GET_MODE (x), XEXP (x, 0),
@@ -553,14 +569,16 @@ lra_eliminate_regs_1 (rtx_insn *insn, rtx x, machine_mode mem_mode,
case PARITY:
case BSWAP:
new_rtx = lra_eliminate_regs_1 (insn, XEXP (x, 0), mem_mode,
- subst_p, update_p, full_p);
+ subst_p, update_p,
+ update_sp_offset, full_p);
if (new_rtx != XEXP (x, 0))
return gen_rtx_fmt_e (code, GET_MODE (x), new_rtx);
return x;
case SUBREG:
new_rtx = lra_eliminate_regs_1 (insn, SUBREG_REG (x), mem_mode,
- subst_p, update_p, full_p);
+ subst_p, update_p,
+ update_sp_offset, full_p);
if (new_rtx != SUBREG_REG (x))
{
@@ -598,12 +616,12 @@ lra_eliminate_regs_1 (rtx_insn *insn, rtx x, machine_mode mem_mode,
replace_equiv_address_nv
(x,
lra_eliminate_regs_1 (insn, XEXP (x, 0), GET_MODE (x),
- subst_p, update_p, full_p));
+ subst_p, update_p, update_sp_offset, full_p));
case USE:
/* Handle insn_list USE that a call to a pure function may generate. */
new_rtx = lra_eliminate_regs_1 (insn, XEXP (x, 0), VOIDmode,
- subst_p, update_p, full_p);
+ subst_p, update_p, update_sp_offset, full_p);
if (new_rtx != XEXP (x, 0))
return gen_rtx_USE (GET_MODE (x), new_rtx);
return x;
@@ -624,7 +642,8 @@ lra_eliminate_regs_1 (rtx_insn *insn, rtx x, machine_mode mem_mode,
if (*fmt == 'e')
{
new_rtx = lra_eliminate_regs_1 (insn, XEXP (x, i), mem_mode,
- subst_p, update_p, full_p);
+ subst_p, update_p,
+ update_sp_offset, full_p);
if (new_rtx != XEXP (x, i) && ! copied)
{
x = shallow_copy_rtx (x);
@@ -638,7 +657,8 @@ lra_eliminate_regs_1 (rtx_insn *insn, rtx x, machine_mode mem_mode,
for (j = 0; j < XVECLEN (x, i); j++)
{
new_rtx = lra_eliminate_regs_1 (insn, XVECEXP (x, i, j), mem_mode,
- subst_p, update_p, full_p);
+ subst_p, update_p,
+ update_sp_offset, full_p);
if (new_rtx != XVECEXP (x, i, j) && ! copied_vec)
{
rtvec new_v = gen_rtvec_v (XVECLEN (x, i),
@@ -665,7 +685,7 @@ rtx
lra_eliminate_regs (rtx x, machine_mode mem_mode,
rtx insn ATTRIBUTE_UNUSED)
{
- return lra_eliminate_regs_1 (NULL, x, mem_mode, true, false, true);
+ return lra_eliminate_regs_1 (NULL, x, mem_mode, true, false, 0, true);
}
/* Stack pointer offset before the current insn relative to one at the
@@ -850,13 +870,15 @@ remove_reg_equal_offset_note (rtx insn, rtx what)
If REPLACE_P is false, just update the offsets while keeping the
base register the same. If FIRST_P, use the sp offset for
- elimination to sp. Attach the note about used elimination for
- insns setting frame pointer to update elimination easy (without
- parsing already generated elimination insns to find offset
- previously used) in future. */
+ elimination to sp. Otherwise, use UPDATE_SP_OFFSET for this.
+ Attach the note about used elimination for insns setting frame
+ pointer to update elimination easy (without parsing already
+ generated elimination insns to find offset previously used) in
+ future. */
-static void
-eliminate_regs_in_insn (rtx_insn *insn, bool replace_p, bool first_p)
+void
+eliminate_regs_in_insn (rtx_insn *insn, bool replace_p, bool first_p,
+ HOST_WIDE_INT update_sp_offset)
{
int icode = recog_memoized (insn);
rtx old_set = single_set (insn);
@@ -986,8 +1008,13 @@ eliminate_regs_in_insn (rtx_insn *insn, bool replace_p, bool first_p)
if (! replace_p)
{
offset += (ep->offset - ep->previous_offset);
- if (first_p && ep->to_rtx == stack_pointer_rtx)
- offset -= lra_get_insn_recog_data (insn)->sp_offset;
+ if (ep->to_rtx == stack_pointer_rtx)
+ {
+ if (first_p)
+ offset -= lra_get_insn_recog_data (insn)->sp_offset;
+ else
+ offset += update_sp_offset;
+ }
offset = trunc_int_for_mode (offset, GET_MODE (plus_cst_src));
}
@@ -1061,7 +1088,7 @@ eliminate_regs_in_insn (rtx_insn *insn, bool replace_p, bool first_p)
substed_operand[i]
= lra_eliminate_regs_1 (insn, *id->operand_loc[i], VOIDmode,
replace_p, ! replace_p && ! first_p,
- first_p);
+ update_sp_offset, first_p);
if (substed_operand[i] != orig_operand[i])
validate_p = true;
}
@@ -1349,7 +1376,7 @@ lra_eliminate_reg_if_possible (rtx *loc)
static void
process_insn_for_elimination (rtx_insn *insn, bool final_p, bool first_p)
{
- eliminate_regs_in_insn (insn, final_p, first_p);
+ eliminate_regs_in_insn (insn, final_p, first_p, 0);
if (! final_p)
{
/* Check that insn changed its code. This is a case when a move
diff --git a/gcc/lra-int.h b/gcc/lra-int.h
index 5355ebfa4ec..9422afcbe55 100644
--- a/gcc/lra-int.h
+++ b/gcc/lra-int.h
@@ -328,7 +328,6 @@ extern bitmap_head lra_inheritance_pseudos;
extern bitmap_head lra_split_regs;
extern bitmap_head lra_subreg_reload_pseudos;
extern bitmap_head lra_optional_reload_pseudos;
-extern int lra_constraint_new_insn_uid_start;
/* lra-constraints.c: */
@@ -339,6 +338,7 @@ extern int lra_constraint_iter;
extern bool lra_risky_transformations_p;
extern int lra_inheritance_iter;
extern int lra_undo_inheritance_iter;
+extern bool lra_constrain_insn (rtx_insn *);
extern bool lra_constraints (bool);
extern void lra_constraints_init (void);
extern void lra_constraints_finish (void);
@@ -353,7 +353,7 @@ extern int *lra_point_freq;
extern int lra_hard_reg_usage[FIRST_PSEUDO_REGISTER];
extern int lra_live_range_iter;
-extern void lra_create_live_ranges (bool);
+extern void lra_create_live_ranges (bool, bool);
extern lra_live_range_t lra_copy_live_range_list (lra_live_range_t);
extern lra_live_range_t lra_merge_live_ranges (lra_live_range_t,
lra_live_range_t);
@@ -389,13 +389,17 @@ extern bool lra_need_for_spills_p (void);
extern void lra_spill (void);
extern void lra_final_code_change (void);
+/* lra-remat.c: */
+
+extern bool lra_remat (void);
/* lra-elimination.c: */
extern void lra_debug_elim_table (void);
extern int lra_get_elimination_hard_regno (int);
-extern rtx lra_eliminate_regs_1 (rtx_insn *, rtx, machine_mode, bool,
- bool, bool);
+extern rtx lra_eliminate_regs_1 (rtx_insn *, rtx, machine_mode,
+ bool, bool, HOST_WIDE_INT, bool);
+extern void eliminate_regs_in_insn (rtx_insn *insn, bool, bool, HOST_WIDE_INT);
extern void lra_eliminate (bool, bool);
extern void lra_eliminate_reg_if_possible (rtx *);
diff --git a/gcc/lra-lives.c b/gcc/lra-lives.c
index 03def823a10..5868be86e37 100644
--- a/gcc/lra-lives.c
+++ b/gcc/lra-lives.c
@@ -100,6 +100,9 @@ static sparseset start_living, start_dying;
insn. */
static sparseset unused_set, dead_set;
+/* Bitmap used for holding intermediate bitmap operation results. */
+static bitmap_head temp_bitmap;
+
/* Pool for pseudo live ranges. */
static alloc_pool live_range_pool;
@@ -252,8 +255,7 @@ make_hard_regno_born (int regno)
unsigned int i;
lra_assert (regno < FIRST_PSEUDO_REGISTER);
- if (TEST_HARD_REG_BIT (lra_no_alloc_regs, regno)
- || TEST_HARD_REG_BIT (hard_regs_live, regno))
+ if (TEST_HARD_REG_BIT (hard_regs_live, regno))
return;
SET_HARD_REG_BIT (hard_regs_live, regno);
sparseset_set_bit (start_living, regno);
@@ -267,8 +269,7 @@ static void
make_hard_regno_dead (int regno)
{
lra_assert (regno < FIRST_PSEUDO_REGISTER);
- if (TEST_HARD_REG_BIT (lra_no_alloc_regs, regno)
- || ! TEST_HARD_REG_BIT (hard_regs_live, regno))
+ if (! TEST_HARD_REG_BIT (hard_regs_live, regno))
return;
sparseset_set_bit (start_dying, regno);
CLEAR_HARD_REG_BIT (hard_regs_live, regno);
@@ -392,7 +393,7 @@ mark_regno_dead (int regno, machine_mode mode, int point, bool local_sets_p)
/* Structure describing local BB data used for pseudo
live-analysis. */
-struct bb_data
+struct bb_data_pseudos
{
/* Basic block about which the below data are. */
basic_block bb;
@@ -401,7 +402,7 @@ struct bb_data
};
/* Array for all BB data. Indexed by the corresponding BB index. */
-typedef struct bb_data *bb_data_t;
+typedef struct bb_data_pseudos *bb_data_t;
/* All basic block data are referred through the following array. */
static bb_data_t bb_data;
@@ -422,9 +423,6 @@ get_bb_data_by_index (int index)
/* Bitmap with all hard regs. */
static bitmap_head all_hard_regs_bitmap;
-/* Bitmap used for holding intermediate bitmap operation results. */
-static bitmap_head temp_bitmap;
-
/* The transfer function used by the DF equation solver to propagate
live info through block with BB_INDEX according to the following
equation:
@@ -478,10 +476,9 @@ static bitmap_head all_blocks;
static void
initiate_live_solver (void)
{
- bitmap_initialize (&temp_bitmap, &reg_obstack);
bitmap_initialize (&all_hard_regs_bitmap, &reg_obstack);
bitmap_set_range (&all_hard_regs_bitmap, 0, FIRST_PSEUDO_REGISTER);
- bb_data = XNEWVEC (struct bb_data, last_basic_block_for_fn (cfun));
+ bb_data = XNEWVEC (struct bb_data_pseudos, last_basic_block_for_fn (cfun));
bitmap_initialize (&all_blocks, &reg_obstack);
basic_block bb;
@@ -510,7 +507,6 @@ finish_live_solver (void)
}
free (bb_data);
bitmap_clear (&all_hard_regs_bitmap);
- bitmap_clear (&temp_bitmap);
}
@@ -642,10 +638,11 @@ check_pseudos_live_through_calls (int regno)
backward scan of BB insns. CURR_POINT is the program point where
BB ends. The function updates this counter and returns in
CURR_POINT the program point where BB starts. The function also
- can delete the dead insns. It returns true if pseudo live info was
+ does local live info updates and can delete the dead insns if
+ GLOBAL_LIVE_INFO_P. It returns true if pseudo live info was
changed at the BB start. */
static bool
-process_bb_lives (basic_block bb, int &curr_point)
+process_bb_lives (basic_block bb, int &curr_point, bool global_live_info_p)
{
int i, regno, freq;
unsigned int j;
@@ -662,15 +659,16 @@ process_bb_lives (basic_block bb, int &curr_point)
sparseset_clear (pseudos_live_through_setjumps);
REG_SET_TO_HARD_REG_SET (hard_regs_live, reg_live_out);
AND_COMPL_HARD_REG_SET (hard_regs_live, eliminable_regset);
- AND_COMPL_HARD_REG_SET (hard_regs_live, lra_no_alloc_regs);
EXECUTE_IF_SET_IN_BITMAP (reg_live_out, FIRST_PSEUDO_REGISTER, j, bi)
mark_pseudo_live (j, curr_point);
- bb_gen_pseudos = &get_bb_data (bb)->gen_pseudos;
- bb_killed_pseudos = &get_bb_data (bb)->killed_pseudos;
- bitmap_clear (bb_gen_pseudos);
- bitmap_clear (bb_killed_pseudos);
-
+ if (global_live_info_p)
+ {
+ bb_gen_pseudos = &get_bb_data (bb)->gen_pseudos;
+ bb_killed_pseudos = &get_bb_data (bb)->killed_pseudos;
+ bitmap_clear (bb_gen_pseudos);
+ bitmap_clear (bb_killed_pseudos);
+ }
freq = REG_FREQ_FROM_BB (bb);
if (lra_dump_file != NULL)
@@ -703,7 +701,7 @@ process_bb_lives (basic_block bb, int &curr_point)
set = single_set (curr_insn);
- if (set != NULL_RTX
+ if (global_live_info_p && set != NULL_RTX
&& REG_P (SET_DEST (set)) && REGNO (SET_DEST (set)) >= FIRST_PSEUDO_REGISTER
&& find_reg_note (curr_insn, REG_EH_REGION, NULL_RTX) == NULL_RTX
&& ! may_trap_p (PATTERN (curr_insn))
@@ -739,8 +737,8 @@ process_bb_lives (basic_block bb, int &curr_point)
unsigned int uid;
rtx_insn *insn;
- EXECUTE_IF_SET_IN_BITMAP
- (&lra_reg_info[dst_regno].insn_bitmap, 0, uid, bi)
+ bitmap_copy (&temp_bitmap, &lra_reg_info[dst_regno].insn_bitmap);
+ EXECUTE_IF_SET_IN_BITMAP (&temp_bitmap, 0, uid, bi)
{
insn = lra_insn_recog_data[uid]->insn;
lra_substitute_pseudo_within_insn (insn, dst_regno,
@@ -818,9 +816,9 @@ process_bb_lives (basic_block bb, int &curr_point)
for (reg = curr_id->regs; reg != NULL; reg = reg->next)
if (reg->type != OP_IN)
{
- need_curr_point_incr |= mark_regno_live (reg->regno,
- reg->biggest_mode,
- curr_point, true);
+ need_curr_point_incr
+ |= mark_regno_live (reg->regno, reg->biggest_mode,
+ curr_point, global_live_info_p);
check_pseudos_live_through_calls (reg->regno);
}
@@ -835,9 +833,9 @@ process_bb_lives (basic_block bb, int &curr_point)
/* See which defined values die here. */
for (reg = curr_id->regs; reg != NULL; reg = reg->next)
if (reg->type == OP_OUT && ! reg->early_clobber && ! reg->subreg_p)
- need_curr_point_incr |= mark_regno_dead (reg->regno,
- reg->biggest_mode,
- curr_point, true);
+ need_curr_point_incr
+ |= mark_regno_dead (reg->regno, reg->biggest_mode,
+ curr_point, global_live_info_p);
for (reg = curr_static_id->hard_regs; reg != NULL; reg = reg->next)
if (reg->type == OP_OUT && ! reg->early_clobber && ! reg->subreg_p)
@@ -877,9 +875,9 @@ process_bb_lives (basic_block bb, int &curr_point)
for (reg = curr_id->regs; reg != NULL; reg = reg->next)
if (reg->type == OP_IN)
{
- need_curr_point_incr |= mark_regno_live (reg->regno,
- reg->biggest_mode,
- curr_point, true);
+ need_curr_point_incr
+ |= mark_regno_live (reg->regno, reg->biggest_mode,
+ curr_point, global_live_info_p);
check_pseudos_live_through_calls (reg->regno);
}
@@ -897,9 +895,9 @@ process_bb_lives (basic_block bb, int &curr_point)
/* Mark early clobber outputs dead. */
for (reg = curr_id->regs; reg != NULL; reg = reg->next)
if (reg->type == OP_OUT && reg->early_clobber && ! reg->subreg_p)
- need_curr_point_incr |= mark_regno_dead (reg->regno,
- reg->biggest_mode,
- curr_point, true);
+ need_curr_point_incr
+ |= mark_regno_dead (reg->regno, reg->biggest_mode,
+ curr_point, global_live_info_p);
for (reg = curr_static_id->hard_regs; reg != NULL; reg = reg->next)
if (reg->type == OP_OUT && reg->early_clobber && ! reg->subreg_p)
@@ -972,19 +970,25 @@ process_bb_lives (basic_block bb, int &curr_point)
make_hard_regno_born (px);
}
- /* Check if bb border live info was changed. */
- unsigned int live_pseudos_num = 0;
bool live_change_p = false;
- EXECUTE_IF_SET_IN_BITMAP (df_get_live_in (bb), FIRST_PSEUDO_REGISTER, j, bi)
+ if (global_live_info_p)
{
- live_pseudos_num++;
- if (! sparseset_bit_p (pseudos_live, j))
+ /* Check if bb border live info was changed. */
+ unsigned int live_pseudos_num = 0;
+ EXECUTE_IF_SET_IN_BITMAP (df_get_live_in (bb),
+ FIRST_PSEUDO_REGISTER, j, bi)
{
- live_change_p = TRUE;
- break;
+ live_pseudos_num++;
+ if (! sparseset_bit_p (pseudos_live, j))
+ {
+ live_change_p = TRUE;
+ break;
+ }
}
+ live_change_p
+ = (live_change_p
+ || sparseset_cardinality (pseudos_live) != live_pseudos_num);
}
- live_change_p = live_change_p || sparseset_cardinality (pseudos_live) != live_pseudos_num;
/* See if we'll need an increment at the end of this basic block.
An increment is needed if the PSEUDOS_LIVE set is not empty,
@@ -1178,10 +1182,11 @@ int lra_live_range_iter;
/* The main entry function creates live ranges only for memory pseudos
(or for all ones if ALL_P), set up CONFLICT_HARD_REGS for the
- pseudos. It also does global live analysis only for pseudos and
- only if the pseudo live info was changed on a BB border. */
+ pseudos. It also does dead insn elimination and global live
+ analysis only for pseudos and only if GLOBAL_LIVE_INFO_P and the
+ pseudo live info was changed on a BB border. */
void
-lra_create_live_ranges (bool all_p)
+lra_create_live_ranges (bool all_p, bool global_live_info_p)
{
basic_block bb;
int i, hard_regno, max_regno = max_reg_num ();
@@ -1257,7 +1262,7 @@ lra_create_live_ranges (bool all_p)
if (bb == EXIT_BLOCK_PTR_FOR_FN (cfun) || bb
== ENTRY_BLOCK_PTR_FOR_FN (cfun))
continue;
- if (process_bb_lives (bb, curr_point))
+ if (process_bb_lives (bb, curr_point, global_live_info_p))
bb_live_change_p = true;
}
if (bb_live_change_p)
@@ -1331,6 +1336,7 @@ lra_live_ranges_init (void)
{
live_range_pool = create_alloc_pool ("live ranges",
sizeof (struct lra_live_range), 100);
+ bitmap_initialize (&temp_bitmap, &reg_obstack);
initiate_live_solver ();
}
@@ -1339,5 +1345,6 @@ void
lra_live_ranges_finish (void)
{
finish_live_solver ();
+ bitmap_clear (&temp_bitmap);
free_alloc_pool (live_range_pool);
}
diff --git a/gcc/lra-remat.c b/gcc/lra-remat.c
new file mode 100644
index 00000000000..f638a1d8740
--- /dev/null
+++ b/gcc/lra-remat.c
@@ -0,0 +1,1237 @@
+/* Rematerialize pseudos values.
+ Copyright (C) 2014 Free Software Foundation, Inc.
+ Contributed by Vladimir Makarov <vmakarov@redhat.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
+<http://www.gnu.org/licenses/>. */
+
+/* This code objective is to rematerialize spilled pseudo values. To
+ do this we calculate available insn candidates. The candidate is
+ available at some point if there is dominated set of insns with the
+ same pattern, the insn inputs are not dying or modified on any path
+ from the set, the outputs are not modified.
+
+ The insns containing memory or spilled pseudos (except for the
+ rematerialized pseudo) are not considered as such insns are not
+ profitable in comparison with regular loads of spilled pseudo
+ values. That simplifies the implementation as we don't need to
+ deal with memory aliasing.
+
+ To speed up available candidate calculation, we calculate partially
+ available candidates first and use them for initialization of the
+ availability. That is because (partial) availability sets are
+ sparse.
+
+ The rematerialization sub-pass could be improved further in the
+ following ways:
+
+ o We could make longer live ranges of inputs in the
+ rematerialization candidates if their hard registers are not used
+ for other purposes. This could be complicated if we need to
+ update BB live info information as LRA does not use
+ DF-infrastructure for compile-time reasons. This problem could
+ be overcome if constrain making live ranges longer only in BB/EBB
+ scope.
+ o We could use cost-based decision to choose rematerialization insn
+ (currently all insns without memory is can be used).
+ o We could use other free hard regs for unused output pseudos in
+ rematerialization candidates although such cases probably will
+ be very rare. */
+
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "hard-reg-set.h"
+#include "rtl.h"
+#include "rtl-error.h"
+#include "tm_p.h"
+#include "target.h"
+#include "insn-config.h"
+#include "recog.h"
+#include "output.h"
+#include "regs.h"
+#include "hashtab.h"
+#include "hash-set.h"
+#include "vec.h"
+#include "machmode.h"
+#include "input.h"
+#include "function.h"
+#include "expr.h"
+#include "predict.h"
+#include "dominance.h"
+#include "cfg.h"
+#include "basic-block.h"
+#include "except.h"
+#include "df.h"
+#include "ira.h"
+#include "sparseset.h"
+#include "params.h"
+#include "df.h"
+#include "lra-int.h"
+
+/* Number of candidates for rematerialization. */
+static unsigned int cands_num;
+
+/* The following is used for representation of call_used_reg_set in
+ form array whose elements are hard register numbers with nonzero bit
+ in CALL_USED_REG_SET. */
+static int call_used_regs_arr_len;
+static int call_used_regs_arr[FIRST_PSEUDO_REGISTER];
+
+/* Bitmap used for different calculations. */
+static bitmap_head temp_bitmap;
+
+typedef struct cand *cand_t;
+typedef const struct cand *const_cand_t;
+
+/* Insn candidates for rematerialization. The candidate insn should
+ have the following properies:
+ o no any memory (as access to memory is non-profitable)
+ o no INOUT regs (it means no non-paradoxical subreg of output reg)
+ o one output spilled pseudo (or reload pseudo of a spilled pseudo)
+ o all other pseudos are with assigned hard regs. */
+struct cand
+{
+ /* Index of the candidates in all_cands. */
+ int index;
+ /* The candidate insn. */
+ rtx_insn *insn;
+ /* Insn pseudo regno for rematerialization. */
+ int regno;
+ /* Non-negative if a reload pseudo is in the insn instead of the
+ pseudo for rematerialization. */
+ int reload_regno;
+ /* Number of the operand containing the regno or its reload
+ regno. */
+ int nop;
+ /* Next candidate for the same regno. */
+ cand_t next_regno_cand;
+};
+
+/* Vector containing all candidates. */
+static vec<cand_t> all_cands;
+/* Map: insn -> candidate representing it. It is null if the insn can
+ not be used for rematerialization. */
+static cand_t *insn_to_cand;
+
+/* Map regno -> candidates can be used for the regno
+ rematerialization. */
+static cand_t *regno_cands;
+
+/* Data about basic blocks used for the rematerialization
+ sub-pass. */
+struct remat_bb_data
+{
+ /* Basic block about which the below data are. */
+ basic_block bb;
+ /* Registers changed in the basic block: */
+ bitmap_head changed_regs;
+ /* Registers becoming dead in the BB. */
+ bitmap_head dead_regs;
+ /* Cands present in the BB whose in/out regs are not changed after
+ the cands occurence and are not dead (except the reload
+ regno). */
+ bitmap_head gen_cands;
+ bitmap_head livein_cands; /* cands whose inputs live at the BB start. */
+ bitmap_head pavin_cands; /* cands partially available at BB entry. */
+ bitmap_head pavout_cands; /* cands partially available at BB exit. */
+ bitmap_head avin_cands; /* cands available at the entry of the BB. */
+ bitmap_head avout_cands; /* cands available at the exit of the BB. */
+};
+
+/* Array for all BB data. Indexed by the corresponding BB index. */
+typedef struct remat_bb_data *remat_bb_data_t;
+
+/* Basic blocks for data flow problems -- all bocks except the special
+ ones. */
+static bitmap_head all_blocks;
+
+/* All basic block data are referred through the following array. */
+static remat_bb_data_t remat_bb_data;
+
+/* Two small functions for access to the bb data. */
+static inline remat_bb_data_t
+get_remat_bb_data (basic_block bb)
+{
+ return &remat_bb_data[(bb)->index];
+}
+
+static inline remat_bb_data_t
+get_remat_bb_data_by_index (int index)
+{
+ return &remat_bb_data[index];
+}
+
+
+
+/* Recursive hash function for RTL X. */
+static hashval_t
+rtx_hash (rtx x)
+{
+ int i, j;
+ enum rtx_code code;
+ const char *fmt;
+ hashval_t val = 0;
+
+ if (x == 0)
+ return val;
+
+ code = GET_CODE (x);
+ val += (int) code + 4095;
+
+ /* Some RTL can be compared nonrecursively. */
+ switch (code)
+ {
+ case REG:
+ return val + REGNO (x);
+
+ case LABEL_REF:
+ return iterative_hash_object (XEXP (x, 0), val);
+
+ case SYMBOL_REF:
+ return iterative_hash_object (XSTR (x, 0), val);
+
+ case SCRATCH:
+ case CONST_DOUBLE:
+ case CONST_INT:
+ case CONST_VECTOR:
+ return val;
+
+ default:
+ break;
+ }
+
+ /* Hash the elements. */
+ fmt = GET_RTX_FORMAT (code);
+ for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
+ {
+ switch (fmt[i])
+ {
+ case 'w':
+ val += XWINT (x, i);
+ break;
+
+ case 'n':
+ case 'i':
+ val += XINT (x, i);
+ break;
+
+ case 'V':
+ case 'E':
+ val += XVECLEN (x, i);
+
+ for (j = 0; j < XVECLEN (x, i); j++)
+ val += rtx_hash (XVECEXP (x, i, j));
+ break;
+
+ case 'e':
+ val += rtx_hash (XEXP (x, i));
+ break;
+
+ case 'S':
+ case 's':
+ val += htab_hash_string (XSTR (x, i));
+ break;
+
+ case 'u':
+ case '0':
+ case 't':
+ break;
+
+ /* It is believed that rtx's at this level will never
+ contain anything but integers and other rtx's, except for
+ within LABEL_REFs and SYMBOL_REFs. */
+ default:
+ abort ();
+ }
+ }
+ return val;
+}
+
+
+
+/* Hash table for the candidates. Different insns (e.g. structurally
+ the same insns or even insns with different unused output regs) can
+ be represented by the same candidate in the table. */
+static htab_t cand_table;
+
+/* Hash function for candidate CAND. */
+static hashval_t
+cand_hash (const void *cand)
+{
+ const_cand_t c = (const_cand_t) cand;
+ lra_insn_recog_data_t id = lra_get_insn_recog_data (c->insn);
+ struct lra_static_insn_data *static_id = id->insn_static_data;
+ int nops = static_id->n_operands;
+ hashval_t hash = 0;
+
+ for (int i = 0; i < nops; i++)
+ if (i == c->nop)
+ hash = iterative_hash_object (c->regno, hash);
+ else if (static_id->operand[i].type == OP_IN)
+ hash = iterative_hash_object (*id->operand_loc[i], hash);
+ return hash;
+}
+
+/* Equal function for candidates CAND1 and CAND2. They are equal if
+ the corresponding candidate insns have the same code, the same
+ regno for rematerialization, the same input operands. */
+static int
+cand_eq_p (const void *cand1, const void *cand2)
+{
+ const_cand_t c1 = (const_cand_t) cand1;
+ const_cand_t c2 = (const_cand_t) cand2;
+ lra_insn_recog_data_t id1 = lra_get_insn_recog_data (c1->insn);
+ lra_insn_recog_data_t id2 = lra_get_insn_recog_data (c2->insn);
+ struct lra_static_insn_data *static_id1 = id1->insn_static_data;
+ int nops = static_id1->n_operands;
+
+ if (c1->regno != c2->regno
+ || INSN_CODE (c1->insn) < 0
+ || INSN_CODE (c1->insn) != INSN_CODE (c2->insn))
+ return false;
+ gcc_assert (c1->nop == c2->nop);
+ for (int i = 0; i < nops; i++)
+ if (i != c1->nop && static_id1->operand[i].type == OP_IN
+ && *id1->operand_loc[i] != *id2->operand_loc[i])
+ return false;
+ return true;
+}
+
+/* Insert candidate CAND into the table if it is not there yet.
+ Return candidate which is in the table. */
+static cand_t
+insert_cand (cand_t cand)
+{
+ void **entry_ptr;
+
+ entry_ptr = htab_find_slot (cand_table, cand, INSERT);
+ if (*entry_ptr == NULL)
+ *entry_ptr = (void *) cand;
+ return (cand_t) *entry_ptr;
+}
+
+/* Free candidate CAND memory. */
+static void
+free_cand (void *cand)
+{
+ free (cand);
+}
+
+/* Initiate the candidate table. */
+static void
+initiate_cand_table (void)
+{
+ cand_table = htab_create (8000, cand_hash, cand_eq_p,
+ (htab_del) free_cand);
+}
+
+/* Finish the candidate table. */
+static void
+finish_cand_table (void)
+{
+ htab_delete (cand_table);
+}
+
+
+
+/* Return true if X contains memory or UNSPEC. We can not just check
+ insn operands as memory or unspec might be not an operand itself
+ but contain an operand. Insn with memory access is not profitable
+ for rematerialization. Rematerialization of UNSPEC might result in
+ wrong code generation as the UNPEC effect is unknown
+ (e.g. generating a label). */
+static bool
+bad_for_rematerialization_p (rtx x)
+{
+ int i, j;
+ const char *fmt;
+ enum rtx_code code;
+
+ if (MEM_P (x) || GET_CODE (x) == UNSPEC)
+ return true;
+ code = GET_CODE (x);
+ fmt = GET_RTX_FORMAT (code);
+ for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
+ {
+ if (fmt[i] == 'e')
+ {
+ if (bad_for_rematerialization_p (XEXP (x, i)))
+ return true;
+ }
+ else if (fmt[i] == 'E')
+ {
+ for (j = XVECLEN (x, i) - 1; j >= 0; j--)
+ if (bad_for_rematerialization_p (XVECEXP (x, i, j)))
+ return true;
+ }
+ }
+ return false;
+}
+
+/* If INSN can not be used for rematerialization, return negative
+ value. If INSN can be considered as a candidate for
+ rematerialization, return value which is the operand number of the
+ pseudo for which the insn can be used for rematerialization. Here
+ we consider the insns without any memory, spilled pseudo (except
+ for the rematerialization pseudo), or dying or unused regs. */
+static int
+operand_to_remat (rtx_insn *insn)
+{
+ lra_insn_recog_data_t id = lra_get_insn_recog_data (insn);
+ struct lra_static_insn_data *static_id = id->insn_static_data;
+ struct lra_insn_reg *reg, *found_reg = NULL;
+
+ /* First find a pseudo which can be rematerialized. */
+ for (reg = id->regs; reg != NULL; reg = reg->next)
+ if (reg->type == OP_OUT && ! reg->subreg_p
+ && find_regno_note (insn, REG_UNUSED, reg->regno) == NULL)
+ {
+ /* We permits only one spilled reg. */
+ if (found_reg != NULL)
+ return -1;
+ found_reg = reg;
+ }
+ if (found_reg == NULL)
+ return -1;
+ if (found_reg->regno < FIRST_PSEUDO_REGISTER)
+ return -1;
+ if (bad_for_rematerialization_p (PATTERN (insn)))
+ return -1;
+ /* Check the other regs are not spilled. */
+ for (reg = id->regs; reg != NULL; reg = reg->next)
+ if (found_reg == reg)
+ continue;
+ else if (reg->type == OP_INOUT)
+ return -1;
+ else if (reg->regno >= FIRST_PSEUDO_REGISTER
+ && reg_renumber[reg->regno] < 0)
+ /* Another spilled reg. */
+ return -1;
+ else if (reg->type == OP_IN)
+ {
+ if (find_regno_note (insn, REG_DEAD, reg->regno) != NULL)
+ /* We don't want to make live ranges longer. */
+ return -1;
+ /* Check that there is no output reg as the input one. */
+ for (struct lra_insn_reg *reg2 = id->regs;
+ reg2 != NULL;
+ reg2 = reg2->next)
+ if (reg2->type == OP_OUT && reg->regno == reg2->regno)
+ return -1;
+ }
+ /* Find the rematerialization operand. */
+ int nop = static_id->n_operands;
+ for (int i = 0; i < nop; i++)
+ if (REG_P (*id->operand_loc[i])
+ && (int) REGNO (*id->operand_loc[i]) == found_reg->regno)
+ return i;
+ return -1;
+}
+
+/* Create candidate for INSN with rematerialization operand NOP and
+ REGNO. Insert the candidate into the table and set up the
+ corresponding INSN_TO_CAND element. */
+static void
+create_cand (rtx_insn *insn, int nop, int regno)
+{
+ lra_insn_recog_data_t id = lra_get_insn_recog_data (insn);
+ rtx reg = *id->operand_loc[nop];
+ gcc_assert (REG_P (reg));
+ int op_regno = REGNO (reg);
+ gcc_assert (op_regno >= FIRST_PSEUDO_REGISTER);
+ cand_t cand = XNEW (struct cand);
+ cand->insn = insn;
+ cand->nop = nop;
+ cand->regno = regno;
+ cand->reload_regno = op_regno == regno ? -1 : op_regno;
+ gcc_assert (cand->regno >= 0);
+ cand_t cand_in_table = insert_cand (cand);
+ insn_to_cand[INSN_UID (insn)] = cand_in_table;
+ if (cand != cand_in_table)
+ free (cand);
+ else
+ {
+ /* A new cand. */
+ cand->index = all_cands.length ();
+ all_cands.safe_push (cand);
+ cand->next_regno_cand = regno_cands[cand->regno];
+ regno_cands[cand->regno] = cand;
+ }
+}
+
+/* Create rematerialization candidates (inserting them into the
+ table). */
+static void
+create_cands (void)
+{
+ rtx_insn *insn;
+ struct potential_cand
+ {
+ rtx_insn *insn;
+ int nop;
+ };
+ struct potential_cand *regno_potential_cand;
+
+ /* Create candidates. */
+ regno_potential_cand = XCNEWVEC (struct potential_cand, max_reg_num ());
+ for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
+ if (INSN_P (insn))
+ {
+ rtx set;
+ int src_regno, dst_regno;
+ rtx_insn *insn2;
+ lra_insn_recog_data_t id = lra_get_insn_recog_data (insn);
+ int nop = operand_to_remat (insn);
+ int regno = -1;
+
+ if ((set = single_set (insn)) != NULL
+ && REG_P (SET_SRC (set)) && REG_P (SET_DEST (set))
+ && (src_regno = REGNO (SET_SRC (set))) >= FIRST_PSEUDO_REGISTER
+ && (dst_regno = REGNO (SET_DEST (set))) >= FIRST_PSEUDO_REGISTER
+ && reg_renumber[dst_regno] < 0
+ && (insn2 = regno_potential_cand[src_regno].insn) != NULL
+ && BLOCK_FOR_INSN (insn2) == BLOCK_FOR_INSN (insn))
+ create_cand (insn2, regno_potential_cand[src_regno].nop, dst_regno);
+ if (nop < 0)
+ goto fail;
+ gcc_assert (REG_P (*id->operand_loc[nop]));
+ regno = REGNO (*id->operand_loc[nop]);
+ gcc_assert (regno >= FIRST_PSEUDO_REGISTER);
+ if (reg_renumber[regno] < 0)
+ create_cand (insn, nop, regno);
+ else
+ {
+ regno_potential_cand[regno].insn = insn;
+ regno_potential_cand[regno].nop = nop;
+ goto fail;
+ }
+ regno = -1;
+ fail:
+ for (struct lra_insn_reg *reg = id->regs; reg != NULL; reg = reg->next)
+ if (reg->type != OP_IN && reg->regno != regno
+ && reg->regno >= FIRST_PSEUDO_REGISTER)
+ regno_potential_cand[reg->regno].insn = NULL;
+ }
+ cands_num = all_cands.length ();
+ free (regno_potential_cand);
+}
+
+
+
+/* Create and initialize BB data. */
+static void
+create_remat_bb_data (void)
+{
+ basic_block bb;
+ remat_bb_data_t bb_info;
+
+ remat_bb_data = XNEWVEC (struct remat_bb_data,
+ last_basic_block_for_fn (cfun));
+ FOR_ALL_BB_FN (bb, cfun)
+ {
+#ifdef ENABLE_CHECKING
+ if (bb->index < 0 || bb->index >= last_basic_block_for_fn (cfun))
+ abort ();
+#endif
+ bb_info = get_remat_bb_data (bb);
+ bb_info->bb = bb;
+ bitmap_initialize (&bb_info->changed_regs, &reg_obstack);
+ bitmap_initialize (&bb_info->dead_regs, &reg_obstack);
+ bitmap_initialize (&bb_info->gen_cands, &reg_obstack);
+ bitmap_initialize (&bb_info->livein_cands, &reg_obstack);
+ bitmap_initialize (&bb_info->pavin_cands, &reg_obstack);
+ bitmap_initialize (&bb_info->pavout_cands, &reg_obstack);
+ bitmap_initialize (&bb_info->avin_cands, &reg_obstack);
+ bitmap_initialize (&bb_info->avout_cands, &reg_obstack);
+ }
+}
+
+/* Dump all candidates to DUMP_FILE. */
+static void
+dump_cands (FILE *dump_file)
+{
+ int i;
+ cand_t cand;
+
+ fprintf (dump_file, "\nCands:\n");
+ for (i = 0; i < (int) cands_num; i++)
+ {
+ cand = all_cands[i];
+ fprintf (dump_file, "%d (nop=%d, remat_regno=%d, reload_regno=%d):\n",
+ i, cand->nop, cand->regno, cand->reload_regno);
+ print_inline_rtx (dump_file, cand->insn, 6);
+ fprintf (dump_file, "\n");
+ }
+}
+
+/* Dump all candidates and BB data. */
+static void
+dump_candidates_and_remat_bb_data (void)
+{
+ basic_block bb;
+
+ if (lra_dump_file == NULL)
+ return;
+ dump_cands (lra_dump_file);
+ FOR_EACH_BB_FN (bb, cfun)
+ {
+ fprintf (lra_dump_file, "\nBB %d:\n", bb->index);
+ /* Livein */
+ fprintf (lra_dump_file, " register live in:");
+ dump_regset (df_get_live_in (bb), lra_dump_file);
+ putc ('\n', lra_dump_file);
+ /* Liveout */
+ fprintf (lra_dump_file, " register live out:");
+ dump_regset (df_get_live_out (bb), lra_dump_file);
+ putc ('\n', lra_dump_file);
+ /* Changed/dead regs: */
+ fprintf (lra_dump_file, " changed regs:");
+ dump_regset (&get_remat_bb_data (bb)->changed_regs, lra_dump_file);
+ putc ('\n', lra_dump_file);
+ fprintf (lra_dump_file, " dead regs:");
+ dump_regset (&get_remat_bb_data (bb)->dead_regs, lra_dump_file);
+ putc ('\n', lra_dump_file);
+ lra_dump_bitmap_with_title ("cands generated in BB",
+ &get_remat_bb_data (bb)->gen_cands, bb->index);
+ lra_dump_bitmap_with_title ("livein cands in BB",
+ &get_remat_bb_data (bb)->livein_cands, bb->index);
+ lra_dump_bitmap_with_title ("pavin cands in BB",
+ &get_remat_bb_data (bb)->pavin_cands, bb->index);
+ lra_dump_bitmap_with_title ("pavout cands in BB",
+ &get_remat_bb_data (bb)->pavout_cands, bb->index);
+ lra_dump_bitmap_with_title ("avin cands in BB",
+ &get_remat_bb_data (bb)->avin_cands, bb->index);
+ lra_dump_bitmap_with_title ("avout cands in BB",
+ &get_remat_bb_data (bb)->avout_cands, bb->index);
+ }
+}
+
+/* Free all BB data. */
+static void
+finish_remat_bb_data (void)
+{
+ basic_block bb;
+
+ FOR_EACH_BB_FN (bb, cfun)
+ {
+ bitmap_clear (&get_remat_bb_data (bb)->avout_cands);
+ bitmap_clear (&get_remat_bb_data (bb)->avin_cands);
+ bitmap_clear (&get_remat_bb_data (bb)->pavout_cands);
+ bitmap_clear (&get_remat_bb_data (bb)->pavin_cands);
+ bitmap_clear (&get_remat_bb_data (bb)->livein_cands);
+ bitmap_clear (&get_remat_bb_data (bb)->gen_cands);
+ bitmap_clear (&get_remat_bb_data (bb)->dead_regs);
+ bitmap_clear (&get_remat_bb_data (bb)->changed_regs);
+ }
+ free (remat_bb_data);
+}
+
+
+
+/* Update changed_regs and dead_regs of BB from INSN. */
+static void
+set_bb_regs (basic_block bb, rtx_insn *insn)
+{
+ lra_insn_recog_data_t id = lra_get_insn_recog_data (insn);
+ struct lra_insn_reg *reg;
+
+ for (reg = id->regs; reg != NULL; reg = reg->next)
+ if (reg->type != OP_IN)
+ bitmap_set_bit (&get_remat_bb_data (bb)->changed_regs, reg->regno);
+ else
+ {
+ if (find_regno_note (insn, REG_DEAD, (unsigned) reg->regno) != NULL)
+ bitmap_set_bit (&get_remat_bb_data (bb)->dead_regs, reg->regno);
+ }
+ if (CALL_P (insn))
+ for (int i = 0; i < call_used_regs_arr_len; i++)
+ bitmap_set_bit (&get_remat_bb_data (bb)->dead_regs,
+ call_used_regs_arr[i]);
+}
+
+/* Calculate changed_regs and dead_regs for each BB. */
+static void
+calculate_local_reg_remat_bb_data (void)
+{
+ basic_block bb;
+ rtx_insn *insn;
+
+ FOR_EACH_BB_FN (bb, cfun)
+ FOR_BB_INSNS (bb, insn)
+ if (INSN_P (insn))
+ set_bb_regs (bb, insn);
+}
+
+
+
+/* Return true if REGNO is an input operand of INSN. */
+static bool
+input_regno_present_p (rtx_insn *insn, int regno)
+{
+ lra_insn_recog_data_t id = lra_get_insn_recog_data (insn);
+ struct lra_insn_reg *reg;
+
+ for (reg = id->regs; reg != NULL; reg = reg->next)
+ if (reg->type == OP_IN && reg->regno == regno)
+ return true;
+ return false;
+}
+
+/* Return true if a call used register is an input operand of INSN. */
+static bool
+call_used_input_regno_present_p (rtx_insn *insn)
+{
+ lra_insn_recog_data_t id = lra_get_insn_recog_data (insn);
+ struct lra_insn_reg *reg;
+
+ for (reg = id->regs; reg != NULL; reg = reg->next)
+ if (reg->type == OP_IN && reg->regno <= FIRST_PSEUDO_REGISTER
+ && TEST_HARD_REG_BIT (call_used_reg_set, reg->regno))
+ return true;
+ return false;
+}
+
+/* Calculate livein_cands for each BB. */
+static void
+calculate_livein_cands (void)
+{
+ basic_block bb;
+
+ FOR_EACH_BB_FN (bb, cfun)
+ {
+ bitmap livein_regs = df_get_live_in (bb);
+ bitmap livein_cands = &get_remat_bb_data (bb)->livein_cands;
+ for (unsigned int i = 0; i < cands_num; i++)
+ {
+ cand_t cand = all_cands[i];
+ lra_insn_recog_data_t id = lra_get_insn_recog_data (cand->insn);
+ struct lra_insn_reg *reg;
+
+ for (reg = id->regs; reg != NULL; reg = reg->next)
+ if (reg->type == OP_IN && ! bitmap_bit_p (livein_regs, reg->regno))
+ break;
+ if (reg == NULL)
+ bitmap_set_bit (livein_cands, i);
+ }
+ }
+}
+
+/* Calculate gen_cands for each BB. */
+static void
+calculate_gen_cands (void)
+{
+ basic_block bb;
+ bitmap gen_cands;
+ bitmap_head gen_insns;
+ rtx_insn *insn;
+
+ bitmap_initialize (&gen_insns, &reg_obstack);
+ FOR_EACH_BB_FN (bb, cfun)
+ {
+ gen_cands = &get_remat_bb_data (bb)->gen_cands;
+ bitmap_clear (&gen_insns);
+ FOR_BB_INSNS (bb, insn)
+ if (INSN_P (insn))
+ {
+ lra_insn_recog_data_t id = lra_get_insn_recog_data (insn);
+ struct lra_insn_reg *reg;
+ unsigned int uid;
+ bitmap_iterator bi;
+ cand_t cand;
+ rtx set;
+ int src_regno = -1, dst_regno = -1;
+
+ if ((set = single_set (insn)) != NULL
+ && REG_P (SET_SRC (set)) && REG_P (SET_DEST (set)))
+ {
+ src_regno = REGNO (SET_SRC (set));
+ dst_regno = REGNO (SET_DEST (set));
+ }
+
+ /* Update gen_cands: */
+ bitmap_clear (&temp_bitmap);
+ for (reg = id->regs; reg != NULL; reg = reg->next)
+ if (reg->type != OP_IN
+ || find_regno_note (insn, REG_DEAD, reg->regno) != NULL)
+ EXECUTE_IF_SET_IN_BITMAP (&gen_insns, 0, uid, bi)
+ {
+ rtx_insn *insn2 = lra_insn_recog_data[uid]->insn;
+
+ cand = insn_to_cand[INSN_UID (insn2)];
+ gcc_assert (cand != NULL);
+ /* Ignore the reload insn. */
+ if (src_regno == cand->reload_regno
+ && dst_regno == cand->regno)
+ continue;
+ if (cand->regno == reg->regno
+ || input_regno_present_p (insn2, reg->regno))
+ {
+ bitmap_clear_bit (gen_cands, cand->index);
+ bitmap_set_bit (&temp_bitmap, uid);
+ }
+ }
+
+ if (CALL_P (insn))
+ EXECUTE_IF_SET_IN_BITMAP (&gen_insns, 0, uid, bi)
+ {
+ rtx_insn *insn2 = lra_insn_recog_data[uid]->insn;
+
+ cand = insn_to_cand[INSN_UID (insn2)];
+ gcc_assert (cand != NULL);
+ if (call_used_input_regno_present_p (insn2))
+ {
+ bitmap_clear_bit (gen_cands, cand->index);
+ bitmap_set_bit (&temp_bitmap, uid);
+ }
+ }
+ bitmap_and_compl_into (&gen_insns, &temp_bitmap);
+
+ cand = insn_to_cand[INSN_UID (insn)];
+ if (cand != NULL)
+ {
+ bitmap_set_bit (gen_cands, cand->index);
+ bitmap_set_bit (&gen_insns, INSN_UID (insn));
+ }
+ }
+ }
+ bitmap_clear (&gen_insns);
+}
+
+
+
+/* The common transfer function used by the DF equation solver to
+ propagate (partial) availability info BB_IN to BB_OUT through block
+ with BB_INDEX according to the following equation:
+
+ bb.out = ((bb.in & bb.livein) - bb.killed) OR bb.gen
+*/
+static bool
+cand_trans_fun (int bb_index, bitmap bb_in, bitmap bb_out)
+{
+ remat_bb_data_t bb_info;
+ bitmap bb_livein, bb_changed_regs, bb_dead_regs;
+ unsigned int cid;
+ bitmap_iterator bi;
+
+ bb_info = get_remat_bb_data_by_index (bb_index);
+ bb_livein = &bb_info->livein_cands;
+ bb_changed_regs = &bb_info->changed_regs;
+ bb_dead_regs = &bb_info->dead_regs;
+ /* Calculate killed avin cands -- cands whose regs are changed or
+ becoming dead in the BB. We calculate it here as we hope that
+ repeated calculations are compensated by smaller size of BB_IN in
+ comparison with all candidates number. */
+ bitmap_clear (&temp_bitmap);
+ EXECUTE_IF_SET_IN_BITMAP (bb_in, 0, cid, bi)
+ {
+ cand_t cand = all_cands[cid];
+ lra_insn_recog_data_t id = lra_get_insn_recog_data (cand->insn);
+ struct lra_insn_reg *reg;
+
+ if (! bitmap_bit_p (bb_livein, cid))
+ {
+ bitmap_set_bit (&temp_bitmap, cid);
+ continue;
+ }
+ for (reg = id->regs; reg != NULL; reg = reg->next)
+ /* Ignore all outputs which are not the regno for
+ rematerialization. */
+ if (reg->type == OP_OUT && reg->regno != cand->regno)
+ continue;
+ else if (bitmap_bit_p (bb_changed_regs, reg->regno)
+ || bitmap_bit_p (bb_dead_regs, reg->regno))
+ {
+ bitmap_set_bit (&temp_bitmap, cid);
+ break;
+ }
+ }
+ return bitmap_ior_and_compl (bb_out,
+ &bb_info->gen_cands, bb_in, &temp_bitmap);
+}
+
+
+
+/* The transfer function used by the DF equation solver to propagate
+ partial candidate availability info through block with BB_INDEX
+ according to the following equation:
+
+ bb.pavout = ((bb.pavin & bb.livein) - bb.killed) OR bb.gen
+*/
+static bool
+cand_pav_trans_fun (int bb_index)
+{
+ remat_bb_data_t bb_info;
+
+ bb_info = get_remat_bb_data_by_index (bb_index);
+ return cand_trans_fun (bb_index, &bb_info->pavin_cands,
+ &bb_info->pavout_cands);
+}
+
+/* The confluence function used by the DF equation solver to set up
+ cand_pav info for a block BB without predecessor. */
+static void
+cand_pav_con_fun_0 (basic_block bb)
+{
+ bitmap_clear (&get_remat_bb_data (bb)->pavin_cands);
+}
+
+/* The confluence function used by the DF equation solver to propagate
+ partial candidate availability info from predecessor to successor
+ on edge E (pred->bb) according to the following equation:
+
+ bb.pavin_cands = 0 for entry block | OR (pavout_cands of predecessors)
+ */
+static bool
+cand_pav_con_fun_n (edge e)
+{
+ basic_block pred = e->src;
+ basic_block bb = e->dest;
+ remat_bb_data_t bb_info;
+ bitmap bb_pavin, pred_pavout;
+
+ bb_info = get_remat_bb_data (bb);
+ bb_pavin = &bb_info->pavin_cands;
+ pred_pavout = &get_remat_bb_data (pred)->pavout_cands;
+ return bitmap_ior_into (bb_pavin, pred_pavout);
+}
+
+
+
+/* The transfer function used by the DF equation solver to propagate
+ candidate availability info through block with BB_INDEX according
+ to the following equation:
+
+ bb.avout = ((bb.avin & bb.livein) - bb.killed) OR bb.gen
+*/
+static bool
+cand_av_trans_fun (int bb_index)
+{
+ remat_bb_data_t bb_info;
+
+ bb_info = get_remat_bb_data_by_index (bb_index);
+ return cand_trans_fun (bb_index, &bb_info->avin_cands,
+ &bb_info->avout_cands);
+}
+
+/* The confluence function used by the DF equation solver to set up
+ cand_av info for a block BB without predecessor. */
+static void
+cand_av_con_fun_0 (basic_block bb)
+{
+ bitmap_clear (&get_remat_bb_data (bb)->avin_cands);
+}
+
+/* The confluence function used by the DF equation solver to propagate
+ cand_av info from predecessor to successor on edge E (pred->bb)
+ according to the following equation:
+
+ bb.avin_cands = 0 for entry block | AND (avout_cands of predecessors)
+ */
+static bool
+cand_av_con_fun_n (edge e)
+{
+ basic_block pred = e->src;
+ basic_block bb = e->dest;
+ remat_bb_data_t bb_info;
+ bitmap bb_avin, pred_avout;
+
+ bb_info = get_remat_bb_data (bb);
+ bb_avin = &bb_info->avin_cands;
+ pred_avout = &get_remat_bb_data (pred)->avout_cands;
+ return bitmap_and_into (bb_avin, pred_avout);
+}
+
+/* Calculate available candidates for each BB. */
+static void
+calculate_global_remat_bb_data (void)
+{
+ basic_block bb;
+
+ df_simple_dataflow
+ (DF_FORWARD, NULL, cand_pav_con_fun_0, cand_pav_con_fun_n,
+ cand_pav_trans_fun, &all_blocks,
+ df_get_postorder (DF_FORWARD), df_get_n_blocks (DF_FORWARD));
+ /* Initialize avin by pavin. */
+ FOR_EACH_BB_FN (bb, cfun)
+ bitmap_copy (&get_remat_bb_data (bb)->avin_cands,
+ &get_remat_bb_data (bb)->pavin_cands);
+ df_simple_dataflow
+ (DF_FORWARD, NULL, cand_av_con_fun_0, cand_av_con_fun_n,
+ cand_av_trans_fun, &all_blocks,
+ df_get_postorder (DF_FORWARD), df_get_n_blocks (DF_FORWARD));
+}
+
+
+
+/* Setup sp offset attribute to SP_OFFSET for all INSNS. */
+static void
+change_sp_offset (rtx_insn *insns, HOST_WIDE_INT sp_offset)
+{
+ for (rtx_insn *insn = insns; insn != NULL; insn = NEXT_INSN (insn))
+ eliminate_regs_in_insn (insn, false, false, sp_offset);
+}
+
+/* Return start hard register of REG (can be a hard or a pseudo reg)
+ or -1 (if it is a spilled pseudo). Return number of hard registers
+ occupied by REG through parameter NREGS if the start hard reg is
+ not negative. */
+static int
+get_hard_regs (struct lra_insn_reg *reg, int &nregs)
+{
+ int regno = reg->regno;
+ int hard_regno = regno < FIRST_PSEUDO_REGISTER ? regno : reg_renumber[regno];
+
+ if (hard_regno >= 0)
+ nregs = hard_regno_nregs[hard_regno][reg->biggest_mode];
+ return hard_regno;
+}
+
+/* Insert rematerialization insns using the data-flow data calculated
+ earlier. */
+static bool
+do_remat (void)
+{
+ rtx_insn *insn;
+ basic_block bb;
+ bitmap_head avail_cands;
+ bool changed_p = false;
+ /* Living hard regs and hard registers of living pseudos. */
+ HARD_REG_SET live_hard_regs;
+
+ bitmap_initialize (&avail_cands, &reg_obstack);
+ FOR_EACH_BB_FN (bb, cfun)
+ {
+ REG_SET_TO_HARD_REG_SET (live_hard_regs, df_get_live_out (bb));
+ bitmap_and (&avail_cands, &get_remat_bb_data (bb)->avin_cands,
+ &get_remat_bb_data (bb)->livein_cands);
+ FOR_BB_INSNS (bb, insn)
+ {
+ if (!NONDEBUG_INSN_P (insn))
+ continue;
+
+ lra_insn_recog_data_t id = lra_get_insn_recog_data (insn);
+ struct lra_static_insn_data *static_id = id->insn_static_data;
+ struct lra_insn_reg *reg;
+ cand_t cand;
+ unsigned int cid;
+ bitmap_iterator bi;
+ rtx set;
+ int src_regno = -1, dst_regno = -1;
+
+ if ((set = single_set (insn)) != NULL
+ && REG_P (SET_SRC (set)) && REG_P (SET_DEST (set)))
+ {
+ src_regno = REGNO (SET_SRC (set));
+ dst_regno = REGNO (SET_DEST (set));
+ }
+
+ cand = NULL;
+ /* Check possibility of rematerialization (hard reg or
+ unpsilled pseudo <- spilled pseudo): */
+ if (dst_regno >= 0 && src_regno >= FIRST_PSEUDO_REGISTER
+ && reg_renumber[src_regno] < 0
+ && (dst_regno < FIRST_PSEUDO_REGISTER
+ || reg_renumber[dst_regno] >= 0))
+ {
+ for (cand = regno_cands[src_regno];
+ cand != NULL;
+ cand = cand->next_regno_cand)
+ if (bitmap_bit_p (&avail_cands, cand->index))
+ break;
+ }
+ int i, hard_regno, nregs;
+ rtx_insn *remat_insn = NULL;
+ HOST_WIDE_INT cand_sp_offset = 0;
+ if (cand != NULL)
+ {
+ lra_insn_recog_data_t cand_id
+ = lra_get_insn_recog_data (cand->insn);
+ struct lra_static_insn_data *static_cand_id
+ = cand_id->insn_static_data;
+ rtx saved_op = *cand_id->operand_loc[cand->nop];
+
+ /* Check clobbers do not kill something living. */
+ gcc_assert (REG_P (saved_op));
+ int ignore_regno = REGNO (saved_op);
+
+ for (reg = cand_id->regs; reg != NULL; reg = reg->next)
+ if (reg->type != OP_IN && reg->regno != ignore_regno)
+ {
+ hard_regno = get_hard_regs (reg, nregs);
+ gcc_assert (hard_regno >= 0);
+ for (i = 0; i < nregs; i++)
+ if (TEST_HARD_REG_BIT (live_hard_regs, hard_regno + i))
+ break;
+ if (i < nregs)
+ break;
+ }
+
+ if (reg == NULL)
+ {
+ for (reg = static_cand_id->hard_regs;
+ reg != NULL;
+ reg = reg->next)
+ if (reg->type != OP_IN
+ && TEST_HARD_REG_BIT (live_hard_regs, reg->regno))
+ break;
+ }
+
+ if (reg == NULL)
+ {
+ *cand_id->operand_loc[cand->nop] = SET_DEST (set);
+ lra_update_insn_regno_info (cand->insn);
+ bool ok_p = lra_constrain_insn (cand->insn);
+ if (ok_p)
+ {
+ rtx remat_pat = copy_insn (PATTERN (cand->insn));
+
+ start_sequence ();
+ emit_insn (remat_pat);
+ remat_insn = get_insns ();
+ end_sequence ();
+ if (recog_memoized (remat_insn) < 0)
+ remat_insn = NULL;
+ cand_sp_offset = cand_id->sp_offset;
+ }
+ *cand_id->operand_loc[cand->nop] = saved_op;
+ lra_update_insn_regno_info (cand->insn);
+ }
+ }
+
+ bitmap_clear (&temp_bitmap);
+ /* Update avail_cands (see analogous code for
+ calculate_gen_cands). */
+ for (reg = id->regs; reg != NULL; reg = reg->next)
+ if (reg->type != OP_IN
+ || find_regno_note (insn, REG_DEAD, reg->regno) != NULL)
+ EXECUTE_IF_SET_IN_BITMAP (&avail_cands, 0, cid, bi)
+ {
+ cand = all_cands[cid];
+
+ /* Ignore the reload insn. */
+ if (src_regno == cand->reload_regno
+ && dst_regno == cand->regno)
+ continue;
+ if (cand->regno == reg->regno
+ || input_regno_present_p (cand->insn, reg->regno))
+ bitmap_set_bit (&temp_bitmap, cand->index);
+ }
+
+ if (CALL_P (insn))
+ EXECUTE_IF_SET_IN_BITMAP (&avail_cands, 0, cid, bi)
+ {
+ cand = all_cands[cid];
+
+ if (call_used_input_regno_present_p (cand->insn))
+ bitmap_set_bit (&temp_bitmap, cand->index);
+ }
+
+ bitmap_and_compl_into (&avail_cands, &temp_bitmap);
+ if ((cand = insn_to_cand[INSN_UID (insn)]) != NULL)
+ bitmap_set_bit (&avail_cands, cand->index);
+
+ if (remat_insn != NULL)
+ {
+ HOST_WIDE_INT sp_offset_change = cand_sp_offset - id->sp_offset;
+ if (sp_offset_change != 0)
+ change_sp_offset (remat_insn, sp_offset_change);
+ lra_process_new_insns (insn, remat_insn, NULL,
+ "Inserting rematerialization insn");
+ lra_set_insn_deleted (insn);
+ changed_p = true;
+ continue;
+ }
+
+ /* Update live hard regs: */
+ for (reg = id->regs; reg != NULL; reg = reg->next)
+ if (reg->type == OP_IN
+ && find_regno_note (insn, REG_DEAD, reg->regno) != NULL)
+ {
+ if ((hard_regno = get_hard_regs (reg, nregs)) < 0)
+ continue;
+ for (i = 0; i < nregs; i++)
+ CLEAR_HARD_REG_BIT (live_hard_regs, hard_regno + i);
+ }
+ else if (reg->type != OP_IN
+ && find_regno_note (insn, REG_UNUSED, reg->regno) == NULL)
+ {
+ if ((hard_regno = get_hard_regs (reg, nregs)) < 0)
+ continue;
+ for (i = 0; i < nregs; i++)
+ SET_HARD_REG_BIT (live_hard_regs, hard_regno + i);
+ }
+ /* Process also hard regs (e.g. CC register) which are part
+ of insn definition. */
+ for (reg = static_id->hard_regs; reg != NULL; reg = reg->next)
+ if (reg->type == OP_IN
+ && find_regno_note (insn, REG_DEAD, reg->regno) != NULL)
+ CLEAR_HARD_REG_BIT (live_hard_regs, reg->regno);
+ else if (reg->type != OP_IN
+ && find_regno_note (insn, REG_UNUSED, reg->regno) == NULL)
+ SET_HARD_REG_BIT (live_hard_regs, reg->regno);
+ }
+ }
+ bitmap_clear (&avail_cands);
+ return changed_p;
+}
+
+
+
+/* Entry point of the rematerialization sub-pass. Return true if we
+ did any rematerialization. */
+bool
+lra_remat (void)
+{
+ basic_block bb;
+ bool result;
+ int max_regno = max_reg_num ();
+
+ if (! flag_lra_remat)
+ return false;
+ timevar_push (TV_LRA_REMAT);
+ insn_to_cand = XCNEWVEC (cand_t, get_max_uid ());
+ regno_cands = XCNEWVEC (cand_t, max_regno);
+ all_cands.create (8000);
+ call_used_regs_arr_len = 0;
+ for (int i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+ if (call_used_regs[i])
+ call_used_regs_arr[call_used_regs_arr_len++] = i;
+ initiate_cand_table ();
+ create_cands ();
+ create_remat_bb_data ();
+ bitmap_initialize (&temp_bitmap, &reg_obstack);
+ calculate_local_reg_remat_bb_data ();
+ calculate_livein_cands ();
+ calculate_gen_cands ();
+ bitmap_initialize (&all_blocks, &reg_obstack);
+ FOR_ALL_BB_FN (bb, cfun)
+ bitmap_set_bit (&all_blocks, bb->index);
+ calculate_global_remat_bb_data ();
+ dump_candidates_and_remat_bb_data ();
+ result = do_remat ();
+ all_cands.release ();
+ bitmap_clear (&temp_bitmap);
+ finish_remat_bb_data ();
+ finish_cand_table ();
+ bitmap_clear (&all_blocks);
+ free (regno_cands);
+ free (insn_to_cand);
+ timevar_pop (TV_LRA_REMAT);
+ return result;
+}
diff --git a/gcc/lra-spills.c b/gcc/lra-spills.c
index a4ffc8578e6..f21a3abcd6f 100644
--- a/gcc/lra-spills.c
+++ b/gcc/lra-spills.c
@@ -445,7 +445,7 @@ remove_pseudos (rtx *loc, rtx_insn *insn)
{
rtx x = lra_eliminate_regs_1 (insn, pseudo_slots[i].mem,
GET_MODE (pseudo_slots[i].mem),
- false, false, true);
+ 0, false, false, true);
*loc = x != pseudo_slots[i].mem ? x : copy_rtx (x);
}
return;
diff --git a/gcc/lra.c b/gcc/lra.c
index 3ae47e86ba6..9309d5e44c2 100644
--- a/gcc/lra.c
+++ b/gcc/lra.c
@@ -37,6 +37,7 @@ along with GCC; see the file COPYING3. If not see
generated;
o Some pseudos might be spilled to assign hard registers to
new reload pseudos;
+ o Recalculating spilled pseudo values (rematerialization);
o Changing spilled pseudos to stack memory or their equivalences;
o Allocation stack memory changes the address displacement and
new iteration is needed.
@@ -57,19 +58,26 @@ along with GCC; see the file COPYING3. If not see
----------- | ---------------- |
| | |
| V New |
- ---------------- No ------------ pseudos -------------------
- | Spilled pseudo | change |Constraints:| or insns | Inheritance/split |
- | to memory |<-------| RTL |--------->| transformations |
- | substitution | | transfor- | | in EBB scope |
- ---------------- | mations | -------------------
- | ------------
- V
- -------------------------
- | Hard regs substitution, |
- | devirtalization, and |------> Finish
- | restoring scratches got |
- | memory |
- -------------------------
+ | ------------ pseudos -------------------
+ | |Constraints:| or insns | Inheritance/split |
+ | | RTL |--------->| transformations |
+ | | transfor- | | in EBB scope |
+ | substi- | mations | -------------------
+ | tutions ------------
+ | | No change
+ ---------------- V
+ | Spilled pseudo | -------------------
+ | to memory |<----| Rematerialization |
+ | substitution | -------------------
+ ----------------
+ | No susbtitions
+ V
+ -------------------------
+ | Hard regs substitution, |
+ | devirtalization, and |------> Finish
+ | restoring scratches got |
+ | memory |
+ -------------------------
To speed up the process:
o We process only insns affected by changes on previous
@@ -849,38 +857,38 @@ collect_non_operand_hard_regs (rtx *x, lra_insn_recog_data_t data,
{
if ((regno = REGNO (op)) >= FIRST_PSEUDO_REGISTER)
return list;
+ /* Process all regs even unallocatable ones as we need info
+ about all regs for rematerialization pass. */
for (last = regno + hard_regno_nregs[regno][mode];
regno < last;
regno++)
- if (! TEST_HARD_REG_BIT (lra_no_alloc_regs, regno)
- || TEST_HARD_REG_BIT (eliminable_regset, regno))
- {
- for (curr = list; curr != NULL; curr = curr->next)
- if (curr->regno == regno && curr->subreg_p == subreg_p
- && curr->biggest_mode == mode)
- {
- if (curr->type != type)
- curr->type = OP_INOUT;
- if (curr->early_clobber != early_clobber)
- curr->early_clobber = true;
- break;
- }
- if (curr == NULL)
+ {
+ for (curr = list; curr != NULL; curr = curr->next)
+ if (curr->regno == regno && curr->subreg_p == subreg_p
+ && curr->biggest_mode == mode)
{
- /* This is a new hard regno or the info can not be
- integrated into the found structure. */
+ if (curr->type != type)
+ curr->type = OP_INOUT;
+ if (curr->early_clobber != early_clobber)
+ curr->early_clobber = true;
+ break;
+ }
+ if (curr == NULL)
+ {
+ /* This is a new hard regno or the info can not be
+ integrated into the found structure. */
#ifdef STACK_REGS
- early_clobber
- = (early_clobber
- /* This clobber is to inform popping floating
- point stack only. */
- && ! (FIRST_STACK_REG <= regno
- && regno <= LAST_STACK_REG));
+ early_clobber
+ = (early_clobber
+ /* This clobber is to inform popping floating
+ point stack only. */
+ && ! (FIRST_STACK_REG <= regno
+ && regno <= LAST_STACK_REG));
#endif
- list = new_insn_reg (data->insn, regno, type, mode, subreg_p,
- early_clobber, list);
- }
- }
+ list = new_insn_reg (data->insn, regno, type, mode, subreg_p,
+ early_clobber, list);
+ }
+ }
return list;
}
switch (code)
@@ -1456,10 +1464,8 @@ add_regs_to_insn_regno_info (lra_insn_recog_data_t data, rtx x, int uid,
if (REG_P (x))
{
regno = REGNO (x);
- if (regno < FIRST_PSEUDO_REGISTER
- && TEST_HARD_REG_BIT (lra_no_alloc_regs, regno)
- && ! TEST_HARD_REG_BIT (eliminable_regset, regno))
- return;
+ /* Process all regs even unallocatable ones as we need info about
+ all regs for rematerialization pass. */
expand_reg_info ();
if (bitmap_set_bit (&lra_reg_info[regno].insn_bitmap, uid))
{
@@ -2152,9 +2158,6 @@ bitmap_head lra_optional_reload_pseudos;
pass. */
bitmap_head lra_subreg_reload_pseudos;
-/* First UID of insns generated before a new spill pass. */
-int lra_constraint_new_insn_uid_start;
-
/* File used for output of LRA debug information. */
FILE *lra_dump_file;
@@ -2252,7 +2255,6 @@ lra (FILE *f)
lra_curr_reload_num = 0;
push_insns (get_last_insn (), NULL);
/* It is needed for the 1st coalescing. */
- lra_constraint_new_insn_uid_start = get_max_uid ();
bitmap_initialize (&lra_inheritance_pseudos, &reg_obstack);
bitmap_initialize (&lra_split_regs, &reg_obstack);
bitmap_initialize (&lra_optional_reload_pseudos, &reg_obstack);
@@ -2294,14 +2296,17 @@ lra (FILE *f)
/* As a side-effect of lra_create_live_ranges, we calculate
actual_call_used_reg_set, which is needed during
lra_inheritance. */
- lra_create_live_ranges (true);
+ lra_create_live_ranges (true, true);
}
lra_inheritance ();
}
if (live_p)
lra_clear_live_ranges ();
- /* We need live ranges for lra_assign -- so build them. */
- lra_create_live_ranges (true);
+ /* We need live ranges for lra_assign -- so build them. But
+ don't remove dead insns or change global live info as we
+ can undo inheritance transformations after inheritance
+ pseudo assigning. */
+ lra_create_live_ranges (true, false);
live_p = true;
/* If we don't spill non-reload and non-inheritance pseudos,
there is no sense to run memory-memory move coalescing.
@@ -2320,7 +2325,7 @@ lra (FILE *f)
{
if (! live_p)
{
- lra_create_live_ranges (true);
+ lra_create_live_ranges (true, true);
live_p = true;
}
if (lra_coalesce ())
@@ -2336,21 +2341,32 @@ lra (FILE *f)
bitmap_clear (&lra_subreg_reload_pseudos);
bitmap_clear (&lra_inheritance_pseudos);
bitmap_clear (&lra_split_regs);
- if (! lra_need_for_spills_p ())
- break;
if (! live_p)
{
/* We need full live info for spilling pseudos into
registers instead of memory. */
- lra_create_live_ranges (lra_reg_spill_p);
+ lra_create_live_ranges (lra_reg_spill_p, true);
+ live_p = true;
+ }
+ /* We should check necessity for spilling here as the above live
+ range pass can remove spilled pseudos. */
+ if (! lra_need_for_spills_p ())
+ break;
+ /* Now we know what pseudos should be spilled. Try to
+ rematerialize them first. */
+ if (lra_remat ())
+ {
+ /* We need full live info -- see the comment above. */
+ lra_create_live_ranges (lra_reg_spill_p, true);
live_p = true;
+ if (! lra_need_for_spills_p ())
+ break;
}
lra_spill ();
/* Assignment of stack slots changes elimination offsets for
some eliminations. So update the offsets here. */
lra_eliminate (false, false);
lra_constraint_new_regno_start = max_reg_num ();
- lra_constraint_new_insn_uid_start = get_max_uid ();
lra_assignment_iter_after_spill = 0;
}
restore_scratches ();
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index da1f0e44682..3ce2367a3bf 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -61,6 +61,7 @@ along with GCC; see the file COPYING3. If not see
#include "context.h"
#include "pass_manager.h"
#include "ipa-utils.h"
+#include "omp-low.h"
/* True when asm nodes has been output. */
bool asm_nodes_output = false;
@@ -330,6 +331,11 @@ referenced_from_other_partition_p (symtab_node *node, lto_symtab_encoder_t encod
for (i = 0; node->iterate_referring (i, ref); i++)
{
+ /* Ignore references from non-offloadable nodes while streaming NODE into
+ offload LTO section. */
+ if (!ref->referring->need_lto_streaming)
+ continue;
+
if (ref->referring->in_other_partition
|| !lto_symtab_encoder_in_partition_p (encoder, ref->referring))
return true;
@@ -348,9 +354,16 @@ reachable_from_other_partition_p (struct cgraph_node *node, lto_symtab_encoder_t
if (node->global.inlined_to)
return false;
for (e = node->callers; e; e = e->next_caller)
- if (e->caller->in_other_partition
- || !lto_symtab_encoder_in_partition_p (encoder, e->caller))
- return true;
+ {
+ /* Ignore references from non-offloadable nodes while streaming NODE into
+ offload LTO section. */
+ if (!e->caller->need_lto_streaming)
+ continue;
+
+ if (e->caller->in_other_partition
+ || !lto_symtab_encoder_in_partition_p (encoder, e->caller))
+ return true;
+ }
return false;
}
@@ -549,6 +562,7 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
bp_pack_value (&bp, node->tm_clone, 1);
bp_pack_value (&bp, node->calls_comdat_local, 1);
bp_pack_value (&bp, node->icf_merged, 1);
+ bp_pack_value (&bp, node->nonfreeing_fn, 1);
bp_pack_value (&bp, node->thunk.thunk_p && !boundary_p, 1);
bp_pack_enum (&bp, ld_plugin_symbol_resolution,
LDPR_NUM_KNOWN, node->resolution);
@@ -818,6 +832,16 @@ create_references (lto_symtab_encoder_t encoder, symtab_node *node)
lto_symtab_encoder_encode (encoder, ref->referred);
}
+/* Select what needs to be streamed out. In regular lto mode stream everything.
+ In offload lto mode stream only nodes marked as offloadable. */
+void
+select_what_to_stream (bool offload_lto_mode)
+{
+ struct symtab_node *snode;
+ FOR_EACH_SYMBOL (snode)
+ snode->need_lto_streaming = !offload_lto_mode || snode->offloadable;
+}
+
/* Find all symbols we want to stream into given partition and insert them
to encoders.
@@ -844,6 +868,8 @@ compute_ltrans_boundary (lto_symtab_encoder_t in_encoder)
!lsei_end_p (lsei); lsei_next_function_in_partition (&lsei))
{
struct cgraph_node *node = lsei_cgraph_node (lsei);
+ if (!node->need_lto_streaming)
+ continue;
add_node_to (encoder, node, true);
lto_set_symtab_encoder_in_partition (encoder, node);
create_references (encoder, node);
@@ -860,6 +886,8 @@ compute_ltrans_boundary (lto_symtab_encoder_t in_encoder)
{
varpool_node *vnode = lsei_varpool_node (lsei);
+ if (!vnode->need_lto_streaming)
+ continue;
lto_set_symtab_encoder_in_partition (encoder, vnode);
lto_set_symtab_encoder_encode_initializer (encoder, vnode);
create_references (encoder, vnode);
@@ -1042,6 +1070,50 @@ read_string (struct lto_input_block *ib)
return str;
}
+/* Output function/variable tables that will allow libgomp to look up offload
+ target code.
+ OFFLOAD_FUNCS is filled in expand_omp_target, OFFLOAD_VARS is filled in
+ varpool_node::get_create. In WHOPR (partitioned) mode during the WPA stage
+ both OFFLOAD_FUNCS and OFFLOAD_VARS are filled by input_offload_tables. */
+
+void
+output_offload_tables (void)
+{
+ if (vec_safe_is_empty (offload_funcs) && vec_safe_is_empty (offload_vars))
+ return;
+
+ struct lto_simple_output_block *ob
+ = lto_create_simple_output_block (LTO_section_offload_table);
+
+ for (unsigned i = 0; i < vec_safe_length (offload_funcs); i++)
+ {
+ streamer_write_enum (ob->main_stream, LTO_symtab_tags,
+ LTO_symtab_last_tag, LTO_symtab_unavail_node);
+ lto_output_fn_decl_index (ob->decl_state, ob->main_stream,
+ (*offload_funcs)[i]);
+ }
+
+ for (unsigned i = 0; i < vec_safe_length (offload_vars); i++)
+ {
+ streamer_write_enum (ob->main_stream, LTO_symtab_tags,
+ LTO_symtab_last_tag, LTO_symtab_variable);
+ lto_output_var_decl_index (ob->decl_state, ob->main_stream,
+ (*offload_vars)[i]);
+ }
+
+ streamer_write_uhwi_stream (ob->main_stream, 0);
+ lto_destroy_simple_output_block (ob);
+
+ /* In WHOPR mode during the WPA stage the joint offload tables need to be
+ streamed to one partition only. That's why we free offload_funcs and
+ offload_vars after the first call of output_offload_tables. */
+ if (flag_wpa)
+ {
+ vec_free (offload_funcs);
+ vec_free (offload_vars);
+ }
+}
+
/* 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
@@ -1097,6 +1169,7 @@ input_overwrite_node (struct lto_file_decl_data *file_data,
node->tm_clone = bp_unpack_value (bp, 1);
node->calls_comdat_local = bp_unpack_value (bp, 1);
node->icf_merged = bp_unpack_value (bp, 1);
+ node->nonfreeing_fn = bp_unpack_value (bp, 1);
node->thunk.thunk_p = bp_unpack_value (bp, 1);
node->resolution = bp_unpack_enum (bp, ld_plugin_symbol_resolution,
LDPR_NUM_KNOWN);
@@ -1768,6 +1841,55 @@ input_symtab (void)
}
}
+/* Input function/variable tables that will allow libgomp to look up offload
+ target code, and store them into OFFLOAD_FUNCS and OFFLOAD_VARS. */
+
+void
+input_offload_tables (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;
+
+ 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_offload_table,
+ &data, &len);
+ if (!ib)
+ continue;
+
+ enum LTO_symtab_tags tag
+ = streamer_read_enum (ib, LTO_symtab_tags, LTO_symtab_last_tag);
+ while (tag)
+ {
+ if (tag == LTO_symtab_unavail_node)
+ {
+ int decl_index = streamer_read_uhwi (ib);
+ tree fn_decl
+ = lto_file_decl_data_get_fn_decl (file_data, decl_index);
+ vec_safe_push (offload_funcs, fn_decl);
+ }
+ else if (tag == LTO_symtab_variable)
+ {
+ int decl_index = streamer_read_uhwi (ib);
+ tree var_decl
+ = lto_file_decl_data_get_var_decl (file_data, decl_index);
+ vec_safe_push (offload_vars, var_decl);
+ }
+ else
+ fatal_error ("invalid offload table in %s", file_data->file_name);
+
+ tag = streamer_read_enum (ib, LTO_symtab_tags, LTO_symtab_last_tag);
+ }
+
+ lto_destroy_simple_input_block (file_data, LTO_section_offload_table,
+ ib, data, len);
+ }
+}
+
/* True when we need optimization summary for NODE. */
static int
diff --git a/gcc/lto-opts.c b/gcc/lto-opts.c
index d1d153d0408..72b09571e26 100644
--- a/gcc/lto-opts.c
+++ b/gcc/lto-opts.c
@@ -49,6 +49,7 @@ along with GCC; see the file COPYING3. If not see
#include "ipa-ref.h"
#include "cgraph.h"
#include "lto-streamer.h"
+#include "lto-section-names.h"
#include "toplev.h"
/* Append the option piece OPT to the COLLECT_GCC_OPTIONS string
@@ -158,6 +159,23 @@ lto_write_options (void)
append_to_collect_gcc_options (&temporary_obstack, &first_p,
"-fno-strict-overflow");
+ /* Append options from target hook and store them to offload_lto section. */
+ if (strcmp (section_name_prefix, OFFLOAD_SECTION_NAME_PREFIX) == 0)
+ {
+ char *offload_opts = targetm.offload_options ();
+ char *offload_ptr = offload_opts;
+ while (offload_ptr)
+ {
+ char *next = strchr (offload_ptr, ' ');
+ if (next)
+ *next++ = '\0';
+ append_to_collect_gcc_options (&temporary_obstack, &first_p,
+ offload_ptr);
+ offload_ptr = next;
+ }
+ free (offload_opts);
+ }
+
/* Output explicitly passed options. */
for (i = 1; i < save_decoded_options_count; ++i)
{
@@ -181,15 +199,23 @@ lto_write_options (void)
if (!(cl_options[option->opt_index].flags & (CL_COMMON|CL_TARGET|CL_LTO)))
continue;
+ /* Do not store target-specific options in offload_lto section. */
+ if ((cl_options[option->opt_index].flags & CL_TARGET)
+ && strcmp (section_name_prefix, OFFLOAD_SECTION_NAME_PREFIX) == 0)
+ continue;
+
/* Drop options created from the gcc driver that will be rejected
when passed on to the driver again. */
if (cl_options[option->opt_index].cl_reject_driver)
continue;
/* Also drop all options that are handled by the driver as well,
- which includes things like -o and -v or -fhelp for example.
- We do not need those. Also drop all diagnostic options. */
- if (cl_options[option->opt_index].flags & (CL_DRIVER|CL_WARNING))
+ which includes things like -o and -v or -fhelp for example.
+ We do not need those. The only exception is -foffload option, if we
+ write it in offload_lto section. Also drop all diagnostic options. */
+ if ((cl_options[option->opt_index].flags & (CL_DRIVER|CL_WARNING))
+ && (strcmp (section_name_prefix, OFFLOAD_SECTION_NAME_PREFIX) != 0
+ || option->opt_index != OPT_foffload_))
continue;
for (j = 0; j < option->canonical_option_num_elements; ++j)
diff --git a/gcc/lto-section-in.c b/gcc/lto-section-in.c
index 042dd99fc43..d54ca0f8b06 100644
--- a/gcc/lto-section-in.c
+++ b/gcc/lto-section-in.c
@@ -70,7 +70,8 @@ const char *lto_section_name[LTO_N_SECTION_TYPES] =
"cgraphopt",
"inline",
"ipcp_trans",
- "icf"
+ "icf",
+ "offload_table"
};
diff --git a/gcc/lto-section-names.h b/gcc/lto-section-names.h
index cb752309872..d84deac84d0 100644
--- a/gcc/lto-section-names.h
+++ b/gcc/lto-section-names.h
@@ -25,9 +25,17 @@ along with GCC; see the file COPYING3. If not see
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 OFFLOAD_SECTION_NAME_PREFIX ".gnu.offload_lto_"
+
+/* Can be either OFFLOAD_SECTION_NAME_PREFIX when we stream IR for offload
+ compiler, or LTO_SECTION_NAME_PREFIX for LTO case. */
+extern const char *section_name_prefix;
/* Segment name for LTO sections. This is only used for Mach-O. */
#define LTO_SEGMENT_NAME "__GNU_LTO"
+#define OFFLOAD_VAR_TABLE_SECTION_NAME ".gnu.offload_vars"
+#define OFFLOAD_FUNC_TABLE_SECTION_NAME ".gnu.offload_funcs"
+
#endif /* GCC_LTO_SECTION_NAMES_H */
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index dc406da67e3..f376a30dac0 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -594,7 +594,7 @@ DFS::DFS_write_tree_body (struct output_block *ob,
{
DFS_follow_tree_edge (DECL_VINDEX (expr));
DFS_follow_tree_edge (DECL_FUNCTION_PERSONALITY (expr));
- /* Do not DECL_FUNCTION_SPECIFIC_TARGET. They will be regenerated. */
+ DFS_follow_tree_edge (DECL_FUNCTION_SPECIFIC_TARGET (expr));
DFS_follow_tree_edge (DECL_FUNCTION_SPECIFIC_OPTIMIZATION (expr));
}
@@ -945,7 +945,7 @@ hash_tree (struct streamer_tree_cache_d *cache, hash_map<tree, hashval_t> *map,
strlen (TRANSLATION_UNIT_LANGUAGE (t)));
if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION))
- gcc_unreachable ();
+ hstate.add_wide_int (cl_target_option_hash (TREE_TARGET_OPTION (t)));
if (CODE_CONTAINS_STRUCT (code, TS_OPTIMIZATION))
hstate.add (t, sizeof (struct cl_optimization));
@@ -1028,7 +1028,7 @@ hash_tree (struct streamer_tree_cache_d *cache, hash_map<tree, hashval_t> *map,
{
visit (DECL_VINDEX (t));
visit (DECL_FUNCTION_PERSONALITY (t));
- /* Do not follow DECL_FUNCTION_SPECIFIC_TARGET. */
+ visit (DECL_FUNCTION_SPECIFIC_TARGET (t));
visit (DECL_FUNCTION_SPECIFIC_OPTIMIZATION (t));
}
@@ -2308,6 +2308,8 @@ lto_output (void)
statements using the statement UIDs. */
output_symtab ();
+ output_offload_tables ();
+
#ifdef ENABLE_CHECKING
lto_bitmap_free (output);
#endif
diff --git a/gcc/lto-streamer.c b/gcc/lto-streamer.c
index b6cac0b5e99..e8347dccd65 100644
--- a/gcc/lto-streamer.c
+++ b/gcc/lto-streamer.c
@@ -60,6 +60,7 @@ struct lto_stats_d lto_stats;
static bitmap_obstack lto_obstack;
static bool lto_obstack_initialized;
+const char *section_name_prefix = LTO_SECTION_NAME_PREFIX;
/* Return a string representing LTO tag TAG. */
@@ -189,7 +190,7 @@ lto_get_section_name (int section_type, const char *name, struct lto_file_decl_d
sprintf (post, "." HOST_WIDE_INT_PRINT_HEX_PURE, f->id);
else
sprintf (post, "." HOST_WIDE_INT_PRINT_HEX_PURE, get_random_seed (false));
- return concat (LTO_SECTION_NAME_PREFIX, sep, add, post, NULL);
+ return concat (section_name_prefix, sep, add, post, NULL);
}
diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h
index 4b875a2b8ba..8e5ee628e12 100644
--- a/gcc/lto-streamer.h
+++ b/gcc/lto-streamer.h
@@ -247,6 +247,7 @@ enum lto_section_type
LTO_section_inline_summary,
LTO_section_ipcp_transform,
LTO_section_ipa_icf,
+ LTO_section_offload_table,
LTO_N_SECTION_TYPES /* Must be last. */
};
@@ -822,6 +823,8 @@ bool lto_symtab_encoder_encode_initializer_p (lto_symtab_encoder_t,
varpool_node *);
void output_symtab (void);
void input_symtab (void);
+void output_offload_tables (void);
+void input_offload_tables (void);
bool referenced_from_other_partition_p (struct ipa_ref_list *,
lto_symtab_encoder_t);
bool reachable_from_other_partition_p (struct cgraph_node *,
@@ -831,6 +834,15 @@ bool referenced_from_this_partition_p (symtab_node *,
bool reachable_from_this_partition_p (struct cgraph_node *,
lto_symtab_encoder_t);
lto_symtab_encoder_t compute_ltrans_boundary (lto_symtab_encoder_t encoder);
+void select_what_to_stream (bool);
+
+/* In options-save.c. */
+void cl_target_option_stream_out (struct output_block *, struct bitpack_d *,
+ struct cl_target_option *);
+
+void cl_target_option_stream_in (struct data_in *,
+ struct bitpack_d *,
+ struct cl_target_option *);
/* In lto-symtab.c. */
diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
index 8033b155baa..951a2ddc787 100644
--- a/gcc/lto-wrapper.c
+++ b/gcc/lto-wrapper.c
@@ -49,6 +49,10 @@ along with GCC; see the file COPYING3. If not see
#include "lto-section-names.h"
#include "collect-utils.h"
+/* Environment variable, used for passing the names of offload targets from GCC
+ driver to lto-wrapper. */
+#define OFFLOAD_TARGET_NAMES_ENV "OFFLOAD_TARGET_NAMES"
+
enum lto_mode_d {
LTO_MODE_NONE, /* Not doing LTO. */
LTO_MODE_LTO, /* Normal LTO. */
@@ -63,6 +67,8 @@ static char *flto_out;
static unsigned int nr;
static char **input_names;
static char **output_names;
+static char **offload_names;
+static const char *offloadbegin, *offloadend;
static char *makefile;
const char tool_name[] = "lto-wrapper";
@@ -290,6 +296,17 @@ merge_and_complain (struct cl_decoded_option **decoded_options,
" files", foption->orig_option_with_args_text);
break;
+ case OPT_foffload_abi_:
+ for (j = 0; j < *decoded_options_count; ++j)
+ if ((*decoded_options)[j].opt_index == foption->opt_index)
+ break;
+ if (j == *decoded_options_count)
+ append_option (decoded_options, decoded_options_count, foption);
+ else if (foption->value != (*decoded_options)[j].value)
+ fatal_error ("Option %s not used consistently in all LTO input"
+ " files", foption->orig_option_with_args_text);
+ break;
+
case OPT_O:
case OPT_Ofast:
case OPT_Og:
@@ -360,10 +377,488 @@ merge_and_complain (struct cl_decoded_option **decoded_options,
(*decoded_options)[j].value = 1;
}
break;
+
+ case OPT_foffload_:
+ append_option (decoded_options, decoded_options_count, foption);
+ break;
+ }
+ }
+}
+
+/* Auxiliary function that frees elements of PTR and PTR itself.
+ N is number of elements to be freed. If PTR is NULL, nothing is freed.
+ If an element is NULL, subsequent elements are not freed. */
+
+static void **
+free_array_of_ptrs (void **ptr, unsigned n)
+{
+ if (!ptr)
+ return NULL;
+ for (unsigned i = 0; i < n; i++)
+ {
+ if (!ptr[i])
+ break;
+ free (ptr[i]);
+ }
+ free (ptr);
+ return NULL;
+}
+
+/* Parse STR, saving found tokens into PVALUES and return their number.
+ Tokens are assumed to be delimited by ':'. If APPEND is non-null,
+ append it to every token we find. */
+
+static unsigned
+parse_env_var (const char *str, char ***pvalues, const char *append)
+{
+ const char *curval, *nextval;
+ char **values;
+ unsigned num = 1, i;
+
+ curval = strchr (str, ':');
+ while (curval)
+ {
+ num++;
+ curval = strchr (curval + 1, ':');
+ }
+
+ values = (char**) xmalloc (num * sizeof (char*));
+ curval = str;
+ nextval = strchr (curval, ':');
+ if (nextval == NULL)
+ nextval = strchr (curval, '\0');
+
+ int append_len = append ? strlen (append) : 0;
+ for (i = 0; i < num; i++)
+ {
+ int l = nextval - curval;
+ values[i] = (char*) xmalloc (l + 1 + append_len);
+ memcpy (values[i], curval, l);
+ values[i][l] = 0;
+ if (append)
+ strcat (values[i], append);
+ curval = nextval + 1;
+ nextval = strchr (curval, ':');
+ if (nextval == NULL)
+ nextval = strchr (curval, '\0');
+ }
+ *pvalues = values;
+ return num;
+}
+
+/* Append options OPTS from lto or offload_lto sections to ARGV_OBSTACK. */
+
+static void
+append_compiler_options (obstack *argv_obstack, struct cl_decoded_option *opts,
+ unsigned int count)
+{
+ /* Append compiler driver arguments as far as they were merged. */
+ for (unsigned int j = 1; j < count; ++j)
+ {
+ struct cl_decoded_option *option = &opts[j];
+
+ /* File options have been properly filtered by lto-opts.c. */
+ switch (option->opt_index)
+ {
+ /* Drop arguments that we want to take from the link line. */
+ case OPT_flto_:
+ case OPT_flto:
+ case OPT_flto_partition_:
+ continue;
+
+ default:
+ break;
+ }
+
+ /* For now do what the original LTO option code was doing - pass
+ on any CL_TARGET flag and a few selected others. */
+ switch (option->opt_index)
+ {
+ case OPT_fPIC:
+ case OPT_fpic:
+ case OPT_fPIE:
+ case OPT_fpie:
+ case OPT_fcommon:
+ case OPT_fexceptions:
+ case OPT_fnon_call_exceptions:
+ case OPT_fgnu_tm:
+ case OPT_freg_struct_return:
+ case OPT_fpcc_struct_return:
+ case OPT_fshort_double:
+ case OPT_ffp_contract_:
+ case OPT_fmath_errno:
+ case OPT_fsigned_zeros:
+ case OPT_ftrapping_math:
+ case OPT_fwrapv:
+ case OPT_ftrapv:
+ case OPT_fstrict_overflow:
+ case OPT_foffload_abi_:
+ case OPT_O:
+ case OPT_Ofast:
+ case OPT_Og:
+ case OPT_Os:
+ break;
+
+ default:
+ if (!(cl_options[option->opt_index].flags & CL_TARGET))
+ continue;
+ }
+
+ /* Pass the option on. */
+ for (unsigned int i = 0; i < option->canonical_option_num_elements; ++i)
+ obstack_ptr_grow (argv_obstack, option->canonical_option[i]);
+ }
+}
+
+/* Append linker options OPTS to ARGV_OBSTACK. */
+
+static void
+append_linker_options (obstack *argv_obstack, struct cl_decoded_option *opts,
+ unsigned int count)
+{
+ /* Append linker driver arguments. Compiler options from the linker
+ driver arguments will override / merge with those from the compiler. */
+ for (unsigned int j = 1; j < count; ++j)
+ {
+ struct cl_decoded_option *option = &opts[j];
+
+ /* Do not pass on frontend specific flags not suitable for lto. */
+ if (!(cl_options[option->opt_index].flags
+ & (CL_COMMON|CL_TARGET|CL_DRIVER|CL_LTO)))
+ continue;
+
+ switch (option->opt_index)
+ {
+ case OPT_o:
+ case OPT_flto_:
+ case OPT_flto:
+ /* We've handled these LTO options, do not pass them on. */
+ continue;
+
+ case OPT_freg_struct_return:
+ case OPT_fpcc_struct_return:
+ case OPT_fshort_double:
+ /* Ignore these, they are determined by the input files.
+ ??? We fail to diagnose a possible mismatch here. */
+ continue;
+
+ default:
+ break;
+ }
+
+ /* Pass the option on. */
+ for (unsigned int i = 0; i < option->canonical_option_num_elements; ++i)
+ obstack_ptr_grow (argv_obstack, option->canonical_option[i]);
+ }
+}
+
+/* Extract options for TARGET offload compiler from OPTIONS and append
+ them to ARGV_OBSTACK. */
+
+static void
+append_offload_options (obstack *argv_obstack, const char *target,
+ struct cl_decoded_option *options,
+ unsigned int options_count)
+{
+ for (unsigned i = 0; i < options_count; i++)
+ {
+ const char *cur, *next, *opts;
+ char **argv;
+ unsigned argc;
+ struct cl_decoded_option *option = &options[i];
+
+ if (option->opt_index != OPT_foffload_)
+ continue;
+
+ /* If option argument starts with '-' then no target is specified. That
+ means offload options are specified for all targets, so we need to
+ append them. */
+ if (option->arg[0] == '-')
+ opts = option->arg;
+ else
+ {
+ opts = strchr (option->arg, '=');
+ if (!opts)
+ continue;
+
+ cur = option->arg;
+
+ while (cur < opts)
+ {
+ next = strchr (cur, ',');
+ if (next == NULL)
+ next = strchr (cur, '\0');
+ next = (next > opts) ? opts : next;
+
+ if (strlen (target) == (size_t) (next - cur)
+ && strncmp (target, cur, next - cur) == 0)
+ break;
+
+ cur = next + 1;
+ }
+
+ if (cur >= opts)
+ continue;
+
+ opts++;
+ }
+
+ argv = buildargv (opts);
+ for (argc = 0; argv[argc]; argc++)
+ obstack_ptr_grow (argv_obstack, argv[argc]);
+ }
+}
+
+/* Check whether NAME can be accessed in MODE. This is like access,
+ except that it never considers directories to be executable. */
+
+static int
+access_check (const char *name, int mode)
+{
+ if (mode == X_OK)
+ {
+ struct stat st;
+
+ if (stat (name, &st) < 0
+ || S_ISDIR (st.st_mode))
+ return -1;
+ }
+
+ return access (name, mode);
+}
+
+/* Prepare a target image for offload TARGET, using mkoffload tool from
+ COMPILER_PATH. Return the name of the resultant object file. */
+
+static char *
+compile_offload_image (const char *target, const char *compiler_path,
+ unsigned in_argc, char *in_argv[],
+ struct cl_decoded_option *compiler_opts,
+ unsigned int compiler_opt_count,
+ struct cl_decoded_option *linker_opts,
+ unsigned int linker_opt_count)
+{
+ char *filename = NULL;
+ char **argv;
+ char *suffix
+ = XALLOCAVEC (char, sizeof ("/accel//mkoffload") + strlen (target));
+ strcpy (suffix, "/accel/");
+ strcat (suffix, target);
+ strcat (suffix, "/mkoffload");
+
+ char **paths = NULL;
+ unsigned n_paths = parse_env_var (compiler_path, &paths, suffix);
+
+ const char *compiler = NULL;
+ for (unsigned i = 0; i < n_paths; i++)
+ if (access_check (paths[i], X_OK) == 0)
+ {
+ compiler = paths[i];
+ break;
+ }
+
+ if (compiler)
+ {
+ /* Generate temporary output file name. */
+ filename = make_temp_file (".target.o");
+
+ struct obstack argv_obstack;
+ obstack_init (&argv_obstack);
+ obstack_ptr_grow (&argv_obstack, compiler);
+ obstack_ptr_grow (&argv_obstack, "-o");
+ obstack_ptr_grow (&argv_obstack, filename);
+
+ /* Append names of input object files. */
+ for (unsigned i = 1; i < in_argc; i++)
+ obstack_ptr_grow (&argv_obstack, in_argv[i]);
+
+ /* Append options from offload_lto sections. */
+ append_compiler_options (&argv_obstack, compiler_opts,
+ compiler_opt_count);
+
+ /* Append options specified by -foffload last. In case of conflicting
+ options we expect offload compiler to choose the latest. */
+ append_offload_options (&argv_obstack, target, compiler_opts,
+ compiler_opt_count);
+ append_offload_options (&argv_obstack, target, linker_opts,
+ linker_opt_count);
+
+ obstack_ptr_grow (&argv_obstack, NULL);
+ argv = XOBFINISH (&argv_obstack, char **);
+ fork_execute (argv[0], argv, true);
+ obstack_free (&argv_obstack, NULL);
+ }
+
+ free_array_of_ptrs ((void **) paths, n_paths);
+ return filename;
+}
+
+
+/* The main routine dealing with offloading.
+ The routine builds a target image for each offload target. IN_ARGC and
+ IN_ARGV specify options and input object files. As all of them could contain
+ target sections, we pass them all to target compilers. */
+
+static void
+compile_images_for_offload_targets (unsigned in_argc, char *in_argv[],
+ struct cl_decoded_option *compiler_opts,
+ unsigned int compiler_opt_count,
+ struct cl_decoded_option *linker_opts,
+ unsigned int linker_opt_count)
+{
+ char **names = NULL;
+ const char *target_names = getenv (OFFLOAD_TARGET_NAMES_ENV);
+ if (!target_names)
+ return;
+ unsigned num_targets = parse_env_var (target_names, &names, NULL);
+
+ const char *compiler_path = getenv ("COMPILER_PATH");
+ if (!compiler_path)
+ goto out;
+
+ /* Prepare an image for each target and save the name of the resultant object
+ file to the OFFLOAD_NAMES array. It is terminated by a NULL entry. */
+ offload_names = XCNEWVEC (char *, num_targets + 1);
+ for (unsigned i = 0; i < num_targets; i++)
+ {
+ offload_names[i]
+ = compile_offload_image (names[i], compiler_path, in_argc, in_argv,
+ compiler_opts, compiler_opt_count,
+ linker_opts, linker_opt_count);
+ if (!offload_names[i])
+ fatal_error ("problem with building target image for %s\n", names[i]);
+ }
+
+ out:
+ free_array_of_ptrs ((void **) names, num_targets);
+}
+
+/* Copy a file from SRC to DEST. */
+
+static void
+copy_file (const char *dest, const char *src)
+{
+ FILE *d = fopen (dest, "wb");
+ FILE *s = fopen (src, "rb");
+ char buffer[512];
+ while (!feof (s))
+ {
+ size_t len = fread (buffer, 1, 512, s);
+ if (ferror (s) != 0)
+ fatal_error ("reading input file");
+ if (len > 0)
+ {
+ fwrite (buffer, 1, len, d);
+ if (ferror (d) != 0)
+ fatal_error ("writing output file");
}
}
}
+/* Find the crtoffloadbegin.o and crtoffloadend.o files in LIBRARY_PATH, make
+ copies and store the names of the copies in offloadbegin and offloadend. */
+
+static void
+find_offloadbeginend (void)
+{
+ char **paths = NULL;
+ const char *library_path = getenv ("LIBRARY_PATH");
+ if (!library_path)
+ return;
+ unsigned n_paths = parse_env_var (library_path, &paths, "/crtoffloadbegin.o");
+
+ unsigned i;
+ for (i = 0; i < n_paths; i++)
+ if (access_check (paths[i], R_OK) == 0)
+ {
+ size_t len = strlen (paths[i]);
+ char *tmp = xstrdup (paths[i]);
+ strcpy (paths[i] + len - strlen ("begin.o"), "end.o");
+ if (access_check (paths[i], R_OK) != 0)
+ fatal_error ("installation error, can't find crtoffloadend.o");
+ /* The linker will delete the filenames we give it, so make
+ copies. */
+ offloadbegin = make_temp_file (".o");
+ offloadend = make_temp_file (".o");
+ copy_file (offloadbegin, tmp);
+ copy_file (offloadend, paths[i]);
+ free (tmp);
+ break;
+ }
+ if (i == n_paths)
+ fatal_error ("installation error, can't find crtoffloadbegin.o");
+
+ free_array_of_ptrs ((void **) paths, n_paths);
+}
+
+/* A subroutine of run_gcc. Examine the open file FD for lto sections with
+ name prefix PREFIX, at FILE_OFFSET, and store any options we find in OPTS
+ and OPT_COUNT. Return true if we found a matchingn section, false
+ otherwise. COLLECT_GCC holds the value of the environment variable with
+ the same name. */
+
+static bool
+find_and_merge_options (int fd, off_t file_offset, const char *prefix,
+ struct cl_decoded_option **opts,
+ unsigned int *opt_count, const char *collect_gcc)
+{
+ off_t offset, length;
+ char *data;
+ char *fopts;
+ const char *errmsg;
+ int err;
+ struct cl_decoded_option *fdecoded_options = *opts;
+ unsigned int fdecoded_options_count = *opt_count;
+
+ simple_object_read *sobj;
+ sobj = simple_object_start_read (fd, file_offset, "__GNU_LTO",
+ &errmsg, &err);
+ if (!sobj)
+ return false;
+
+ char *secname = XALLOCAVEC (char, strlen (prefix) + sizeof (".opts"));
+ strcpy (secname, prefix);
+ strcat (secname, ".opts");
+ if (!simple_object_find_section (sobj, secname, &offset, &length,
+ &errmsg, &err))
+ {
+ simple_object_release_read (sobj);
+ return false;
+ }
+
+ lseek (fd, file_offset + offset, SEEK_SET);
+ data = (char *)xmalloc (length);
+ read (fd, data, length);
+ fopts = data;
+ do
+ {
+ struct cl_decoded_option *f2decoded_options;
+ unsigned int f2decoded_options_count;
+ get_options_from_collect_gcc_options (collect_gcc,
+ fopts, CL_LANG_ALL,
+ &f2decoded_options,
+ &f2decoded_options_count);
+ if (!fdecoded_options)
+ {
+ fdecoded_options = f2decoded_options;
+ fdecoded_options_count = f2decoded_options_count;
+ }
+ else
+ merge_and_complain (&fdecoded_options,
+ &fdecoded_options_count,
+ f2decoded_options, f2decoded_options_count);
+
+ fopts += strlen (fopts) + 1;
+ }
+ while (fopts - data < length);
+
+ free (data);
+ simple_object_release_read (sobj);
+ *opts = fdecoded_options;
+ *opt_count = fdecoded_options_count;
+ return true;
+}
+
/* Execute gcc. ARGC is the number of arguments. ARGV contains the arguments. */
static void
@@ -379,11 +874,15 @@ run_gcc (unsigned argc, char *argv[])
int jobserver = 0;
bool no_partition = false;
struct cl_decoded_option *fdecoded_options = NULL;
+ struct cl_decoded_option *offload_fdecoded_options = NULL;
unsigned int fdecoded_options_count = 0;
+ unsigned int offload_fdecoded_options_count = 0;
struct cl_decoded_option *decoded_options;
unsigned int decoded_options_count;
struct obstack argv_obstack;
int new_head_argc;
+ bool have_lto = false;
+ bool have_offload = false;
/* Get the driver and options. */
collect_gcc = getenv ("COLLECT_GCC");
@@ -400,18 +899,13 @@ run_gcc (unsigned argc, char *argv[])
/* Look at saved options in the IL files. */
for (i = 1; i < argc; ++i)
{
- char *data, *p;
- char *fopts;
+ char *p;
int fd;
- const char *errmsg;
- int err;
- off_t file_offset = 0, offset, length;
+ off_t file_offset = 0;
long loffset;
- simple_object_read *sobj;
int consumed;
- struct cl_decoded_option *f2decoded_options;
- unsigned int f2decoded_options_count;
char *filename = argv[i];
+
if ((p = strrchr (argv[i], '@'))
&& p != argv[i]
&& sscanf (p, "@%li%n", &loffset, &consumed) >= 1
@@ -425,46 +919,15 @@ run_gcc (unsigned argc, char *argv[])
fd = open (argv[i], O_RDONLY);
if (fd == -1)
continue;
- sobj = simple_object_start_read (fd, file_offset, "__GNU_LTO",
- &errmsg, &err);
- if (!sobj)
- {
- close (fd);
- continue;
- }
- if (!simple_object_find_section (sobj, LTO_SECTION_NAME_PREFIX "." "opts",
- &offset, &length, &errmsg, &err))
- {
- simple_object_release_read (sobj);
- close (fd);
- continue;
- }
- lseek (fd, file_offset + offset, SEEK_SET);
- data = (char *)xmalloc (length);
- read (fd, data, length);
- fopts = data;
- do
- {
- get_options_from_collect_gcc_options (collect_gcc,
- fopts, CL_LANG_ALL,
- &f2decoded_options,
- &f2decoded_options_count);
- if (!fdecoded_options)
- {
- fdecoded_options = f2decoded_options;
- fdecoded_options_count = f2decoded_options_count;
- }
- else
- merge_and_complain (&fdecoded_options,
- &fdecoded_options_count,
- f2decoded_options, f2decoded_options_count);
-
- fopts += strlen (fopts) + 1;
- }
- while (fopts - data < length);
- free (data);
- simple_object_release_read (sobj);
+ have_lto
+ = find_and_merge_options (fd, file_offset, LTO_SECTION_NAME_PREFIX,
+ &fdecoded_options, &fdecoded_options_count,
+ collect_gcc);
+ have_offload
+ = find_and_merge_options (fd, file_offset, OFFLOAD_SECTION_NAME_PREFIX,
+ &offload_fdecoded_options,
+ &offload_fdecoded_options_count, collect_gcc);
close (fd);
}
@@ -474,79 +937,19 @@ run_gcc (unsigned argc, char *argv[])
obstack_ptr_grow (&argv_obstack, "-xlto");
obstack_ptr_grow (&argv_obstack, "-c");
- /* Append compiler driver arguments as far as they were merged. */
- for (j = 1; j < fdecoded_options_count; ++j)
- {
- struct cl_decoded_option *option = &fdecoded_options[j];
-
- /* File options have been properly filtered by lto-opts.c. */
- switch (option->opt_index)
- {
- /* Drop arguments that we want to take from the link line. */
- case OPT_flto_:
- case OPT_flto:
- case OPT_flto_partition_:
- continue;
-
- default:
- break;
- }
-
- /* For now do what the original LTO option code was doing - pass
- on any CL_TARGET flag and a few selected others. */
- switch (option->opt_index)
- {
- case OPT_fPIC:
- case OPT_fpic:
- case OPT_fPIE:
- case OPT_fpie:
- case OPT_fcommon:
- case OPT_fexceptions:
- case OPT_fnon_call_exceptions:
- case OPT_fgnu_tm:
- case OPT_freg_struct_return:
- case OPT_fpcc_struct_return:
- case OPT_fshort_double:
- case OPT_ffp_contract_:
- case OPT_fmath_errno:
- case OPT_fsigned_zeros:
- case OPT_ftrapping_math:
- case OPT_fwrapv:
- case OPT_ftrapv:
- case OPT_fstrict_overflow:
- case OPT_O:
- case OPT_Ofast:
- case OPT_Og:
- case OPT_Os:
- break;
-
- default:
- if (!(cl_options[option->opt_index].flags & CL_TARGET))
- continue;
- }
-
- /* Pass the option on. */
- for (i = 0; i < option->canonical_option_num_elements; ++i)
- obstack_ptr_grow (&argv_obstack, option->canonical_option[i]);
- }
+ append_compiler_options (&argv_obstack, fdecoded_options,
+ fdecoded_options_count);
+ append_linker_options (&argv_obstack, decoded_options, decoded_options_count);
- /* Append linker driver arguments. Compiler options from the linker
- driver arguments will override / merge with those from the compiler. */
+ /* Scan linker driver arguments for things that are of relevance to us. */
for (j = 1; j < decoded_options_count; ++j)
{
struct cl_decoded_option *option = &decoded_options[j];
-
- /* Do not pass on frontend specific flags not suitable for lto. */
- if (!(cl_options[option->opt_index].flags
- & (CL_COMMON|CL_TARGET|CL_DRIVER|CL_LTO)))
- continue;
-
switch (option->opt_index)
{
case OPT_o:
linker_output = option->arg;
- /* We generate new intermediate output, drop this arg. */
- continue;
+ break;
case OPT_save_temps:
save_temps = 1;
@@ -577,23 +980,11 @@ run_gcc (unsigned argc, char *argv[])
case OPT_flto:
lto_mode = LTO_MODE_WHOPR;
- /* We've handled these LTO options, do not pass them on. */
- continue;
-
- case OPT_freg_struct_return:
- case OPT_fpcc_struct_return:
- case OPT_fshort_double:
- /* Ignore these, they are determined by the input files.
- ??? We fail to diagnose a possible mismatch here. */
- continue;
+ break;
default:
break;
}
-
- /* Pass the option on. */
- for (i = 0; i < option->canonical_option_num_elements; ++i)
- obstack_ptr_grow (&argv_obstack, option->canonical_option[i]);
}
if (no_partition)
@@ -633,6 +1024,46 @@ run_gcc (unsigned argc, char *argv[])
/* Remember at which point we can scrub args to re-use the commons. */
new_head_argc = obstack_object_size (&argv_obstack) / sizeof (void *);
+ if (have_offload)
+ {
+ compile_images_for_offload_targets (argc, argv, offload_fdecoded_options,
+ offload_fdecoded_options_count,
+ decoded_options,
+ decoded_options_count);
+ if (offload_names)
+ {
+ find_offloadbeginend ();
+ for (i = 0; offload_names[i]; i++)
+ printf ("%s\n", offload_names[i]);
+ free_array_of_ptrs ((void **) offload_names, i);
+ }
+ }
+
+ if (offloadbegin)
+ printf ("%s\n", offloadbegin);
+
+ /* If object files contain offload sections, but do not contain LTO sections,
+ then there is no need to perform a link-time recompilation, i.e.
+ lto-wrapper is used only for a compilation of offload images. */
+ if (have_offload && !have_lto)
+ {
+ for (i = 1; i < argc; ++i)
+ if (strncmp (argv[i], "-fresolution=", sizeof ("-fresolution=") - 1))
+ {
+ char *out_file;
+ /* Can be ".o" or ".so". */
+ char *ext = strrchr (argv[i], '.');
+ if (ext == NULL)
+ out_file = make_temp_file ("");
+ else
+ out_file = make_temp_file (ext);
+ /* The linker will delete the files we give it, so make copies. */
+ copy_file (out_file, argv[i]);
+ printf ("%s\n", out_file);
+ }
+ goto finish;
+ }
+
if (lto_mode == LTO_MODE_LTO)
{
flto_out = make_temp_file (".lto.o");
@@ -859,6 +1290,10 @@ cont:
obstack_free (&env_obstack, NULL);
}
+ finish:
+ if (offloadend)
+ printf ("%s\n", offloadend);
+
obstack_free (&argv_obstack, NULL);
}
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index cbd1af51f14..6975042cf27 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,28 @@
+2014-11-14 Jan Hubicka <hubicka@ucw.cz>
+
+ * lto.c (compare_tree_sccs_1): Compare cl_target_option_eq.
+
+2014-11-13 Ilya Verbin <ilya.verbin@intel.com>
+ Bernd Schmidt <bernds@codesourcery.com>
+ Andrey Turetskiy <andrey.turetskiy@intel.com>
+ Michael Zolotukhin <michael.v.zolotukhin@intel.com>
+
+ * lto/lto.c (read_cgraph_and_symbols): Call input_offload_tables.
+
+2014-11-13 Ilya Verbin <ilya.verbin@intel.com>
+ Ilya Tocar <ilya.tocar@intel.com>
+ Andrey Turetskiy <andrey.turetskiy@intel.com>
+ Bernd Schmidt <bernds@codesourcery.com>
+
+ * lto-object.c (lto_obj_add_section): Use section_name_prefix instead of
+ LTO_SECTION_NAME_PREFIX.
+ * lto-partition.c (lto_promote_cross_file_statics): Call
+ select_what_to_stream.
+ * lto.c (lto_section_with_id): Use section_name_prefix instead of
+ LTO_SECTION_NAME_PREFIX.
+ (read_cgraph_and_symbols): Read OFFLOAD_SECTION_NAME_PREFIX sections, if
+ being built as an offload compiler.
+
2014-10-29 Richard Sandiford <richard.sandiford@arm.com>
* lto-lang.c: Remove redundant enum from machine_mode.
diff --git a/gcc/lto/lto-object.c b/gcc/lto/lto-object.c
index 1178326b991..b4124f65b97 100644
--- a/gcc/lto/lto-object.c
+++ b/gcc/lto/lto-object.c
@@ -242,8 +242,7 @@ lto_obj_add_section (void *data, const char *name, off_t offset,
void **slot;
struct lto_section_list *list = loasd->list;
- if (strncmp (name, LTO_SECTION_NAME_PREFIX,
- strlen (LTO_SECTION_NAME_PREFIX)) != 0)
+ if (strncmp (name, section_name_prefix, strlen (section_name_prefix)))
return 1;
new_name = xstrdup (name);
diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c
index 0e1a95bf918..65f0582cf6b 100644
--- a/gcc/lto/lto-partition.c
+++ b/gcc/lto/lto-partition.c
@@ -952,6 +952,8 @@ lto_promote_cross_file_statics (void)
gcc_assert (flag_wpa);
+ select_what_to_stream (false);
+
/* First compute boundaries. */
n_sets = ltrans_partitions.length ();
for (i = 0; i < n_sets; i++)
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index d8519d9426b..ff7f9f63453 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -1377,7 +1377,8 @@ compare_tree_sccs_1 (tree t1, tree t2, tree **map)
return false;
if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION))
- gcc_unreachable ();
+ if (!cl_target_option_eq (TREE_TARGET_OPTION (t1), TREE_TARGET_OPTION (t2)))
+ return false;
if (CODE_CONTAINS_STRUCT (code, TS_OPTIMIZATION))
if (memcmp (TREE_OPTIMIZATION (t1), TREE_OPTIMIZATION (t2),
@@ -2137,7 +2138,7 @@ lto_section_with_id (const char *name, unsigned HOST_WIDE_INT *id)
{
const char *s;
- if (strncmp (name, LTO_SECTION_NAME_PREFIX, strlen (LTO_SECTION_NAME_PREFIX)))
+ if (strncmp (name, section_name_prefix, strlen (section_name_prefix)))
return 0;
s = strrchr (name, '.');
return s && sscanf (s, "." HOST_WIDE_INT_PRINT_HEX_PURE, id) == 1;
@@ -2912,6 +2913,10 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
timevar_push (TV_IPA_LTO_DECL_IN);
+#ifdef ACCEL_COMPILER
+ section_name_prefix = OFFLOAD_SECTION_NAME_PREFIX;
+#endif
+
real_file_decl_data
= decl_data = ggc_cleared_vec_alloc<lto_file_decl_data_ptr> (nfiles + 1);
real_file_count = nfiles;
@@ -3030,6 +3035,8 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
/* Read the symtab. */
input_symtab ();
+ input_offload_tables ();
+
/* Store resolutions into the symbol table. */
ld_plugin_symbol_resolution_t *res;
diff --git a/gcc/match.pd b/gcc/match.pd
index d94a8f51418..127c7d9b5e4 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -31,6 +31,14 @@ along with GCC; see the file COPYING3. If not see
CONSTANT_CLASS_P
tree_expr_nonnegative_p)
+/* Operator lists. */
+(define_operator_list tcc_comparison
+ lt le eq ne ge gt unordered ordered unlt unle ungt unge uneq ltgt)
+(define_operator_list inverted_tcc_comparison
+ ge gt ne eq lt le ordered unordered ge gt le lt ltgt uneq)
+(define_operator_list inverted_tcc_comparison_with_nans
+ unge ungt ne eq unlt unle ordered unordered ge gt le lt ltgt uneq)
+
/* Simplifications of operations with one constant operand and
simplifications to constants or single values. */
@@ -45,19 +53,59 @@ along with GCC; see the file COPYING3. If not see
(pointer_plus integer_zerop @1)
(non_lvalue (convert @1)))
+/* See if ARG1 is zero and X + ARG1 reduces to X.
+ Likewise if the operands are reversed. */
+(simplify
+ (plus:c @0 real_zerop@1)
+ (if (fold_real_zero_addition_p (type, @1, 0))
+ (non_lvalue @0)))
+
+/* See if ARG1 is zero and X - ARG1 reduces to X. */
+(simplify
+ (minus @0 real_zerop@1)
+ (if (fold_real_zero_addition_p (type, @1, 1))
+ (non_lvalue @0)))
+
/* Simplify x - x.
This is unsafe for certain floats even in non-IEEE formats.
In IEEE, it is unsafe because it does wrong for NaNs.
Also note that operand_equal_p is always false if an operand
is volatile. */
(simplify
- (minus @0 @0)
- (if (!FLOAT_TYPE_P (type) || !HONOR_NANS (TYPE_MODE (type)))
- { build_zero_cst (type); }))
+ (minus @0 @0)
+ (if (!FLOAT_TYPE_P (type) || !HONOR_NANS (TYPE_MODE (type)))
+ { build_zero_cst (type); }))
(simplify
- (mult @0 integer_zerop@1)
- @1)
+ (mult @0 integer_zerop@1)
+ @1)
+
+/* Maybe fold x * 0 to 0. The expressions aren't the same
+ when x is NaN, since x * 0 is also NaN. Nor are they the
+ same in modes with signed zeros, since multiplying a
+ negative value by 0 gives -0, not +0. */
+(simplify
+ (mult @0 real_zerop@1)
+ (if (!HONOR_NANS (TYPE_MODE (type))
+ && !HONOR_SIGNED_ZEROS (TYPE_MODE (type)))
+ @1))
+
+/* In IEEE floating point, x*1 is not equivalent to x for snans.
+ Likewise for complex arithmetic with signed zeros. */
+(simplify
+ (mult @0 real_onep)
+ (if (!HONOR_SNANS (TYPE_MODE (type))
+ && (!HONOR_SIGNED_ZEROS (TYPE_MODE (type))
+ || !COMPLEX_FLOAT_TYPE_P (type)))
+ (non_lvalue @0)))
+
+/* Transform x * -1.0 into -x. */
+(simplify
+ (mult @0 real_minus_onep)
+ (if (!HONOR_SNANS (TYPE_MODE (type))
+ && (!HONOR_SIGNED_ZEROS (TYPE_MODE (type))
+ || !COMPLEX_FLOAT_TYPE_P (type)))
+ (negate @0)))
/* Make sure to preserve divisions by zero. This is the reason why
we don't simplify x / x to 1 or 0 / x to 0. */
@@ -66,19 +114,98 @@ along with GCC; see the file COPYING3. If not see
(op @0 integer_onep)
(non_lvalue @0)))
+/* X / -1 is -X. */
+(for div (trunc_div ceil_div floor_div round_div exact_div)
+ (simplify
+ (div @0 INTEGER_CST@1)
+ (if (!TYPE_UNSIGNED (type)
+ && wi::eq_p (@1, -1))
+ (negate @0))))
+
+/* For unsigned integral types, FLOOR_DIV_EXPR is the same as
+ TRUNC_DIV_EXPR. Rewrite into the latter in this case. */
+(simplify
+ (floor_div @0 @1)
+ (if (INTEGRAL_TYPE_P (type) && TYPE_UNSIGNED (type))
+ (trunc_div @0 @1)))
+
+/* Optimize A / A to 1.0 if we don't care about
+ NaNs or Infinities. Skip the transformation
+ for non-real operands. */
+(simplify
+ (rdiv @0 @0)
+ (if (SCALAR_FLOAT_TYPE_P (type)
+ && ! HONOR_NANS (TYPE_MODE (type))
+ && ! HONOR_INFINITIES (TYPE_MODE (type)))
+ { build_real (type, dconst1); })
+ /* The complex version of the above A / A optimization. */
+ (if (COMPLEX_FLOAT_TYPE_P (type)
+ && ! HONOR_NANS (TYPE_MODE (TREE_TYPE (type)))
+ && ! HONOR_INFINITIES (TYPE_MODE (TREE_TYPE (type))))
+ { build_complex (type, build_real (TREE_TYPE (type), dconst1),
+ build_real (TREE_TYPE (type), dconst0)); }))
+
+/* In IEEE floating point, x/1 is not equivalent to x for snans. */
+(simplify
+ (rdiv @0 real_onep)
+ (if (!HONOR_SNANS (TYPE_MODE (type)))
+ (non_lvalue @0)))
+
+/* In IEEE floating point, x/-1 is not equivalent to -x for snans. */
+(simplify
+ (rdiv @0 real_minus_onep)
+ (if (!HONOR_SNANS (TYPE_MODE (type)))
+ (negate @0)))
+
+/* If ARG1 is a constant, we can convert this to a multiply by the
+ reciprocal. This does not have the same rounding properties,
+ so only do this if -freciprocal-math. We can actually
+ always safely do it if ARG1 is a power of two, but it's hard to
+ tell if it is or not in a portable manner. */
+(for cst (REAL_CST COMPLEX_CST VECTOR_CST)
+ (simplify
+ (rdiv @0 cst@1)
+ (if (optimize)
+ (if (flag_reciprocal_math)
+ (with
+ { tree tem = fold_binary (RDIV_EXPR, type, build_one_cst (type), @1); }
+ (if (tem)
+ (mult @0 { tem; } ))))
+ (if (cst != COMPLEX_CST)
+ (with { tree inverse = exact_inverse (type, @1); }
+ (if (inverse)
+ (mult @0 { inverse; } )))))))
+
/* Same applies to modulo operations, but fold is inconsistent here
and simplifies 0 % x to 0, only preserving literal 0 % 0. */
-(for op (ceil_mod floor_mod round_mod trunc_mod)
+(for mod (ceil_mod floor_mod round_mod trunc_mod)
/* 0 % X is always zero. */
(simplify
- (op integer_zerop@0 @1)
+ (mod integer_zerop@0 @1)
/* But not for 0 % 0 so that we can get the proper warnings and errors. */
(if (!integer_zerop (@1))
@0))
/* X % 1 is always zero. */
(simplify
- (op @0 integer_onep)
- { build_zero_cst (type); }))
+ (mod @0 integer_onep)
+ { build_zero_cst (type); })
+ /* X % -1 is zero. */
+ (simplify
+ (mod @0 INTEGER_CST@1)
+ (if (!TYPE_UNSIGNED (type)
+ && wi::eq_p (@1, -1))
+ { build_zero_cst (type); })))
+
+/* X % -C is the same as X % C. */
+(simplify
+ (trunc_mod @0 INTEGER_CST@1)
+ (if (TYPE_SIGN (type) == SIGNED
+ && !TREE_OVERFLOW (@1)
+ && wi::neg_p (@1)
+ && !TYPE_OVERFLOW_TRAPS (type)
+ /* Avoid this transformation if C is INT_MIN, i.e. C == -C. */
+ && !sign_bit_p (@1, @1))
+ (trunc_mod @0 (negate @1))))
/* x | ~0 -> ~0 */
(simplify
@@ -172,7 +299,7 @@ along with GCC; see the file COPYING3. If not see
(match truth_valued_p
@0
(if (INTEGRAL_TYPE_P (type) && TYPE_PRECISION (type) == 1)))
-(for op (lt le eq ne ge gt truth_and truth_andif truth_or truth_orif truth_xor)
+(for op (tcc_comparison truth_and truth_andif truth_or truth_orif truth_xor)
(match truth_valued_p
(op @0 @1)))
(match truth_valued_p
@@ -187,7 +314,8 @@ along with GCC; see the file COPYING3. If not see
(ne truth_valued_p@0 integer_onep)
(if (INTEGRAL_TYPE_P (TREE_TYPE (@0)))))
(match (logical_inverted_value @0)
- (bit_xor truth_valued_p@0 integer_onep))
+ (bit_xor truth_valued_p@0 integer_onep)
+ (if (INTEGRAL_TYPE_P (TREE_TYPE (@0)))))
/* X & !X -> 0. */
(simplify
@@ -197,7 +325,7 @@ along with GCC; see the file COPYING3. If not see
(for op (bit_ior bit_xor)
(simplify
(op:c truth_valued_p@0 (logical_inverted_value @0))
- { build_one_cst (type); }))
+ { constant_boolean_node (true, type); }))
(for bitop (bit_and bit_ior)
rbitop (bit_ior bit_and)
@@ -285,26 +413,20 @@ along with GCC; see the file COPYING3. If not see
/* Apply STRIP_NOPS on @0 and the negate. */
(if (tree_nop_conversion_p (type, TREE_TYPE (@0))
&& tree_nop_conversion_p (type, TREE_TYPE (@1))
- && (!INTEGRAL_TYPE_P (type)
- || TYPE_OVERFLOW_WRAPS (type)
- || (flag_sanitize & SANITIZE_SI_OVERFLOW) == 0))
+ && !TYPE_OVERFLOW_SANITIZED (type))
(minus (convert @0) (convert @1))))
/* A - (-B) -> A + B */
(simplify
(minus (convert1? @0) (convert2? (negate @1)))
(if (tree_nop_conversion_p (type, TREE_TYPE (@0))
&& tree_nop_conversion_p (type, TREE_TYPE (@1))
- && (!INTEGRAL_TYPE_P (type)
- || TYPE_OVERFLOW_WRAPS (type)
- || (flag_sanitize & SANITIZE_SI_OVERFLOW) == 0))
+ && !TYPE_OVERFLOW_SANITIZED (type))
(plus (convert @0) (convert @1))))
/* -(-A) -> A */
(simplify
(negate (convert? (negate @1)))
(if (tree_nop_conversion_p (type, TREE_TYPE (@1))
- && (!INTEGRAL_TYPE_P (type)
- || TYPE_OVERFLOW_WRAPS (type)
- || (flag_sanitize & SANITIZE_SI_OVERFLOW) == 0))
+ && !TYPE_OVERFLOW_SANITIZED (type))
(convert @1)))
/* We can't reassociate floating-point or fixed-point plus or minus
@@ -390,6 +512,64 @@ along with GCC; see the file COPYING3. If not see
(convert @1))))))
+/* Simplifications of MIN_EXPR and MAX_EXPR. */
+
+(for minmax (min max)
+ (simplify
+ (minmax @0 @0)
+ @0))
+(simplify
+ (min @0 @1)
+ (if (INTEGRAL_TYPE_P (type)
+ && TYPE_MIN_VALUE (type)
+ && operand_equal_p (@1, TYPE_MIN_VALUE (type), OEP_ONLY_CONST))
+ @1))
+(simplify
+ (max @0 @1)
+ (if (INTEGRAL_TYPE_P (type)
+ && TYPE_MAX_VALUE (type)
+ && operand_equal_p (@1, TYPE_MAX_VALUE (type), OEP_ONLY_CONST))
+ @1))
+
+
+/* Simplifications of shift and rotates. */
+
+(for rotate (lrotate rrotate)
+ (simplify
+ (rotate integer_all_onesp@0 @1)
+ @0))
+
+/* Optimize -1 >> x for arithmetic right shifts. */
+(simplify
+ (rshift integer_all_onesp@0 @1)
+ (if (!TYPE_UNSIGNED (type)
+ && tree_expr_nonnegative_p (@1))
+ @0))
+
+(for shiftrotate (lrotate rrotate lshift rshift)
+ (simplify
+ (shiftrotate @0 integer_zerop)
+ (non_lvalue @0))
+ (simplify
+ (shiftrotate integer_zerop@0 @1)
+ @0)
+ /* Prefer vector1 << scalar to vector1 << vector2
+ if vector2 is uniform. */
+ (for vec (VECTOR_CST CONSTRUCTOR)
+ (simplify
+ (shiftrotate @0 vec@1)
+ (with { tree tem = uniform_vector_p (@1); }
+ (if (tem)
+ (shiftrotate @0 { tem; }))))))
+
+/* Rewrite an LROTATE_EXPR by a constant into an
+ RROTATE_EXPR by a new constant. */
+(simplify
+ (lrotate @0 INTEGER_CST@1)
+ (rrotate @0 { fold_binary (MINUS_EXPR, TREE_TYPE (@1),
+ build_int_cst (TREE_TYPE (@1),
+ element_precision (type)), @1); }))
+
/* Simplifications of conversions. */
@@ -565,6 +745,38 @@ along with GCC; see the file COPYING3. If not see
(if (TYPE_PRECISION (TREE_TYPE (@0)) == TYPE_PRECISION (type))
(convert @0)))
+/* Canonicalization of binary operations. */
+
+/* Convert X + -C into X - C. */
+(simplify
+ (plus @0 REAL_CST@1)
+ (if (REAL_VALUE_NEGATIVE (TREE_REAL_CST (@1)))
+ (with { tree tem = fold_unary (NEGATE_EXPR, type, @1); }
+ (if (!TREE_OVERFLOW (tem) || !flag_trapping_math)
+ (minus @0 { tem; })))))
+
+/* Convert x+x into x*2.0. */
+(simplify
+ (plus @0 @0)
+ (if (SCALAR_FLOAT_TYPE_P (type))
+ (mult @0 { build_real (type, dconst2); })))
+
+(simplify
+ (minus integer_zerop @1)
+ (negate @1))
+
+/* (ARG0 - ARG1) is the same as (-ARG1 + ARG0). So check whether
+ ARG0 is zero and X + ARG0 reduces to X, since that would mean
+ (-ARG1 + ARG0) reduces to -ARG1. */
+(simplify
+ (minus real_zerop@0 @1)
+ (if (fold_real_zero_addition_p (type, @0, 0))
+ (negate @1)))
+
+/* Transform x * -1 into -x. */
+(simplify
+ (mult @0 integer_minus_onep)
+ (negate @0))
/* COMPLEX_EXPR and REALPART/IMAGPART_EXPR cancellations. */
(simplify
@@ -576,3 +788,104 @@ along with GCC; see the file COPYING3. If not see
(simplify
(imagpart (complex @0 @1))
@1)
+
+
+/* BSWAP simplifications, transforms checked by gcc.dg/builtin-bswap-8.c. */
+(for bswap (BUILT_IN_BSWAP16 BUILT_IN_BSWAP32 BUILT_IN_BSWAP64)
+ (simplify
+ (bswap (bswap @0))
+ @0)
+ (simplify
+ (bswap (bit_not (bswap @0)))
+ (bit_not @0))
+ (for bitop (bit_xor bit_ior bit_and)
+ (simplify
+ (bswap (bitop:c (bswap @0) @1))
+ (bitop @0 (bswap @1)))))
+
+
+/* Combine COND_EXPRs and VEC_COND_EXPRs. */
+
+/* Simplify constant conditions.
+ Only optimize constant conditions when the selected branch
+ has the same type as the COND_EXPR. This avoids optimizing
+ away "c ? x : throw", where the throw has a void type.
+ Note that we cannot throw away the fold-const.c variant nor
+ this one as we depend on doing this transform before possibly
+ A ? B : B -> B triggers and the fold-const.c one can optimize
+ 0 ? A : B to B even if A has side-effects. Something
+ genmatch cannot handle. */
+(simplify
+ (cond INTEGER_CST@0 @1 @2)
+ (if (integer_zerop (@0)
+ && (!VOID_TYPE_P (TREE_TYPE (@2))
+ || VOID_TYPE_P (type)))
+ @2)
+ (if (!integer_zerop (@0)
+ && (!VOID_TYPE_P (TREE_TYPE (@1))
+ || VOID_TYPE_P (type)))
+ @1))
+(simplify
+ (vec_cond VECTOR_CST@0 @1 @2)
+ (if (integer_all_onesp (@0))
+ @1)
+ (if (integer_zerop (@0))
+ @2))
+
+(for cnd (cond vec_cond)
+ /* A ? B : (A ? X : C) -> A ? B : C. */
+ (simplify
+ (cnd @0 (cnd @0 @1 @2) @3)
+ (cnd @0 @1 @3))
+ (simplify
+ (cnd @0 @1 (cnd @0 @2 @3))
+ (cnd @0 @1 @3))
+
+ /* A ? B : B -> B. */
+ (simplify
+ (cnd @0 @1 @1)
+ @1))
+
+/* !A ? B : C -> A ? C : B. */
+(simplify
+ (cond (logical_inverted_value truth_valued_p@0) @1 @2)
+ (cond @0 @2 @1))
+
+
+/* Simplifications of comparisons. */
+
+/* We can simplify a logical negation of a comparison to the
+ inverted comparison. As we cannot compute an expression
+ operator using invert_tree_comparison we have to simulate
+ that with expression code iteration. */
+(for cmp (tcc_comparison)
+ icmp (inverted_tcc_comparison)
+ ncmp (inverted_tcc_comparison_with_nans)
+ /* Ideally we'd like to combine the following two patterns
+ and handle some more cases by using
+ (logical_inverted_value (cmp @0 @1))
+ here but for that genmatch would need to "inline" that.
+ For now implement what forward_propagate_comparison did. */
+ (simplify
+ (bit_not (cmp @0 @1))
+ (if (VECTOR_TYPE_P (type)
+ || (INTEGRAL_TYPE_P (type) && TYPE_PRECISION (type) == 1))
+ /* Comparison inversion may be impossible for trapping math,
+ invert_tree_comparison will tell us. But we can't use
+ a computed operator in the replacement tree thus we have
+ to play the trick below. */
+ (with { enum tree_code ic = invert_tree_comparison
+ (cmp, HONOR_NANS (TYPE_MODE (TREE_TYPE (@0)))); }
+ (if (ic == icmp)
+ (icmp @0 @1))
+ (if (ic == ncmp)
+ (ncmp @0 @1)))))
+ (simplify
+ (bit_xor (cmp @0 @1) integer_onep)
+ (if (INTEGRAL_TYPE_P (type))
+ (with { enum tree_code ic = invert_tree_comparison
+ (cmp, HONOR_NANS (TYPE_MODE (TREE_TYPE (@0)))); }
+ (if (ic == icmp)
+ (icmp @0 @1))
+ (if (ic == ncmp)
+ (ncmp @0 @1))))))
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index b59d069ac14..915d55f7f93 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -77,6 +77,7 @@ along with GCC; see the file COPYING3. If not see
#include "optabs.h"
#include "cfgloop.h"
#include "target.h"
+#include "common/common-target.h"
#include "omp-low.h"
#include "gimple-low.h"
#include "tree-cfgcleanup.h"
@@ -86,6 +87,8 @@ along with GCC; see the file COPYING3. If not see
#include "tree-nested.h"
#include "tree-eh.h"
#include "cilk.h"
+#include "context.h"
+#include "lto-section-names.h"
/* Lowering of OpenMP parallel and workshare constructs proceeds in two
@@ -234,6 +237,9 @@ static tree scan_omp_1_op (tree *, int *, void *);
*handled_ops_p = false; \
break;
+/* Holds offload tables with decls. */
+vec<tree, va_gc> *offload_funcs, *offload_vars;
+
/* Convenience function for calling scan_omp_1_op on tree operands. */
static inline tree
@@ -273,6 +279,16 @@ is_parallel_ctx (omp_context *ctx)
}
+/* Return true if CTX is for an omp target region. */
+
+static inline bool
+is_targetreg_ctx (omp_context *ctx)
+{
+ return gimple_code (ctx->stmt) == GIMPLE_OMP_TARGET
+ && gimple_omp_target_kind (ctx->stmt) == GF_OMP_TARGET_KIND_REGION;
+}
+
+
/* Return true if CTX is for an omp task. */
static inline bool
@@ -1642,8 +1658,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
&& DECL_P (decl)
&& is_global_var (maybe_lookup_decl_in_outer_ctx (decl, ctx))
- && lookup_attribute ("omp declare target",
- DECL_ATTRIBUTES (decl)))
+ && varpool_node::get_create (decl)->offloadable)
break;
if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
&& OMP_CLAUSE_MAP_KIND (c) == OMP_CLAUSE_MAP_POINTER)
@@ -1783,8 +1798,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
decl = OMP_CLAUSE_DECL (c);
if (DECL_P (decl)
&& is_global_var (maybe_lookup_decl_in_outer_ctx (decl, ctx))
- && lookup_attribute ("omp declare target",
- DECL_ATTRIBUTES (decl)))
+ && varpool_node::get_create (decl)->offloadable)
break;
if (DECL_P (decl))
{
@@ -1938,26 +1952,19 @@ create_omp_child_function (omp_context *ctx, bool task_copy)
DECL_EXTERNAL (decl) = 0;
DECL_CONTEXT (decl) = NULL_TREE;
DECL_INITIAL (decl) = make_node (BLOCK);
- bool target_p = false;
- if (lookup_attribute ("omp declare target",
- DECL_ATTRIBUTES (current_function_decl)))
- target_p = true;
+ if (cgraph_node::get (current_function_decl)->offloadable)
+ cgraph_node::get_create (decl)->offloadable = 1;
else
{
omp_context *octx;
for (octx = ctx; octx; octx = octx->outer)
- if (gimple_code (octx->stmt) == GIMPLE_OMP_TARGET
- && gimple_omp_target_kind (octx->stmt)
- == GF_OMP_TARGET_KIND_REGION)
+ if (is_targetreg_ctx (octx))
{
- target_p = true;
+ cgraph_node::get_create (decl)->offloadable = 1;
+ g->have_offload = true;
break;
}
}
- if (target_p)
- DECL_ATTRIBUTES (decl)
- = tree_cons (get_identifier ("omp declare target"),
- NULL_TREE, DECL_ATTRIBUTES (decl));
t = build_decl (DECL_SOURCE_LOCATION (decl),
RESULT_DECL, NULL_TREE, void_type_node);
@@ -2663,8 +2670,7 @@ check_omp_nesting_restrictions (gimple stmt, omp_context *ctx)
break;
case GIMPLE_OMP_TARGET:
for (; ctx != NULL; ctx = ctx->outer)
- if (gimple_code (ctx->stmt) == GIMPLE_OMP_TARGET
- && gimple_omp_target_kind (ctx->stmt) == GF_OMP_TARGET_KIND_REGION)
+ if (is_targetreg_ctx (ctx))
{
const char *name;
switch (gimple_omp_target_kind (stmt))
@@ -8281,6 +8287,7 @@ expand_omp_target (struct omp_region *region)
if (kind == GF_OMP_TARGET_KIND_REGION)
{
unsigned srcidx, dstidx, num;
+ struct cgraph_node *node;
/* If the target region needs data sent from the parent
function, then the very first statement (except possible
@@ -8407,11 +8414,19 @@ expand_omp_target (struct omp_region *region)
DECL_STRUCT_FUNCTION (child_fn)->curr_properties = cfun->curr_properties;
cgraph_node::add_new_function (child_fn, true);
+ /* Add the new function to the offload table. */
+ vec_safe_push (offload_funcs, child_fn);
+
/* Fix the callgraph edges for child_cfun. Those for cfun will be
fixed in a following pass. */
push_cfun (child_cfun);
cgraph_edge::rebuild_edges ();
+ /* Prevent IPA from removing child_fn as unreachable, since there are no
+ refs from the parent function to child_fn in offload LTO mode. */
+ node = cgraph_node::get (child_fn);
+ node->mark_force_output ();
+
/* Some EH regions might become dead, see PR34608. If
pass_cleanup_cfg isn't the first pass to happen with the
new child, these dead EH edges might cause problems.
@@ -8801,7 +8816,7 @@ const pass_data pass_data_expand_omp =
OPTGROUP_NONE, /* optinfo_flags */
TV_NONE, /* tv_id */
PROP_gimple_any, /* properties_required */
- 0, /* properties_provided */
+ PROP_gimple_eomp, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
0, /* todo_flags_finish */
@@ -8815,13 +8830,18 @@ public:
{}
/* opt_pass methods: */
- virtual bool gate (function *)
+ virtual unsigned int execute (function *)
{
- return ((flag_openmp != 0 || flag_openmp_simd != 0
- || flag_cilkplus != 0) && !seen_error ());
- }
+ bool gate = ((flag_openmp != 0 || flag_openmp_simd != 0
+ || flag_cilkplus != 0) && !seen_error ());
- virtual unsigned int execute (function *) { return execute_expand_omp (); }
+ /* This pass always runs, to provide PROP_gimple_eomp.
+ But there is nothing to do unless -fopenmp is given. */
+ if (!gate)
+ return 0;
+
+ return execute_expand_omp ();
+ }
}; // class pass_expand_omp
@@ -8832,6 +8852,45 @@ make_pass_expand_omp (gcc::context *ctxt)
{
return new pass_expand_omp (ctxt);
}
+
+namespace {
+
+const pass_data pass_data_expand_omp_ssa =
+{
+ GIMPLE_PASS, /* type */
+ "ompexpssa", /* name */
+ OPTGROUP_NONE, /* optinfo_flags */
+ TV_NONE, /* tv_id */
+ PROP_cfg | PROP_ssa, /* properties_required */
+ PROP_gimple_eomp, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_cleanup_cfg | TODO_rebuild_alias, /* todo_flags_finish */
+};
+
+class pass_expand_omp_ssa : public gimple_opt_pass
+{
+public:
+ pass_expand_omp_ssa (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_expand_omp_ssa, ctxt)
+ {}
+
+ /* opt_pass methods: */
+ virtual bool gate (function *fun)
+ {
+ return !(fun->curr_properties & PROP_gimple_eomp);
+ }
+ virtual unsigned int execute (function *) { return execute_expand_omp (); }
+
+}; // class pass_expand_omp_ssa
+
+} // anon namespace
+
+gimple_opt_pass *
+make_pass_expand_omp_ssa (gcc::context *ctxt)
+{
+ return new pass_expand_omp_ssa (ctxt);
+}
/* Routines to lower OpenMP directives into OMP-GIMPLE. */
@@ -9282,6 +9341,17 @@ lower_omp_critical (gimple_stmt_iterator *gsi_p, omp_context *ctx)
DECL_COMMON (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
DECL_IGNORED_P (decl) = 1;
+
+ /* If '#pragma omp critical' is inside target region, the symbol must
+ be marked for offloading. */
+ omp_context *octx;
+ for (octx = ctx->outer; octx; octx = octx->outer)
+ if (is_targetreg_ctx (octx))
+ {
+ varpool_node::get_create (decl)->offloadable = 1;
+ break;
+ }
+
varpool_node::finalize_decl (decl);
splay_tree_insert (critical_name_mutexes, (splay_tree_key) name,
@@ -12361,4 +12431,91 @@ make_pass_omp_simd_clone (gcc::context *ctxt)
return new pass_omp_simd_clone (ctxt);
}
+/* Helper function for omp_finish_file routine. Takes decls from V_DECLS and
+ adds their addresses and sizes to constructor-vector V_CTOR. */
+static void
+add_decls_addresses_to_decl_constructor (vec<tree, va_gc> *v_decls,
+ vec<constructor_elt, va_gc> *v_ctor)
+{
+ unsigned len = vec_safe_length (v_decls);
+ for (unsigned i = 0; i < len; i++)
+ {
+ tree it = (*v_decls)[i];
+ bool is_function = TREE_CODE (it) != VAR_DECL;
+
+ CONSTRUCTOR_APPEND_ELT (v_ctor, NULL_TREE, build_fold_addr_expr (it));
+ if (!is_function)
+ CONSTRUCTOR_APPEND_ELT (v_ctor, NULL_TREE,
+ fold_convert (const_ptr_type_node,
+ DECL_SIZE_UNIT (it)));
+ }
+}
+
+/* Create new symbols containing (address, size) pairs for global variables,
+ marked with "omp declare target" attribute, as well as addresses for the
+ functions, which are outlined target regions. */
+void
+omp_finish_file (void)
+{
+ unsigned num_funcs = vec_safe_length (offload_funcs);
+ unsigned num_vars = vec_safe_length (offload_vars);
+
+ if (num_funcs == 0 && num_vars == 0)
+ return;
+
+ if (targetm_common.have_named_sections)
+ {
+ vec<constructor_elt, va_gc> *v_f, *v_v;
+ vec_alloc (v_f, num_funcs);
+ vec_alloc (v_v, num_vars * 2);
+
+ add_decls_addresses_to_decl_constructor (offload_funcs, v_f);
+ add_decls_addresses_to_decl_constructor (offload_vars, v_v);
+
+ tree vars_decl_type = build_array_type_nelts (pointer_sized_int_node,
+ num_vars * 2);
+ tree funcs_decl_type = build_array_type_nelts (pointer_sized_int_node,
+ num_funcs);
+ TYPE_ALIGN (vars_decl_type) = TYPE_ALIGN (pointer_sized_int_node);
+ TYPE_ALIGN (funcs_decl_type) = TYPE_ALIGN (pointer_sized_int_node);
+ tree ctor_v = build_constructor (vars_decl_type, v_v);
+ tree ctor_f = build_constructor (funcs_decl_type, v_f);
+ TREE_CONSTANT (ctor_v) = TREE_CONSTANT (ctor_f) = 1;
+ TREE_STATIC (ctor_v) = TREE_STATIC (ctor_f) = 1;
+ tree funcs_decl = build_decl (UNKNOWN_LOCATION, VAR_DECL,
+ get_identifier (".offload_func_table"),
+ funcs_decl_type);
+ tree vars_decl = build_decl (UNKNOWN_LOCATION, VAR_DECL,
+ get_identifier (".offload_var_table"),
+ vars_decl_type);
+ TREE_STATIC (funcs_decl) = TREE_STATIC (vars_decl) = 1;
+ /* Do not align tables more than TYPE_ALIGN (pointer_sized_int_node),
+ otherwise a joint table in a binary will contain padding between
+ tables from multiple object files. */
+ DECL_USER_ALIGN (funcs_decl) = DECL_USER_ALIGN (vars_decl) = 1;
+ DECL_ALIGN (funcs_decl) = TYPE_ALIGN (funcs_decl_type);
+ DECL_ALIGN (vars_decl) = TYPE_ALIGN (vars_decl_type);
+ DECL_INITIAL (funcs_decl) = ctor_f;
+ DECL_INITIAL (vars_decl) = ctor_v;
+ set_decl_section_name (funcs_decl, OFFLOAD_FUNC_TABLE_SECTION_NAME);
+ set_decl_section_name (vars_decl, OFFLOAD_VAR_TABLE_SECTION_NAME);
+
+ varpool_node::finalize_decl (vars_decl);
+ varpool_node::finalize_decl (funcs_decl);
+ }
+ else
+ {
+ for (unsigned i = 0; i < num_funcs; i++)
+ {
+ tree it = (*offload_funcs)[i];
+ targetm.record_offload_symbol (it);
+ }
+ for (unsigned i = 0; i < num_vars; i++)
+ {
+ tree it = (*offload_vars)[i];
+ targetm.record_offload_symbol (it);
+ }
+ }
+}
+
#include "gt-omp-low.h"
diff --git a/gcc/omp-low.h b/gcc/omp-low.h
index d80c2d6f5c0..ac587d04d3a 100644
--- a/gcc/omp-low.h
+++ b/gcc/omp-low.h
@@ -27,5 +27,9 @@ extern void omp_expand_local (basic_block);
extern void free_omp_regions (void);
extern tree omp_reduction_init (tree, tree);
extern bool make_gimple_omp_edges (basic_block, struct omp_region **, int *);
+extern void omp_finish_file (void);
+
+extern GTY(()) vec<tree, va_gc> *offload_funcs;
+extern GTY(()) vec<tree, va_gc> *offload_vars;
#endif /* GCC_OMP_LOW_H */
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 6278d7daad1..0acedb9350e 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -520,9 +520,6 @@ optab_for_tree_code (enum tree_code code, const_tree type,
case REDUC_PLUS_EXPR:
return reduc_plus_scal_optab;
- case VEC_RSHIFT_EXPR:
- return vec_shr_optab;
-
case VEC_WIDEN_MULT_HI_EXPR:
return TYPE_UNSIGNED (type) ?
vec_widen_umult_hi_optab : vec_widen_smult_hi_optab;
@@ -771,34 +768,6 @@ force_expand_binop (machine_mode mode, optab binoptab,
return true;
}
-/* Generate insns for VEC_RSHIFT_EXPR. */
-
-rtx
-expand_vec_shift_expr (sepops ops, rtx target)
-{
- struct expand_operand eops[3];
- enum insn_code icode;
- rtx rtx_op1, rtx_op2;
- machine_mode mode = TYPE_MODE (ops->type);
- tree vec_oprnd = ops->op0;
- tree shift_oprnd = ops->op1;
-
- gcc_assert (ops->code == VEC_RSHIFT_EXPR);
-
- icode = optab_handler (vec_shr_optab, mode);
- gcc_assert (icode != CODE_FOR_nothing);
-
- rtx_op1 = expand_normal (vec_oprnd);
- rtx_op2 = expand_normal (shift_oprnd);
-
- create_output_operand (&eops[0], target, mode);
- create_input_operand (&eops[1], rtx_op1, GET_MODE (rtx_op1));
- create_convert_operand_from_type (&eops[2], rtx_op2, TREE_TYPE (shift_oprnd));
- expand_insn (icode, 3, eops);
-
- return eops[0].value;
-}
-
/* Create a new vector value in VMODE with all elements set to OP. The
mode of OP must be the element mode of VMODE. If OP is a constant,
then the return value will be a constant. */
@@ -4308,9 +4277,12 @@ prepare_operand (enum insn_code icode, rtx x, int opnum, machine_mode mode,
if (!insn_operand_matches (icode, opnum, x))
{
+ machine_mode op_mode = insn_data[(int) icode].operand[opnum].mode;
if (reload_completed)
return NULL_RTX;
- x = copy_to_mode_reg (insn_data[(int) icode].operand[opnum].mode, x);
+ if (GET_MODE (x) != op_mode && GET_MODE (x) != VOIDmode)
+ return NULL_RTX;
+ x = copy_to_mode_reg (op_mode, x);
}
return x;
@@ -6564,8 +6536,11 @@ vector_compare_rtx (enum tree_code tcode, tree t_op0, tree t_op1,
return gen_rtx_fmt_ee (rcode, VOIDmode, ops[0].value, ops[1].value);
}
-/* Return true if VEC_PERM_EXPR can be expanded using SIMD extensions
- of the CPU. SEL may be NULL, which stands for an unknown constant. */
+/* Return true if VEC_PERM_EXPR of arbitrary input vectors can be expanded using
+ SIMD extensions of the CPU. SEL may be NULL, which stands for an unknown
+ constant. Note that additional permutations representing whole-vector shifts
+ may also be handled via the vec_shr optab, but only where the second input
+ vector is entirely constant zeroes; this case is not dealt with here. */
bool
can_vec_perm_p (machine_mode mode, bool variable,
@@ -6618,6 +6593,34 @@ can_vec_perm_p (machine_mode mode, bool variable,
return true;
}
+/* Checks if vec_perm mask SEL is a constant equivalent to a shift of the first
+ vec_perm operand, assuming the second operand is a constant vector of zeroes.
+ Return the shift distance in bits if so, or NULL_RTX if the vec_perm is not a
+ shift. */
+static rtx
+shift_amt_for_vec_perm_mask (rtx sel)
+{
+ unsigned int i, first, nelt = GET_MODE_NUNITS (GET_MODE (sel));
+ unsigned int bitsize = GET_MODE_BITSIZE (GET_MODE_INNER (GET_MODE (sel)));
+
+ if (GET_CODE (sel) != CONST_VECTOR)
+ return NULL_RTX;
+
+ first = INTVAL (CONST_VECTOR_ELT (sel, 0));
+ if (first >= 2*nelt)
+ return NULL_RTX;
+ for (i = 1; i < nelt; i++)
+ {
+ int idx = INTVAL (CONST_VECTOR_ELT (sel, i));
+ unsigned int expected = (i + first) & (2 * nelt - 1);
+ /* Indices into the second vector are all equivalent. */
+ if (idx < 0 || (MIN (nelt, (unsigned) idx) != MIN (nelt, expected)))
+ return NULL_RTX;
+ }
+
+ return GEN_INT (first * bitsize);
+}
+
/* A subroutine of expand_vec_perm for expanding one vec_perm insn. */
static rtx
@@ -6646,6 +6649,17 @@ expand_vec_perm_1 (enum insn_code icode, rtx target,
else
{
create_input_operand (&ops[1], v0, tmode);
+ /* See if this can be handled with a vec_shr. We only do this if the
+ second vector is all zeroes. */
+ enum insn_code shift_code = optab_handler (vec_shr_optab, GET_MODE (v0));
+ if (v1 == CONST0_RTX (GET_MODE (v1)) && shift_code)
+ if (rtx shift_amt = shift_amt_for_vec_perm_mask (sel))
+ {
+ create_convert_operand_from_type (&ops[2], shift_amt,
+ sizetype_tab[(int) stk_sizetype]);
+ if (maybe_expand_insn (shift_code, 3, ops))
+ return ops[0].value;
+ }
create_input_operand (&ops[2], v1, tmode);
}
diff --git a/gcc/optabs.h b/gcc/optabs.h
index 91e36d61b3b..982a5935cfa 100644
--- a/gcc/optabs.h
+++ b/gcc/optabs.h
@@ -287,8 +287,6 @@ extern rtx simplify_expand_binop (machine_mode mode, optab binoptab,
enum optab_methods methods);
extern bool force_expand_binop (machine_mode, optab, rtx, rtx, rtx, int,
enum optab_methods);
-/* Generate code for VEC_RSHIFT_EXPR. */
-extern rtx expand_vec_shift_expr (struct separate_ops *, rtx);
/* Generate code for a simple binary or unary operation. "Simple" in
this case means "can be unambiguously described by a (mode, code)
diff --git a/gcc/optc-save-gen.awk b/gcc/optc-save-gen.awk
index a5ec7e48660..861683460ad 100644
--- a/gcc/optc-save-gen.awk
+++ b/gcc/optc-save-gen.awk
@@ -39,6 +39,18 @@ print "#include " quote "intl.h" quote
print ""
print "#include " quote "flags.h" quote
print "#include " quote "target.h" quote
+print "#include " quote "inchash.h" quote
+print "#include " quote "tree.h" quote
+print "#include " quote "tree-ssa-alias.h" quote
+print "#include " quote "is-a.h" quote
+print "#include " quote "predict.h" quote
+print "#include " quote "function.h" quote
+print "#include " quote "basic-block.h" quote
+print "#include " quote "gimple-expr.h" quote
+print "#include " quote "gimple.h" quote
+print "#include " quote "data-streamer.h" quote
+print "#include " quote "ipa-ref.h" quote
+print "#include " quote "cgraph.h" quote
print ""
if (n_extra_c_includes > 0) {
@@ -417,4 +429,126 @@ print " targetm.target_option.print (file, indent, ptr);";
print "}";
+print "";
+print "/* Compare two target options */";
+print "bool";
+print "cl_target_option_eq (struct cl_target_option const *ptr1 ATTRIBUTE_UNUSED,";
+print " struct cl_target_option const *ptr2 ATTRIBUTE_UNUSED)";
+print "{";
+n_target_val = 0;
+n_target_str = 0;
+
+for (i = 0; i < n_target_save; i++) {
+ var = target_save_decl[i];
+ sub (" *=.*", "", var);
+ name = var;
+ type = var;
+ sub("^.*[ *]", "", name)
+ sub(" *" name "$", "", type)
+ if (target_save_decl[i] ~ "^const char \\*+[_" alnum "]+$")
+ var_target_str[n_target_str++] = name;
+ else {
+ var_target_val_type[n_target_val] = type;
+ var_target_val[n_target_val++] = name;
+ }
+}
+if (have_save) {
+ for (i = 0; i < n_opts; i++) {
+ if (flag_set_p("Save", flags[i])) {
+ name = var_name(flags[i])
+ if(name == "")
+ name = "target_flags";
+
+ if(name in var_list_seen)
+ continue;
+
+ var_list_seen[name]++;
+ otype = var_type_struct(flags[i])
+ if (otype ~ "^const char \\**$")
+ var_target_str[n_target_str++] = "x_" name;
+ else {
+ var_target_val_type[n_target_val] = otype;
+ var_target_val[n_target_val++] = "x_" name;
+ }
+ }
+ }
+} else {
+ var_target_val_type[n_target_val] = "int";
+ var_target_val[n_target_val++] = "x_target_flags";
+}
+
+for (i = 0; i < n_target_str; i++) {
+ name = var_target_str[i]
+ print " if (ptr1->" name" != ptr2->" name;
+ print " && (!ptr1->" name" || !ptr2->" name
+ print " || strcmp (ptr1->" name", ptr2->" name ")))";
+ print " return false;";
+}
+for (i = 0; i < n_target_val; i++) {
+ name = var_target_val[i]
+ print " if (ptr1->" name" != ptr2->" name ")";
+ print " return false;";
+}
+
+print " return true;";
+
+print "}";
+
+print "";
+print "/* Hash target options */";
+print "hashval_t";
+print "cl_target_option_hash (struct cl_target_option const *ptr ATTRIBUTE_UNUSED)";
+print "{";
+print " inchash::hash hstate;";
+for (i = 0; i < n_target_str; i++) {
+ name = var_target_str[i]
+ print " if (ptr->" name")";
+ print " hstate.add (ptr->" name", strlen (ptr->" name"));";
+ print " else";
+ print " hstate.add_int (0);";
+}
+for (i = 0; i < n_target_val; i++) {
+ name = var_target_val[i]
+ print " hstate.add_wide_int (ptr->" name");";
+}
+print " return hstate.end ();";
+print "}";
+
+print "";
+print "/* Stream out target options */";
+print "void";
+print "cl_target_option_stream_out (struct output_block *ob ATTRIBUTE_UNUSED,";
+print " struct bitpack_d *bp ATTRIBUTE_UNUSED,";
+print " struct cl_target_option *ptr ATTRIBUTE_UNUSED)";
+print "{";
+for (i = 0; i < n_target_str; i++) {
+ name = var_target_str[i]
+ print " bp_pack_string (ob, bp, ptr->" name", true);";
+}
+for (i = 0; i < n_target_val; i++) {
+ name = var_target_val[i]
+ print " bp_pack_value (bp, ptr->" name", 64);";
+}
+print "}";
+
+print "";
+print "/* Stream in target options */";
+print "void";
+print "cl_target_option_stream_in (struct data_in *data_in ATTRIBUTE_UNUSED,";
+print " struct bitpack_d *bp ATTRIBUTE_UNUSED,";
+print " struct cl_target_option *ptr ATTRIBUTE_UNUSED)";
+print "{";
+for (i = 0; i < n_target_str; i++) {
+ name = var_target_str[i]
+ print " ptr->" name" = bp_unpack_string (data_in, bp);";
+ print " if (ptr->" name")";
+ print " ptr->" name" = xstrdup (ptr->" name");";
+}
+for (i = 0; i < n_target_val; i++) {
+ name = var_target_val[i]
+ print " ptr->" name" = (" var_target_val_type[i] ") bp_unpack_value (bp, 64);";
+}
+
+print "}";
+
}
diff --git a/gcc/opth-gen.awk b/gcc/opth-gen.awk
index cbc7ab53b88..a8a04b789ec 100644
--- a/gcc/opth-gen.awk
+++ b/gcc/opth-gen.awk
@@ -293,6 +293,12 @@ print "";
print "/* Print target option variables from a structure. */";
print "extern void cl_target_option_print (FILE *, int, struct cl_target_option *);";
print "";
+print "/* Compare two target option variables from a structure. */";
+print "extern bool cl_target_option_eq (const struct cl_target_option *, const struct cl_target_option *);";
+print "";
+print "/* Hash option variables from a structure. */";
+print "extern hashval_t cl_target_option_hash (const struct cl_target_option *);";
+print "";
print "/* Anything that includes tm.h, does not necessarily need this. */"
print "#if !defined(GCC_TM_H)"
print "#include \"input.h\" /* for location_t */"
diff --git a/gcc/opts-global.c b/gcc/opts-global.c
index 6825943a8a5..80a84f629d2 100644
--- a/gcc/opts-global.c
+++ b/gcc/opts-global.c
@@ -132,7 +132,7 @@ complain_wrong_lang (const struct cl_decoded_option *decoded,
we only complain about unknown -Wno-* options if they may have
prevented a diagnostic. Otherwise, we just ignore them. Note that
if we do complain, it is only as a warning, not an error; passing
- the compiler an unrecognised -Wno-* option should never change
+ the compiler an unrecognized -Wno-* option should never change
whether the compilation succeeds or fails. */
static void
@@ -152,7 +152,7 @@ print_ignored_options (void)
opt = ignored_options.pop ();
warning_at (UNKNOWN_LOCATION, 0,
- "unrecognized command line option \"%s\"", opt);
+ "unrecognized command line option %qs", opt);
}
}
diff --git a/gcc/opts.c b/gcc/opts.c
index 752cc84473d..d22882bf3a2 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -500,6 +500,7 @@ static const struct default_options default_options_table[] =
{ OPT_LEVELS_2_PLUS, OPT_fipa_icf, NULL, 1 },
{ OPT_LEVELS_2_PLUS, OPT_fisolate_erroneous_paths_dereference, NULL, 1 },
{ OPT_LEVELS_2_PLUS, OPT_fuse_caller_save, NULL, 1 },
+ { OPT_LEVELS_2_PLUS, OPT_flra_remat, NULL, 1 },
/* -O3 optimizations. */
{ OPT_LEVELS_3_PLUS, OPT_ftree_loop_distribute_patterns, NULL, 1 },
@@ -1806,6 +1807,17 @@ common_handle_option (struct gcc_options *opts,
/* Deferred. */
break;
+ case OPT_foffload_:
+ /* Deferred. */
+ break;
+
+#ifndef ACCEL_COMPILER
+ case OPT_foffload_abi_:
+ error_at (loc, "-foffload-abi option can be specified only for "
+ "offload compiler");
+ break;
+#endif
+
case OPT_fpack_struct_:
if (value <= 0 || (value & (value - 1)) || value > 16)
error_at (loc,
@@ -1923,7 +1935,7 @@ common_handle_option (struct gcc_options *opts,
? STATIC_BUILTIN_STACK_CHECK
: GENERIC_STACK_CHECK;
else
- warning_at (loc, 0, "unknown stack check parameter \"%s\"", arg);
+ warning_at (loc, 0, "unknown stack check parameter %qs", arg);
break;
case OPT_fstack_limit:
@@ -2199,7 +2211,7 @@ set_debug_level (enum debug_info_type type, int extended, const char *arg,
if (opts_set->x_write_symbols != NO_DEBUG
&& opts->x_write_symbols != NO_DEBUG
&& type != opts->x_write_symbols)
- error_at (loc, "debug format \"%s\" conflicts with prior selection",
+ error_at (loc, "debug format %qs conflicts with prior selection",
debug_type_names[type]);
opts->x_write_symbols = type;
opts_set->x_write_symbols = type;
@@ -2217,9 +2229,9 @@ set_debug_level (enum debug_info_type type, int extended, const char *arg,
{
int argval = integral_argument (arg);
if (argval == -1)
- error_at (loc, "unrecognised debug output level \"%s\"", arg);
+ error_at (loc, "unrecognised debug output level %qs", arg);
else if (argval > 3)
- error_at (loc, "debug output level %s is too high", arg);
+ error_at (loc, "debug output level %qs is too high", arg);
else
opts->x_debug_info_level = (enum debug_info_levels) argval;
}
diff --git a/gcc/passes.c b/gcc/passes.c
index 5e91a79414a..aa40fe5fa30 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -2416,7 +2416,7 @@ ipa_write_summaries_1 (lto_symtab_encoder_t encoder)
/* Write out summaries for all the nodes in the callgraph. */
void
-ipa_write_summaries (void)
+ipa_write_summaries (bool offload_lto_mode)
{
lto_symtab_encoder_t encoder;
int i, order_pos;
@@ -2427,6 +2427,8 @@ ipa_write_summaries (void)
if (!flag_generate_lto || seen_error ())
return;
+ select_what_to_stream (offload_lto_mode);
+
encoder = lto_symtab_encoder_new (false);
/* Create the callgraph set in the same order used in
@@ -2453,15 +2455,16 @@ ipa_write_summaries (void)
renumber_gimple_stmt_uids ();
pop_cfun ();
}
- if (node->definition)
+ if (node->definition && node->need_lto_streaming)
lto_set_symtab_encoder_in_partition (encoder, node);
}
FOR_EACH_DEFINED_FUNCTION (node)
- if (node->alias)
+ if (node->alias && node->need_lto_streaming)
lto_set_symtab_encoder_in_partition (encoder, node);
FOR_EACH_DEFINED_VARIABLE (vnode)
- lto_set_symtab_encoder_in_partition (encoder, vnode);
+ if (vnode->need_lto_streaming)
+ lto_set_symtab_encoder_in_partition (encoder, vnode);
ipa_write_summaries_1 (compute_ltrans_boundary (encoder));
diff --git a/gcc/passes.def b/gcc/passes.def
index 2305d670663..194e2a91925 100644
--- a/gcc/passes.def
+++ b/gcc/passes.def
@@ -241,6 +241,9 @@ along with GCC; see the file COPYING3. If not see
POP_INSERT_PASSES ()
NEXT_PASS (pass_iv_canon);
NEXT_PASS (pass_parallelize_loops);
+ PUSH_INSERT_PASSES_WITHIN (pass_parallelize_loops)
+ NEXT_PASS (pass_expand_omp_ssa);
+ POP_INSERT_PASSES ()
NEXT_PASS (pass_if_conversion);
/* pass_vectorize must immediately follow pass_if_conversion.
Please do not add any other passes in between. */
@@ -416,6 +419,7 @@ along with GCC; see the file COPYING3. If not see
NEXT_PASS (pass_stack_adjustments);
NEXT_PASS (pass_jump2);
NEXT_PASS (pass_duplicate_computed_gotos);
+ NEXT_PASS (pass_sched_fusion);
NEXT_PASS (pass_peephole2);
NEXT_PASS (pass_if_after_reload);
NEXT_PASS (pass_regrename);
diff --git a/gcc/sanitizer.def b/gcc/sanitizer.def
index cddc5ea4935..3fc8c8396be 100644
--- a/gcc/sanitizer.def
+++ b/gcc/sanitizer.def
@@ -394,7 +394,7 @@ DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_SHIFT_OUT_OF_BOUNDS,
DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_BUILTIN_UNREACHABLE,
"__ubsan_handle_builtin_unreachable",
BT_FN_VOID_PTR,
- ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST)
+ ATTR_COLD_CONST_NORETURN_NOTHROW_LEAF_LIST)
DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_MISSING_RETURN,
"__ubsan_handle_missing_return",
BT_FN_VOID_PTR,
diff --git a/gcc/sanopt.c b/gcc/sanopt.c
index 0fc032a7a30..f6e8ee71d70 100644
--- a/gcc/sanopt.c
+++ b/gcc/sanopt.c
@@ -49,6 +49,7 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h"
#include "ubsan.h"
#include "params.h"
+#include "tree-ssa-operands.h"
/* This is used to carry information about basic blocks. It is
@@ -56,7 +57,30 @@ along with GCC; see the file COPYING3. If not see
struct sanopt_info
{
- /* True if this BB has been visited. */
+ /* True if this BB might call (directly or indirectly) free/munmap
+ or similar operation. */
+ bool has_freeing_call_p;
+
+ /* True if HAS_FREEING_CALL_P flag has been computed. */
+ bool has_freeing_call_computed_p;
+
+ /* True if there is a block with HAS_FREEING_CALL_P flag set
+ on any path between an immediate dominator of BB, denoted
+ imm(BB), and BB. */
+ bool imm_dom_path_with_freeing_call_p;
+
+ /* True if IMM_DOM_PATH_WITH_FREEING_CALL_P has been computed. */
+ bool imm_dom_path_with_freeing_call_computed_p;
+
+ /* Number of possibly freeing calls encountered in this bb
+ (so far). */
+ uint64_t freeing_call_events;
+
+ /* True if BB is currently being visited during computation
+ of IMM_DOM_PATH_WITH_FREEING_CALL_P flag. */
+ bool being_visited_p;
+
+ /* True if this BB has been visited in the dominator walk. */
bool visited_p;
};
@@ -69,131 +93,387 @@ struct sanopt_ctx
a vector of UBSAN_NULL call statements that check this pointer. */
hash_map<tree, auto_vec<gimple> > null_check_map;
+ /* This map maps a pointer (the second argument of ASAN_CHECK) to
+ a vector of ASAN_CHECK call statements that check the access. */
+ hash_map<tree, auto_vec<gimple> > asan_check_map;
+
/* Number of IFN_ASAN_CHECK statements. */
int asan_num_accesses;
};
-/* Try to optimize away redundant UBSAN_NULL checks.
-
+/* Return true if there might be any call to free/munmap operation
+ on any path in between DOM (which should be imm(BB)) and BB. */
+
+static bool
+imm_dom_path_with_freeing_call (basic_block bb, basic_block dom)
+{
+ sanopt_info *info = (sanopt_info *) bb->aux;
+ edge e;
+ edge_iterator ei;
+
+ if (info->imm_dom_path_with_freeing_call_computed_p)
+ return info->imm_dom_path_with_freeing_call_p;
+
+ info->being_visited_p = true;
+
+ FOR_EACH_EDGE (e, ei, bb->preds)
+ {
+ sanopt_info *pred_info = (sanopt_info *) e->src->aux;
+
+ if (e->src == dom)
+ continue;
+
+ if ((pred_info->imm_dom_path_with_freeing_call_computed_p
+ && pred_info->imm_dom_path_with_freeing_call_p)
+ || (pred_info->has_freeing_call_computed_p
+ && pred_info->has_freeing_call_p))
+ {
+ info->imm_dom_path_with_freeing_call_computed_p = true;
+ info->imm_dom_path_with_freeing_call_p = true;
+ info->being_visited_p = false;
+ return true;
+ }
+ }
+
+ FOR_EACH_EDGE (e, ei, bb->preds)
+ {
+ sanopt_info *pred_info = (sanopt_info *) e->src->aux;
+
+ if (e->src == dom)
+ continue;
+
+ if (pred_info->has_freeing_call_computed_p)
+ continue;
+
+ gimple_stmt_iterator gsi;
+ for (gsi = gsi_start_bb (e->src); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ gimple stmt = gsi_stmt (gsi);
+
+ if (is_gimple_call (stmt) && !nonfreeing_call_p (stmt))
+ {
+ pred_info->has_freeing_call_p = true;
+ break;
+ }
+ }
+
+ pred_info->has_freeing_call_computed_p = true;
+ if (pred_info->has_freeing_call_p)
+ {
+ info->imm_dom_path_with_freeing_call_computed_p = true;
+ info->imm_dom_path_with_freeing_call_p = true;
+ info->being_visited_p = false;
+ return true;
+ }
+ }
+
+ FOR_EACH_EDGE (e, ei, bb->preds)
+ {
+ if (e->src == dom)
+ continue;
+
+ basic_block src;
+ for (src = e->src; src != dom; )
+ {
+ sanopt_info *pred_info = (sanopt_info *) src->aux;
+ if (pred_info->being_visited_p)
+ break;
+ basic_block imm = get_immediate_dominator (CDI_DOMINATORS, src);
+ if (imm_dom_path_with_freeing_call (src, imm))
+ {
+ info->imm_dom_path_with_freeing_call_computed_p = true;
+ info->imm_dom_path_with_freeing_call_p = true;
+ info->being_visited_p = false;
+ return true;
+ }
+ src = imm;
+ }
+ }
+
+ info->imm_dom_path_with_freeing_call_computed_p = true;
+ info->imm_dom_path_with_freeing_call_p = false;
+ info->being_visited_p = false;
+ return false;
+}
+
+/* Optimize away redundant UBSAN_NULL calls. */
+
+static bool
+maybe_optimize_ubsan_null_ifn (struct sanopt_ctx *ctx, gimple stmt)
+{
+ gcc_assert (gimple_call_num_args (stmt) == 3);
+ tree ptr = gimple_call_arg (stmt, 0);
+ tree cur_align = gimple_call_arg (stmt, 2);
+ gcc_assert (TREE_CODE (cur_align) == INTEGER_CST);
+ bool remove = false;
+
+ auto_vec<gimple> &v = ctx->null_check_map.get_or_insert (ptr);
+ if (v.is_empty ())
+ {
+ /* For this PTR we don't have any UBSAN_NULL stmts recorded, so there's
+ nothing to optimize yet. */
+ v.safe_push (stmt);
+ return false;
+ }
+
+ /* We already have recorded a UBSAN_NULL check for this pointer. Perhaps we
+ can drop this one. But only if this check doesn't specify stricter
+ alignment. */
+ while (!v.is_empty ())
+ {
+ gimple g = v.last ();
+ /* Remove statements for BBs that have been already processed. */
+ sanopt_info *si = (sanopt_info *) gimple_bb (g)->aux;
+ if (si->visited_p)
+ {
+ v.pop ();
+ continue;
+ }
+
+ /* At this point we shouldn't have any statements that aren't dominating
+ the current BB. */
+ tree align = gimple_call_arg (g, 2);
+ int kind = tree_to_shwi (gimple_call_arg (g, 1));
+ /* If this is a NULL pointer check where we had segv anyway, we can
+ remove it. */
+ if (integer_zerop (align)
+ && (kind == UBSAN_LOAD_OF
+ || kind == UBSAN_STORE_OF
+ || kind == UBSAN_MEMBER_ACCESS))
+ remove = true;
+ /* Otherwise remove the check in non-recovering mode, or if the
+ stmts have same location. */
+ else if (integer_zerop (align))
+ remove = (flag_sanitize_recover & SANITIZE_NULL) == 0
+ || flag_sanitize_undefined_trap_on_error
+ || gimple_location (g) == gimple_location (stmt);
+ else if (tree_int_cst_le (cur_align, align))
+ remove = (flag_sanitize_recover & SANITIZE_ALIGNMENT) == 0
+ || flag_sanitize_undefined_trap_on_error
+ || gimple_location (g) == gimple_location (stmt);
+ if (!remove && gimple_bb (g) == gimple_bb (stmt)
+ && tree_int_cst_compare (cur_align, align) == 0)
+ v.pop ();
+ break;
+ }
+
+ if (!remove)
+ v.safe_push (stmt);
+ return remove;
+}
+
+/* Optimize away redundant ASAN_CHECK calls. */
+
+static bool
+maybe_optimize_asan_check_ifn (struct sanopt_ctx *ctx, gimple stmt)
+{
+ gcc_assert (gimple_call_num_args (stmt) == 4);
+ tree ptr = gimple_call_arg (stmt, 1);
+ tree len = gimple_call_arg (stmt, 2);
+ basic_block bb = gimple_bb (stmt);
+ sanopt_info *info = (sanopt_info *) bb->aux;
+
+ if (TREE_CODE (len) != INTEGER_CST)
+ return false;
+ if (integer_zerop (len))
+ return false;
+
+ gimple_set_uid (stmt, info->freeing_call_events);
+
+ auto_vec<gimple> &v = ctx->asan_check_map.get_or_insert (ptr);
+ if (v.is_empty ())
+ {
+ /* For this PTR we don't have any ASAN_CHECK stmts recorded, so there's
+ nothing to optimize yet. */
+ v.safe_push (stmt);
+ return false;
+ }
+
+ /* We already have recorded a ASAN_CHECK check for this pointer. Perhaps
+ we can drop this one. But only if this check doesn't specify larger
+ size. */
+ while (!v.is_empty ())
+ {
+ gimple g = v.last ();
+ /* Remove statements for BBs that have been already processed. */
+ sanopt_info *si = (sanopt_info *) gimple_bb (g)->aux;
+ if (si->visited_p)
+ v.pop ();
+ else
+ break;
+ }
+
+ unsigned int i;
+ gimple g;
+ gimple to_pop = NULL;
+ bool remove = false;
+ basic_block last_bb = bb;
+ bool cleanup = false;
+
+ FOR_EACH_VEC_ELT_REVERSE (v, i, g)
+ {
+ basic_block gbb = gimple_bb (g);
+ sanopt_info *si = (sanopt_info *) gbb->aux;
+ if (gimple_uid (g) < si->freeing_call_events)
+ {
+ /* If there is a potentially freeing call after g in gbb, we should
+ remove it from the vector, can't use in optimization. */
+ cleanup = true;
+ continue;
+ }
+
+ if (TREE_CODE (len) != INTEGER_CST)
+ {
+ /* If there is some stmts not followed by freeing call event
+ for ptr already in the current bb, no need to insert anything.
+ Non-constant len is treated just as length 1. */
+ if (gbb == bb)
+ return false;
+ break;
+ }
+
+ tree glen = gimple_call_arg (g, 2);
+ /* If we've checked only smaller length than we want to check now,
+ we can't remove the current stmt. If g is in the same basic block,
+ we want to remove it though, as the current stmt is better. */
+ if (tree_int_cst_lt (glen, len))
+ {
+ if (gbb == bb)
+ {
+ to_pop = g;
+ cleanup = true;
+ }
+ continue;
+ }
+
+ while (last_bb != gbb)
+ {
+ /* Paths from last_bb to bb have been checked before.
+ gbb is necessarily a dominator of last_bb, but not necessarily
+ immediate dominator. */
+ if (((sanopt_info *) last_bb->aux)->freeing_call_events)
+ break;
+
+ basic_block imm = get_immediate_dominator (CDI_DOMINATORS, last_bb);
+ gcc_assert (imm);
+ if (imm_dom_path_with_freeing_call (last_bb, imm))
+ break;
+
+ last_bb = imm;
+ }
+ if (last_bb == gbb)
+ remove = true;
+ break;
+ }
+
+ if (cleanup)
+ {
+ unsigned int j = 0, l = v.length ();
+ for (i = 0; i < l; i++)
+ if (v[i] != to_pop
+ && (gimple_uid (v[i])
+ == ((sanopt_info *)
+ gimple_bb (v[i])->aux)->freeing_call_events))
+ {
+ if (i != j)
+ v[j] = v[i];
+ j++;
+ }
+ v.truncate (j);
+ }
+
+ if (!remove)
+ v.safe_push (stmt);
+ return remove;
+}
+
+/* Try to optimize away redundant UBSAN_NULL and ASAN_CHECK calls.
+
We walk blocks in the CFG via a depth first search of the dominator
- tree; we push unique UBSAN_NULL statements into a vector in the
- NULL_CHECK_MAP as we enter the blocks. When leaving a block, we
- mark the block as visited; then when checking the statements in the
- vector, we ignore statements that are coming from already visited
- blocks, because these cannot dominate anything anymore.
- CTX is a sanopt context. */
+ tree; we push unique UBSAN_NULL or ASAN_CHECK statements into a vector
+ in the NULL_CHECK_MAP or ASAN_CHECK_MAP hash maps as we enter the
+ blocks. When leaving a block, we mark the block as visited; then
+ when checking the statements in the vector, we ignore statements that
+ are coming from already visited blocks, because these cannot dominate
+ anything anymore. CTX is a sanopt context. */
static void
sanopt_optimize_walker (basic_block bb, struct sanopt_ctx *ctx)
{
basic_block son;
gimple_stmt_iterator gsi;
+ sanopt_info *info = (sanopt_info *) bb->aux;
+ bool asan_check_optimize
+ = (flag_sanitize & SANITIZE_ADDRESS)
+ && ((flag_sanitize & flag_sanitize_recover
+ & SANITIZE_KERNEL_ADDRESS) == 0);
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);)
{
gimple stmt = gsi_stmt (gsi);
bool remove = false;
- if (is_gimple_call (stmt)
- && gimple_call_internal_p (stmt))
+ if (!is_gimple_call (stmt))
+ {
+ /* Handle asm volatile or asm with "memory" clobber
+ the same as potentionally freeing call. */
+ if (gimple_code (stmt) == GIMPLE_ASM
+ && asan_check_optimize
+ && (gimple_asm_clobbers_memory_p (stmt)
+ || gimple_asm_volatile_p (stmt)))
+ info->freeing_call_events++;
+ gsi_next (&gsi);
+ continue;
+ }
+
+ if (asan_check_optimize && !nonfreeing_call_p (stmt))
+ info->freeing_call_events++;
+
+ if (gimple_call_internal_p (stmt))
switch (gimple_call_internal_fn (stmt))
{
case IFN_UBSAN_NULL:
- {
- gcc_assert (gimple_call_num_args (stmt) == 3);
- tree ptr = gimple_call_arg (stmt, 0);
- tree cur_align = gimple_call_arg (stmt, 2);
- gcc_assert (TREE_CODE (cur_align) == INTEGER_CST);
-
- auto_vec<gimple> &v = ctx->null_check_map.get_or_insert (ptr);
- if (v.is_empty ())
- /* For this PTR we don't have any UBSAN_NULL stmts
- recorded, so there's nothing to optimize yet. */
- v.safe_push (stmt);
- else
- {
- /* We already have recorded a UBSAN_NULL check
- for this pointer. Perhaps we can drop this one.
- But only if this check doesn't specify stricter
- alignment. */
- while (!v.is_empty ())
- {
- gimple g = v.last ();
- /* Remove statements for BBs that have been
- already processed. */
- sanopt_info *si = (sanopt_info *) gimple_bb (g)->aux;
- if (si->visited_p)
- v.pop ();
- else
- {
- /* At this point we shouldn't have any statements
- that aren't dominating the current BB. */
- tree align = gimple_call_arg (g, 2);
- int kind = tree_to_shwi (gimple_call_arg (g, 1));
- /* If this is a NULL pointer check where we had segv
- anyway, we can remove it. */
- if (integer_zerop (align)
- && (kind == UBSAN_LOAD_OF
- || kind == UBSAN_STORE_OF
- || kind == UBSAN_MEMBER_ACCESS))
- remove = true;
- /* Otherwise remove the check in non-recovering
- mode, or if the stmts have same location. */
- else if (integer_zerop (align))
- remove = !(flag_sanitize_recover & SANITIZE_NULL)
- || flag_sanitize_undefined_trap_on_error
- || gimple_location (g)
- == gimple_location (stmt);
- else if (tree_int_cst_le (cur_align, align))
- remove = !(flag_sanitize_recover
- & SANITIZE_ALIGNMENT)
- || flag_sanitize_undefined_trap_on_error
- || gimple_location (g)
- == gimple_location (stmt);
- if (!remove && gimple_bb (g) == gimple_bb (stmt)
- && tree_int_cst_compare (cur_align, align) == 0)
- v.pop ();
- break;
- }
- }
-
- if (remove)
- {
- /* Drop this check. */
- if (dump_file && (dump_flags & TDF_DETAILS))
- {
- fprintf (dump_file, "Optimizing out\n ");
- print_gimple_stmt (dump_file, stmt, 0,
- dump_flags);
- fprintf (dump_file, "\n");
- }
- gsi_remove (&gsi, true);
- }
- else
- v.safe_push (stmt);
- }
- }
+ remove = maybe_optimize_ubsan_null_ifn (ctx, stmt);
+ break;
case IFN_ASAN_CHECK:
- ctx->asan_num_accesses++;
+ if (asan_check_optimize)
+ remove = maybe_optimize_asan_check_ifn (ctx, stmt);
+ if (!remove)
+ ctx->asan_num_accesses++;
break;
default:
break;
}
- /* If we were able to remove the current statement, gsi_remove
- already pointed us to the next statement. */
- if (!remove)
+ if (remove)
+ {
+ /* Drop this check. */
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "Optimizing out\n ");
+ print_gimple_stmt (dump_file, stmt, 0, dump_flags);
+ fprintf (dump_file, "\n");
+ }
+ unlink_stmt_vdef (stmt);
+ gsi_remove (&gsi, true);
+ }
+ else
gsi_next (&gsi);
}
+ if (asan_check_optimize)
+ {
+ info->has_freeing_call_p = info->freeing_call_events != 0;
+ info->has_freeing_call_computed_p = true;
+ }
+
for (son = first_dom_son (CDI_DOMINATORS, bb);
son;
son = next_dom_son (CDI_DOMINATORS, son))
sanopt_optimize_walker (son, ctx);
/* We're leaving this BB, so mark it to that effect. */
- sanopt_info *info = (sanopt_info *) bb->aux;
info->visited_p = true;
}
@@ -259,7 +539,8 @@ pass_sanopt::execute (function *fun)
/* Try to remove redundant checks. */
if (optimize
- && (flag_sanitize & (SANITIZE_NULL | SANITIZE_ALIGNMENT)))
+ && (flag_sanitize
+ & (SANITIZE_NULL | SANITIZE_ALIGNMENT | SANITIZE_ADDRESS)))
asan_num_accesses = sanopt_optimize (fun);
else if (flag_sanitize & SANITIZE_ADDRESS)
{
@@ -312,6 +593,21 @@ pass_sanopt::execute (function *fun)
break;
}
}
+ else if (gimple_call_builtin_p (stmt, BUILT_IN_NORMAL))
+ {
+ tree callee = gimple_call_fndecl (stmt);
+ switch (DECL_FUNCTION_CODE (callee))
+ {
+ case BUILT_IN_UNREACHABLE:
+ if (flag_sanitize & SANITIZE_UNREACHABLE
+ && !lookup_attribute ("no_sanitize_undefined",
+ DECL_ATTRIBUTES (fun->decl)))
+ no_next = ubsan_instrument_unreachable (&gsi);
+ break;
+ default:
+ break;
+ }
+ }
if (dump_file && (dump_flags & TDF_DETAILS))
{
diff --git a/gcc/sched-int.h b/gcc/sched-int.h
index eaeabfa96d6..2e156f33db7 100644
--- a/gcc/sched-int.h
+++ b/gcc/sched-int.h
@@ -805,6 +805,9 @@ struct _haifa_insn_data
/* A priority for each insn. */
int priority;
+ /* The fusion priority for each insn. */
+ int fusion_priority;
+
/* The minimum clock tick at which the insn becomes ready. This is
used to note timing constraints for the insns in the pending list. */
int tick;
@@ -903,6 +906,7 @@ extern vec<haifa_insn_data_def> h_i_d;
/* Accessor macros for h_i_d. There are more in haifa-sched.c and
sched-rgn.c. */
#define INSN_PRIORITY(INSN) (HID (INSN)->priority)
+#define INSN_FUSION_PRIORITY(INSN) (HID (INSN)->fusion_priority)
#define INSN_REG_PRESSURE(INSN) (HID (INSN)->reg_pressure)
#define INSN_MAX_REG_PRESSURE(INSN) (HID (INSN)->max_reg_pressure)
#define INSN_REG_USE_LIST(INSN) (HID (INSN)->reg_use_list)
@@ -1620,6 +1624,10 @@ extern void sd_copy_back_deps (rtx_insn *, rtx_insn *, bool);
extern void sd_delete_dep (sd_iterator_def);
extern void sd_debug_lists (rtx, sd_list_types_def);
+/* Macros and declarations for scheduling fusion. */
+#define FUSION_MAX_PRIORITY (INT_MAX)
+extern bool sched_fusion;
+
#endif /* INSN_SCHEDULING */
#endif /* GCC_SCHED_INT_H */
diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c
index 7a0af10ddcb..2a1c18c1ede 100644
--- a/gcc/sched-rgn.c
+++ b/gcc/sched-rgn.c
@@ -3658,6 +3658,17 @@ rest_of_handle_sched2 (void)
return 0;
}
+static unsigned int
+rest_of_handle_sched_fusion (void)
+{
+#ifdef INSN_SCHEDULING
+ sched_fusion = true;
+ schedule_insns ();
+ sched_fusion = false;
+#endif
+ return 0;
+}
+
namespace {
const pass_data pass_data_live_range_shrinkage =
@@ -3800,3 +3811,55 @@ make_pass_sched2 (gcc::context *ctxt)
{
return new pass_sched2 (ctxt);
}
+
+namespace {
+
+const pass_data pass_data_sched_fusion =
+{
+ RTL_PASS, /* type */
+ "sched_fusion", /* name */
+ OPTGROUP_NONE, /* optinfo_flags */
+ TV_SCHED_FUSION, /* tv_id */
+ 0, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_df_finish, /* todo_flags_finish */
+};
+
+class pass_sched_fusion : public rtl_opt_pass
+{
+public:
+ pass_sched_fusion (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_sched_fusion, ctxt)
+ {}
+
+ /* opt_pass methods: */
+ virtual bool gate (function *);
+ virtual unsigned int execute (function *)
+ {
+ return rest_of_handle_sched_fusion ();
+ }
+
+}; // class pass_sched2
+
+bool
+pass_sched_fusion::gate (function *)
+{
+#ifdef INSN_SCHEDULING
+ /* Scheduling fusion relies on peephole2 to do real fusion work,
+ so only enable it if peephole2 is in effect. */
+ return (optimize > 0 && flag_peephole2
+ && flag_schedule_fusion && targetm.sched.fusion_priority != NULL);
+#else
+ return 0;
+#endif
+}
+
+} // anon namespace
+
+rtl_opt_pass *
+make_pass_sched_fusion (gcc::context *ctxt)
+{
+ return new pass_sched_fusion (ctxt);
+}
diff --git a/gcc/target.def b/gcc/target.def
index b2fe47b8066..c329b2a9632 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -1526,6 +1526,79 @@ parallelism required in output calculations chain.",
int, (unsigned int opc, machine_mode mode),
hook_int_uint_mode_1)
+/* The following member value is a function that returns priority for
+ fusion of each instruction via pointer parameters. */
+DEFHOOK
+(fusion_priority,
+"This hook is called by scheduling fusion pass. It calculates fusion\n\
+priorities for each instruction passed in by parameter. The priorities\n\
+are returned via pointer parameters.\n\
+\n\
+@var{insn} is the instruction whose priorities need to be calculated.\n\
+@var{max_pri} is the maximum priority can be returned in any cases.\n\
+@var{fusion_pri} is the pointer parameter through which @var{insn}'s\n\
+fusion priority should be calculated and returned.\n\
+@var{pri} is the pointer parameter through which @var{insn}'s priority\n\
+should be calculated and returned.\n\
+\n\
+Same @var{fusion_pri} should be returned for instructions which should\n\
+be scheduled together. Different @var{pri} should be returned for\n\
+instructions with same @var{fusion_pri}. @var{fusion_pri} is the major\n\
+sort key, @var{pri} is the minor sort key. All instructions will be\n\
+scheduled according to the two priorities. All priorities calculated\n\
+should be between 0 (exclusive) and @var{max_pri} (inclusive). To avoid\n\
+false dependencies, @var{fusion_pri} of instructions which need to be\n\
+scheduled together should be smaller than @var{fusion_pri} of irrelevant\n\
+instructions.\n\
+\n\
+Given below example:\n\
+\n\
+ ldr r10, [r1, 4]\n\
+ add r4, r4, r10\n\
+ ldr r15, [r2, 8]\n\
+ sub r5, r5, r15\n\
+ ldr r11, [r1, 0]\n\
+ add r4, r4, r11\n\
+ ldr r16, [r2, 12]\n\
+ sub r5, r5, r16\n\
+\n\
+On targets like ARM/AArch64, the two pairs of consecutive loads should be\n\
+merged. Since peephole2 pass can't help in this case unless consecutive\n\
+loads are actually next to each other in instruction flow. That's where\n\
+this scheduling fusion pass works. This hook calculates priority for each\n\
+instruction based on its fustion type, like:\n\
+\n\
+ ldr r10, [r1, 4] ; fusion_pri=99, pri=96 \n\
+ add r4, r4, r10 ; fusion_pri=100, pri=100 \n\
+ ldr r15, [r2, 8] ; fusion_pri=98, pri=92 \n\
+ sub r5, r5, r15 ; fusion_pri=100, pri=100 \n\
+ ldr r11, [r1, 0] ; fusion_pri=99, pri=100 \n\
+ add r4, r4, r11 ; fusion_pri=100, pri=100 \n\
+ ldr r16, [r2, 12] ; fusion_pri=98, pri=88 \n\
+ sub r5, r5, r16 ; fusion_pri=100, pri=100 \n\
+\n\
+Scheduling fusion pass then sorts all ready to issue instructions according\n\
+to the priorities. As a result, instructions of same fusion type will be\n\
+pushed together in instruction flow, like:\n\
+\n\
+ ldr r11, [r1, 0]\n\
+ ldr r10, [r1, 4]\n\
+ ldr r15, [r2, 8]\n\
+ ldr r16, [r2, 12]\n\
+ add r4, r4, r10\n\
+ sub r5, r5, r15\n\
+ add r4, r4, r11\n\
+ sub r5, r5, r16\n\
+\n\
+Now peephole2 pass can simply merge the two pairs of loads.\n\
+\n\
+Since scheduling fusion pass relies on peephole2 to do real fusion\n\
+work, it is only enabled by default when peephole2 is in effect.\n\
+\n\
+This is firstly introduced on ARM/AArch64 targets, please refer to\n\
+the hook implementation for how different fusion types are supported.",
+void, (rtx_insn *insn, int max_pri, int *fusion_pri, int *pri), NULL)
+
HOOK_VECTOR_END (sched)
/* Functions relating to OpenMP and Cilk Plus SIMD clones. */
@@ -1779,6 +1852,14 @@ HOOK_VECTOR_END (vectorize)
#undef HOOK_PREFIX
#define HOOK_PREFIX "TARGET_"
+DEFHOOK
+(record_offload_symbol,
+ "Used when offloaded functions are seen in the compilation unit and no named\n\
+sections are available. It is called once for each symbol that must be\n\
+recorded in the offload function and variable table.",
+ void, (tree),
+ hook_void_tree)
+
/* Allow target specific overriding of option settings after options have
been changed by an attribute or pragma or when it is reset at the
end of the code affected by an attribute or pragma. */
@@ -1794,6 +1875,15 @@ actions then, you should have @code{TARGET_OPTION_OVERRIDE} call\n\
void, (void),
hook_void_void)
+DEFHOOK
+(offload_options,
+ "Used when writing out the list of options into an LTO file. It should\n\
+translate any relevant target-specific options (such as the ABI in use)\n\
+into one of the @option{-foffload} options that exist as a common interface\n\
+to express such options. It should return a string containing these options,\n\
+separated by spaces, which the caller will free.\n",
+char *, (void), hook_charptr_void_null)
+
DEFHOOK_UNDOC
(eh_return_filter_mode,
"Return machine mode for filter value.",
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c2cbfe80aed..2829167e950 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,97 @@
+2014-11-14 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ * gcc.target/powerpc/ppc-fpconv-1.c: Adjust for -mupper-regs-df
+ changes.
+ * gcc.target/powerpc/ppc-fpconv-2.c: Likewise.
+ * gcc.target/powerpc/ppc-fpconv-3.c: Likewise.
+ * gcc.target/powerpc/ppc-fpconv-4.c: Likewise.
+ * gcc.target/powerpc/ppc-fpconv-5.c: Likewise.
+ * gcc.target/powerpc/ppc-fpconv-6.c: Likewise.
+ * gcc.target/powerpc/ppc-fpconv-7.c: Likewise.
+ * gcc.target/powerpc/ppc-fpconv-8.c: Likewise.
+ * gcc.target/powerpc/ppc-fpconv-9.c: Likewise.
+ * gcc.target/powerpc/ppc-fpconv-10.c: Likewise.
+ * gcc.target/powerpc/ppc-round.c: Likewise.
+
+2014-11-14 Martin Jambor <mjambor@suse.cz>
+
+ * g++.dg/ipa/devirt-11.C: Dont't run ipa-cp, remove times constraint
+ from the dump scan.
+ * g++.dg/ipa/devirt-21.C: Xfail.
+ * g++.dg/ipa/devirt-24.C: Likewise.
+ * g++.dg/ipa/devirt-10.C: Removed times constraint from the dump scan.
+ * g++.dg/ipa/devirt-41.C: Updated the dump scan.
+ * g++.dg/ipa/devirt-44.C: Likewise.
+ * g++.dg/ipa/devirt-43.C: Xfail.
+
+2014-11-14 Jonathan Wakely <jwakely@redhat.com>
+
+ * g++.dg/abi/abi-tag11.C: New.
+
+2014-11-14 Marek Polacek <polacek@redhat.com>
+
+ * c-c++-common/ubsan/overflow-negate-3.c: New test.
+
+2014-11-14 Marek Polacek <polacek@redhat.com>
+
+ PR sanitizer/63839
+ * c-c++-common/ubsan/pr63839.c: New test.
+ * c-c++-common/ubsan/unreachable-2.c: New test.
+
+2014-11-14 Richard Biener <rguenther@suse.de>
+
+ * gcc.c-torture/execute/shiftopt-1.c: XFAIL invalid parts.
+
+2014-11-13 Teresa Johnson <tejohnson@google.com>
+
+ PR tree-optimization/63841
+ * g++.dg/tree-ssa/pr63841.C: Remove prints, use abort.
+
+2014-11-14 Bin Cheng <bin.cheng@arm.com>
+
+ * gcc.target/arm/ldrd-strd-pair-1.c: New test.
+ * gcc.target/arm/vfp-1.c: Improve scanning string.
+
+2014-11-13 Rong Xu <xur@google.com>
+
+ PR debug/63581
+ * g++.dg/tree-prof/pr63581.C: New test.
+
+2014-11-13 Teresa Johnson <tejohnson@google.com>
+
+ PR tree-optimization/63841
+ * g++.dg/tree-ssa/pr63841.C: Remove prints, use abort.
+
+2014-11-13 Teresa Johnson <tejohnson@google.com>
+
+ PR tree-optimization/63841
+ * g++.dg/tree-ssa/pr63841.C: New test.
+
+2014-11-13 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/tree-ssa/forwprop-28.c: Adjust.
+
+2014-11-12 Alexander Ivchenko <alexander.ivchenko@intel.com>
+
+ * lib/target-supports.exp (error_h): New check.
+ (libc_has_complex_functions): Ditto.
+ (tgmath_h): Ditto.
+ * gcc.dg/builtins-59.c: Add libc_has_complex_functions check.
+ * gcc.dg/builtins-61.c: Likewise.
+ * gcc.dg/builtins-67.c: Disable test for Bionic.
+ * gcc.dg/strlenopt-14g.c: Likewise.
+ * gcc.dg/strlenopt-14gf.c: Likewise.
+ * gcc.dg/c99-tgmath-1.c: Add tgmath_h check.
+ * gcc.dg/c99-tgmath-2.c: Likewise.
+ * gcc.dg/c99-tgmath-3.c: Likewise.
+ * gcc.dg/c99-tgmath-4.c: Likewise.
+ * gcc.dg/dfp/convert-dfp-round-thread.c: Add error_h check.
+
+2014-11-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR ipa/63838
+ * g++.dg/ipa/pr63838.C: New test.
+
2014-11-12 Matthew Fortune <matthew.fortune@imgtec.com>
* gcc.target/mips/args-1.c: Handle __mips_fpr == 0.
@@ -3123,6 +3217,7 @@
* gcc.dg/attr-isr.c: Move SH specific test to ...
* gcc.target/sh/attr-isr.c: ... here.
+>>>>>>> .r217525
2014-10-17 Marek Polacek <polacek@redhat.com>
PR c/63567
diff --git a/gcc/testsuite/c-c++-common/ubsan/overflow-negate-3.c b/gcc/testsuite/c-c++-common/ubsan/overflow-negate-3.c
new file mode 100644
index 00000000000..e6db394a4f5
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/ubsan/overflow-negate-3.c
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=signed-integer-overflow" } */
+
+#define INT_MIN (-__INT_MAX__ - 1)
+
+int
+main ()
+{
+ int x = INT_MIN;
+ int y;
+ asm ("" : "+g" (x));
+ y = -(-x);
+ asm ("" : "+g" (y));
+ y = -(-INT_MIN);
+ asm ("" : "+g" (y));
+}
+
+/* { dg-output "negation of -2147483648 cannot be represented in type 'int'\[^\n\r]*; cast to an unsigned type to negate this value to itself\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*negation of -2147483648 cannot be represented in type 'int'\[^\n\r]*; cast to an unsigned type to negate this value to itself\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*negation of -2147483648 cannot be represented in type 'int'\[^\n\r]*; cast to an unsigned type to negate this value to itself\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*negation of -2147483648 cannot be represented in type 'int'\[^\n\r]*; cast to an unsigned type to negate this value to itself\[^\n\r]*(\n|\r\n|\r)" } */
diff --git a/gcc/testsuite/c-c++-common/ubsan/pr63839.c b/gcc/testsuite/c-c++-common/ubsan/pr63839.c
new file mode 100644
index 00000000000..e3933f7fe66
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/ubsan/pr63839.c
@@ -0,0 +1,23 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=unreachable" } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-O2" } } */
+/* { dg-shouldfail "ubsan" } */
+
+static void __attribute__ ((noreturn))
+bar ()
+{
+} /* { dg-warning "function does return" } */
+
+void
+foo ()
+{
+ bar ();
+}
+
+int
+main (void)
+{
+ foo ();
+}
+
+/* { dg-output "execution reached a __builtin_unreachable\\(\\) call" } */
diff --git a/gcc/testsuite/c-c++-common/ubsan/unreachable-2.c b/gcc/testsuite/c-c++-common/ubsan/unreachable-2.c
new file mode 100644
index 00000000000..783ebc24913
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/ubsan/unreachable-2.c
@@ -0,0 +1,14 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=unreachable" } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-O2" } } */
+/* { dg-shouldfail "ubsan" } */
+
+int e;
+
+int
+main (void)
+{
+ return e ? 0 : (__builtin_unreachable (), 1);
+}
+
+/* { dg-output "execution reached a __builtin_unreachable\\(\\) call" } */
diff --git a/gcc/testsuite/g++.dg/abi/abi-tag11.C b/gcc/testsuite/g++.dg/abi/abi-tag11.C
new file mode 100644
index 00000000000..36c1c9f0c09
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/abi-tag11.C
@@ -0,0 +1,12 @@
+// { dg-final { scan-assembler "_Z1fSbB3fooIwSt11char_traitsIwESaIwEES3_" } }
+
+namespace std {
+ template <class T> struct char_traits {};
+ template <class T> struct allocator {};
+ template <class T, class U, class V>
+ struct __attribute ((abi_tag ("foo"))) basic_string { };
+ typedef basic_string<wchar_t,char_traits<wchar_t>,allocator<wchar_t> >
+ wstring;
+}
+
+void f(std::wstring,std::wstring) {}
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-10.C b/gcc/testsuite/g++.dg/ipa/devirt-10.C
index 658442e3451..e29d33fa955 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-10.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-10.C
@@ -27,8 +27,6 @@ struct wxBufferedPaintDC : public wxBufferedDC {
void OnPaint(wxPaintEvent & event) {
wxBufferedPaintDC dc;
}
-/* IPA-CP should really discover both cases, but for time being the second is handled by inliner. */
-/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target" 1 "inline" } } */
-/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target" 1 "cp" } } */
+/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target" 2 "cp" } } */
/* { dg-final { cleanup-ipa-dump "inline" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-11.C b/gcc/testsuite/g++.dg/ipa/devirt-11.C
index 3246e214f14..7a698f16967 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-11.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-11.C
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-ipa-inline -fno-devirtualize-speculatively" } */
+/* { dg-options "-O2 -fno-ipa-cp -fdump-ipa-inline -fno-devirtualize-speculatively" } */
int baz ();
struct A
{
@@ -42,7 +42,5 @@ bar ()
baz ();
c + d;
}
-/* While inlining function called once we should devirtualize a new call to fn3.
- Because fn2 is already removed, we should not devirtualize. */
-/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target" 1 "inline" } } */
+/* { dg-final { scan-ipa-dump "Discovered a virtual call to a known target" "inline" } } */
/* { dg-final { cleanup-ipa-dump "inline" } } */
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-21.C b/gcc/testsuite/g++.dg/ipa/devirt-21.C
index 675bd08d782..99f60afe33c 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-21.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-21.C
@@ -37,5 +37,5 @@ main()
{
class C c;
}
-/* { dg-final { scan-ipa-dump "Discovered a virtual call to" "cp" { xfail *-*-* } } } */
+/* { dg-final { scan-ipa-dump "Discovered a virtual call to" "cp" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-24.C b/gcc/testsuite/g++.dg/ipa/devirt-24.C
index 01bfdc2ec50..6ac4b606d88 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-24.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-24.C
@@ -36,7 +36,7 @@ C *b = new (C);
sort(f, *b);
}
}
-/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target" 1 "inline" } } */
+/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target" 1 "inline" { xfail *-*-* } } } */
/* { dg-final { cleanup-ipa-dump "inline" } } */
/* { dg-final { scan-ipa-dump-times "Aggregate passed by reference" 1 "cp" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-41.C b/gcc/testsuite/g++.dg/ipa/devirt-41.C
index 5ba1158f8f7..926c3c49813 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-41.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-41.C
@@ -26,6 +26,6 @@ main()
Because the type is in static storage, we know it won't change type in dostuff
and from callstack we can tell that is is not in construction/destruction. */
-/* { dg-final { scan-ipa-dump-times "First type is base of second" 1 "inline" } } */
+/* { dg-final { scan-ipa-dump "Second type is base of first" "inline" } } */
/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target" 1 "inline" } } */
/* { dg-final { cleanup-ipa-dump "inline" } } */
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-43.C b/gcc/testsuite/g++.dg/ipa/devirt-43.C
index 9be49e764ea..be1aaa86754 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-43.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-43.C
@@ -23,5 +23,5 @@ t(struct B *b)
of type B. This makes A fully specified and we know C::foo is unlikely.
FIXME: We could most probably can devirtualize unconditonally because dereference of b in
&b->a makes the type known. GIMPLE does not represent this. */
-/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a speculative target" 1 "inline" } } */
+/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a speculative target" 1 "inline" { xfail *-*-* } } } */
/* { dg-final { cleanup-ipa-dump "inline" } } */
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-44.C b/gcc/testsuite/g++.dg/ipa/devirt-44.C
index cfc6e554459..214cf95d6e9 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-44.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-44.C
@@ -26,7 +26,7 @@ main()
/* Here one invocation of foo is while type is in construction, while other is not.
Check that we handle that. */
-/* { dg-final { scan-ipa-dump-times "First type is base of second" 1 "inline" } } */
+/* { dg-final { scan-ipa-dump "Second type is base of first" "inline" } } */
/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target\[^\\n\]*A::foo" 1 "inline" } } */
/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target\[^\\n\]*B::foo" 1 "inline" } } */
/* { dg-final { cleanup-ipa-dump "inline" } } */
diff --git a/gcc/testsuite/g++.dg/ipa/pr63838.C b/gcc/testsuite/g++.dg/ipa/pr63838.C
new file mode 100644
index 00000000000..d6736490080
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/pr63838.C
@@ -0,0 +1,56 @@
+// PR ipa/63838
+// { dg-do run }
+// { dg-options "-O2 -fdump-ipa-pure-const" }
+// { dg-final { scan-ipa-dump-not "Function found to be nothrow: void foo" "pure-const" } }
+// { dg-final { scan-ipa-dump-not "Function found to be nothrow: void bar" "pure-const" } }
+// { dg-final { cleanup-ipa-dump "pure-const" } }
+
+__attribute__((noinline, noclone)) static void bar (int);
+volatile int v;
+void (*fn) ();
+struct S { S () { v++; } ~S () { v++; } };
+
+__attribute__((noinline, noclone)) static void
+foo (int x)
+{
+ v++;
+ if (x == 5)
+ bar (x);
+}
+
+__attribute__((noinline, noclone)) static void
+bar (int x)
+{
+ v++;
+ if (x == 6)
+ foo (x);
+ else if (x == 5)
+ fn ();
+}
+
+__attribute__((noinline, noclone)) int
+baz (int x)
+{
+ S s;
+ foo (x);
+}
+
+void
+throw0 ()
+{
+ throw 0;
+}
+
+int
+main ()
+{
+ fn = throw0;
+ asm volatile ("" : : : "memory");
+ try
+ {
+ baz (5);
+ }
+ catch (int)
+ {
+ }
+}
diff --git a/gcc/testsuite/g++.dg/tree-prof/pr63581.C b/gcc/testsuite/g++.dg/tree-prof/pr63581.C
new file mode 100644
index 00000000000..c8caf076584
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tree-prof/pr63581.C
@@ -0,0 +1,91 @@
+// { dg-require-effective-target freorder }
+/* { dg-options "-O2 -g -fno-peel-loops" } */
+
+struct page {
+ int i;
+} global;
+
+__attribute__((noinline)) static struct page* find_page1 (int i)
+{
+ if ( i< 150)
+ return 0;
+ global.i = i;
+ return &global;
+}
+
+__attribute__((noinline)) static struct page* find_page2 (int i)
+{
+ global.i = i;
+ return &global;
+}
+
+volatile int ii;
+__attribute__((noinline)) static int zero (void)
+{
+ return ii;
+}
+
+static inline int uptodate (struct page* p)
+{
+ return (p->i < 709);
+}
+
+static struct page* bar(int i)
+{
+ struct page *page;
+
+repeat:
+ page = find_page1 (i);
+ if (!page) {
+ page = find_page2 (i);
+ if (!page)
+ return 0;
+ if (zero () ) {
+ zero ();
+ goto repeat;
+ }
+ }
+ return page;
+}
+
+__attribute__((noinline)) int foo (int n)
+{
+ struct page *page;
+
+retry:
+ page = bar (n);
+ if (page == 0)
+ return 0;
+ if (uptodate (page))
+ goto out;
+
+ zero ();
+ if (page->i < 0) {
+ zero ();
+ goto retry;
+ }
+out:
+ return 1;
+}
+
+__attribute__((noinline)) int hot (void)
+{
+ int i;
+ int sum = 0;
+
+ for (i = 0; i < 433038; i++)
+ sum+=i;
+
+ return sum;
+}
+
+int main(void)
+{
+ int i;
+
+ global.i = hot ();
+ for (i = 0; i < 858; i++)
+ foo (i);
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr63841.C b/gcc/testsuite/g++.dg/tree-ssa/pr63841.C
new file mode 100644
index 00000000000..2a2c78f9fb2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr63841.C
@@ -0,0 +1,35 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+#include <string>
+
+std::string __attribute__ ((noinline)) comp_test_write() {
+ std::string data;
+
+ for (int i = 0; i < 2; ++i) {
+ char b = 1 >> (i * 8);
+ data.append(&b, 1);
+ }
+
+ return data;
+}
+
+std::string __attribute__ ((noinline)) comp_test_write_good() {
+ std::string data;
+
+ char b;
+ for (int i = 0; i < 2; ++i) {
+ b = 1 >> (i * 8);
+ data.append(&b, 1);
+ }
+
+ return data;
+}
+
+int main() {
+ std::string good = comp_test_write_good();
+ std::string bad = comp_test_write();
+
+ if (good != bad)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/shiftopt-1.c b/gcc/testsuite/gcc.c-torture/execute/shiftopt-1.c
index 8c855b88895..3ff714d3b47 100644
--- a/gcc/testsuite/gcc.c-torture/execute/shiftopt-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/shiftopt-1.c
@@ -22,11 +22,16 @@ utest (unsigned int x)
if (0 >> x != 0)
link_error ();
+ /* XFAIL: the C frontend converts the shift amount to 'int'
+ thus we get -1 >> (int)x which means the shift amount may
+ be negative. See PR63862. */
+#if 0
if (-1 >> x != -1)
link_error ();
if (~0 >> x != ~0)
link_error ();
+#endif
}
void
diff --git a/gcc/testsuite/gcc.dg/builtins-59.c b/gcc/testsuite/gcc.dg/builtins-59.c
index b940d39ed60..f5c1803d5df 100644
--- a/gcc/testsuite/gcc.dg/builtins-59.c
+++ b/gcc/testsuite/gcc.dg/builtins-59.c
@@ -1,6 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-fdump-tree-gimple" } */
/* { dg-require-effective-target c99_runtime } */
+/* { dg-require-effective-target libc_has_complex_functions } */
double test (double x)
{
diff --git a/gcc/testsuite/gcc.dg/builtins-61.c b/gcc/testsuite/gcc.dg/builtins-61.c
index dff163ff112..a3310afbac2 100644
--- a/gcc/testsuite/gcc.dg/builtins-61.c
+++ b/gcc/testsuite/gcc.dg/builtins-61.c
@@ -1,6 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-O -ffast-math -fdump-tree-optimized" } */
/* { dg-require-effective-target c99_runtime } */
+/* { dg-require-effective-target libc_has_complex_functions } */
double test1 (double x)
{
diff --git a/gcc/testsuite/gcc.dg/builtins-67.c b/gcc/testsuite/gcc.dg/builtins-67.c
index 22267bd31b9..0992fe1597f 100644
--- a/gcc/testsuite/gcc.dg/builtins-67.c
+++ b/gcc/testsuite/gcc.dg/builtins-67.c
@@ -3,6 +3,8 @@
/* { dg-do link } */
/* { dg-options "-ffast-math -lm" } */
/* { dg-add-options c99_runtime } */
+/* Bionic doesn't have rintl */
+/* { dg-require-effective-target non_bionic } */
#include "builtins-config.h"
diff --git a/gcc/testsuite/gcc.dg/c99-tgmath-1.c b/gcc/testsuite/gcc.dg/c99-tgmath-1.c
index c7d848c7a6c..cfa02a91d33 100644
--- a/gcc/testsuite/gcc.dg/c99-tgmath-1.c
+++ b/gcc/testsuite/gcc.dg/c99-tgmath-1.c
@@ -3,6 +3,7 @@
/* { dg-do preprocess { target c99_runtime } } */
/* { dg-options "-std=iso9899:1999" } */
/* { dg-add-options c99_runtime } */
+/* { dg-require-effective-target tgmath_h } */
/* Test that tgmath defines the macros it's supposed to. */
#include <tgmath.h>
diff --git a/gcc/testsuite/gcc.dg/c99-tgmath-2.c b/gcc/testsuite/gcc.dg/c99-tgmath-2.c
index d4f1f87cfa9..1a1153cc6ea 100644
--- a/gcc/testsuite/gcc.dg/c99-tgmath-2.c
+++ b/gcc/testsuite/gcc.dg/c99-tgmath-2.c
@@ -3,6 +3,7 @@
/* { dg-do compile { target c99_runtime } } */
/* { dg-options "-std=iso9899:1999" } */
/* { dg-add-options c99_runtime } */
+/* { dg-require-effective-target tgmath_h } */
/* Test that invoking type-generic sin on a float invokes sinf. */
#include <tgmath.h>
diff --git a/gcc/testsuite/gcc.dg/c99-tgmath-3.c b/gcc/testsuite/gcc.dg/c99-tgmath-3.c
index 3e983042751..a595cf68559 100644
--- a/gcc/testsuite/gcc.dg/c99-tgmath-3.c
+++ b/gcc/testsuite/gcc.dg/c99-tgmath-3.c
@@ -3,6 +3,7 @@
/* { dg-do compile { target c99_runtime } } */
/* { dg-options "-std=iso9899:1999" } */
/* { dg-add-options c99_runtime } */
+/* { dg-require-effective-target tgmath_h } */
/* Test that invoking type-generic exp on a complex invokes cexp. */
#include <tgmath.h>
diff --git a/gcc/testsuite/gcc.dg/c99-tgmath-4.c b/gcc/testsuite/gcc.dg/c99-tgmath-4.c
index d8dc043c261..c05a1c59ebc 100644
--- a/gcc/testsuite/gcc.dg/c99-tgmath-4.c
+++ b/gcc/testsuite/gcc.dg/c99-tgmath-4.c
@@ -3,6 +3,7 @@
/* { dg-do compile { target c99_runtime } } */
/* { dg-options "-std=iso9899:1999" } */
/* { dg-add-options c99_runtime } */
+/* { dg-require-effective-target tgmath_h } */
/* Test that invoking type-generic pow on complex float invokes cpowf. */
#include <tgmath.h>
diff --git a/gcc/testsuite/gcc.dg/dfp/convert-dfp-round-thread.c b/gcc/testsuite/gcc.dg/dfp/convert-dfp-round-thread.c
index 6727e800c3f..59d9569b84f 100644
--- a/gcc/testsuite/gcc.dg/dfp/convert-dfp-round-thread.c
+++ b/gcc/testsuite/gcc.dg/dfp/convert-dfp-round-thread.c
@@ -1,5 +1,7 @@
/* { dg-options "-std=gnu99 -D_GNU_SOURCE -pthread" } */
/* { dg-do run { target i?86-*-linux* i?86-*-gnu* x86_64-*-linux* } } */
+/* { dg-require-effective-target error_h } */
+
/* N1150 5.2: Conversions among decimal floating types and between
decimal floating types and generic floating types.
diff --git a/gcc/testsuite/gcc.dg/strlenopt-14g.c b/gcc/testsuite/gcc.dg/strlenopt-14g.c
index 86c57f195f0..8bc47903be1 100644
--- a/gcc/testsuite/gcc.dg/strlenopt-14g.c
+++ b/gcc/testsuite/gcc.dg/strlenopt-14g.c
@@ -1,6 +1,8 @@
/* This test needs runtime that provides stpcpy and mempcpy functions. */
/* { dg-do run { target *-*-linux* *-*-gnu* } } */
/* { dg-options "-O2 -fdump-tree-strlen" } */
+/* Bionic targets don't have mempcpy */
+/* { dg-require-effective-target non_bionic } */
#define USE_GNU
#include "strlenopt.h"
diff --git a/gcc/testsuite/gcc.dg/strlenopt-14gf.c b/gcc/testsuite/gcc.dg/strlenopt-14gf.c
index 8b78538d41d..54bb3a1b065 100644
--- a/gcc/testsuite/gcc.dg/strlenopt-14gf.c
+++ b/gcc/testsuite/gcc.dg/strlenopt-14gf.c
@@ -2,6 +2,8 @@
functions. */
/* { dg-do run { target *-*-linux* *-*-gnu* } } */
/* { dg-options "-O2 -fdump-tree-strlen" } */
+/* Bionic targets don't have mempcpy */
+/* { dg-require-effective-target non_bionic } */
#define FORTIFY_SOURCE 2
#include "strlenopt-14g.c"
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-28.c b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-28.c
index 5c945fce41b..1824131086a 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-28.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-28.c
@@ -79,6 +79,11 @@ test_8 (int code)
oof ();
}
-/* { dg-final { scan-tree-dump-times "simplified to if \\\(\[^ ]* <" 8 "forwprop1"} } */
+/* ??? This used to check for 8 times transforming the combined conditional
+ to a ordered compare. But the transform does not trigger if we transform
+ the negated code == 22 compare to code != 22 first. It turns out if
+ we do that we even generate better code on x86 at least. */
+
+/* { dg-final { scan-tree-dump-times "simplified to if \\\(\[^ ]* <" 4 "forwprop1"} } */
/* { dg-final { cleanup-tree-dump "forwprop1" } } */
diff --git a/gcc/testsuite/gcc.target/arm/ldrd-strd-pair-1.c b/gcc/testsuite/gcc.target/arm/ldrd-strd-pair-1.c
new file mode 100644
index 00000000000..7a0bff5f841
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/ldrd-strd-pair-1.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_prefer_ldrd_strd } */
+/* { dg-options "-O2 -mthumb" } */
+
+struct
+{
+ int x;
+ int y;
+ char c;
+ int d;
+}a;
+
+int foo(int x, int y)
+{
+ int c;
+ a.x = x;
+ c = a.x;
+ a.d = c;
+ a.y = y;
+
+ return 0;
+}
+/* { dg-final { scan-assembler "strd\t" { target { arm_thumb2_ok } } } } */
diff --git a/gcc/testsuite/gcc.target/arm/vfp-1.c b/gcc/testsuite/gcc.target/arm/vfp-1.c
index 8ceef2ba637..b6bb7be9995 100644
--- a/gcc/testsuite/gcc.target/arm/vfp-1.c
+++ b/gcc/testsuite/gcc.target/arm/vfp-1.c
@@ -126,7 +126,7 @@ void test_convert () {
}
void test_ldst (float f[], double d[]) {
- /* { dg-final { scan-assembler "vldr.32.+ \\\[r0, #1020\\\]" } } */
+ /* { dg-final { scan-assembler "vldr.32.+ \\\[r0, #-?\[0-9\]+\\\]" } } */
/* { dg-final { scan-assembler "vldr.32.+ \\\[r\[0-9\], #-1020\\\]" { target { arm32 && { ! arm_thumb2_ok } } } } } */
/* { dg-final { scan-assembler "add.+ r0, #1024" } } */
/* { dg-final { scan-assembler "vstr.32.+ \\\[r\[0-9\]\\\]\n" } } */
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index a31d050b436..02b2b778418 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -5124,6 +5124,30 @@ proc check_effective_target_non_bionic {} {
}]
}
+# Return true if this target has error.h header.
+
+proc check_effective_target_error_h {} {
+ return [check_no_compiler_messages error_h object {
+ #include <error.h>
+ }]
+}
+
+# Return true if this target has tgmath.h header.
+
+proc check_effective_target_tgmath_h {} {
+ return [check_no_compiler_messages tgmath_h object {
+ #include <tgmath.h>
+ }]
+}
+
+# Return true if target's libc supports complex functions.
+
+proc check_effective_target_libc_has_complex_functions {} {
+ return [check_no_compiler_messages libc_has_complex_functions object {
+ #include <complex.h>
+ }]
+}
+
# Return 1 if
# (a) an error of a few ULP is expected in string to floating-point
# conversion functions; and
diff --git a/gcc/timevar.def b/gcc/timevar.def
index f3e7b889069..5d8d0e769b5 100644
--- a/gcc/timevar.def
+++ b/gcc/timevar.def
@@ -237,6 +237,7 @@ DEFTIMEVAR (TV_LRA_INHERITANCE , "LRA reload inheritance")
DEFTIMEVAR (TV_LRA_CREATE_LIVE_RANGES, "LRA create live ranges")
DEFTIMEVAR (TV_LRA_ASSIGN , "LRA hard reg assignment")
DEFTIMEVAR (TV_LRA_COALESCE , "LRA coalesce pseudo regs")
+DEFTIMEVAR (TV_LRA_REMAT , "LRA rematerialization")
DEFTIMEVAR (TV_RELOAD , "reload")
DEFTIMEVAR (TV_RELOAD_CSE_REGS , "reload CSE regs")
DEFTIMEVAR (TV_GCSE_AFTER_RELOAD , "load CSE after reload")
@@ -246,6 +247,7 @@ DEFTIMEVAR (TV_IFCVT2 , "if-conversion 2")
DEFTIMEVAR (TV_COMBINE_STACK_ADJUST , "combine stack adjustments")
DEFTIMEVAR (TV_PEEPHOLE2 , "peephole 2")
DEFTIMEVAR (TV_RENAME_REGISTERS , "rename registers")
+DEFTIMEVAR (TV_SCHED_FUSION , "scheduling fusion")
DEFTIMEVAR (TV_CPROP_REGISTERS , "hard reg cprop")
DEFTIMEVAR (TV_SCHED2 , "scheduling 2")
DEFTIMEVAR (TV_MACH_DEP , "machine dep reorg")
diff --git a/gcc/toplev.c b/gcc/toplev.c
index aa1653e7c44..2ed76bc610d 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -98,6 +98,7 @@ along with GCC; see the file COPYING3. If not see
#include "insn-codes.h"
#include "optabs.h"
#include "tree-chkp.h"
+#include "omp-low.h"
#if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO)
#include "dbxout.h"
@@ -601,6 +602,8 @@ compile_file (void)
if (flag_check_pointer_bounds)
chkp_finish_file ();
+ omp_finish_file ();
+
output_shared_constant_pool ();
output_object_blocks ();
finish_tm_clone_pairs ();
@@ -1264,12 +1267,28 @@ process_options (void)
maximum_field_alignment = initial_max_fld_align * BITS_PER_UNIT;
- /* Default to -fdiagnostics-color=auto if GCC_COLORS is in the environment,
- otherwise default to -fdiagnostics-color=never. */
- if (!global_options_set.x_flag_diagnostics_show_color
- && getenv ("GCC_COLORS"))
- pp_show_color (global_dc->printer)
- = colorize_init (DIAGNOSTICS_COLOR_AUTO);
+ /* If DIAGNOSTICS_COLOR_DEFAULT is -1, default to -fdiagnostics-color=auto
+ if GCC_COLORS is in the environment, otherwise default to
+ -fdiagnostics-color=never, for other values default to that
+ -fdiagnostics-color={never,auto,always}. */
+ if (!global_options_set.x_flag_diagnostics_show_color)
+ switch ((int) DIAGNOSTICS_COLOR_DEFAULT)
+ {
+ case -1:
+ if (!getenv ("GCC_COLORS"))
+ break;
+ /* FALLTHRU */
+ case DIAGNOSTICS_COLOR_AUTO:
+ pp_show_color (global_dc->printer)
+ = colorize_init (DIAGNOSTICS_COLOR_AUTO);
+ break;
+ case DIAGNOSTICS_COLOR_YES:
+ pp_show_color (global_dc->printer)
+ = colorize_init (DIAGNOSTICS_COLOR_YES);
+ break;
+ default:
+ break;
+ }
/* Allow the front end to perform consistency checks and do further
initialization based on the command line options. This hook also
@@ -1470,7 +1489,7 @@ process_options (void)
debug_hooks = &vmsdbg_debug_hooks;
#endif
else
- error ("target system does not support the \"%s\" debug format",
+ error ("target system does not support the %qs debug format",
debug_type_names[write_symbols]);
/* We know which debug output will be used so we can set flag_var_tracking
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index ee10bc614b1..904f2ddf9fb 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -3675,38 +3675,6 @@ verify_gimple_assign_binary (gimple stmt)
return false;
}
- case VEC_RSHIFT_EXPR:
- {
- if (TREE_CODE (rhs1_type) != VECTOR_TYPE
- || !(INTEGRAL_TYPE_P (TREE_TYPE (rhs1_type))
- || POINTER_TYPE_P (TREE_TYPE (rhs1_type))
- || FIXED_POINT_TYPE_P (TREE_TYPE (rhs1_type))
- || SCALAR_FLOAT_TYPE_P (TREE_TYPE (rhs1_type)))
- || (!INTEGRAL_TYPE_P (rhs2_type)
- && (TREE_CODE (rhs2_type) != VECTOR_TYPE
- || !INTEGRAL_TYPE_P (TREE_TYPE (rhs2_type))))
- || !useless_type_conversion_p (lhs_type, rhs1_type))
- {
- error ("type mismatch in vector shift expression");
- debug_generic_expr (lhs_type);
- debug_generic_expr (rhs1_type);
- debug_generic_expr (rhs2_type);
- return true;
- }
- /* For shifting a vector of non-integral components we
- only allow shifting by a constant multiple of the element size. */
- if (!INTEGRAL_TYPE_P (TREE_TYPE (rhs1_type))
- && (TREE_CODE (rhs2) != INTEGER_CST
- || !div_if_zero_remainder (rhs2,
- TYPE_SIZE (TREE_TYPE (rhs1_type)))))
- {
- error ("non-element sized vector shift of floating point vector");
- return true;
- }
-
- return false;
- }
-
case WIDEN_LSHIFT_EXPR:
{
if (!INTEGRAL_TYPE_P (lhs_type)
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 8cb951095c4..520546e3d09 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -3807,7 +3807,6 @@ estimate_operator_cost (enum tree_code code, eni_weights *weights,
case RSHIFT_EXPR:
case LROTATE_EXPR:
case RROTATE_EXPR:
- case VEC_RSHIFT_EXPR:
case BIT_IOR_EXPR:
case BIT_XOR_EXPR:
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index 09b3f163c11..e5dca78082c 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -1753,7 +1753,6 @@ gen_parallel_loop (struct loop *loop,
tree many_iterations_cond, type, nit;
tree arg_struct, new_arg_struct;
gimple_seq stmts;
- basic_block parallel_head;
edge entry, exit;
struct clsn_data clsn_data;
unsigned prob;
@@ -1891,8 +1890,8 @@ gen_parallel_loop (struct loop *loop,
cond_stmt = last_stmt (loop->header);
if (cond_stmt)
loc = gimple_location (cond_stmt);
- parallel_head = create_parallel_loop (loop, create_loop_fn (loc), arg_struct,
- new_arg_struct, n_threads, loc);
+ create_parallel_loop (loop, create_loop_fn (loc), arg_struct,
+ new_arg_struct, n_threads, loc);
if (reduction_list->elements () > 0)
create_call_for_reduction (loop, reduction_list, &clsn_data);
@@ -1906,13 +1905,6 @@ gen_parallel_loop (struct loop *loop,
removed statements. */
FOR_EACH_LOOP (loop, 0)
free_numbers_of_iterations_estimates_loop (loop);
-
- /* Expand the parallel constructs. We do it directly here instead of running
- a separate expand_omp pass, since it is more efficient, and less likely to
- cause troubles with further analyses not being able to deal with the
- OMP trees. */
-
- omp_expand_local (parallel_head);
}
/* Returns true when LOOP contains vector phi nodes. */
@@ -2284,7 +2276,11 @@ pass_parallelize_loops::execute (function *fun)
return 0;
if (parallelize_loops ())
- return TODO_cleanup_cfg | TODO_rebuild_alias;
+ {
+ fun->curr_properties &= ~(PROP_gimple_eomp);
+ return TODO_update_ssa;
+ }
+
return 0;
}
diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index a3efdd84b08..a3e1e729124 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -220,6 +220,7 @@ protected:
#define PROP_gimple_lcx (1 << 10) /* lowered complex */
#define PROP_loops (1 << 11) /* preserve loop structures */
#define PROP_gimple_lvec (1 << 12) /* lowered vector */
+#define PROP_gimple_eomp (1 << 13) /* no OpenMP directives */
#define PROP_trees \
(PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh | PROP_gimple_lomp)
@@ -399,6 +400,7 @@ extern gimple_opt_pass *make_pass_lower_vector_ssa (gcc::context *ctxt);
extern gimple_opt_pass *make_pass_lower_omp (gcc::context *ctxt);
extern gimple_opt_pass *make_pass_diagnose_omp_blocks (gcc::context *ctxt);
extern gimple_opt_pass *make_pass_expand_omp (gcc::context *ctxt);
+extern gimple_opt_pass *make_pass_expand_omp_ssa (gcc::context *ctxt);
extern gimple_opt_pass *make_pass_object_sizes (gcc::context *ctxt);
extern gimple_opt_pass *make_pass_strlen (gcc::context *ctxt);
extern gimple_opt_pass *make_pass_fold_builtins (gcc::context *ctxt);
@@ -550,6 +552,7 @@ extern rtl_opt_pass *make_pass_branch_target_load_optimize1 (gcc::context
extern rtl_opt_pass *make_pass_thread_prologue_and_epilogue (gcc::context
*ctxt);
extern rtl_opt_pass *make_pass_stack_adjustments (gcc::context *ctxt);
+extern rtl_opt_pass *make_pass_sched_fusion (gcc::context *ctxt);
extern rtl_opt_pass *make_pass_peephole2 (gcc::context *ctxt);
extern rtl_opt_pass *make_pass_if_after_reload (gcc::context *ctxt);
extern rtl_opt_pass *make_pass_regrename (gcc::context *ctxt);
@@ -600,7 +603,7 @@ extern void pass_fini_dump_file (opt_pass *);
extern const char *get_current_pass_name (void);
extern void print_current_pass (FILE *);
extern void debug_pass (void);
-extern void ipa_write_summaries (void);
+extern void ipa_write_summaries (bool);
extern void ipa_write_optimization_summaries (struct lto_symtab_encoder_d *);
extern void ipa_read_summaries (void);
extern void ipa_read_optimization_summaries (void);
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index b8abd144f59..53720ded5cd 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -1858,7 +1858,6 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
case RSHIFT_EXPR:
case LROTATE_EXPR:
case RROTATE_EXPR:
- case VEC_RSHIFT_EXPR:
case WIDEN_LSHIFT_EXPR:
case BIT_IOR_EXPR:
case BIT_XOR_EXPR:
@@ -3038,7 +3037,6 @@ op_code_prio (enum tree_code code)
case REDUC_MAX_EXPR:
case REDUC_MIN_EXPR:
case REDUC_PLUS_EXPR:
- case VEC_RSHIFT_EXPR:
case VEC_UNPACK_HI_EXPR:
case VEC_UNPACK_LO_EXPR:
case VEC_UNPACK_FLOAT_HI_EXPR:
@@ -3148,9 +3146,6 @@ op_symbol_code (enum tree_code code)
case RROTATE_EXPR:
return "r>>";
- case VEC_RSHIFT_EXPR:
- return "v>>";
-
case WIDEN_LSHIFT_EXPR:
return "w<<";
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 52d85036e1f..b3efa99f6f6 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -1126,6 +1126,27 @@ valueize_op (tree op)
return op;
}
+/* Return the constant value for OP, but signal to not follow SSA
+ edges if the definition may be simulated again. */
+
+static tree
+valueize_op_1 (tree op)
+{
+ if (TREE_CODE (op) == SSA_NAME)
+ {
+ tree tem = get_constant_value (op);
+ if (tem)
+ return tem;
+ /* If the definition may be simulated again we cannot follow
+ this SSA edge as the SSA propagator does not necessarily
+ re-visit the use. */
+ gimple def_stmt = SSA_NAME_DEF_STMT (op);
+ if (prop_simulate_again_p (def_stmt))
+ return NULL_TREE;
+ }
+ return op;
+}
+
/* CCP specific front-end to the non-destructive constant folding
routines.
@@ -1158,7 +1179,8 @@ ccp_fold (gimple stmt)
case GIMPLE_ASSIGN:
case GIMPLE_CALL:
- return gimple_fold_stmt_to_constant_1 (stmt, valueize_op);
+ return gimple_fold_stmt_to_constant_1 (stmt,
+ valueize_op, valueize_op_1);
default:
gcc_unreachable ();
@@ -2568,6 +2590,9 @@ optimize_unreachable (gimple_stmt_iterator i)
edge e;
bool ret;
+ if (flag_sanitize & SANITIZE_UNREACHABLE)
+ return false;
+
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
stmt = gsi_stmt (gsi);
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index 6543dc7d26a..3a230584853 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -1402,6 +1402,11 @@ eliminate_unnecessary_stmts (void)
maybe_clean_or_replace_eh_stmt (stmt, stmt);
update_stmt (stmt);
release_ssa_name (name);
+
+ /* GOMP_SIMD_LANE without lhs is not needed. */
+ if (gimple_call_internal_p (stmt)
+ && gimple_call_internal_fn (stmt) == IFN_GOMP_SIMD_LANE)
+ remove_dead_stmt (&gsi, bb);
}
else if (gimple_call_internal_p (stmt))
switch (gimple_call_internal_fn (stmt))
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index b47f7e20251..d42dcf891a9 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -233,38 +233,6 @@ fwprop_invalidate_lattice (tree name)
}
-/* Get the next statement we can propagate NAME's value into skipping
- trivial copies. Returns the statement that is suitable as a
- propagation destination or NULL_TREE if there is no such one.
- This only returns destinations in a single-use chain. FINAL_NAME_P
- if non-NULL is written to the ssa name that represents the use. */
-
-static gimple
-get_prop_dest_stmt (tree name, tree *final_name_p)
-{
- use_operand_p use;
- gimple use_stmt;
-
- do {
- /* If name has multiple uses, bail out. */
- if (!single_imm_use (name, &use, &use_stmt))
- return NULL;
-
- /* If this is not a trivial copy, we found it. */
- if (!gimple_assign_ssa_name_copy_p (use_stmt)
- || gimple_assign_rhs1 (use_stmt) != name)
- break;
-
- /* Continue searching uses of the copy destination. */
- name = gimple_assign_lhs (use_stmt);
- } while (1);
-
- if (final_name_p)
- *final_name_p = name;
-
- return use_stmt;
-}
-
/* Get the statement we can propagate from into NAME skipping
trivial copies. Returns the statement which defines the
propagation source or NULL_TREE if there is no such one.
@@ -617,7 +585,6 @@ forward_propagate_into_cond (gimple_stmt_iterator *gsi_p)
tree tmp = NULL_TREE;
tree cond = gimple_assign_rhs1 (stmt);
enum tree_code code = gimple_assign_rhs_code (stmt);
- bool swap = false;
/* We can do tree combining on SSA_NAME and comparison expressions. */
if (COMPARISON_CLASS_P (cond))
@@ -640,15 +607,6 @@ forward_propagate_into_cond (gimple_stmt_iterator *gsi_p)
TREE_TYPE (cond),
gimple_assign_rhs1 (def_stmt),
gimple_assign_rhs2 (def_stmt));
- else if (code == COND_EXPR
- && ((def_code == BIT_NOT_EXPR
- && TYPE_PRECISION (TREE_TYPE (cond)) == 1)
- || (def_code == BIT_XOR_EXPR
- && integer_onep (gimple_assign_rhs2 (def_stmt)))))
- {
- tmp = gimple_assign_rhs1 (def_stmt);
- swap = true;
- }
}
if (tmp
@@ -669,15 +627,7 @@ forward_propagate_into_cond (gimple_stmt_iterator *gsi_p)
else if (integer_zerop (tmp))
gimple_assign_set_rhs_from_tree (gsi_p, gimple_assign_rhs3 (stmt));
else
- {
- gimple_assign_set_rhs1 (stmt, unshare_expr (tmp));
- if (swap)
- {
- tree t = gimple_assign_rhs2 (stmt);
- gimple_assign_set_rhs2 (stmt, gimple_assign_rhs3 (stmt));
- gimple_assign_set_rhs3 (stmt, t);
- }
- }
+ gimple_assign_set_rhs1 (stmt, unshare_expr (tmp));
stmt = gsi_stmt (*gsi_p);
update_stmt (stmt);
@@ -687,58 +637,6 @@ forward_propagate_into_cond (gimple_stmt_iterator *gsi_p)
return 0;
}
-/* Propagate from the ssa name definition statements of COND_EXPR
- values in the rhs of statement STMT into the conditional arms
- if that simplifies it.
- Returns true if the stmt was changed. */
-
-static bool
-combine_cond_exprs (gimple_stmt_iterator *gsi_p)
-{
- gimple stmt = gsi_stmt (*gsi_p);
- tree cond, val1, val2;
- bool changed = false;
-
- cond = gimple_assign_rhs1 (stmt);
- val1 = gimple_assign_rhs2 (stmt);
- if (TREE_CODE (val1) == SSA_NAME)
- {
- gimple def_stmt = SSA_NAME_DEF_STMT (val1);
- if (is_gimple_assign (def_stmt)
- && gimple_assign_rhs_code (def_stmt) == gimple_assign_rhs_code (stmt)
- && operand_equal_p (gimple_assign_rhs1 (def_stmt), cond, 0))
- {
- val1 = unshare_expr (gimple_assign_rhs2 (def_stmt));
- gimple_assign_set_rhs2 (stmt, val1);
- changed = true;
- }
- }
- val2 = gimple_assign_rhs3 (stmt);
- if (TREE_CODE (val2) == SSA_NAME)
- {
- gimple def_stmt = SSA_NAME_DEF_STMT (val2);
- if (is_gimple_assign (def_stmt)
- && gimple_assign_rhs_code (def_stmt) == gimple_assign_rhs_code (stmt)
- && operand_equal_p (gimple_assign_rhs1 (def_stmt), cond, 0))
- {
- val2 = unshare_expr (gimple_assign_rhs3 (def_stmt));
- gimple_assign_set_rhs3 (stmt, val2);
- changed = true;
- }
- }
- if (operand_equal_p (val1, val2, 0))
- {
- gimple_assign_set_rhs_from_tree (gsi_p, val1);
- stmt = gsi_stmt (*gsi_p);
- changed = true;
- }
-
- if (changed)
- update_stmt (stmt);
-
- return changed;
-}
-
/* We've just substituted an ADDR_EXPR into stmt. Update all the
relevant data structures to match. */
@@ -1130,90 +1028,6 @@ forward_propagate_addr_expr (tree name, tree rhs, bool parent_single_use_p)
}
-/* Forward propagate the comparison defined in *DEFGSI like
- cond_1 = x CMP y to uses of the form
- a_1 = (T')cond_1
- a_1 = !cond_1
- a_1 = cond_1 != 0
- Returns true if stmt is now unused. Advance DEFGSI to the next
- statement. */
-
-static bool
-forward_propagate_comparison (gimple_stmt_iterator *defgsi)
-{
- gimple stmt = gsi_stmt (*defgsi);
- tree name = gimple_assign_lhs (stmt);
- gimple use_stmt;
- tree tmp = NULL_TREE;
- gimple_stmt_iterator gsi;
- enum tree_code code;
- tree lhs;
-
- /* Don't propagate ssa names that occur in abnormal phis. */
- if ((TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME
- && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (gimple_assign_rhs1 (stmt)))
- || (TREE_CODE (gimple_assign_rhs2 (stmt)) == SSA_NAME
- && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (gimple_assign_rhs2 (stmt))))
- goto bailout;
-
- /* Do not un-cse comparisons. But propagate through copies. */
- use_stmt = get_prop_dest_stmt (name, &name);
- if (!use_stmt
- || !is_gimple_assign (use_stmt))
- goto bailout;
-
- code = gimple_assign_rhs_code (use_stmt);
- lhs = gimple_assign_lhs (use_stmt);
- if (!INTEGRAL_TYPE_P (TREE_TYPE (lhs)))
- goto bailout;
-
- /* We can propagate the condition into a statement that
- computes the logical negation of the comparison result. */
- if ((code == BIT_NOT_EXPR
- && TYPE_PRECISION (TREE_TYPE (lhs)) == 1)
- || (code == BIT_XOR_EXPR
- && integer_onep (gimple_assign_rhs2 (use_stmt))))
- {
- tree type = TREE_TYPE (gimple_assign_rhs1 (stmt));
- bool nans = HONOR_NANS (TYPE_MODE (type));
- enum tree_code inv_code;
- inv_code = invert_tree_comparison (gimple_assign_rhs_code (stmt), nans);
- if (inv_code == ERROR_MARK)
- goto bailout;
-
- tmp = build2 (inv_code, TREE_TYPE (lhs), gimple_assign_rhs1 (stmt),
- gimple_assign_rhs2 (stmt));
- }
- else
- goto bailout;
-
- gsi = gsi_for_stmt (use_stmt);
- gimple_assign_set_rhs_from_tree (&gsi, unshare_expr (tmp));
- use_stmt = gsi_stmt (gsi);
- update_stmt (use_stmt);
-
- if (dump_file && (dump_flags & TDF_DETAILS))
- {
- fprintf (dump_file, " Replaced '");
- print_gimple_expr (dump_file, stmt, 0, dump_flags);
- fprintf (dump_file, "' with '");
- print_gimple_expr (dump_file, use_stmt, 0, dump_flags);
- fprintf (dump_file, "'\n");
- }
-
- /* When we remove stmt now the iterator defgsi goes off it's current
- sequence, hence advance it now. */
- gsi_next (defgsi);
-
- /* Remove defining statements. */
- return remove_prop_source_from_use (name);
-
-bailout:
- gsi_next (defgsi);
- return false;
-}
-
-
/* Helper function for simplify_gimple_switch. Remove case labels that
have values outside the range of the new type. */
@@ -2386,11 +2200,6 @@ pass_forwprop::execute (function *fun)
else
gsi_next (&gsi);
}
- else if (TREE_CODE_CLASS (code) == tcc_comparison)
- {
- if (forward_propagate_comparison (&gsi))
- cfg_changed = true;
- }
else
gsi_next (&gsi);
}
@@ -2432,8 +2241,7 @@ pass_forwprop::execute (function *fun)
|| code == VEC_COND_EXPR)
{
/* In this case the entire COND_EXPR is in rhs1. */
- if (forward_propagate_into_cond (&gsi)
- || combine_cond_exprs (&gsi))
+ if (forward_propagate_into_cond (&gsi))
{
changed = true;
stmt = gsi_stmt (gsi);
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
index 73ad46aedac..9bc8842946c 100644
--- a/gcc/tree-ssa-loop-ivcanon.c
+++ b/gcc/tree-ssa-loop-ivcanon.c
@@ -29,7 +29,7 @@ along with GCC; see the file COPYING3. If not see
to pay up.
We also perform
- - complette unrolling (or peeling) when the loops is rolling few enough
+ - complete unrolling (or peeling) when the loops is rolling few enough
times
- simple peeling (i.e. copying few initial iterations prior the loop)
when number of iteration estimate is known (typically by the profile
@@ -422,7 +422,7 @@ estimated_unrolled_size (struct loop_size *size,
the same time it does not make any code potentially executed
during the last iteration dead.
- After complette unrolling we still may get rid of the conditional
+ After complete unrolling we still may get rid of the conditional
on the exit in the last copy even if we have no idea what it does.
This is quite common case for loops of form
@@ -775,7 +775,7 @@ try_unroll_loop_completely (struct loop *loop,
loop->num);
return false;
}
- /* Outer loops tend to be less interesting candidates for complette
+ /* Outer loops tend to be less interesting candidates for complete
unrolling unless we can do a lot of propagation into the inner loop
body. For now we disable outer loop unrolling when the code would
grow. */
@@ -986,7 +986,7 @@ try_peel_loop (struct loop *loop,
{
if (dump_file)
fprintf (dump_file, "Not peeling: upper bound is known so can "
- "unroll complettely\n");
+ "unroll completely\n");
return false;
}
diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c
index c224fd9a3f8..3789e30449d 100644
--- a/gcc/tree-ssa-strlen.c
+++ b/gcc/tree-ssa-strlen.c
@@ -1934,7 +1934,7 @@ strlen_optimize_stmt (gimple_stmt_iterator *gsi)
break;
}
}
- else if (is_gimple_assign (stmt))
+ else if (is_gimple_assign (stmt) && !gimple_clobber_p (stmt))
{
tree lhs = gimple_assign_lhs (stmt);
diff --git a/gcc/tree-streamer-in.c b/gcc/tree-streamer-in.c
index 371e3164822..c63bc607d8a 100644
--- a/gcc/tree-streamer-in.c
+++ b/gcc/tree-streamer-in.c
@@ -506,9 +506,6 @@ unpack_value_fields (struct data_in *data_in, struct bitpack_d *bp, tree expr)
if (CODE_CONTAINS_STRUCT (code, TS_TRANSLATION_UNIT_DECL))
unpack_ts_translation_unit_decl_value_fields (data_in, bp, expr);
- if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION))
- gcc_unreachable ();
-
if (CODE_CONTAINS_STRUCT (code, TS_OPTIMIZATION))
unpack_ts_optimization (bp, expr);
@@ -526,6 +523,9 @@ unpack_value_fields (struct data_in *data_in, struct bitpack_d *bp, tree expr)
vec_safe_grow (CONSTRUCTOR_ELTS (expr), length);
}
+ if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION))
+ cl_target_option_stream_in (data_in, bp, TREE_TARGET_OPTION (expr));
+
if (code == OMP_CLAUSE)
unpack_ts_omp_clause_value_fields (data_in, bp, expr);
}
diff --git a/gcc/tree-streamer-out.c b/gcc/tree-streamer-out.c
index 7419f5ae34f..41dca6e6abd 100644
--- a/gcc/tree-streamer-out.c
+++ b/gcc/tree-streamer-out.c
@@ -472,9 +472,6 @@ streamer_pack_tree_bitfields (struct output_block *ob,
if (CODE_CONTAINS_STRUCT (code, TS_TRANSLATION_UNIT_DECL))
pack_ts_translation_unit_decl_value_fields (ob, bp, expr);
- if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION))
- gcc_unreachable ();
-
if (CODE_CONTAINS_STRUCT (code, TS_OPTIMIZATION))
pack_ts_optimization (bp, expr);
@@ -484,6 +481,9 @@ streamer_pack_tree_bitfields (struct output_block *ob,
if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR))
bp_pack_var_len_unsigned (bp, CONSTRUCTOR_NELTS (expr));
+ if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION))
+ cl_target_option_stream_out (ob, bp, TREE_TARGET_OPTION (expr));
+
if (code == OMP_CLAUSE)
pack_ts_omp_clause_value_fields (ob, bp, expr);
}
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index d07885fd143..2f8e0c2c9d8 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -4619,8 +4619,7 @@ vect_permute_store_chain (vec<tree> dr_chain,
if (3 * i + nelt2 < nelt)
sel[3 * i + nelt2] = 0;
}
- perm3_mask_low = vect_gen_perm_mask (vectype, sel);
- gcc_assert (perm3_mask_low != NULL);
+ perm3_mask_low = vect_gen_perm_mask_checked (vectype, sel);
for (i = 0; i < nelt; i++)
{
@@ -4631,8 +4630,7 @@ vect_permute_store_chain (vec<tree> dr_chain,
if (3 * i + nelt2 < nelt)
sel[3 * i + nelt2] = nelt + j2++;
}
- perm3_mask_high = vect_gen_perm_mask (vectype, sel);
- gcc_assert (perm3_mask_high != NULL);
+ perm3_mask_high = vect_gen_perm_mask_checked (vectype, sel);
vect1 = dr_chain[0];
vect2 = dr_chain[1];
@@ -4671,13 +4669,11 @@ vect_permute_store_chain (vec<tree> dr_chain,
sel[i * 2] = i;
sel[i * 2 + 1] = i + nelt;
}
- perm_mask_high = vect_gen_perm_mask (vectype, sel);
- gcc_assert (perm_mask_high != NULL);
+ perm_mask_high = vect_gen_perm_mask_checked (vectype, sel);
for (i = 0; i < nelt; i++)
sel[i] += nelt / 2;
- perm_mask_low = vect_gen_perm_mask (vectype, sel);
- gcc_assert (perm_mask_low != NULL);
+ perm_mask_low = vect_gen_perm_mask_checked (vectype, sel);
for (i = 0, n = log_length; i < n; i++)
{
@@ -5180,8 +5176,7 @@ vect_permute_load_chain (vec<tree> dr_chain,
sel[i] = 3 * i + k;
else
sel[i] = 0;
- perm3_mask_low = vect_gen_perm_mask (vectype, sel);
- gcc_assert (perm3_mask_low != NULL);
+ perm3_mask_low = vect_gen_perm_mask_checked (vectype, sel);
for (i = 0, j = 0; i < nelt; i++)
if (3 * i + k < 2 * nelt)
@@ -5189,8 +5184,7 @@ vect_permute_load_chain (vec<tree> dr_chain,
else
sel[i] = nelt + ((nelt + k) % 3) + 3 * (j++);
- perm3_mask_high = vect_gen_perm_mask (vectype, sel);
- gcc_assert (perm3_mask_high != NULL);
+ perm3_mask_high = vect_gen_perm_mask_checked (vectype, sel);
first_vect = dr_chain[0];
second_vect = dr_chain[1];
@@ -5224,13 +5218,11 @@ vect_permute_load_chain (vec<tree> dr_chain,
for (i = 0; i < nelt; ++i)
sel[i] = i * 2;
- perm_mask_even = vect_gen_perm_mask (vectype, sel);
- gcc_assert (perm_mask_even != NULL);
+ perm_mask_even = vect_gen_perm_mask_checked (vectype, sel);
for (i = 0; i < nelt; ++i)
sel[i] = i * 2 + 1;
- perm_mask_odd = vect_gen_perm_mask (vectype, sel);
- gcc_assert (perm_mask_odd != NULL);
+ perm_mask_odd = vect_gen_perm_mask_checked (vectype, sel);
for (i = 0; i < log_length; i++)
{
@@ -5386,8 +5378,7 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
supported by target\n");
return false;
}
- perm2_mask1 = vect_gen_perm_mask (vectype, sel);
- gcc_assert (perm2_mask1 != NULL);
+ perm2_mask1 = vect_gen_perm_mask_checked (vectype, sel);
for (i = 0; i < nelt / 2; ++i)
sel[i] = i * 2 + 1;
@@ -5401,8 +5392,7 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
supported by target\n");
return false;
}
- perm2_mask2 = vect_gen_perm_mask (vectype, sel);
- gcc_assert (perm2_mask2 != NULL);
+ perm2_mask2 = vect_gen_perm_mask_checked (vectype, sel);
/* Generating permutation constant to shift all elements.
For vector length 8 it is {4 5 6 7 8 9 10 11}. */
@@ -5415,8 +5405,7 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
"shift permutation is not supported by target\n");
return false;
}
- shift1_mask = vect_gen_perm_mask (vectype, sel);
- gcc_assert (shift1_mask != NULL);
+ shift1_mask = vect_gen_perm_mask_checked (vectype, sel);
/* Generating permutation constant to select vector from 2.
For vector length 8 it is {0 1 2 3 12 13 14 15}. */
@@ -5431,8 +5420,7 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
"select is not supported by target\n");
return false;
}
- select_mask = vect_gen_perm_mask (vectype, sel);
- gcc_assert (select_mask != NULL);
+ select_mask = vect_gen_perm_mask_checked (vectype, sel);
for (i = 0; i < log_length; i++)
{
@@ -5498,8 +5486,7 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
supported by target\n");
return false;
}
- perm3_mask = vect_gen_perm_mask (vectype, sel);
- gcc_assert (perm3_mask != NULL);
+ perm3_mask = vect_gen_perm_mask_checked (vectype, sel);
/* Generating permutation constant to shift all elements.
For vector length 8 it is {6 7 8 9 10 11 12 13}. */
@@ -5512,8 +5499,7 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
"shift permutation is not supported by target\n");
return false;
}
- shift1_mask = vect_gen_perm_mask (vectype, sel);
- gcc_assert (shift1_mask != NULL);
+ shift1_mask = vect_gen_perm_mask_checked (vectype, sel);
/* Generating permutation constant to shift all elements.
For vector length 8 it is {5 6 7 8 9 10 11 12}. */
@@ -5526,8 +5512,7 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
"shift permutation is not supported by target\n");
return false;
}
- shift2_mask = vect_gen_perm_mask (vectype, sel);
- gcc_assert (shift2_mask != NULL);
+ shift2_mask = vect_gen_perm_mask_checked (vectype, sel);
/* Generating permutation constant to shift all elements.
For vector length 8 it is {3 4 5 6 7 8 9 10}. */
@@ -5540,8 +5525,7 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
"shift permutation is not supported by target\n");
return false;
}
- shift3_mask = vect_gen_perm_mask (vectype, sel);
- gcc_assert (shift3_mask != NULL);
+ shift3_mask = vect_gen_perm_mask_checked (vectype, sel);
/* Generating permutation constant to shift all elements.
For vector length 8 it is {5 6 7 8 9 10 11 12}. */
@@ -5554,8 +5538,7 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
"shift permutation is not supported by target\n");
return false;
}
- shift4_mask = vect_gen_perm_mask (vectype, sel);
- gcc_assert (shift4_mask != NULL);
+ shift4_mask = vect_gen_perm_mask_checked (vectype, sel);
for (k = 0; k < 3; k++)
{
diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c
index a0c1363eae5..bd9df1599e4 100644
--- a/gcc/tree-vect-generic.c
+++ b/gcc/tree-vect-generic.c
@@ -1604,7 +1604,6 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi)
if (compute_type == type)
return;
- gcc_assert (code != VEC_RSHIFT_EXPR);
new_rhs = expand_vector_operation (gsi, type, compute_type, stmt, code);
/* Leave expression untouched for later expansion. */
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index f3f02fadb1d..70405d86f34 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -3083,6 +3083,41 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo,
*ret_min_profitable_estimate = min_profitable_estimate;
}
+/* Writes into SEL a mask for a vec_perm, equivalent to a vec_shr by OFFSET
+ vector elements (not bits) for a vector of mode MODE. */
+static void
+calc_vec_perm_mask_for_shift (enum machine_mode mode, unsigned int offset,
+ unsigned char *sel)
+{
+ unsigned int i, nelt = GET_MODE_NUNITS (mode);
+
+ for (i = 0; i < nelt; i++)
+ sel[i] = (i + offset) & (2*nelt - 1);
+}
+
+/* Checks whether the target supports whole-vector shifts for vectors of mode
+ MODE. This is the case if _either_ the platform handles vec_shr_optab, _or_
+ it supports vec_perm_const with masks for all necessary shift amounts. */
+static bool
+have_whole_vector_shift (enum machine_mode mode)
+{
+ if (optab_handler (vec_shr_optab, mode) != CODE_FOR_nothing)
+ return true;
+
+ if (direct_optab_handler (vec_perm_const_optab, mode) == CODE_FOR_nothing)
+ return false;
+
+ unsigned int i, nelt = GET_MODE_NUNITS (mode);
+ unsigned char *sel = XALLOCAVEC (unsigned char, nelt);
+
+ for (i = nelt/2; i >= 1; i/=2)
+ {
+ calc_vec_perm_mask_for_shift (mode, i, sel);
+ if (!can_vec_perm_p (mode, false, sel))
+ return false;
+ }
+ return true;
+}
/* TODO: Close dependency between vect_model_*_cost and vectorizable_*
functions. Design better to avoid maintenance issues. */
@@ -3185,7 +3220,7 @@ vect_model_reduction_cost (stmt_vec_info stmt_info, enum tree_code reduc_code,
/* We have a whole vector shift available. */
if (VECTOR_MODE_P (mode)
&& optab_handler (optab, mode) != CODE_FOR_nothing
- && optab_handler (vec_shr_optab, mode) != CODE_FOR_nothing)
+ && have_whole_vector_shift (mode))
{
/* Final reduction via vector shifts and the reduction operator.
Also requires scalar extract. */
@@ -3788,7 +3823,6 @@ get_initial_def_for_reduction (gimple stmt, tree init_val,
return init_def;
}
-
/* Function vect_create_epilog_for_reduction
Create code at the loop-epilog to finalize the result of a reduction
@@ -3873,14 +3907,13 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple stmt,
gimple epilog_stmt = NULL;
enum tree_code code = gimple_assign_rhs_code (stmt);
gimple exit_phi;
- tree bitsize, bitpos;
+ tree bitsize;
tree adjustment_def = NULL;
tree vec_initial_def = NULL;
tree reduction_op, expr, def;
tree orig_name, scalar_result;
imm_use_iterator imm_iter, phi_imm_iter;
use_operand_p use_p, phi_use_p;
- bool extract_scalar_result = false;
gimple use_stmt, orig_stmt, reduction_phi = NULL;
bool nested_in_vect_loop = false;
auto_vec<gimple> new_phis;
@@ -4212,18 +4245,11 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple stmt,
}
else
{
- enum tree_code shift_code = ERROR_MARK;
- bool have_whole_vector_shift = true;
- int bit_offset;
+ bool reduce_with_shift = have_whole_vector_shift (mode);
int element_bitsize = tree_to_uhwi (bitsize);
int vec_size_in_bits = tree_to_uhwi (TYPE_SIZE (vectype));
tree vec_temp;
- if (optab_handler (vec_shr_optab, mode) != CODE_FOR_nothing)
- shift_code = VEC_RSHIFT_EXPR;
- else
- have_whole_vector_shift = false;
-
/* Regardless of whether we have a whole vector shift, if we're
emulating the operation via tree-vect-generic, we don't want
to use it. Only the first round of the reduction is likely
@@ -4231,37 +4257,46 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple stmt,
/* ??? It might be better to emit a reduction tree code here, so that
tree-vect-generic can expand the first round via bit tricks. */
if (!VECTOR_MODE_P (mode))
- have_whole_vector_shift = false;
+ reduce_with_shift = false;
else
{
optab optab = optab_for_tree_code (code, vectype, optab_default);
if (optab_handler (optab, mode) == CODE_FOR_nothing)
- have_whole_vector_shift = false;
+ reduce_with_shift = false;
}
- if (have_whole_vector_shift && !slp_reduc)
+ if (reduce_with_shift && !slp_reduc)
{
+ int nelements = vec_size_in_bits / element_bitsize;
+ unsigned char *sel = XALLOCAVEC (unsigned char, nelements);
+
+ int elt_offset;
+
+ tree zero_vec = build_zero_cst (vectype);
/*** Case 2: Create:
- for (offset = VS/2; offset >= element_size; offset/=2)
+ for (offset = nelements/2; offset >= 1; offset/=2)
{
Create: va' = vec_shift <va, offset>
Create: va = vop <va, va'>
} */
+ tree rhs;
+
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
"Reduce using vector shifts\n");
vec_dest = vect_create_destination_var (scalar_dest, vectype);
new_temp = new_phi_result;
- for (bit_offset = vec_size_in_bits/2;
- bit_offset >= element_bitsize;
- bit_offset /= 2)
+ for (elt_offset = nelements / 2;
+ elt_offset >= 1;
+ elt_offset /= 2)
{
- tree bitpos = size_int (bit_offset);
-
- epilog_stmt = gimple_build_assign_with_ops (shift_code,
- vec_dest, new_temp, bitpos);
+ calc_vec_perm_mask_for_shift (mode, elt_offset, sel);
+ tree mask = vect_gen_perm_mask_any (vectype, sel);
+ epilog_stmt = gimple_build_assign_with_ops (VEC_PERM_EXPR,
+ vec_dest, new_temp,
+ zero_vec, mask);
new_name = make_ssa_name (vec_dest, epilog_stmt);
gimple_assign_set_lhs (epilog_stmt, new_name);
gsi_insert_before (&exit_gsi, epilog_stmt, GSI_SAME_STMT);
@@ -4273,12 +4308,23 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple stmt,
gsi_insert_before (&exit_gsi, epilog_stmt, GSI_SAME_STMT);
}
- extract_scalar_result = true;
+ /* 2.4 Extract the final scalar result. Create:
+ s_out3 = extract_field <v_out2, bitpos> */
+
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "extract scalar result\n");
+
+ rhs = build3 (BIT_FIELD_REF, scalar_type, new_temp,
+ bitsize, bitsize_zero_node);
+ epilog_stmt = gimple_build_assign (new_scalar_dest, rhs);
+ new_temp = make_ssa_name (new_scalar_dest, epilog_stmt);
+ gimple_assign_set_lhs (epilog_stmt, new_temp);
+ gsi_insert_before (&exit_gsi, epilog_stmt, GSI_SAME_STMT);
+ scalar_results.safe_push (new_temp);
}
else
{
- tree rhs;
-
/*** Case 3: Create:
s = extract_field <v_out2, 0>
for (offset = element_size;
@@ -4296,11 +4342,12 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple stmt,
vec_size_in_bits = tree_to_uhwi (TYPE_SIZE (vectype));
FOR_EACH_VEC_ELT (new_phis, i, new_phi)
{
+ int bit_offset;
if (gimple_code (new_phi) == GIMPLE_PHI)
vec_temp = PHI_RESULT (new_phi);
else
vec_temp = gimple_assign_lhs (new_phi);
- rhs = build3 (BIT_FIELD_REF, scalar_type, vec_temp, bitsize,
+ tree rhs = build3 (BIT_FIELD_REF, scalar_type, vec_temp, bitsize,
bitsize_zero_node);
epilog_stmt = gimple_build_assign (new_scalar_dest, rhs);
new_temp = make_ssa_name (new_scalar_dest, epilog_stmt);
@@ -4368,36 +4415,8 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple stmt,
else
/* Not SLP - we have one scalar to keep in SCALAR_RESULTS. */
scalar_results.safe_push (new_temp);
-
- extract_scalar_result = false;
}
}
-
- /* 2.4 Extract the final scalar result. Create:
- s_out3 = extract_field <v_out2, bitpos> */
-
- if (extract_scalar_result)
- {
- tree rhs;
-
- if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location,
- "extract scalar result\n");
-
- if (BYTES_BIG_ENDIAN)
- bitpos = size_binop (MULT_EXPR,
- bitsize_int (TYPE_VECTOR_SUBPARTS (vectype) - 1),
- TYPE_SIZE (scalar_type));
- else
- bitpos = bitsize_zero_node;
-
- rhs = build3 (BIT_FIELD_REF, scalar_type, new_temp, bitsize, bitpos);
- epilog_stmt = gimple_build_assign (new_scalar_dest, rhs);
- new_temp = make_ssa_name (new_scalar_dest, epilog_stmt);
- gimple_assign_set_lhs (epilog_stmt, new_temp);
- gsi_insert_before (&exit_gsi, epilog_stmt, GSI_SAME_STMT);
- scalar_results.safe_push (new_temp);
- }
vect_finalize_reduction:
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 2a5f23cbe0f..f877feaf347 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -1917,8 +1917,7 @@ vectorizable_mask_load_store (gimple stmt, gimple_stmt_iterator *gsi,
for (i = 0; i < gather_off_nunits; ++i)
sel[i] = i | nunits;
- perm_mask = vect_gen_perm_mask (gather_off_vectype, sel);
- gcc_assert (perm_mask != NULL_TREE);
+ perm_mask = vect_gen_perm_mask_checked (gather_off_vectype, sel);
}
else if (nunits == gather_off_nunits * 2)
{
@@ -1929,13 +1928,11 @@ vectorizable_mask_load_store (gimple stmt, gimple_stmt_iterator *gsi,
sel[i] = i < gather_off_nunits
? i : i + nunits - gather_off_nunits;
- perm_mask = vect_gen_perm_mask (vectype, sel);
- gcc_assert (perm_mask != NULL_TREE);
+ perm_mask = vect_gen_perm_mask_checked (vectype, sel);
ncopies *= 2;
for (i = 0; i < nunits; ++i)
sel[i] = i | gather_off_nunits;
- mask_perm_mask = vect_gen_perm_mask (masktype, sel);
- gcc_assert (mask_perm_mask != NULL_TREE);
+ mask_perm_mask = vect_gen_perm_mask_checked (masktype, sel);
}
else
gcc_unreachable ();
@@ -4940,7 +4937,9 @@ perm_mask_for_reverse (tree vectype)
for (i = 0; i < nunits; ++i)
sel[i] = nunits - 1 - i;
- return vect_gen_perm_mask (vectype, sel);
+ if (!can_vec_perm_p (TYPE_MODE (vectype), false, sel))
+ return NULL_TREE;
+ return vect_gen_perm_mask_checked (vectype, sel);
}
/* Function vectorizable_store.
@@ -5471,21 +5470,19 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
return true;
}
-/* Given a vector type VECTYPE and permutation SEL returns
- the VECTOR_CST mask that implements the permutation of the
- vector elements. If that is impossible to do, returns NULL. */
+/* Given a vector type VECTYPE, turns permutation SEL into the equivalent
+ VECTOR_CST mask. No checks are made that the target platform supports the
+ mask, so callers may wish to test can_vec_perm_p separately, or use
+ vect_gen_perm_mask_checked. */
tree
-vect_gen_perm_mask (tree vectype, unsigned char *sel)
+vect_gen_perm_mask_any (tree vectype, const unsigned char *sel)
{
tree mask_elt_type, mask_type, mask_vec, *mask_elts;
int i, nunits;
nunits = TYPE_VECTOR_SUBPARTS (vectype);
- if (!can_vec_perm_p (TYPE_MODE (vectype), false, sel))
- return NULL;
-
mask_elt_type = lang_hooks.types.type_for_mode
(int_mode_for_mode (TYPE_MODE (TREE_TYPE (vectype))), 1);
mask_type = get_vectype_for_scalar_type (mask_elt_type);
@@ -5498,6 +5495,16 @@ vect_gen_perm_mask (tree vectype, unsigned char *sel)
return mask_vec;
}
+/* Checked version of vect_gen_perm_mask_any. Asserts can_vec_perm_p,
+ i.e. that the target supports the pattern _for arbitrary input vectors_. */
+
+tree
+vect_gen_perm_mask_checked (tree vectype, const unsigned char *sel)
+{
+ gcc_assert (can_vec_perm_p (TYPE_MODE (vectype), false, sel));
+ return vect_gen_perm_mask_any (vectype, sel);
+}
+
/* Given a vector variable X and Y, that was generated for the scalar
STMT, generate instructions to permute the vector elements of X and Y
using permutation mask MASK_VEC, insert them at *GSI and return the
@@ -5853,8 +5860,7 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
for (i = 0; i < gather_off_nunits; ++i)
sel[i] = i | nunits;
- perm_mask = vect_gen_perm_mask (gather_off_vectype, sel);
- gcc_assert (perm_mask != NULL_TREE);
+ perm_mask = vect_gen_perm_mask_checked (gather_off_vectype, sel);
}
else if (nunits == gather_off_nunits * 2)
{
@@ -5865,8 +5871,7 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
sel[i] = i < gather_off_nunits
? i : i + nunits - gather_off_nunits;
- perm_mask = vect_gen_perm_mask (vectype, sel);
- gcc_assert (perm_mask != NULL_TREE);
+ perm_mask = vect_gen_perm_mask_checked (vectype, sel);
ncopies *= 2;
}
else
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 93aa73e59c6..d817f9f53a6 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -1040,7 +1040,8 @@ extern void vect_get_store_cost (struct data_reference *, int,
extern bool vect_supportable_shift (enum tree_code, tree);
extern void vect_get_vec_defs (tree, tree, gimple, vec<tree> *,
vec<tree> *, slp_tree, int);
-extern tree vect_gen_perm_mask (tree, unsigned char *);
+extern tree vect_gen_perm_mask_any (tree, const unsigned char *);
+extern tree vect_gen_perm_mask_checked (tree, const unsigned char *);
/* In tree-vect-data-refs.c. */
extern bool vect_can_force_dr_alignment_p (const_tree, unsigned int);
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index b2872828334..13b7c791eea 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -7025,6 +7025,27 @@ vrp_valueize (tree name)
return name;
}
+/* Return the singleton value-range for NAME if that is a constant
+ but signal to not follow SSA edges. */
+
+static inline tree
+vrp_valueize_1 (tree name)
+{
+ if (TREE_CODE (name) == SSA_NAME)
+ {
+ value_range_t *vr = get_value_range (name);
+ if (range_int_cst_singleton_p (vr))
+ return vr->min;
+ /* If the definition may be simulated again we cannot follow
+ this SSA edge as the SSA propagator does not necessarily
+ re-visit the use. */
+ gimple def_stmt = SSA_NAME_DEF_STMT (name);
+ if (prop_simulate_again_p (def_stmt))
+ return NULL_TREE;
+ }
+ return name;
+}
+
/* Visit assignment STMT. If it produces an interesting range, record
the SSA name in *OUTPUT_P. */
@@ -7048,8 +7069,9 @@ vrp_visit_assignment_or_call (gimple stmt, tree *output_p)
value_range_t new_vr = VR_INITIALIZER;
/* Try folding the statement to a constant first. */
- tree tem = gimple_fold_stmt_to_constant (stmt, vrp_valueize);
- if (tem)
+ tree tem = gimple_fold_stmt_to_constant_1 (stmt, vrp_valueize,
+ vrp_valueize_1);
+ if (tem && is_gimple_min_invariant (tem))
set_value_range_to_value (&new_vr, tem, NULL);
/* Then dispatch to value-range extracting functions. */
else if (code == GIMPLE_CALL)
diff --git a/gcc/tree.c b/gcc/tree.c
index 221f0dd3d57..933e8eb4d61 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -9935,7 +9935,7 @@ build_common_builtin_nodes (void)
local_define_builtin ("__builtin_unreachable", ftype, BUILT_IN_UNREACHABLE,
"__builtin_unreachable",
ECF_NOTHROW | ECF_LEAF | ECF_NORETURN
- | ECF_CONST | ECF_LEAF);
+ | ECF_CONST);
}
if (!builtin_decl_explicit_p (BUILT_IN_MEMCPY)
@@ -10330,6 +10330,8 @@ initializer_zerop (const_tree init)
{
unsigned HOST_WIDE_INT idx;
+ if (TREE_CLOBBER_P (init))
+ return false;
FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (init), idx, elt)
if (!initializer_zerop (elt))
return false;
@@ -11484,10 +11486,7 @@ cl_option_hash_hash (const void *x)
}
else if (TREE_CODE (t) == TARGET_OPTION_NODE)
- {
- p = (const char *)TREE_TARGET_OPTION (t);
- len = sizeof (struct cl_target_option);
- }
+ return cl_target_option_hash (TREE_TARGET_OPTION (t));
else
gcc_unreachable ();
@@ -11526,9 +11525,8 @@ cl_option_hash_eq (const void *x, const void *y)
else if (TREE_CODE (xt) == TARGET_OPTION_NODE)
{
- xp = (const char *)TREE_TARGET_OPTION (xt);
- yp = (const char *)TREE_TARGET_OPTION (yt);
- len = sizeof (struct cl_target_option);
+ return cl_target_option_eq (TREE_TARGET_OPTION (xt),
+ TREE_TARGET_OPTION (yt));
}
else
diff --git a/gcc/tree.def b/gcc/tree.def
index 91359a23876..e4625d09822 100644
--- a/gcc/tree.def
+++ b/gcc/tree.def
@@ -1251,11 +1251,6 @@ DEFTREECODE (WIDEN_LSHIFT_EXPR, "widen_lshift_expr", tcc_binary, 2)
before adding operand three. */
DEFTREECODE (FMA_EXPR, "fma_expr", tcc_expression, 3)
-/* Whole vector right shift in bits.
- Operand 0 is a vector to be shifted.
- Operand 1 is an integer shift amount in bits. */
-DEFTREECODE (VEC_RSHIFT_EXPR, "vec_rshift_expr", tcc_binary, 2)
-
/* Widening vector multiplication.
The two operands are vectors with N elements of size S. Multiplying the
elements of the two vectors will result in N products of size 2*S.
diff --git a/gcc/tree.h b/gcc/tree.h
index 0577d51d1ca..108b52dcd68 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -789,6 +789,12 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
#define TYPE_OVERFLOW_TRAPS(TYPE) \
(!TYPE_UNSIGNED (TYPE) && flag_trapv)
+/* True if an overflow is to be preserved for sanitization. */
+#define TYPE_OVERFLOW_SANITIZED(TYPE) \
+ (INTEGRAL_TYPE_P (TYPE) \
+ && !TYPE_OVERFLOW_WRAPS (TYPE) \
+ && (flag_sanitize & SANITIZE_SI_OVERFLOW))
+
/* True if pointer types have undefined overflow. */
#define POINTER_TYPE_OVERFLOW_UNDEFINED (flag_strict_overflow)
diff --git a/gcc/ubsan.c b/gcc/ubsan.c
index 41cf546cde3..b5b1b924c67 100644
--- a/gcc/ubsan.c
+++ b/gcc/ubsan.c
@@ -588,17 +588,26 @@ ubsan_create_data (const char *name, int loccnt, const location_t *ploc, ...)
/* Instrument the __builtin_unreachable call. We just call the libubsan
routine instead. */
-tree
-ubsan_instrument_unreachable (location_t loc)
+bool
+ubsan_instrument_unreachable (gimple_stmt_iterator *gsi)
{
- if (flag_sanitize_undefined_trap_on_error)
- return build_call_expr_loc (loc, builtin_decl_explicit (BUILT_IN_TRAP), 0);
+ gimple g;
+ location_t loc = gimple_location (gsi_stmt (*gsi));
- initialize_sanitizer_builtins ();
- tree data = ubsan_create_data ("__ubsan_unreachable_data", 1, &loc, NULL_TREE,
- NULL_TREE);
- tree t = builtin_decl_explicit (BUILT_IN_UBSAN_HANDLE_BUILTIN_UNREACHABLE);
- return build_call_expr_loc (loc, t, 1, build_fold_addr_expr_loc (loc, data));
+ if (flag_sanitize_undefined_trap_on_error)
+ g = gimple_build_call (builtin_decl_explicit (BUILT_IN_TRAP), 0);
+ else
+ {
+ tree data = ubsan_create_data ("__ubsan_unreachable_data", 1, &loc,
+ NULL_TREE, NULL_TREE);
+ data = build_fold_addr_expr_loc (loc, data);
+ tree fn
+ = builtin_decl_explicit (BUILT_IN_UBSAN_HANDLE_BUILTIN_UNREACHABLE);
+ g = gimple_build_call (fn, 1, data);
+ }
+ gimple_set_location (g, loc);
+ gsi_replace (gsi, g, false);
+ return false;
}
/* Return true if T is a call to a libubsan routine. */
diff --git a/gcc/ubsan.h b/gcc/ubsan.h
index 27c18eb00f8..dcdbb4fa4c9 100644
--- a/gcc/ubsan.h
+++ b/gcc/ubsan.h
@@ -41,7 +41,7 @@ enum ubsan_print_style {
extern bool ubsan_expand_bounds_ifn (gimple_stmt_iterator *);
extern bool ubsan_expand_null_ifn (gimple_stmt_iterator *);
extern bool ubsan_expand_objsize_ifn (gimple_stmt_iterator *);
-extern tree ubsan_instrument_unreachable (location_t);
+extern bool ubsan_instrument_unreachable (gimple_stmt_iterator *);
extern tree ubsan_create_data (const char *, int, const location_t *, ...);
extern tree ubsan_type_descriptor (tree, enum ubsan_print_style = UBSAN_PRINT_NORMAL);
extern tree ubsan_encode_value (tree, bool = false);
diff --git a/gcc/varpool.c b/gcc/varpool.c
index ac7abc1be86..80dd496a49a 100644
--- a/gcc/varpool.c
+++ b/gcc/varpool.c
@@ -49,6 +49,8 @@ along with GCC; see the file COPYING3. If not see
#include "tree-ssa-alias.h"
#include "gimple.h"
#include "lto-streamer.h"
+#include "context.h"
+#include "omp-low.h"
const char * const tls_model_names[]={"none", "tls-emulated", "tls-real",
"tls-global-dynamic", "tls-local-dynamic",
@@ -164,6 +166,16 @@ varpool_node::get_create (tree decl)
node = varpool_node::create_empty ();
node->decl = decl;
+
+ if (flag_openmp
+ && lookup_attribute ("omp declare target", DECL_ATTRIBUTES (decl)))
+ {
+ node->offloadable = 1;
+ g->have_offload = true;
+ if (!in_lto_p)
+ vec_safe_push (offload_vars, decl);
+ }
+
node->register_symbol ();
return node;
}
diff --git a/include/ChangeLog b/include/ChangeLog
index d9cb8a0c4f5..ea7fba60ae1 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,13 @@
+2014-11-14 Shinichiro Hamaji <shinichiro.hamaji@gmail.com>
+
+ * dwarf2.def (DW_AT_APPLE_optimized, DW_AT_APPLE_flags)
+ (DW_AT_APPLE_isa, DW_AT_APPLE_block)
+ (DW_AT_APPLE_major_runtime_vers, DW_AT_APPLE_runtime_class)
+ (DW_AT_APPLE_omit_frame_ptr, DW_AT_APPLE_property_name)
+ (DW_AT_APPLE_property_getter, DW_AT_APPLE_property_setter)
+ (DW_AT_APPLE_property_attribute, DW_AT_APPLE_objc_complete_type)
+ (DW_AT_APPLE_property): New macros.
+
2014-11-11 Anthony Brandon <anthony.brandon@gmail.com>
Manuel López-Ibáñez <manu@gcc.gnu.org>
diff --git a/include/dwarf2.def b/include/dwarf2.def
index 42a8d4bceeb..8ca143c5212 100644
--- a/include/dwarf2.def
+++ b/include/dwarf2.def
@@ -408,6 +408,20 @@ DW_AT (DW_AT_upc_threads_scaled, 0x3210)
DW_AT (DW_AT_PGI_lbase, 0x3a00)
DW_AT (DW_AT_PGI_soffset, 0x3a01)
DW_AT (DW_AT_PGI_lstride, 0x3a02)
+/* Apple extensions. */
+DW_AT (DW_AT_APPLE_optimized, 0x3fe1)
+DW_AT (DW_AT_APPLE_flags, 0x3fe2)
+DW_AT (DW_AT_APPLE_isa, 0x3fe3)
+DW_AT (DW_AT_APPLE_block, 0x3fe4)
+DW_AT (DW_AT_APPLE_major_runtime_vers, 0x3fe5)
+DW_AT (DW_AT_APPLE_runtime_class, 0x3fe6)
+DW_AT (DW_AT_APPLE_omit_frame_ptr, 0x3fe7)
+DW_AT (DW_AT_APPLE_property_name, 0x3fe8)
+DW_AT (DW_AT_APPLE_property_getter, 0x3fe9)
+DW_AT (DW_AT_APPLE_property_setter, 0x3fea)
+DW_AT (DW_AT_APPLE_property_attribute, 0x3feb)
+DW_AT (DW_AT_APPLE_objc_complete_type, 0x3fec)
+DW_AT (DW_AT_APPLE_property, 0x3fed)
DW_END_AT
DW_FIRST_OP (DW_OP_addr, 0x03)
diff --git a/libatomic/ChangeLog b/libatomic/ChangeLog
index 609779f9845..21f4856998b 100644
--- a/libatomic/ChangeLog
+++ b/libatomic/ChangeLog
@@ -1,3 +1,7 @@
+2014-11-13 Andrew Waterman <waterman@cs.berkeley.edu>
+
+ * cas_n.c (libat_compare_exchange): Add missing cast.
+
2014-11-11 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR target/63610
diff --git a/libatomic/cas_n.c b/libatomic/cas_n.c
index 801262d551c..a885afab7a5 100644
--- a/libatomic/cas_n.c
+++ b/libatomic/cas_n.c
@@ -70,7 +70,7 @@ SIZE(libat_compare_exchange) (UTYPE *mptr, UTYPE *eptr, UTYPE newval,
mask = -1;
}
- weval = *eptr << shift;
+ weval = (UWORD)*eptr << shift;
wnewval = (UWORD)newval << shift;
woldval = __atomic_load_n (wptr, __ATOMIC_RELAXED);
do
diff --git a/libcc1/ChangeLog b/libcc1/ChangeLog
index 023c444b150..1164c501022 100644
--- a/libcc1/ChangeLog
+++ b/libcc1/ChangeLog
@@ -1,3 +1,10 @@
+2014-11-13 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * configure.ac (libcc1_cv_lib_sockets): Check for -lsocket -lnsl.
+ * configure: Regenerate.
+ * connection.cc: Include <string.h>.
+ * libcc1.cc (libcc1_compile): Use AF_UNIX instead of AF_LOCAL.
+
2014-11-11 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR target/63610
diff --git a/libcc1/configure b/libcc1/configure
index 05384d32512..d8daefb38de 100755
--- a/libcc1/configure
+++ b/libcc1/configure
@@ -14371,6 +14371,122 @@ if test "$GXX" = yes; then
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket libraries" >&5
+$as_echo_n "checking for socket libraries... " >&6; }
+if test "${libcc1_cv_lib_sockets+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ libcc1_cv_lib_sockets=
+ libcc1_check_both=no
+ ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect"
+if test "x$ac_cv_func_connect" = x""yes; then :
+ libcc1_check_socket=no
+else
+ libcc1_check_socket=yes
+fi
+
+ if test "$libcc1_check_socket" = "yes"; then
+ unset ac_cv_func_connect
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lsocket" >&5
+$as_echo_n "checking for main in -lsocket... " >&6; }
+if test "${ac_cv_lib_socket_main+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsocket $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+
+int
+main ()
+{
+return main ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_socket_main=yes
+else
+ ac_cv_lib_socket_main=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_socket_main" >&5
+$as_echo "$ac_cv_lib_socket_main" >&6; }
+if test "x$ac_cv_lib_socket_main" = x""yes; then :
+ libcc1_cv_lib_sockets="-lsocket"
+else
+ libcc1_check_both=yes
+fi
+
+ fi
+ if test "$libcc1_check_both" = "yes"; then
+ libcc1_old_libs=$LIBS
+ LIBS="$LIBS -lsocket -lnsl"
+ unset ac_cv_func_accept
+ ac_fn_c_check_func "$LINENO" "accept" "ac_cv_func_accept"
+if test "x$ac_cv_func_accept" = x""yes; then :
+ libcc1_check_nsl=no
+ libcc1_cv_lib_sockets="-lsocket -lnsl"
+fi
+
+ unset ac_cv_func_accept
+ LIBS=$libcc1_old_libs
+ fi
+ unset ac_cv_func_gethostbyname
+ libcc1_old_libs="$LIBS"
+ ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname"
+if test "x$ac_cv_func_gethostbyname" = x""yes; then :
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lnsl" >&5
+$as_echo_n "checking for main in -lnsl... " >&6; }
+if test "${ac_cv_lib_nsl_main+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lnsl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+
+int
+main ()
+{
+return main ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_nsl_main=yes
+else
+ ac_cv_lib_nsl_main=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_nsl_main" >&5
+$as_echo "$ac_cv_lib_nsl_main" >&6; }
+if test "x$ac_cv_lib_nsl_main" = x""yes; then :
+ libcc1_cv_lib_sockets="$libcc1_cv_lib_sockets -lnsl"
+fi
+
+fi
+
+ unset ac_cv_func_gethostbyname
+ LIBS=$libcc1_old_libs
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libcc1_cv_lib_sockets" >&5
+$as_echo "$libcc1_cv_lib_sockets" >&6; }
+LIBS="$LIBS $libcc1_cv_lib_sockets"
+
# If any of these functions are missing, simply don't bother building
# this plugin.
# Check for plugin support
diff --git a/libcc1/configure.ac b/libcc1/configure.ac
index 1e0925ffcde..6c97afdf9c7 100644
--- a/libcc1/configure.ac
+++ b/libcc1/configure.ac
@@ -63,6 +63,36 @@ if test "$GXX" = yes; then
fi
AC_SUBST(libsuffix)
+dnl Test for -lsocket and -lnsl. Copied from libgo/configure.ac.
+AC_CACHE_CHECK([for socket libraries], libcc1_cv_lib_sockets,
+ [libcc1_cv_lib_sockets=
+ libcc1_check_both=no
+ AC_CHECK_FUNC(connect, libcc1_check_socket=no, libcc1_check_socket=yes)
+ if test "$libcc1_check_socket" = "yes"; then
+ unset ac_cv_func_connect
+ AC_CHECK_LIB(socket, main, libcc1_cv_lib_sockets="-lsocket",
+ libcc1_check_both=yes)
+ fi
+ if test "$libcc1_check_both" = "yes"; then
+ libcc1_old_libs=$LIBS
+ LIBS="$LIBS -lsocket -lnsl"
+ unset ac_cv_func_accept
+ AC_CHECK_FUNC(accept,
+ [libcc1_check_nsl=no
+ libcc1_cv_lib_sockets="-lsocket -lnsl"])
+ unset ac_cv_func_accept
+ LIBS=$libcc1_old_libs
+ fi
+ unset ac_cv_func_gethostbyname
+ libcc1_old_libs="$LIBS"
+ AC_CHECK_FUNC(gethostbyname, ,
+ [AC_CHECK_LIB(nsl, main,
+ [libcc1_cv_lib_sockets="$libcc1_cv_lib_sockets -lnsl"])])
+ unset ac_cv_func_gethostbyname
+ LIBS=$libcc1_old_libs
+])
+LIBS="$LIBS $libcc1_cv_lib_sockets"
+
# If any of these functions are missing, simply don't bother building
# this plugin.
GCC_ENABLE_PLUGINS
diff --git a/libcc1/connection.cc b/libcc1/connection.cc
index 3e57bbc0efe..5db42046ae7 100644
--- a/libcc1/connection.cc
+++ b/libcc1/connection.cc
@@ -21,6 +21,7 @@ along with GCC; see the file COPYING3. If not see
#include <string>
#include <unistd.h>
#include <sys/types.h>
+#include <string.h>
#include <errno.h>
#include "marshall.hh"
#include "connection.hh"
diff --git a/libcc1/libcc1.cc b/libcc1/libcc1.cc
index 15320c2d750..7d7d2c190c7 100644
--- a/libcc1/libcc1.cc
+++ b/libcc1/libcc1.cc
@@ -440,7 +440,7 @@ libcc1_compile (struct gcc_base_context *s,
libcc1 *self = (libcc1 *) s;
int fds[2];
- if (socketpair (AF_LOCAL, SOCK_STREAM, 0, fds) != 0)
+ if (socketpair (AF_UNIX, SOCK_STREAM, 0, fds) != 0)
{
self->print ("could not create socketpair\n");
return 0;
diff --git a/libcilkrts/ChangeLog b/libcilkrts/ChangeLog
index f7e41c45a37..a4a53538069 100644
--- a/libcilkrts/ChangeLog
+++ b/libcilkrts/ChangeLog
@@ -1,3 +1,7 @@
+2014-11-13 Kirill Yukhin <kirill.yukhin@intel.com>
+
+ * configure.tgt: Use config/target-posix.
+
2014-11-11 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR target/63610
diff --git a/libcilkrts/configure.tgt b/libcilkrts/configure.tgt
index f7663521cda..fcda70fb68f 100644
--- a/libcilkrts/configure.tgt
+++ b/libcilkrts/configure.tgt
@@ -43,19 +43,4 @@ case "${target}" in
esac
# Disable libcilkrts on non POSIX hosted systems.
-if test x$enable_libcilkrts = x ; then
- # Enable libcilkrts by default on hosted POSIX systems.
- case "${target}" in
- *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
- ;;
- *-*-netbsd* | *-*-freebsd* | *-*-openbsd* | *-*-dragonfly*)
- ;;
- *-*-solaris2* | *-*-hpux11*)
- ;;
- *-*-darwin* | *-*-aix*)
- ;;
- *)
- UNSUPPORTED=1
- ;;
- esac
-fi
+. ${srcdir}/../config/target-posix
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index b75d521cf9f..5814dc4da18 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,8 @@
+2014-11-13 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ * include/line-map.h: Include EXPR, so that unused variable warnings
+ do not occur.
+
2014-11-11 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR fortran/44054
diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h
index 2fcee1906be..edcbdc9bd66 100644
--- a/libcpp/include/line-map.h
+++ b/libcpp/include/line-map.h
@@ -586,7 +586,8 @@ bool linemap_location_from_macro_expansion_p (const struct line_maps *,
({linemap_assert (!linemap_macro_expansion_map_p (LINE_MAP)); \
(LINE_MAP);})
#else
-#define linemap_assert(EXPR)
+/* Include EXPR, so that unused variable warnings do not occur. */
+#define linemap_assert(EXPR) ((void)(0 && (EXPR)))
#define linemap_check_ordinary(LINE_MAP) (LINE_MAP)
#endif
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index fd7ba114d36..296a9e4792d 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,30 @@
+2014-11-13 Bernd Schmidt <bernds@codesourcery.com>
+ Thomas Schwinge <thomas@codesourcery.com>
+ Ilya Verbin <ilya.verbin@intel.com>
+ Andrey Turetskiy <andrey.turetskiy@intel.com>
+
+ * Makefile.in (crtoffloadbegin$(objext)): New rule.
+ (crtoffloadend$(objext)): Likewise.
+ * configure: Regenerate.
+ * configure.ac (accel_dir_suffix): Compute new variable.
+ (extra_parts): Add crtoffloadbegin.o and crtoffloadend.o
+ if enable_offload_targets is not empty.
+ * offloadstuff.c: New file.
+
+2014-11-13 Nick Clifton <nickc@redhat.com>
+
+ * config/rl78/divmodhi.S: Add support for the G10 architecture.
+ Use START_FUNC and END_FUNC macros to enable linker garbage
+ collection.
+ * config/rl78/divmodqi.S: Likewise.
+ * config/rl78/divmodsi.S: Likewise.
+ * config/rl78/mulsi3.S: Likewise.
+ * config/rl78/lib2div.c: Remove G10 functions.
+ * config/rl78/lib2muls.c: Likewise.
+ * config/rl78/t-rl8 (HOST_LIBGCC2_CFLAGS): Define.
+ * config/rl78/vregs.h (START_FUNC): New macro.
+ (END_FUNC): New macro.
+
2014-11-12 Matthew Fortune <matthew.fortune@imgtec.com>
* config/mips/mips16.S: Set .module when supported. Update O32
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
index 357e15c3761..f0506f26620 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -184,7 +184,7 @@ STRIP = @STRIP@
STRIP_FOR_TARGET = $(STRIP)
# Directory in which the compiler finds libraries etc.
-libsubdir = $(libdir)/gcc/$(host_noncanonical)/$(version)
+libsubdir = $(libdir)/gcc/$(host_noncanonical)/$(version)@accel_dir_suffix@
# Used to install the shared libgcc.
slibdir = @slibdir@
# Maybe used for DLLs on Windows targets.
@@ -995,6 +995,14 @@ crtendS$(objext): $(srcdir)/crtstuff.c
crtbeginT$(objext): $(srcdir)/crtstuff.c
$(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN -DCRTSTUFFT_O
+# crtoffloadbegin and crtoffloadend contain symbols, that mark the begin and
+# the end of tables with addresses, required for offloading.
+crtoffloadbegin$(objext): $(srcdir)/offloadstuff.c
+ $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN
+
+crtoffloadend$(objext): $(srcdir)/offloadstuff.c
+ $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_END
+
ifeq ($(enable_vtable_verify),yes)
# These are used in vtable verification; see comments in source files for
# more details.
diff --git a/libgcc/config/rl78/divmodhi.S b/libgcc/config/rl78/divmodhi.S
index e08345a3280..12070e3fa14 100644
--- a/libgcc/config/rl78/divmodhi.S
+++ b/libgcc/config/rl78/divmodhi.S
@@ -23,11 +23,9 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#ifndef __RL78_G10__
-
#include "vregs.h"
- .macro make_generic which,need_result
+.macro MAKE_GENERIC which,need_result
.if \need_result
quot = r8
@@ -53,11 +51,11 @@
bitB0 = bit
bitB1 = bit+1
-#if 1
#define bit bc
#define bitB0 c
#define bitB1 b
-#endif
+
+ START_FUNC __generic_hidivmod\which
num_lt_den\which:
.if \need_result
@@ -72,12 +70,13 @@ num_lt_den\which:
;; to store sign information that must remain intact
.if \need_result
-
-generic_div:
+ .global __generic_hidiv
+__generic_hidiv:
.else
-generic_mod:
+ .global __generic_himod
+__generic_himod:
.endif
@@ -193,42 +192,40 @@ enter_main_loop\which:
main_loop_done\which:
ret
- .endm
+ END_FUNC __generic_hidivmod\which
+.endm
+;----------------------------------------------------------------------
- make_generic _d 1
- make_generic _m 0
+ MAKE_GENERIC _d 1
+ MAKE_GENERIC _m 0
;----------------------------------------------------------------------
- .global ___udivhi3
- .type ___udivhi3,@function
-___udivhi3:
+START_FUNC ___udivhi3
;; r8 = 4[sp] / 6[sp]
- call $!generic_div
+ call $!__generic_hidiv
ret
- .size ___udivhi3, . - ___udivhi3
+END_FUNC ___udivhi3
- .global ___umodhi3
- .type ___umodhi3,@function
-___umodhi3:
+START_FUNC ___umodhi3
;; r8 = 4[sp] % 6[sp]
- call $!generic_mod
+ call $!__generic_himod
ret
- .size ___umodhi3, . - ___umodhi3
+END_FUNC ___umodhi3
;----------------------------------------------------------------------
- .macro neg_ax
+.macro NEG_AX
movw hl, ax
movw ax, #0
subw ax, [hl]
movw [hl], ax
- .endm
+.endm
- .global ___divhi3
- .type ___divhi3,@function
-___divhi3:
+;----------------------------------------------------------------------
+
+START_FUNC ___divhi3
;; r8 = 4[sp] / 6[sp]
movw de, #0
mov a, [sp+5]
@@ -237,14 +234,14 @@ ___divhi3:
mov a, [sp+7]
mov1 cy, a.7
bc $div_signed_den
- call $!generic_div
+ call $!__generic_hidiv
ret
div_signed_num:
;; neg [sp+4]
movw ax, sp
addw ax, #4
- neg_ax
+ NEG_AX
mov d, #1
mov a, [sp+7]
mov1 cy, a.7
@@ -253,10 +250,10 @@ div_signed_den:
;; neg [sp+6]
movw ax, sp
addw ax, #6
- neg_ax
+ NEG_AX
mov e, #1
div_unsigned_den:
- call $!generic_div
+ call $!__generic_hidiv
mov a, d
cmp0 a
@@ -264,28 +261,26 @@ div_unsigned_den:
;; We have to restore the numerator [sp+4]
movw ax, sp
addw ax, #4
- neg_ax
+ NEG_AX
mov a, d
div_skip_restore_num:
xor a, e
bz $div_no_neg
movw ax, #r8
- neg_ax
+ NEG_AX
div_no_neg:
mov a, e
cmp0 a
bz $div_skip_restore_den
movw ax, sp
addw ax, #6
- neg_ax
+ NEG_AX
div_skip_restore_den:
ret
- .size ___divhi3, . - ___divhi3
+END_FUNC ___divhi3
- .global ___modhi3
- .type ___modhi3,@function
-___modhi3:
+START_FUNC ___modhi3
;; r8 = 4[sp] % 6[sp]
movw de, #0
mov a, [sp+5]
@@ -294,14 +289,14 @@ ___modhi3:
mov a, [sp+7]
mov1 cy, a.7
bc $mod_signed_den
- call $!generic_mod
+ call $!__generic_himod
ret
mod_signed_num:
;; neg [sp+4]
movw ax, sp
addw ax, #4
- neg_ax
+ NEG_AX
mov d, #1
mov a, [sp+7]
mov1 cy, a.7
@@ -310,28 +305,26 @@ mod_signed_den:
;; neg [sp+6]
movw ax, sp
addw ax, #6
- neg_ax
+ NEG_AX
mod_unsigned_den:
- call $!generic_mod
+ call $!__generic_himod
mov a, d
cmp0 a
bz $mod_no_neg
movw ax, #r8
- neg_ax
+ NEG_AX
;; Also restore numerator
movw ax, sp
addw ax, #4
- neg_ax
+ NEG_AX
mod_no_neg:
mov a, e
cmp0 a
bz $mod_skip_restore_den
movw ax, sp
addw ax, #6
- neg_ax
+ NEG_AX
mod_skip_restore_den:
ret
- .size ___modhi3, . - ___modhi3
-
-#endif
+END_FUNC ___modhi3
diff --git a/libgcc/config/rl78/divmodqi.S b/libgcc/config/rl78/divmodqi.S
index 0d13a2fd6c3..8d1022bcf04 100644
--- a/libgcc/config/rl78/divmodqi.S
+++ b/libgcc/config/rl78/divmodqi.S
@@ -23,11 +23,9 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#ifndef __RL78_G10__
-
#include "vregs.h"
- .macro make_generic which,need_result
+.macro MAKE_GENERIC which,need_result
.if \need_result
quot = r8
@@ -41,11 +39,11 @@
bit = r14
.endif
-#if 1
#define bit b
#define den c
#define bitden bc
-#endif
+
+ START_FUNC __generic_qidivmod\which
num_lt_den\which:
.if \need_result
@@ -72,12 +70,13 @@ den_is_zero\which:
;; to store sign information that must remain intact
.if \need_result
-
-generic_div:
+ .global __generic_qidiv
+__generic_qidiv:
.else
-generic_mod:
+ .global __generic_qimod
+__generic_qimod:
.endif
@@ -111,7 +110,8 @@ den_not_zero\which:
; while (den < num && !(den & (1L << BITS_MINUS_1)))
shift_den_bit\which:
- .macro sdb_one\which
+
+.macro SDB_ONE\which
mov a, den
mov1 cy,a.7
bc $enter_main_loop\which
@@ -125,10 +125,10 @@ shift_den_bit\which:
;; bit <<= 1
shl bit, 1
- .endm
+.endm
- sdb_one\which
- sdb_one\which
+ SDB_ONE\which
+ SDB_ONE\which
br $shift_den_bit\which
@@ -164,42 +164,41 @@ enter_main_loop\which:
main_loop_done\which:
ret
- .endm
+ END_FUNC __generic_qidivmod\which
+.endm
- make_generic _d 1
- make_generic _m 0
+;----------------------------------------------------------------------
+
+ MAKE_GENERIC _d 1
+ MAKE_GENERIC _m 0
;----------------------------------------------------------------------
- .global ___udivqi3
- .type ___udivqi3,@function
-___udivqi3:
+START_FUNC ___udivqi3
;; r8 = 4[sp] / 6[sp]
movw hl, sp
- br $!generic_div
- .size ___udivqi3, . - ___udivqi3
+ br $!__generic_qidiv
+END_FUNC ___udivqi3
- .global ___umodqi3
- .type ___umodqi3,@function
-___umodqi3:
+START_FUNC ___umodqi3
;; r8 = 4[sp] % 6[sp]
movw hl, sp
- br $!generic_mod
- .size ___umodqi3, . - ___umodqi3
+ br $!__generic_qimod
+END_FUNC ___umodqi3
;----------------------------------------------------------------------
- .macro neg_ax
+.macro NEG_AX
movw hl, ax
mov a, #0
sub a, [hl]
mov [hl], a
- .endm
+.endm
+
+;----------------------------------------------------------------------
- .global ___divqi3
- .type ___divqi3,@function
-___divqi3:
+START_FUNC ___divqi3
;; r8 = 4[sp] / 6[sp]
movw hl, sp
movw de, #0
@@ -209,7 +208,7 @@ ___divqi3:
mov a, [sp+6]
mov1 cy, a.7
bc $div_signed_den
- br $!generic_div
+ br $!__generic_qidiv
div_signed_num:
;; neg [sp+4]
@@ -227,7 +226,7 @@ div_signed_den:
mov [hl+6], a
mov e, #1
div_unsigned_den:
- call $!generic_div
+ call $!__generic_qidiv
mov a, d
cmp0 a
@@ -235,28 +234,26 @@ div_unsigned_den:
;; We have to restore the numerator [sp+4]
movw ax, sp
addw ax, #4
- neg_ax
+ NEG_AX
mov a, d
div_skip_restore_num:
xor a, e
bz $div_no_neg
movw ax, #r8
- neg_ax
+ NEG_AX
div_no_neg:
mov a, e
cmp0 a
bz $div_skip_restore_den
movw ax, sp
addw ax, #6
- neg_ax
+ NEG_AX
div_skip_restore_den:
ret
- .size ___divqi3, . - ___divqi3
+END_FUNC ___divqi3
- .global ___modqi3
- .type ___modqi3,@function
-___modqi3:
+START_FUNC ___modqi3
;; r8 = 4[sp] % 6[sp]
movw hl, sp
movw de, #0
@@ -266,7 +263,7 @@ ___modqi3:
mov a, [hl+6]
mov1 cy, a.7
bc $mod_signed_den
- br $!generic_mod
+ br $!__generic_qimod
mod_signed_num:
;; neg [sp+4]
@@ -284,7 +281,7 @@ mod_signed_den:
mov [hl+6], a
mov e, #1
mod_unsigned_den:
- call $!generic_mod
+ call $!__generic_qimod
mov a, d
cmp0 a
@@ -295,16 +292,14 @@ mod_unsigned_den:
;; Also restore numerator
movw ax, sp
addw ax, #4
- neg_ax
+ NEG_AX
mod_no_neg:
mov a, e
cmp0 a
bz $mod_skip_restore_den
movw ax, sp
addw ax, #6
- neg_ax
+ NEG_AX
mod_skip_restore_den:
ret
- .size ___modqi3, . - ___modqi3
-
-#endif
+END_FUNC ___modqi3
diff --git a/libgcc/config/rl78/divmodsi.S b/libgcc/config/rl78/divmodsi.S
index fac0a6090c9..a580c3eb403 100644
--- a/libgcc/config/rl78/divmodsi.S
+++ b/libgcc/config/rl78/divmodsi.S
@@ -23,11 +23,9 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#ifndef __RL78_G10__
-
#include "vregs.h"
- .macro make_generic which,need_result
+.macro MAKE_GENERIC which,need_result
.if \need_result
quot = r8
@@ -69,6 +67,8 @@
bitB2 = bit+2
bitB3 = bit+3
+START_FUNC __generic_sidivmod\which
+
num_lt_den\which:
.if \need_result
movw r8, #0
@@ -100,12 +100,13 @@ shift_den_bit16\which:
;; to store sign information that must remain intact
.if \need_result
-
-generic_div:
+ .global __generic_sidiv
+__generic_sidiv:
.else
-generic_mod:
+ .global __generic_simod
+__generic_simod:
.endif
@@ -119,12 +120,21 @@ generic_mod:
cmpw ax, [hl+8] ; numL
bh $num_lt_den\which
+#ifdef __RL78_G10__
+ movw ax, denL
+ push ax
+ movw ax, bitL
+ push ax
+ movw ax, bitH
+ push ax
+#else
sel rb2
push ax ; denL
; push bc ; denH
push de ; bitL
push hl ; bitH - stored in BC
sel rb0
+#endif
;; (quot,rem) = 16[sp] /% 20[sp]
@@ -360,41 +370,49 @@ next_loop_himode\which:
bnz $main_loop_himode\which
main_loop_done_himode\which:
+#ifdef __RL78_G10__
+ pop ax
+ movw bitH, ax
+ pop ax
+ movw bitL, ax
+ pop ax
+ movw denL, ax
+#else
sel rb2
pop hl ; bitH - stored in BC
pop de ; bitL
; pop bc ; denH
pop ax ; denL
sel rb0
+#endif
ret
- .endm
+END_FUNC __generic_sidivmod\which
+.endm
- make_generic _d 1
- make_generic _m 0
+;----------------------------------------------------------------------
+
+ MAKE_GENERIC _d 1
+ MAKE_GENERIC _m 0
;----------------------------------------------------------------------
- .global ___udivsi3
- .type ___udivsi3,@function
-___udivsi3:
+START_FUNC ___udivsi3
;; r8 = 4[sp] / 8[sp]
- call $!generic_div
+ call $!__generic_sidiv
ret
- .size ___udivsi3, . - ___udivsi3
+END_FUNC ___udivsi3
- .global ___umodsi3
- .type ___umodsi3,@function
-___umodsi3:
+START_FUNC ___umodsi3
;; r8 = 4[sp] % 8[sp]
- call $!generic_mod
+ call $!__generic_simod
ret
- .size ___umodsi3, . - ___umodsi3
+END_FUNC ___umodsi3
;----------------------------------------------------------------------
- .macro neg_ax
+.macro NEG_AX
movw hl, ax
movw ax, #0
subw ax, [hl]
@@ -404,11 +422,11 @@ ___umodsi3:
decw ax
subw ax, [hl+2]
movw [hl+2], ax
- .endm
+.endm
- .global ___divsi3
- .type ___divsi3,@function
-___divsi3:
+;----------------------------------------------------------------------
+
+START_FUNC ___divsi3
;; r8 = 4[sp] / 8[sp]
movw de, #0
mov a, [sp+7]
@@ -417,14 +435,14 @@ ___divsi3:
mov a, [sp+11]
mov1 cy, a.7
bc $div_signed_den
- call $!generic_div
+ call $!__generic_sidiv
ret
-
+
div_signed_num:
;; neg [sp+4]
movw ax, sp
addw ax, #4
- neg_ax
+ NEG_AX
mov d, #1
mov a, [sp+11]
mov1 cy, a.7
@@ -433,10 +451,10 @@ div_signed_den:
;; neg [sp+8]
movw ax, sp
addw ax, #8
- neg_ax
+ NEG_AX
mov e, #1
div_unsigned_den:
- call $!generic_div
+ call $!__generic_sidiv
mov a, d
cmp0 a
@@ -444,13 +462,13 @@ div_unsigned_den:
;; We have to restore the numerator [sp+4]
movw ax, sp
addw ax, #4
- neg_ax
+ NEG_AX
mov a, d
div_skip_restore_num:
xor a, e
bz $div_no_neg
movw ax, #r8
- neg_ax
+ NEG_AX
div_no_neg:
mov a, e
cmp0 a
@@ -458,15 +476,13 @@ div_no_neg:
;; We have to restore the denominator [sp+8]
movw ax, sp
addw ax, #8
- neg_ax
+ NEG_AX
div_skip_restore_den:
ret
- .size ___divsi3, . - ___divsi3
+END_FUNC ___divsi3
- .global ___modsi3
- .type ___modsi3,@function
-___modsi3:
+START_FUNC ___modsi3
;; r8 = 4[sp] % 8[sp]
movw de, #0
mov a, [sp+7]
@@ -475,14 +491,14 @@ ___modsi3:
mov a, [sp+11]
mov1 cy, a.7
bc $mod_signed_den
- call $!generic_mod
+ call $!__generic_simod
ret
-
+
mod_signed_num:
;; neg [sp+4]
movw ax, sp
addw ax, #4
- neg_ax
+ NEG_AX
mov d, #1
mov a, [sp+11]
mov1 cy, a.7
@@ -491,20 +507,20 @@ mod_signed_den:
;; neg [sp+8]
movw ax, sp
addw ax, #8
- neg_ax
+ NEG_AX
mov e, #1
mod_unsigned_den:
- call $!generic_mod
+ call $!__generic_simod
mov a, d
cmp0 a
bz $mod_no_neg
movw ax, #r8
- neg_ax
+ NEG_AX
;; We have to restore [sp+4] as well.
movw ax, sp
addw ax, #4
- neg_ax
+ NEG_AX
mod_no_neg:
.if 1
mov a, e
@@ -512,10 +528,8 @@ mod_no_neg:
bz $mod_skip_restore_den
movw ax, sp
addw ax, #8
- neg_ax
+ NEG_AX
mod_skip_restore_den:
.endif
ret
- .size ___modsi3, . - ___modsi3
-
-#endif
+END_FUNC ___modsi3
diff --git a/libgcc/config/rl78/lib2div.c b/libgcc/config/rl78/lib2div.c
index 8fc9cde69c5..2e9a16dfb26 100644
--- a/libgcc/config/rl78/lib2div.c
+++ b/libgcc/config/rl78/lib2div.c
@@ -34,41 +34,6 @@ typedef int word_type __attribute__ ((mode (__word__)));
#define C3B(a,b,c) a##b##c
#define C3(a,b,c) C3B(a,b,c)
-#ifdef __RL78_G10__
-
-#define UINT_TYPE uint32_type
-#define SINT_TYPE sint32_type
-#define BITS_MINUS_1 31
-#define NAME_MODE si
-
-#include "rl78-divmod.h"
-
-#undef UINT_TYPE
-#undef SINT_TYPE
-#undef BITS_MINUS_1
-#undef NAME_MODE
-
-#define UINT_TYPE uint16_type
-#define SINT_TYPE sint16_type
-#define BITS_MINUS_1 15
-#define NAME_MODE hi
-
-#include "rl78-divmod.h"
-
-#undef UINT_TYPE
-#undef SINT_TYPE
-#undef BITS_MINUS_1
-#undef NAME_MODE
-
-#define UINT_TYPE uint08_type
-#define SINT_TYPE sint08_type
-#define BITS_MINUS_1 7
-#define NAME_MODE qi
-
-#include "rl78-divmod.h"
-
-#endif
-
/* See the comment by the definition of LIBGCC2_UNITS_PER_WORD in
m32c.h for why we are creating extra versions of some of the
functions defined in libgcc2.c. */
diff --git a/libgcc/config/rl78/lib2mul.c b/libgcc/config/rl78/lib2mul.c
index 95701880e87..3788b6f2114 100644
--- a/libgcc/config/rl78/lib2mul.c
+++ b/libgcc/config/rl78/lib2mul.c
@@ -30,26 +30,6 @@ typedef unsigned int uint08_type __attribute__ ((mode (QI)));
#define C3B(a,b,c) a##b##c
#define C3(a,b,c) C3B(a,b,c)
-#ifdef __RL78_G10__
-
-#define UINT_TYPE uint32_type
-#define BITS_MINUS_1 31
-#define NAME_MODE si
-
-#include "rl78-mul.h"
-
-#undef UINT_TYPE
-#undef BITS_MINUS_1
-#undef NAME_MODE
-
-#define UINT_TYPE uint16_type
-#define BITS_MINUS_1 15
-#define NAME_MODE hi
-
-#include "rl78-mul.h"
-
-#endif
-
#undef UINT_TYPE
#undef BITS_MINUS_1
#undef NAME_MODE
diff --git a/libgcc/config/rl78/mulsi3.S b/libgcc/config/rl78/mulsi3.S
index 89f45b68a5d..190f4112360 100644
--- a/libgcc/config/rl78/mulsi3.S
+++ b/libgcc/config/rl78/mulsi3.S
@@ -24,12 +24,6 @@
#include "vregs.h"
-; the G10 only has one register bank, so cannot use these optimized
-; versions. Use the C version instead.
-
-#ifndef __RL78_G10__
-
-
;----------------------------------------------------------------------
; Register use:
@@ -39,19 +33,22 @@
; DE count (resL-tmp)
; HL [sp+4]
- .text
- nop
- .global ___mulsi3 ; (USI a, USI b)
-___mulsi3:
+START_FUNC ___mulsi3
;; A is at [sp+4]
;; B is at [sp+8]
;; result is in R8..R11
+#ifdef __RL78_G10__
+ movw ax, r16
+ push ax
+ movw ax, r18
+ push ax
+#else
sel rb2
push ax
push bc
sel rb0
-
+#endif
clrw ax
movw r8, ax
movw r16, ax
@@ -62,9 +59,19 @@ ___mulsi3:
cmpw ax, #0xffff
bnz $2f
movw ax, [sp+8]
+#ifdef __RL78_G10__
+ push bc
+ movw bc, r8
+ xchw ax, bc
+ subw ax, bc
+ movw r8, ax
+ movw ax, bc
+ pop bc
+#else
sel rb1
subw ax, r_0
sel rb0
+#endif
br $1f
2:
movw bc, ax
@@ -80,9 +87,19 @@ ___mulsi3:
cmpw ax, #0xffff
bnz $2f
movw ax, [sp+12]
+#ifdef __RL78_G10__
+ push bc
+ movw bc, r8
+ xchw ax, bc
+ subw ax, bc
+ movw r8, ax
+ movw ax, bc
+ pop bc
+#else
sel rb1
subw ax, r_0
sel rb0
+#endif
br $1f
2:
movw bc, ax
@@ -113,12 +130,28 @@ ___mulsi3:
movw r10, ax
movw ax, bc
-
.Lmul_hisi_top:
movw bc, #0
.Lmul_hisi_loop:
shrw ax, 1
+#ifdef __RL78_G10__
+ push ax
+ bnc $.Lmul_hisi_no_add_g10
+ movw ax, r8
+ addw ax, r10
+ movw r8, ax
+ sknc
+ incw r16
+ movw ax, r16
+ addw ax, r_2
+ movw r16, ax
+.Lmul_hisi_no_add_g10:
+ movw ax, r10
+ shlw ax, 1
+ movw r10, ax
+ pop ax
+#else
bnc $.Lmul_hisi_no_add
sel rb1
addw ax, bc
@@ -130,11 +163,29 @@ ___mulsi3:
sel rb1
shlw bc, 1
sel rb0
+#endif
rolwc bc, 1
cmpw ax, #0
bz $.Lmul_hisi_done
shrw ax, 1
+#ifdef __RL78_G10__
+ push ax
+ bnc $.Lmul_hisi_no_add2_g10
+ movw ax, r8
+ addw ax, r10
+ movw r8, ax
+ movw ax, r16
+ sknc
+ incw ax
+ addw ax, r_2
+ movw r16, ax
+.Lmul_hisi_no_add2_g10:
+ movw ax, r10
+ shlw ax, 1
+ movw r10, ax
+ pop ax
+#else
bnc $.Lmul_hisi_no_add2
sel rb1
addw ax, bc
@@ -146,6 +197,7 @@ ___mulsi3:
sel rb1
shlw bc, 1
sel rb0
+#endif
rolwc bc, 1
cmpw ax, #0
bnz $.Lmul_hisi_loop
@@ -154,18 +206,25 @@ ___mulsi3:
movw ax, r16
movw r10, ax
-
+
+#ifdef __RL78_G10__
+ pop ax
+ movw r18, ax
+ pop ax
+ movw r16, ax
+#else
sel rb2
pop bc
pop ax
sel rb0
+#endif
ret
+END_FUNC ___mulsi3
;----------------------------------------------------------------------
- .global ___mulhi3
-___mulhi3:
+START_FUNC ___mulhi3
movw r8, #0
movw ax, [sp+6]
movw bc, ax
@@ -179,9 +238,18 @@ ___mulhi3:
br $.Lmul_hi_loop
.Lmul_hi_top:
+#ifdef __RL78_G10__
+ push ax
+ movw ax, r8
+ addw ax, r_2
+ movw r8, ax
+ pop ax
+#else
sel rb1
addw ax, r_2
sel rb0
+#endif
+
.Lmul_hi_no_add:
shlw bc, 1
.Lmul_hi_loop:
@@ -198,5 +266,4 @@ ___mulhi3:
.Lmul_hi_done:
ret
-
-#endif
+END_FUNC ___mulhi3
diff --git a/libgcc/config/rl78/t-rl78 b/libgcc/config/rl78/t-rl78
index 274d2041694..be0d643d8be 100644
--- a/libgcc/config/rl78/t-rl78
+++ b/libgcc/config/rl78/t-rl78
@@ -30,3 +30,5 @@ LIB2ADD = \
$(srcdir)/config/rl78/divmodqi.S \
$(srcdir)/config/rl78/signbit.S \
$(srcdir)/config/rl78/cmpsi2.S
+
+HOST_LIBGCC2_CFLAGS += -Os -ffunction-sections -fdata-sections
diff --git a/libgcc/config/rl78/vregs.h b/libgcc/config/rl78/vregs.h
index fa488fabcb1..d5209e20fa5 100644
--- a/libgcc/config/rl78/vregs.h
+++ b/libgcc/config/rl78/vregs.h
@@ -54,3 +54,18 @@ r22 = 0xffeee
r23 = 0xffeef
#endif
+
+ /* Start a function in its own section, so that it
+ can be subject to linker garbage collection. */
+.macro START_FUNC name
+ .pushsection .text.\name,"ax",@progbits
+ .global \name
+ .type \name , @function
+\name:
+.endm
+
+ /* End the function. Set the size. */
+.macro END_FUNC name
+ .size \name , . - \name
+ .popsection
+.endm
diff --git a/libgcc/configure b/libgcc/configure
index 3f53aafacaa..87924653210 100644
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -566,6 +566,7 @@ sfp_machine_header
set_use_emutls
set_have_cc_tls
vis_hide
+accel_dir_suffix
force_explicit_eh_registry
fixed_point
enable_decimal_float
@@ -4451,6 +4452,23 @@ esac
# Collect host-machine-specific information.
. ${srcdir}/config.host
+# Used for constructing correct paths for offload compilers.
+accel_dir_suffix=
+if test x"$enable_as_accelerator_for" != x; then
+ accel_dir_suffix=/accel/${target_noncanonical}
+ case "${target_noncanonical}" in
+ *-intelmicemul-*)
+ # In this case we expect offload compiler to be built as native, so we
+ # need to change install directory for driver to be able to find libgcc.
+ host_noncanonical=${enable_as_accelerator_for} ;;
+ esac
+fi
+
+
+if test x"$enable_offload_targets" != x; then
+ extra_parts="${extra_parts} crtoffloadbegin.o crtoffloadend.o"
+fi
+
# Check if Solaris/x86 linker supports ZERO terminator unwind entries.
# This is after config.host so we can augment tmake_file.
# Link with -nostartfiles -nodefaultlibs since neither are present while
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
index 79d0ea43493..ab9c5562e28 100644
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -379,6 +379,23 @@ esac
# Collect host-machine-specific information.
. ${srcdir}/config.host
+# Used for constructing correct paths for offload compilers.
+accel_dir_suffix=
+if test x"$enable_as_accelerator_for" != x; then
+ accel_dir_suffix=/accel/${target_noncanonical}
+ case "${target_noncanonical}" in
+ *-intelmicemul-*)
+ # In this case we expect offload compiler to be built as native, so we
+ # need to change install directory for driver to be able to find libgcc.
+ host_noncanonical=${enable_as_accelerator_for} ;;
+ esac
+fi
+AC_SUBST(accel_dir_suffix)
+
+if test x"$enable_offload_targets" != x; then
+ extra_parts="${extra_parts} crtoffloadbegin.o crtoffloadend.o"
+fi
+
# Check if Solaris/x86 linker supports ZERO terminator unwind entries.
# This is after config.host so we can augment tmake_file.
# Link with -nostartfiles -nodefaultlibs since neither are present while
diff --git a/libgcc/offloadstuff.c b/libgcc/offloadstuff.c
new file mode 100644
index 00000000000..273189d952c
--- /dev/null
+++ b/libgcc/offloadstuff.c
@@ -0,0 +1,80 @@
+/* Specialized bits of code needed for the offloading tables.
+ Copyright (C) 2014 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.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/* Target machine header files require this define. */
+#define IN_LIBGCC2
+
+/* FIXME: Including auto-host is incorrect, but until we have
+ identified the set of defines that need to go into auto-target.h,
+ this will have to do. */
+#include "auto-host.h"
+#undef caddr_t
+#undef pid_t
+#undef rlim_t
+#undef ssize_t
+#undef vfork
+#include "tconfig.h"
+#include "tsystem.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "libgcc_tm.h"
+
+#define OFFLOAD_FUNC_TABLE_SECTION_NAME ".gnu.offload_funcs"
+#define OFFLOAD_VAR_TABLE_SECTION_NAME ".gnu.offload_vars"
+
+#ifdef CRT_BEGIN
+
+#if defined(HAVE_GAS_HIDDEN) && defined(ENABLE_OFFLOADING)
+void *__offload_func_table[0]
+ __attribute__ ((__used__, visibility ("hidden"),
+ section (OFFLOAD_FUNC_TABLE_SECTION_NAME))) = { };
+void *__offload_var_table[0]
+ __attribute__ ((__used__, visibility ("hidden"),
+ section (OFFLOAD_VAR_TABLE_SECTION_NAME))) = { };
+#endif
+
+#elif defined CRT_END
+
+#if defined(HAVE_GAS_HIDDEN) && defined(ENABLE_OFFLOADING)
+void *__offload_funcs_end[0]
+ __attribute__ ((__used__, visibility ("hidden"),
+ section (OFFLOAD_FUNC_TABLE_SECTION_NAME))) = { };
+void *__offload_vars_end[0]
+ __attribute__ ((__used__, visibility ("hidden"),
+ section (OFFLOAD_VAR_TABLE_SECTION_NAME))) = { };
+
+extern void *__offload_func_table[];
+extern void *__offload_var_table[];
+
+void *__OFFLOAD_TABLE__[]
+ __attribute__ ((__visibility__ ("hidden"))) =
+{
+ &__offload_func_table, &__offload_funcs_end,
+ &__offload_var_table, &__offload_vars_end
+};
+#endif
+
+#else /* ! CRT_BEGIN && ! CRT_END */
+#error "One of CRT_BEGIN or CRT_END must be defined."
+#endif
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 2d600d1947e..b941e734673 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,76 @@
+2014-11-13 Marek Polacek <polacek@redhat.com>
+
+ * intrinsics/access.c: Include <stdlib.h>.
+ * intrinsics/chdir.c: Likewise.
+ * intrinsics/chmod.c: Likewise.
+ * intrinsics/link.c: Likewise.
+ * intrinsics/perror.c: Likewise.
+ * intrinsics/rename.c: Likewise.
+ * intrinsics/symlnk.c: Likewise.
+ * intrinsics/unlink.c: Likewise.
+
+2014-11-13 Janne Blomqvist <jb@gcc.gnu.org>
+
+ PR libfortran/60324
+ * configure: Regenerated.
+ * configure.ac (AM_CFLAGS): Add Werror=vla.
+ * libgfortran.h (gfc_alloca): Remove macro.
+ (fc_strdup_notrim): New prototype.
+ * intrinsics/access.c (access_func): Use fc_strdup rather than
+ stack allocation.
+ * intrinsics/chdir.c (chdir_i4_sub): Likewise.
+ (chdir_i8_sub): Likewise.
+ * intrinsics/chmod.c (chmod_internal): New function, move logic
+ here.
+ (chmod_func): Call chmod_internal.
+ * intrinsics/env.c (getenv): Use fc_strdup rather than stack
+ allocation.
+ (get_environment_variable_i4): Likewise.
+ * intrinsics/execute_command_line.c (execute_command_line):
+ Likewise.
+ * intrinsics/hostnm.c (hostnm_0): New function, use static buffer
+ rather than VLA.
+ (hostnm_i4_sub): Call hostnm_0.
+ (hostnm_i8_sub): Likewise.
+ (hostnm): Likewise.
+ * intrinsics/link.c (link_internal): New function, use fc_strdup
+ rather than stack allocation.
+ (link_i4_sub): Call link_internal.
+ (link_i8_sub): Likewise.
+ (link_i4): Likewise.
+ (link_i8): Likewise.
+ * intrinsics/perror.c (perror_sub): Use fc_strdup rather than
+ stack allocation.
+ * intrinsics/random.c (random_seed_i4): Use static buffer rather
+ than VLA, use _Static_assert to make sure it's big enough.
+ * intrinsics/rename.c (rename_internal): New function, use
+ fc_strdup rather than stack allocation.
+ (rename_i4_sub): Call rename_internal.
+ (rename_i8_sub): Likewise.
+ (rename_i4): Likewise.
+ (rename_i8): Likewise.
+ * intrinsics/stat.c (stat_i4_sub_0): Use fc_strdup rather than
+ stack allocation.
+ (stat_i8_sub_0): Likewise.
+ * intrinsics/symlink.c (symlnk_internal): New function, use
+ fc_strdup rather than stack allocation.
+ (symlnk_i4_sub): Call symlnk_internal.
+ (symlnk_i8_sub): Likewise.
+ (symlnk_i4): Likewise.
+ (symlnk_i8): Likewise.
+ * intrinsics/system.c (system_sub): Use fc_strdup rather than
+ stack allocation.
+ * intrinsics/unlink.c (unlink_i4_sub): Likewise.
+ * io/file_pos.c (READ_CHUNK): Make it a macro rather than variable.
+ * io/list_read.c (nml_get_obj_data): Use fixed stack buffer, fall
+ back to xmalloc/free for large sizes.
+ * io/read.c (read_f): Likewise.
+ * io/transfer.c (MAX_READ): Make it a macro rather than variable.
+ (WRITE_CHUNK): Likewise.
+ * io/write_float.def (write_float): Use fixed stack buffer, fall
+ back to xmalloc/free for large sizes.
+ * runtime/string.c (fc_strdup_notrim): New function.
+
2014-11-11 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR target/63610
diff --git a/libgfortran/configure b/libgfortran/configure
index e02ef1a7281..17d7570e26c 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -5783,7 +5783,7 @@ if test "x$GCC" = "xyes"; then
## We like to use C11 and C99 routines when available. This makes
## sure that
## __STDC_VERSION__ is set such that libc includes make them available.
- AM_CFLAGS="-std=gnu11 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -Werror=implicit-function-declaration"
+ AM_CFLAGS="-std=gnu11 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -Werror=implicit-function-declaration -Werror=vla"
## Compile the following tests with the same system header contents
## that we'll encounter when compiling our own source files.
CFLAGS="-std=gnu11 $CFLAGS"
diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index f54104bb460..ada74e3318a 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -142,7 +142,7 @@ if test "x$GCC" = "xyes"; then
## We like to use C11 and C99 routines when available. This makes
## sure that
## __STDC_VERSION__ is set such that libc includes make them available.
- AM_CFLAGS="-std=gnu11 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -Werror=implicit-function-declaration"
+ AM_CFLAGS="-std=gnu11 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -Werror=implicit-function-declaration -Werror=vla"
## Compile the following tests with the same system header contents
## that we'll encounter when compiling our own source files.
CFLAGS="-std=gnu11 $CFLAGS"
diff --git a/libgfortran/intrinsics/access.c b/libgfortran/intrinsics/access.c
index a418d6703c5..0c18da028fe 100644
--- a/libgfortran/intrinsics/access.c
+++ b/libgfortran/intrinsics/access.c
@@ -2,7 +2,7 @@
Copyright (C) 2006-2014 Free Software Foundation, Inc.
Contributed by François-Xavier Coudert <coudert@clipper.ens.fr>
-This file is part of the GNU Fortran 95 runtime library (libgfortran).
+This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
@@ -26,6 +26,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "libgfortran.h"
#include <errno.h>
+#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
@@ -43,7 +44,6 @@ int
access_func (char *name, char *mode, gfc_charlen_type name_len,
gfc_charlen_type mode_len)
{
- char * file;
gfc_charlen_type i;
int m;
@@ -75,16 +75,12 @@ access_func (char *name, char *mode, gfc_charlen_type name_len,
break;
}
- /* Trim trailing spaces from NAME argument. */
- while (name_len > 0 && name[name_len - 1] == ' ')
- name_len--;
-
- /* Make a null terminated copy of the string. */
- file = gfc_alloca (name_len + 1);
- memcpy (file, name, name_len);
- file[name_len] = '\0';
+ char *path = fc_strdup (name, name_len);
/* And make the call to access(). */
- return (access (file, m) == 0 ? 0 : errno);
+ int res = (access (path, m) == 0 ? 0 : errno);
+
+ free (path);
+ return res;
}
#endif
diff --git a/libgfortran/intrinsics/chdir.c b/libgfortran/intrinsics/chdir.c
index c4933a3d5f3..193e482ab37 100644
--- a/libgfortran/intrinsics/chdir.c
+++ b/libgfortran/intrinsics/chdir.c
@@ -26,6 +26,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "libgfortran.h"
#include <errno.h>
+#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
@@ -44,18 +45,10 @@ void
chdir_i4_sub (char *dir, GFC_INTEGER_4 *status, gfc_charlen_type dir_len)
{
int val;
- char *str;
-
- /* Trim trailing spaces from paths. */
- while (dir_len > 0 && dir[dir_len - 1] == ' ')
- dir_len--;
-
- /* Make a null terminated copy of the strings. */
- str = gfc_alloca (dir_len + 1);
- memcpy (str, dir, dir_len);
- str[dir_len] = '\0';
+ char *str = fc_strdup (dir, dir_len);
val = chdir (str);
+ free (str);
if (status != NULL)
*status = (val == 0) ? 0 : errno;
@@ -69,18 +62,10 @@ void
chdir_i8_sub (char *dir, GFC_INTEGER_8 *status, gfc_charlen_type dir_len)
{
int val;
- char *str;
-
- /* Trim trailing spaces from paths. */
- while (dir_len > 0 && dir[dir_len - 1] == ' ')
- dir_len--;
-
- /* Make a null terminated copy of the strings. */
- str = gfc_alloca (dir_len + 1);
- memcpy (str, dir, dir_len);
- str[dir_len] = '\0';
+ char *str = fc_strdup (dir, dir_len);
val = chdir (str);
+ free (str);
if (status != NULL)
*status = (val == 0) ? 0 : errno;
diff --git a/libgfortran/intrinsics/chmod.c b/libgfortran/intrinsics/chmod.c
index acef433d92e..bdcb6761be5 100644
--- a/libgfortran/intrinsics/chmod.c
+++ b/libgfortran/intrinsics/chmod.c
@@ -28,6 +28,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#if defined(HAVE_SYS_STAT_H)
#include <string.h> /* For memcpy. */
+#include <stdlib.h> /* For free. */
#include <sys/stat.h> /* For stat, chmod and umask. */
@@ -61,14 +62,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
A return value of 0 indicates success, -1 an error of chmod() while 1
indicates a mode parsing error. */
-extern int chmod_func (char *, char *, gfc_charlen_type, gfc_charlen_type);
-export_proto(chmod_func);
-int
-chmod_func (char *name, char *mode, gfc_charlen_type name_len,
- gfc_charlen_type mode_len)
+static int
+chmod_internal (char *file, char *mode, gfc_charlen_type mode_len)
{
- char * file;
int i;
bool ugo[3];
bool rwxXstugo[9];
@@ -80,15 +77,6 @@ chmod_func (char *name, char *mode, gfc_charlen_type name_len,
mode_t mode_mask, file_mode, new_mode;
struct stat stat_buf;
- /* Trim trailing spaces of the file name. */
- while (name_len > 0 && name[name_len - 1] == ' ')
- name_len--;
-
- /* Make a null terminated copy of the file name. */
- file = gfc_alloca (name_len + 1);
- memcpy (file, name, name_len);
- file[name_len] = '\0';
-
if (mode_len == 0)
return 1;
@@ -496,6 +484,20 @@ clause_done:
}
+extern int chmod_func (char *, char *, gfc_charlen_type, gfc_charlen_type);
+export_proto(chmod_func);
+
+int
+chmod_func (char *name, char *mode, gfc_charlen_type name_len,
+ gfc_charlen_type mode_len)
+{
+ char *cname = fc_strdup (name, name_len);
+ int ret = chmod_internal (cname, mode, mode_len);
+ free (cname);
+ return ret;
+}
+
+
extern void chmod_i4_sub (char *, char *, GFC_INTEGER_4 *,
gfc_charlen_type, gfc_charlen_type);
export_proto(chmod_i4_sub);
diff --git a/libgfortran/intrinsics/env.c b/libgfortran/intrinsics/env.c
index 9f4507305cd..ffdc54ac42f 100644
--- a/libgfortran/intrinsics/env.c
+++ b/libgfortran/intrinsics/env.c
@@ -52,27 +52,19 @@ PREFIX(getenv) (char * name, char * value, gfc_charlen_type name_len,
else
memset (value, ' ', value_len); /* Blank the string. */
- /* Trim trailing spaces from name. */
- while (name_len > 0 && name[name_len - 1] == ' ')
- name_len--;
-
/* Make a null terminated copy of the string. */
- name_nt = gfc_alloca (name_len + 1);
- memcpy (name_nt, name, name_len);
- name_nt[name_len] = '\0';
+ name_nt = fc_strdup (name, name_len);
res = getenv(name_nt);
+ free (name_nt);
+
/* If res is NULL, it means that the environment variable didn't
exist, so just return. */
if (res == NULL)
return;
- res_len = strlen(res);
- if (value_len < res_len)
- memcpy (value, res, value_len);
- else
- memcpy (value, res, res_len);
+ cf_strcpy (value, value_len, res);
}
@@ -127,18 +119,14 @@ get_environment_variable_i4 (char *name, char *value, GFC_INTEGER_4 *length,
}
if ((!trim_name) || *trim_name)
- {
- /* Trim trailing spaces from name. */
- while (name_len > 0 && name[name_len - 1] == ' ')
- name_len--;
- }
- /* Make a null terminated copy of the name. */
- name_nt = gfc_alloca (name_len + 1);
- memcpy (name_nt, name, name_len);
- name_nt[name_len] = '\0';
+ name_nt = fc_strdup (name, name_len);
+ else
+ name_nt = fc_strdup_notrim (name, name_len);
res = getenv(name_nt);
+ free (name_nt);
+
if (res == NULL)
stat = GFC_NAME_DOES_NOT_EXIST;
else
diff --git a/libgfortran/intrinsics/execute_command_line.c b/libgfortran/intrinsics/execute_command_line.c
index 19cc29b3c42..578b4e92658 100644
--- a/libgfortran/intrinsics/execute_command_line.c
+++ b/libgfortran/intrinsics/execute_command_line.c
@@ -61,9 +61,7 @@ execute_command_line (const char *command, bool wait, int *exitstat,
gfc_charlen_type cmdmsg_len)
{
/* Transform the Fortran string to a C string. */
- char cmd[command_len + 1];
- memcpy (cmd, command, command_len);
- cmd[command_len] = '\0';
+ char *cmd = fc_strdup (command, command_len);
/* Flush all I/O units before executing the command. */
flush_all_units();
@@ -110,6 +108,8 @@ execute_command_line (const char *command, bool wait, int *exitstat,
}
}
+ free (cmd);
+
/* Now copy back to the Fortran string if needed. */
if (cmdstat && *cmdstat > EXEC_NOERROR)
{
diff --git a/libgfortran/intrinsics/hostnm.c b/libgfortran/intrinsics/hostnm.c
index 856625826e5..c94dd775329 100644
--- a/libgfortran/intrinsics/hostnm.c
+++ b/libgfortran/intrinsics/hostnm.c
@@ -2,7 +2,7 @@
Copyright (C) 2005-2014 Free Software Foundation, Inc.
Contributed by François-Xavier Coudert <coudert@clipper.ens.fr>
-This file is part of the GNU Fortran 95 runtime library (libgfortran).
+This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
@@ -32,6 +32,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include <unistd.h>
#endif
+#include <limits.h>
+
+#ifndef HOST_NAME_MAX
+#define HOST_NAME_MAX 255
+#endif
+
/* Windows32 version */
#if defined __MINGW32__ && !defined HAVE_GETHOSTNAME
@@ -79,19 +85,17 @@ w32_gethostname (char *name, size_t len)
INTEGER, INTENT(OUT), OPTIONAL :: STATUS */
#ifdef HAVE_GETHOSTNAME
-extern void hostnm_i4_sub (char *, GFC_INTEGER_4 *, gfc_charlen_type);
-iexport_proto(hostnm_i4_sub);
-
-void
-hostnm_i4_sub (char *name, GFC_INTEGER_4 *status, gfc_charlen_type name_len)
+static int
+hostnm_0 (char *name, gfc_charlen_type name_len)
{
int val, i;
- char *p;
+ char p[HOST_NAME_MAX + 1];
memset (name, ' ', name_len);
- p = gfc_alloca (name_len + 1);
- val = gethostname (p, name_len);
+ size_t reqlen = sizeof (p) > (size_t) name_len + 1
+ ? (size_t) name_len + 1: sizeof (p);
+ val = gethostname (p, reqlen);
if (val == 0)
{
@@ -100,8 +104,18 @@ hostnm_i4_sub (char *name, GFC_INTEGER_4 *status, gfc_charlen_type name_len)
name[i] = p[i];
}
+ return ((val == 0) ? 0 : errno);
+}
+
+extern void hostnm_i4_sub (char *, GFC_INTEGER_4 *, gfc_charlen_type);
+iexport_proto(hostnm_i4_sub);
+
+void
+hostnm_i4_sub (char *name, GFC_INTEGER_4 *status, gfc_charlen_type name_len)
+{
+ int val = hostnm_0 (name, name_len);
if (status != NULL)
- *status = (val == 0) ? 0 : errno;
+ *status = val;
}
iexport(hostnm_i4_sub);
@@ -111,23 +125,9 @@ iexport_proto(hostnm_i8_sub);
void
hostnm_i8_sub (char *name, GFC_INTEGER_8 *status, gfc_charlen_type name_len)
{
- int val, i;
- char *p;
-
- memset (name, ' ', name_len);
- p = gfc_alloca (name_len + 1);
-
- val = gethostname (p, name_len);
-
- if (val == 0)
- {
- i = -1;
- while (i < name_len && p[++i] != '\0')
- name[i] = p[i];
- }
-
+ int val = hostnm_0 (name, name_len);
if (status != NULL)
- *status = (val == 0) ? 0 : errno;
+ *status = val;
}
iexport(hostnm_i8_sub);
@@ -137,8 +137,6 @@ export_proto(hostnm);
GFC_INTEGER_4
hostnm (char *name, gfc_charlen_type name_len)
{
- GFC_INTEGER_4 val;
- hostnm_i4_sub (name, &val, name_len);
- return val;
+ return hostnm_0 (name, name_len);
}
#endif
diff --git a/libgfortran/intrinsics/link.c b/libgfortran/intrinsics/link.c
index 2018c628a00..dd9c470a5dd 100644
--- a/libgfortran/intrinsics/link.c
+++ b/libgfortran/intrinsics/link.c
@@ -2,7 +2,7 @@
Copyright (C) 2005-2014 Free Software Foundation, Inc.
Contributed by François-Xavier Coudert <coudert@clipper.ens.fr>
-This file is part of the GNU Fortran 95 runtime library (libgfortran).
+This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
@@ -26,6 +26,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "libgfortran.h"
#include <errno.h>
+#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
@@ -37,36 +38,39 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
INTEGER, INTENT(OUT), OPTIONAL :: STATUS */
#ifdef HAVE_LINK
-extern void link_i4_sub (char *, char *, GFC_INTEGER_4 *, gfc_charlen_type,
- gfc_charlen_type);
-iexport_proto(link_i4_sub);
-void
-link_i4_sub (char *path1, char *path2, GFC_INTEGER_4 *status,
- gfc_charlen_type path1_len, gfc_charlen_type path2_len)
+static int
+link_internal (char *path1, char *path2, gfc_charlen_type path1_len,
+ gfc_charlen_type path2_len)
{
int val;
char *str1, *str2;
- /* Trim trailing spaces from paths. */
- while (path1_len > 0 && path1[path1_len - 1] == ' ')
- path1_len--;
- while (path2_len > 0 && path2[path2_len - 1] == ' ')
- path2_len--;
-
/* Make a null terminated copy of the strings. */
- str1 = gfc_alloca (path1_len + 1);
- memcpy (str1, path1, path1_len);
- str1[path1_len] = '\0';
-
- str2 = gfc_alloca (path2_len + 1);
- memcpy (str2, path2, path2_len);
- str2[path2_len] = '\0';
+ str1 = fc_strdup (path1, path1_len);
+ str2 = fc_strdup (path2, path2_len);
val = link (str1, str2);
+ free (str1);
+ free (str2);
+
+ return ((val == 0) ? 0 : errno);
+}
+
+
+extern void link_i4_sub (char *, char *, GFC_INTEGER_4 *, gfc_charlen_type,
+ gfc_charlen_type);
+iexport_proto(link_i4_sub);
+
+void
+link_i4_sub (char *path1, char *path2, GFC_INTEGER_4 *status,
+ gfc_charlen_type path1_len, gfc_charlen_type path2_len)
+{
+ int val = link_internal (path1, path2, path1_len, path2_len);
+
if (status != NULL)
- *status = (val == 0) ? 0 : errno;
+ *status = val;
}
iexport(link_i4_sub);
@@ -78,28 +82,10 @@ void
link_i8_sub (char *path1, char *path2, GFC_INTEGER_8 *status,
gfc_charlen_type path1_len, gfc_charlen_type path2_len)
{
- int val;
- char *str1, *str2;
-
- /* Trim trailing spaces from paths. */
- while (path1_len > 0 && path1[path1_len - 1] == ' ')
- path1_len--;
- while (path2_len > 0 && path2[path2_len - 1] == ' ')
- path2_len--;
-
- /* Make a null terminated copy of the strings. */
- str1 = gfc_alloca (path1_len + 1);
- memcpy (str1, path1, path1_len);
- str1[path1_len] = '\0';
-
- str2 = gfc_alloca (path2_len + 1);
- memcpy (str2, path2, path2_len);
- str2[path2_len] = '\0';
-
- val = link (str1, str2);
+ int val = link_internal (path1, path2, path1_len, path2_len);
if (status != NULL)
- *status = (val == 0) ? 0 : errno;
+ *status = val;
}
iexport(link_i8_sub);
@@ -111,9 +97,7 @@ GFC_INTEGER_4
link_i4 (char *path1, char *path2, gfc_charlen_type path1_len,
gfc_charlen_type path2_len)
{
- GFC_INTEGER_4 val;
- link_i4_sub (path1, path2, &val, path1_len, path2_len);
- return val;
+ return link_internal (path1, path2, path1_len, path2_len);
}
extern GFC_INTEGER_8 link_i8 (char *, char *, gfc_charlen_type,
@@ -124,8 +108,6 @@ GFC_INTEGER_8
link_i8 (char *path1, char *path2, gfc_charlen_type path1_len,
gfc_charlen_type path2_len)
{
- GFC_INTEGER_8 val;
- link_i8_sub (path1, path2, &val, path1_len, path2_len);
- return val;
+ return link_internal (path1, path2, path1_len, path2_len);
}
#endif
diff --git a/libgfortran/intrinsics/perror.c b/libgfortran/intrinsics/perror.c
index 9a2851f5507..2bb1305c102 100644
--- a/libgfortran/intrinsics/perror.c
+++ b/libgfortran/intrinsics/perror.c
@@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include <errno.h>
#include <string.h>
+#include <stdlib.h>
/* SUBROUTINE PERROR(STRING)
CHARACTER(len=*), INTENT(IN) :: STRING */
@@ -37,17 +38,8 @@ iexport_proto(perror_sub);
void
perror_sub (char *string, gfc_charlen_type string_len)
{
- char * str;
-
- /* Trim trailing spaces from paths. */
- while (string_len > 0 && string[string_len - 1] == ' ')
- string_len--;
-
- /* Make a null terminated copy of the strings. */
- str = gfc_alloca (string_len + 1);
- memcpy (str, string, string_len);
- str[string_len] = '\0';
-
+ char *str = fc_strdup (string, string_len);
perror (str);
+ free (str);
}
iexport(perror_sub);
diff --git a/libgfortran/intrinsics/random.c b/libgfortran/intrinsics/random.c
index 593a6518cae..5e919292aab 100644
--- a/libgfortran/intrinsics/random.c
+++ b/libgfortran/intrinsics/random.c
@@ -666,7 +666,11 @@ void
random_seed_i4 (GFC_INTEGER_4 *size, gfc_array_i4 *put, gfc_array_i4 *get)
{
int i;
- unsigned char seed[4*kiss_size];
+
+#define KISS_MAX_SIZE 12
+ unsigned char seed[4 * KISS_MAX_SIZE];
+ _Static_assert (kiss_size <= KISS_MAX_SIZE,
+ "kiss_size must <= KISS_MAX_SIZE");
__gthread_mutex_lock (&random_lock);
diff --git a/libgfortran/intrinsics/rename.c b/libgfortran/intrinsics/rename.c
index 63901df4398..78c3d811f90 100644
--- a/libgfortran/intrinsics/rename.c
+++ b/libgfortran/intrinsics/rename.c
@@ -2,7 +2,7 @@
Copyright (C) 2005-2014 Free Software Foundation, Inc.
Contributed by François-Xavier Coudert <coudert@clipper.ens.fr>
-This file is part of the GNU Fortran 95 runtime library (libgfortran).
+This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
@@ -26,8 +26,23 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "libgfortran.h"
#include <errno.h>
+#include <stdlib.h>
#include <string.h>
+
+static int
+rename_internal (char *path1, char *path2, gfc_charlen_type path1_len,
+ gfc_charlen_type path2_len)
+{
+ char *str1 = fc_strdup (path1, path1_len);
+ char *str2 = fc_strdup (path2, path2_len);
+ int val = rename (str1, str2);
+ free (str1);
+ free (str2);
+ return ((val == 0) ? 0 : errno);
+}
+
+
/* SUBROUTINE RENAME(PATH1, PATH2, STATUS)
CHARACTER(len=*), INTENT(IN) :: PATH1, PATH2
INTEGER, INTENT(OUT), OPTIONAL :: STATUS */
@@ -40,28 +55,9 @@ void
rename_i4_sub (char *path1, char *path2, GFC_INTEGER_4 *status,
gfc_charlen_type path1_len, gfc_charlen_type path2_len)
{
- int val;
- char *str1, *str2;
-
- /* Trim trailing spaces from paths. */
- while (path1_len > 0 && path1[path1_len - 1] == ' ')
- path1_len--;
- while (path2_len > 0 && path2[path2_len - 1] == ' ')
- path2_len--;
-
- /* Make a null terminated copy of the strings. */
- str1 = gfc_alloca (path1_len + 1);
- memcpy (str1, path1, path1_len);
- str1[path1_len] = '\0';
-
- str2 = gfc_alloca (path2_len + 1);
- memcpy (str2, path2, path2_len);
- str2[path2_len] = '\0';
-
- val = rename (str1, str2);
-
+ int val = rename_internal (path1, path2, path1_len, path2_len);
if (status != NULL)
- *status = (val == 0) ? 0 : errno;
+ *status = val;
}
iexport(rename_i4_sub);
@@ -73,28 +69,9 @@ void
rename_i8_sub (char *path1, char *path2, GFC_INTEGER_8 *status,
gfc_charlen_type path1_len, gfc_charlen_type path2_len)
{
- int val;
- char *str1, *str2;
-
- /* Trim trailing spaces from paths. */
- while (path1_len > 0 && path1[path1_len - 1] == ' ')
- path1_len--;
- while (path2_len > 0 && path2[path2_len - 1] == ' ')
- path2_len--;
-
- /* Make a null terminated copy of the strings. */
- str1 = gfc_alloca (path1_len + 1);
- memcpy (str1, path1, path1_len);
- str1[path1_len] = '\0';
-
- str2 = gfc_alloca (path2_len + 1);
- memcpy (str2, path2, path2_len);
- str2[path2_len] = '\0';
-
- val = rename (str1, str2);
-
+ int val = rename_internal (path1, path2, path1_len, path2_len);
if (status != NULL)
- *status = (val == 0) ? 0 : errno;
+ *status = val;
}
iexport(rename_i8_sub);
@@ -106,9 +83,7 @@ GFC_INTEGER_4
rename_i4 (char *path1, char *path2, gfc_charlen_type path1_len,
gfc_charlen_type path2_len)
{
- GFC_INTEGER_4 val;
- rename_i4_sub (path1, path2, &val, path1_len, path2_len);
- return val;
+ return rename_internal (path1, path2, path1_len, path2_len);
}
extern GFC_INTEGER_8 rename_i8 (char *, char *, gfc_charlen_type,
@@ -119,7 +94,5 @@ GFC_INTEGER_8
rename_i8 (char *path1, char *path2, gfc_charlen_type path1_len,
gfc_charlen_type path2_len)
{
- GFC_INTEGER_8 val;
- rename_i8_sub (path1, path2, &val, path1_len, path2_len);
- return val;
+ return rename_internal (path1, path2, path1_len, path2_len);
}
diff --git a/libgfortran/intrinsics/stat.c b/libgfortran/intrinsics/stat.c
index 1bd8b4b5a71..a60664210ec 100644
--- a/libgfortran/intrinsics/stat.c
+++ b/libgfortran/intrinsics/stat.c
@@ -67,14 +67,8 @@ stat_i4_sub_0 (char *name, gfc_array_i4 *sarray, GFC_INTEGER_4 *status,
if (GFC_DESCRIPTOR_EXTENT(sarray,0) < 13)
runtime_error ("Array size of SARRAY is too small.");
- /* Trim trailing spaces from name. */
- while (name_len > 0 && name[name_len - 1] == ' ')
- name_len--;
-
/* Make a null terminated copy of the string. */
- str = gfc_alloca (name_len + 1);
- memcpy (str, name, name_len);
- str[name_len] = '\0';
+ str = fc_strdup (name, name_len);
/* On platforms that don't provide lstat(), we use stat() instead. */
#ifdef HAVE_LSTAT
@@ -84,6 +78,8 @@ stat_i4_sub_0 (char *name, gfc_array_i4 *sarray, GFC_INTEGER_4 *status,
#endif
val = stat(str, &sb);
+ free (str);
+
if (val == 0)
{
index_type stride = GFC_DESCRIPTOR_STRIDE(sarray,0);
@@ -188,14 +184,8 @@ stat_i8_sub_0 (char *name, gfc_array_i8 *sarray, GFC_INTEGER_8 *status,
if (GFC_DESCRIPTOR_EXTENT(sarray,0) < 13)
runtime_error ("Array size of SARRAY is too small.");
- /* Trim trailing spaces from name. */
- while (name_len > 0 && name[name_len - 1] == ' ')
- name_len--;
-
/* Make a null terminated copy of the string. */
- str = gfc_alloca (name_len + 1);
- memcpy (str, name, name_len);
- str[name_len] = '\0';
+ str = fc_strdup (name, name_len);
/* On platforms that don't provide lstat(), we use stat() instead. */
#ifdef HAVE_LSTAT
@@ -205,6 +195,8 @@ stat_i8_sub_0 (char *name, gfc_array_i8 *sarray, GFC_INTEGER_8 *status,
#endif
val = stat(str, &sb);
+ free (str);
+
if (val == 0)
{
index_type stride = GFC_DESCRIPTOR_STRIDE(sarray,0);
diff --git a/libgfortran/intrinsics/symlnk.c b/libgfortran/intrinsics/symlnk.c
index 3c3d2fbba79..52a3c4b0d34 100644
--- a/libgfortran/intrinsics/symlnk.c
+++ b/libgfortran/intrinsics/symlnk.c
@@ -2,7 +2,7 @@
Copyright (C) 2005-2014 Free Software Foundation, Inc.
Contributed by François-Xavier Coudert <coudert@clipper.ens.fr>
-This file is part of the GNU Fortran 95 runtime library (libgfortran).
+This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
@@ -26,6 +26,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "libgfortran.h"
#include <errno.h>
+#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
@@ -37,6 +38,18 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
INTEGER, INTENT(OUT), OPTIONAL :: STATUS */
#ifdef HAVE_SYMLINK
+static int
+symlnk_internal (char *path1, char *path2, gfc_charlen_type path1_len,
+ gfc_charlen_type path2_len)
+{
+ char *str1 = fc_strdup (path1, path1_len);
+ char *str2 = fc_strdup (path2, path2_len);
+ int val = symlink (str1, str2);
+ free (str1);
+ free (str2);
+ return ((val == 0) ? 0 : errno);
+}
+
extern void symlnk_i4_sub (char *, char *, GFC_INTEGER_4 *, gfc_charlen_type,
gfc_charlen_type);
iexport_proto(symlnk_i4_sub);
@@ -45,28 +58,9 @@ void
symlnk_i4_sub (char *path1, char *path2, GFC_INTEGER_4 *status,
gfc_charlen_type path1_len, gfc_charlen_type path2_len)
{
- int val;
- char *str1, *str2;
-
- /* Trim trailing spaces from paths. */
- while (path1_len > 0 && path1[path1_len - 1] == ' ')
- path1_len--;
- while (path2_len > 0 && path2[path2_len - 1] == ' ')
- path2_len--;
-
- /* Make a null terminated copy of the strings. */
- str1 = gfc_alloca (path1_len + 1);
- memcpy (str1, path1, path1_len);
- str1[path1_len] = '\0';
-
- str2 = gfc_alloca (path2_len + 1);
- memcpy (str2, path2, path2_len);
- str2[path2_len] = '\0';
-
- val = symlink (str1, str2);
-
+ int val = symlnk_internal (path1, path2, path1_len, path2_len);
if (status != NULL)
- *status = (val == 0) ? 0 : errno;
+ *status = val;
}
iexport(symlnk_i4_sub);
@@ -78,28 +72,9 @@ void
symlnk_i8_sub (char *path1, char *path2, GFC_INTEGER_8 *status,
gfc_charlen_type path1_len, gfc_charlen_type path2_len)
{
- int val;
- char *str1, *str2;
-
- /* Trim trailing spaces from paths. */
- while (path1_len > 0 && path1[path1_len - 1] == ' ')
- path1_len--;
- while (path2_len > 0 && path2[path2_len - 1] == ' ')
- path2_len--;
-
- /* Make a null terminated copy of the strings. */
- str1 = gfc_alloca (path1_len + 1);
- memcpy (str1, path1, path1_len);
- str1[path1_len] = '\0';
-
- str2 = gfc_alloca (path2_len + 1);
- memcpy (str2, path2, path2_len);
- str2[path2_len] = '\0';
-
- val = symlink (str1, str2);
-
+ int val = symlnk_internal (path1, path2, path1_len, path2_len);
if (status != NULL)
- *status = (val == 0) ? 0 : errno;
+ *status = val;
}
iexport(symlnk_i8_sub);
@@ -111,9 +86,7 @@ GFC_INTEGER_4
symlnk_i4 (char *path1, char *path2, gfc_charlen_type path1_len,
gfc_charlen_type path2_len)
{
- GFC_INTEGER_4 val;
- symlnk_i4_sub (path1, path2, &val, path1_len, path2_len);
- return val;
+ return symlnk_internal (path1, path2, path1_len, path2_len);
}
extern GFC_INTEGER_8 symlnk_i8 (char *, char *, gfc_charlen_type,
@@ -124,8 +97,6 @@ GFC_INTEGER_8
symlnk_i8 (char *path1, char *path2, gfc_charlen_type path1_len,
gfc_charlen_type path2_len)
{
- GFC_INTEGER_8 val;
- symlnk_i8_sub (path1, path2, &val, path1_len, path2_len);
- return val;
+ return symlnk_internal (path1, path2, path1_len, path2_len);
}
#endif
diff --git a/libgfortran/intrinsics/system.c b/libgfortran/intrinsics/system.c
index d0a131d60e1..add6f4ff218 100644
--- a/libgfortran/intrinsics/system.c
+++ b/libgfortran/intrinsics/system.c
@@ -34,16 +34,14 @@ iexport_proto(system_sub);
void
system_sub (const char *fcmd, GFC_INTEGER_4 *status, gfc_charlen_type cmd_len)
{
- char cmd[cmd_len + 1];
+ char *cmd = fc_strdup (fcmd, cmd_len);
int stat;
/* Flush all I/O units before executing the command. */
flush_all_units();
- memcpy (cmd, fcmd, cmd_len);
- cmd[cmd_len] = '\0';
-
stat = system (cmd);
+ free (cmd);
if (status)
*status = stat;
}
diff --git a/libgfortran/intrinsics/unlink.c b/libgfortran/intrinsics/unlink.c
index b4de6e65cbe..47529881449 100644
--- a/libgfortran/intrinsics/unlink.c
+++ b/libgfortran/intrinsics/unlink.c
@@ -2,7 +2,7 @@
Copyright (C) 2004-2014 Free Software Foundation, Inc.
Contributed by Steven G. Kargl <kargls@comcast.net>.
-This file is part of the GNU Fortran 95 runtime library (libgfortran).
+This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
@@ -25,6 +25,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "libgfortran.h"
+#include <stdlib.h>
#include <string.h>
#include <errno.h>
@@ -46,17 +47,13 @@ unlink_i4_sub (char *name, GFC_INTEGER_4 *status, gfc_charlen_type name_len)
char *str;
GFC_INTEGER_4 stat;
- /* Trim trailing spaces from name. */
- while (name_len > 0 && name[name_len - 1] == ' ')
- name_len--;
-
/* Make a null terminated copy of the string. */
- str = gfc_alloca (name_len + 1);
- memcpy (str, name, name_len);
- str[name_len] = '\0';
+ str = fc_strdup (name, name_len);
stat = unlink (str);
+ free (str);
+
if (status != NULL)
*status = (stat == 0) ? stat : errno;
}
diff --git a/libgfortran/io/file_pos.c b/libgfortran/io/file_pos.c
index 85183a6632d..061f42ea9be 100644
--- a/libgfortran/io/file_pos.c
+++ b/libgfortran/io/file_pos.c
@@ -36,7 +36,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
record, and we have to sift backwards to find the newline before
that or the start of the file, whichever comes first. */
-static const int READ_CHUNK = 4096;
+#define READ_CHUNK 4096
static void
formatted_backspace (st_parameter_filepos *fpp, gfc_unit *u)
diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index 1cb329f7df4..20b2b83a5e6 100644
--- a/libgfortran/io/list_read.c
+++ b/libgfortran/io/list_read.c
@@ -3132,16 +3132,27 @@ get_name:
if (component_flag)
{
+#define EXT_STACK_SZ 100
+ char ext_stack[EXT_STACK_SZ];
+ char *ext_name;
size_t var_len = strlen (root_nl->var_name);
size_t saved_len
= dtp->u.p.saved_string ? strlen (dtp->u.p.saved_string) : 0;
- char ext_name[var_len + saved_len + 1];
+ size_t ext_size = var_len + saved_len + 1;
+
+ if (ext_size > EXT_STACK_SZ)
+ ext_name = xmalloc (ext_size);
+ else
+ ext_name = ext_stack;
memcpy (ext_name, root_nl->var_name, var_len);
if (dtp->u.p.saved_string)
memcpy (ext_name + var_len, dtp->u.p.saved_string, saved_len);
ext_name[var_len + saved_len] = '\0';
nl = find_nml_node (dtp, ext_name);
+
+ if (ext_size > EXT_STACK_SZ)
+ free (ext_name);
}
else
nl = find_nml_node (dtp, dtp->u.p.saved_string);
diff --git a/libgfortran/io/read.c b/libgfortran/io/read.c
index 64f2ddf49a1..5c56dc26e42 100644
--- a/libgfortran/io/read.c
+++ b/libgfortran/io/read.c
@@ -881,6 +881,9 @@ read_radix (st_parameter_dt *dtp, const fnode *f, char *dest, int length,
void
read_f (st_parameter_dt *dtp, const fnode *f, char *dest, int length)
{
+#define READF_TMP 50
+ char tmp[READF_TMP];
+ size_t buf_size = 0;
int w, seen_dp, exponent;
int exponent_sign;
const char *p;
@@ -895,6 +898,7 @@ read_f (st_parameter_dt *dtp, const fnode *f, char *dest, int length)
exponent_sign = 1;
exponent = 0;
w = f->u.w;
+ buffer = tmp;
/* Read in the next block. */
p = read_block_form (dtp, &w);
@@ -911,7 +915,10 @@ read_f (st_parameter_dt *dtp, const fnode *f, char *dest, int length)
exponent because of an implicit decimal point or the like. Thus allocating
strlen ("+0.0e-1000") == 10 characters plus one for NUL more than the
original buffer had should be enough. */
- buffer = gfc_alloca (w + 11);
+ buf_size = w + 11;
+ if (buf_size > READF_TMP)
+ buffer = xmalloc (buf_size);
+
out = buffer;
/* Optional sign */
@@ -984,6 +991,8 @@ read_f (st_parameter_dt *dtp, const fnode *f, char *dest, int length)
goto bad_float;
convert_infnan (dtp, dest, buffer, length);
+ if (buf_size > READF_TMP)
+ free (buffer);
return;
}
@@ -1170,7 +1179,8 @@ done:
/* Do the actual conversion. */
convert_real (dtp, dest, buffer, length);
-
+ if (buf_size > READF_TMP)
+ free (buffer);
return;
/* The value read is zero. */
@@ -1203,6 +1213,8 @@ zero:
return;
bad_float:
+ if (buf_size > READF_TMP)
+ free (buffer);
generate_error (&dtp->common, LIBERROR_READ_VALUE,
"Bad value during floating point read");
next_record (dtp, 1);
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c
index 87b8c05c1a4..71c60b6f412 100644
--- a/libgfortran/io/transfer.c
+++ b/libgfortran/io/transfer.c
@@ -2982,7 +2982,7 @@ static void
skip_record (st_parameter_dt *dtp, ssize_t bytes)
{
ssize_t rlength, readb;
- static const ssize_t MAX_READ = 4096;
+#define MAX_READ 4096
char p[MAX_READ];
dtp->u.p.current_unit->bytes_left_subrecord += bytes;
@@ -3282,7 +3282,7 @@ next_record_w_unf (st_parameter_dt *dtp, int next_subrecord)
static ssize_t
sset (stream * s, int c, ssize_t nbyte)
{
- static const int WRITE_CHUNK = 256;
+#define WRITE_CHUNK 256
char p[WRITE_CHUNK];
ssize_t bytes_left, trans;
diff --git a/libgfortran/io/write_float.def b/libgfortran/io/write_float.def
index 99f6ff8e83f..1b345f8fc4b 100644
--- a/libgfortran/io/write_float.def
+++ b/libgfortran/io/write_float.def
@@ -1277,7 +1277,13 @@ write_float (st_parameter_dt *dtp, const fnode *f, const char *source, \
trailing null, and finally some extra digits depending on the
requested precision. */
const size_t size = 4932 + 3 + precision;
- char buffer[size];
+#define BUF_STACK_SZ 5000
+ char buf_stack[BUF_STACK_SZ];
+ char *buffer;
+ if (size > BUF_STACK_SZ)
+ buffer = xmalloc (size);
+ else
+ buffer = buf_stack;
switch (len)
{
@@ -1306,4 +1312,6 @@ write_float (st_parameter_dt *dtp, const fnode *f, const char *source, \
default:
internal_error (NULL, "bad real kind");
}
+ if (size > BUF_STACK_SZ)
+ free (buffer);
}
diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h
index d2de76fcb92..bf7442c405a 100644
--- a/libgfortran/libgfortran.h
+++ b/libgfortran/libgfortran.h
@@ -573,10 +573,6 @@ iexport_data_proto(line);
extern char *filename;
iexport_data_proto(filename);
-/* Avoid conflicting prototypes of alloca() in system headers by using
- GCC's builtin alloca(). */
-#define gfc_alloca(x) __builtin_alloca(x)
-
/* The default value of record length for preconnected units is defined
here. This value can be overriden by an environment variable.
@@ -851,6 +847,9 @@ export_proto(string_len_trim_char4);
extern char *fc_strdup(const char *, gfc_charlen_type);
internal_proto(fc_strdup);
+extern char *fc_strdup_notrim(const char *, gfc_charlen_type);
+internal_proto(fc_strdup_notrim);
+
/* io/intrinsics.c */
extern void flush_all_units (void);
diff --git a/libgfortran/runtime/string.c b/libgfortran/runtime/string.c
index b95d1997a5c..79f75b44458 100644
--- a/libgfortran/runtime/string.c
+++ b/libgfortran/runtime/string.c
@@ -134,6 +134,20 @@ fc_strdup (const char *src, gfc_charlen_type src_len)
}
+/* Duplicate a non-null-terminated Fortran string to a malloced
+ null-terminated C string, without getting rid of trailing
+ blanks. */
+
+char *
+fc_strdup_notrim (const char *src, gfc_charlen_type src_len)
+{
+ char *p = strndup (src, src_len);
+ if (!p)
+ os_error ("Memory allocation failed in fc_strdup");
+ return p;
+}
+
+
/* Given a fortran string and an array of st_option structures, search through
the array to find a match. If the option is not found, we generate an error
if no default is provided. */
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
index 79cfdd85fb3..c6ee01ba3d3 100644
--- a/libgo/Makefile.am
+++ b/libgo/Makefile.am
@@ -99,8 +99,13 @@ AM_MAKEFLAGS = \
# Subdir rules rely on $(FLAGS_TO_PASS)
FLAGS_TO_PASS = $(AM_MAKEFLAGS)
+if GOC_IS_LLGO
+toolexeclib_LTLIBRARIES = libgo-llgo.la
+toolexeclib_LIBRARIES = libgobegin-llgo.a
+else
toolexeclib_LTLIBRARIES = libgo.la
toolexeclib_LIBRARIES = libgobegin.a
+endif
toolexeclibgo_DATA = \
bufio.gox \
@@ -1993,18 +1998,27 @@ libgo_go_objs = \
unicode/utf16.lo \
unicode/utf8.lo
-libgo_la_SOURCES = $(runtime_files)
-
-libgo_la_LDFLAGS = \
+libgo_ldflags = \
-version-info $(libtool_VERSION) $(PTHREAD_CFLAGS) $(AM_LDFLAGS)
-libgo_la_LIBADD = \
+libgo_libadd = \
$(libgo_go_objs) ../libbacktrace/libbacktrace.la \
$(LIBATOMIC) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS)
+libgo_la_SOURCES = $(runtime_files)
+libgo_la_LDFLAGS = $(libgo_ldflags)
+libgo_la_LIBADD = $(libgo_libadd)
+
+libgo_llgo_la_SOURCES = $(runtime_files)
+libgo_llgo_la_LDFLAGS = $(libgo_ldflags)
+libgo_llgo_la_LIBADD = $(libgo_libadd)
+
libgobegin_a_SOURCES = \
runtime/go-main.c
+libgobegin_llgo_a_SOURCES = \
+ runtime/go-main.c
+
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
GOCFLAGS = $(CFLAGS)
@@ -2066,7 +2080,7 @@ CHECK = \
fi
# Build all packages before checking any.
-CHECK_DEPS = libgo.la libgobegin.a \
+CHECK_DEPS = \
$(toolexeclibgo_DATA) \
$(toolexeclibgoarchive_DATA) \
$(toolexeclibgocompress_DATA) \
@@ -2095,6 +2109,12 @@ CHECK_DEPS = libgo.la libgobegin.a \
$(toolexeclibgotexttemplate_DATA) \
$(toolexeclibgounicode_DATA)
+if GOC_IS_LLGO
+CHECK_DEPS += libgo-llgo.la libgobegin-llgo.a
+else
+CHECK_DEPS += libgo.la libgobegin.a
+endif
+
@go_include@ bufio.lo.dep
bufio.lo.dep: $(go_bufio_files)
$(BUILDDEPS)
diff --git a/libgo/Makefile.in b/libgo/Makefile.in
index f5b5e70c007..f42c8f96fbd 100644
--- a/libgo/Makefile.in
+++ b/libgo/Makefile.in
@@ -45,6 +45,8 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
+@GOC_IS_LLGO_TRUE@am__append_1 = libgo-llgo.la libgobegin-llgo.a
+@GOC_IS_LLGO_FALSE@am__append_2 = libgo.la libgobegin.a
subdir = .
DIST_COMMON = README $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/configure $(am__configure_deps) \
@@ -126,6 +128,10 @@ am__installdirs = "$(DESTDIR)$(toolexeclibdir)" \
"$(DESTDIR)$(toolexeclibgounicodedir)"
LIBRARIES = $(toolexeclib_LIBRARIES)
ARFLAGS = cru
+libgobegin_llgo_a_AR = $(AR) $(ARFLAGS)
+libgobegin_llgo_a_LIBADD =
+am_libgobegin_llgo_a_OBJECTS = go-main.$(OBJEXT)
+libgobegin_llgo_a_OBJECTS = $(am_libgobegin_llgo_a_OBJECTS)
libgobegin_a_AR = $(AR) $(ARFLAGS)
libgobegin_a_LIBADD =
am_libgobegin_a_OBJECTS = go-main.$(OBJEXT)
@@ -171,10 +177,11 @@ am__DEPENDENCIES_2 = bufio.lo bytes.lo bytes/index.lo crypto.lo \
text/tabwriter.lo text/template.lo text/template/parse.lo \
testing/iotest.lo testing/quick.lo unicode/utf16.lo \
unicode/utf8.lo
-libgo_la_DEPENDENCIES = $(am__DEPENDENCIES_2) \
+am__DEPENDENCIES_3 = $(am__DEPENDENCIES_2) \
../libbacktrace/libbacktrace.la $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+libgo_llgo_la_DEPENDENCIES = $(am__DEPENDENCIES_3)
@LIBGO_IS_LINUX_FALSE@am__objects_1 = lock_sema.lo thread-sema.lo
@LIBGO_IS_LINUX_TRUE@am__objects_1 = lock_futex.lo thread-linux.lo
@HAVE_SYS_MMAN_H_FALSE@am__objects_2 = mem_posix_memalign.lo
@@ -220,11 +227,19 @@ am__objects_6 = go-append.lo go-assert.lo go-assert-interface.lo \
malloc.lo map.lo mprof.lo netpoll.lo rdebug.lo reflect.lo \
runtime1.lo sema.lo sigqueue.lo string.lo time.lo \
$(am__objects_5)
+am_libgo_llgo_la_OBJECTS = $(am__objects_6)
+libgo_llgo_la_OBJECTS = $(am_libgo_llgo_la_OBJECTS)
+libgo_llgo_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libgo_llgo_la_LDFLAGS) $(LDFLAGS) -o $@
+@GOC_IS_LLGO_TRUE@am_libgo_llgo_la_rpath = -rpath $(toolexeclibdir)
+libgo_la_DEPENDENCIES = $(am__DEPENDENCIES_3)
am_libgo_la_OBJECTS = $(am__objects_6)
libgo_la_OBJECTS = $(am_libgo_la_OBJECTS)
libgo_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(libgo_la_LDFLAGS) \
$(LDFLAGS) -o $@
+@GOC_IS_LLGO_FALSE@am_libgo_la_rpath = -rpath $(toolexeclibdir)
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/../depcomp
am__depfiles_maybe = depfiles
@@ -238,7 +253,8 @@ CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
-SOURCES = $(libgobegin_a_SOURCES) $(libgo_la_SOURCES)
+SOURCES = $(libgobegin_llgo_a_SOURCES) $(libgobegin_a_SOURCES) \
+ $(libgo_llgo_la_SOURCES) $(libgo_la_SOURCES)
MULTISRCTOP =
MULTIBUILDTOP =
MULTIDIRS =
@@ -501,8 +517,10 @@ AM_MAKEFLAGS = \
# Subdir rules rely on $(FLAGS_TO_PASS)
FLAGS_TO_PASS = $(AM_MAKEFLAGS)
-toolexeclib_LTLIBRARIES = libgo.la
-toolexeclib_LIBRARIES = libgobegin.a
+@GOC_IS_LLGO_FALSE@toolexeclib_LTLIBRARIES = libgo.la
+@GOC_IS_LLGO_TRUE@toolexeclib_LTLIBRARIES = libgo-llgo.la
+@GOC_IS_LLGO_FALSE@toolexeclib_LIBRARIES = libgobegin.a
+@GOC_IS_LLGO_TRUE@toolexeclib_LIBRARIES = libgobegin-llgo.a
toolexeclibgo_DATA = \
bufio.gox \
bytes.gox \
@@ -2054,17 +2072,25 @@ libgo_go_objs = \
unicode/utf16.lo \
unicode/utf8.lo
-libgo_la_SOURCES = $(runtime_files)
-libgo_la_LDFLAGS = \
+libgo_ldflags = \
-version-info $(libtool_VERSION) $(PTHREAD_CFLAGS) $(AM_LDFLAGS)
-libgo_la_LIBADD = \
+libgo_libadd = \
$(libgo_go_objs) ../libbacktrace/libbacktrace.la \
$(LIBATOMIC) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS)
+libgo_la_SOURCES = $(runtime_files)
+libgo_la_LDFLAGS = $(libgo_ldflags)
+libgo_la_LIBADD = $(libgo_libadd)
+libgo_llgo_la_SOURCES = $(runtime_files)
+libgo_llgo_la_LDFLAGS = $(libgo_ldflags)
+libgo_llgo_la_LIBADD = $(libgo_libadd)
libgobegin_a_SOURCES = \
runtime/go-main.c
+libgobegin_llgo_a_SOURCES = \
+ runtime/go-main.c
+
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
AM_GOCFLAGS = $(STRINGOPS_FLAG)
GOCOMPILE = $(GOC) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_GOCFLAGS) $(GOCFLAGS)
@@ -2126,35 +2152,20 @@ CHECK = \
# Build all packages before checking any.
-CHECK_DEPS = libgo.la libgobegin.a \
- $(toolexeclibgo_DATA) \
- $(toolexeclibgoarchive_DATA) \
- $(toolexeclibgocompress_DATA) \
- $(toolexeclibgocontainer_DATA) \
- $(toolexeclibgocrypto_DATA) \
- $(toolexeclibgodebug_DATA) \
- $(toolexeclibgoencoding_DATA) \
- $(toolexeclibgoexp_DATA) \
- $(toolexeclibgogo_DATA) \
- $(toolexeclibgohash_DATA) \
- $(toolexeclibgoimage_DATA) \
- $(toolexeclibgoindex_DATA) \
- $(toolexeclibgoio_DATA) \
- $(toolexeclibgolog_DATA) \
- $(toolexeclibgomath_DATA) \
- $(toolexeclibgomime_DATA) \
- $(toolexeclibgonet_DATA) \
- $(toolexeclibgonethttp_DATA) \
- $(toolexeclibgoos_DATA) \
- $(toolexeclibgopath_DATA) \
- $(toolexeclibgorpc_DATA) \
- $(toolexeclibgoruntime_DATA) \
- $(toolexeclibgosync_DATA) \
- $(toolexeclibgotesting_DATA) \
- $(toolexeclibgotext_DATA) \
- $(toolexeclibgotexttemplate_DATA) \
- $(toolexeclibgounicode_DATA)
-
+CHECK_DEPS = $(toolexeclibgo_DATA) $(toolexeclibgoarchive_DATA) \
+ $(toolexeclibgocompress_DATA) $(toolexeclibgocontainer_DATA) \
+ $(toolexeclibgocrypto_DATA) $(toolexeclibgodebug_DATA) \
+ $(toolexeclibgoencoding_DATA) $(toolexeclibgoexp_DATA) \
+ $(toolexeclibgogo_DATA) $(toolexeclibgohash_DATA) \
+ $(toolexeclibgoimage_DATA) $(toolexeclibgoindex_DATA) \
+ $(toolexeclibgoio_DATA) $(toolexeclibgolog_DATA) \
+ $(toolexeclibgomath_DATA) $(toolexeclibgomime_DATA) \
+ $(toolexeclibgonet_DATA) $(toolexeclibgonethttp_DATA) \
+ $(toolexeclibgoos_DATA) $(toolexeclibgopath_DATA) \
+ $(toolexeclibgorpc_DATA) $(toolexeclibgoruntime_DATA) \
+ $(toolexeclibgosync_DATA) $(toolexeclibgotesting_DATA) \
+ $(toolexeclibgotext_DATA) $(toolexeclibgotexttemplate_DATA) \
+ $(toolexeclibgounicode_DATA) $(am__append_1) $(am__append_2)
# At least for now, we need -static-libgo for this test, because
# otherwise we can't get the line numbers.
runtime_pprof_check_GOCFLAGS = -static-libgo
@@ -2380,6 +2391,10 @@ uninstall-toolexeclibLIBRARIES:
clean-toolexeclibLIBRARIES:
-test -z "$(toolexeclib_LIBRARIES)" || rm -f $(toolexeclib_LIBRARIES)
+libgobegin-llgo.a: $(libgobegin_llgo_a_OBJECTS) $(libgobegin_llgo_a_DEPENDENCIES)
+ -rm -f libgobegin-llgo.a
+ $(libgobegin_llgo_a_AR) libgobegin-llgo.a $(libgobegin_llgo_a_OBJECTS) $(libgobegin_llgo_a_LIBADD)
+ $(RANLIB) libgobegin-llgo.a
libgobegin.a: $(libgobegin_a_OBJECTS) $(libgobegin_a_DEPENDENCIES)
-rm -f libgobegin.a
$(libgobegin_a_AR) libgobegin.a $(libgobegin_a_OBJECTS) $(libgobegin_a_LIBADD)
@@ -2415,8 +2430,10 @@ clean-toolexeclibLTLIBRARIES:
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
+libgo-llgo.la: $(libgo_llgo_la_OBJECTS) $(libgo_llgo_la_DEPENDENCIES)
+ $(libgo_llgo_la_LINK) $(am_libgo_llgo_la_rpath) $(libgo_llgo_la_OBJECTS) $(libgo_llgo_la_LIBADD) $(LIBS)
libgo.la: $(libgo_la_OBJECTS) $(libgo_la_DEPENDENCIES)
- $(libgo_la_LINK) -rpath $(toolexeclibdir) $(libgo_la_OBJECTS) $(libgo_la_LIBADD) $(LIBS)
+ $(libgo_la_LINK) $(am_libgo_la_rpath) $(libgo_la_OBJECTS) $(libgo_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
diff --git a/libgo/configure b/libgo/configure
index 7813c028c47..3352c0ff6d1 100755
--- a/libgo/configure
+++ b/libgo/configure
@@ -616,6 +616,8 @@ PTHREAD_LIBS
PTHREAD_CFLAGS
NET_LIBS
MATH_LIBS
+GOC_IS_LLGO_FALSE
+GOC_IS_LLGO_TRUE
USING_SPLIT_STACK_FALSE
USING_SPLIT_STACK_TRUE
SPLIT_STACK
@@ -11117,7 +11119,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11120 "configure"
+#line 11122 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11223,7 +11225,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11226 "configure"
+#line 11228 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -14014,6 +14016,27 @@ $as_echo "#define LINKER_SUPPORTS_SPLIT_STACK 1" >>confdefs.h
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler is llgo" >&5
+$as_echo_n "checking whether compiler is llgo... " >&6; }
+if test "${libgo_cv_c_goc_is_llgo+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ libgo_cv_c_goc_is_llgo=no
+if $GOC -dumpversion 2>/dev/null | grep llgo >/dev/null 2>&1; then
+ libgo_cv_c_goc_is_llgo=yes
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_c_goc_is_llgo" >&5
+$as_echo "$libgo_cv_c_goc_is_llgo" >&6; }
+ if test "$libgo_cv_c_goc_is_llgo" = yes; then
+ GOC_IS_LLGO_TRUE=
+ GOC_IS_LLGO_FALSE='#'
+else
+ GOC_IS_LLGO_TRUE='#'
+ GOC_IS_LLGO_FALSE=
+fi
+
+
MATH_LIBS=
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqrt in -lm" >&5
$as_echo_n "checking for sqrt in -lm... " >&6; }
@@ -15692,6 +15715,10 @@ if test -z "${USING_SPLIT_STACK_TRUE}" && test -z "${USING_SPLIT_STACK_FALSE}";
as_fn_error "conditional \"USING_SPLIT_STACK\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${GOC_IS_LLGO_TRUE}" && test -z "${GOC_IS_LLGO_FALSE}"; then
+ as_fn_error "conditional \"GOC_IS_LLGO\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${HAVE_SYS_MMAN_H_TRUE}" && test -z "${HAVE_SYS_MMAN_H_FALSE}"; then
as_fn_error "conditional \"HAVE_SYS_MMAN_H\" was never defined.
diff --git a/libgo/configure.ac b/libgo/configure.ac
index d651827fee5..6dac4d693fe 100644
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -392,6 +392,14 @@ if test "$libgo_cv_c_linker_supports_split_stack" = yes; then
[Define if the linker support split stack adjustments])
fi
+AC_CACHE_CHECK([whether compiler is llgo],
+[libgo_cv_c_goc_is_llgo],
+[libgo_cv_c_goc_is_llgo=no
+if $GOC -dumpversion 2>/dev/null | grep llgo >/dev/null 2>&1; then
+ libgo_cv_c_goc_is_llgo=yes
+fi])
+AM_CONDITIONAL(GOC_IS_LLGO, test "$libgo_cv_c_goc_is_llgo" = yes)
+
dnl Test for the -lm library.
MATH_LIBS=
AC_CHECK_LIB([m], [sqrt], MATH_LIBS=-lm)
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 53a9e68b7e5..737cd2476b6 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,142 @@
+2014-11-14 Jakub Jelinek <jakub@redhat.com>
+
+ * libgomp.c/examples-4/e.54.2.c (main): Use N / 8 instead
+ of 32 as block_size.
+ * libgomp.fortran/examples-4/e.54.2.f90 (e_54_1): Use n / 8
+ instead of 32 as block_size.
+
+2014-11-13 Andrey Turetskiy <andrey.turetskiy@intel.com>
+ Ilya Verbin <ilya.verbin@intel.com>
+
+ * Makefile.in: Regenerate.
+ * configure: Regenerate.
+ * configure.ac: Set up offload_additional_options,
+ offload_additional_lib_paths and offload_targets.
+ * testsuite/Makefile.am: Export environment variables: OFFLOAD_TARGETS,
+ OFFLOAD_ADDITIONAL_OPTIONS, OFFLOAD_ADDITIONAL_LIB_PATHS.
+ * testsuite/Makefile.in: Regenerate.
+ * testsuite/lib/libgomp.exp (libgomp_init): Append
+ offload_additional_lib_paths to LD_LIBRARY_PATH. Append
+ offload_additional_options to ALWAYS_CFLAGS. Append liboffloadmic
+ build directory to LD_LIBRARY_PATH for intelmic offload targets.
+
+2014-11-13 Andrey Turetskiy <andrey.turetskiy@intel.com>
+ Ilya Verbin <ilya.verbin@intel.com>
+ Kirill Yukhin <kirill.yukhin@intel.com>
+ Ilya Tocar <ilya.tocar@intel.com>
+
+ * testsuite/lib/libgomp.exp
+ (check_effective_target_offload_device): New.
+ * testsuite/libgomp.c++/c++.exp: Include tests from subdirectories.
+ * testsuite/libgomp.c++/examples-4/e.51.5.C: New test.
+ * testsuite/libgomp.c++/examples-4/e.53.2.C: Ditto.
+ * testsuite/libgomp.c/examples-4/e.50.1.c: Ditto.
+ * testsuite/libgomp.c/examples-4/e.50.2.c: Ditto.
+ * testsuite/libgomp.c/examples-4/e.50.3.c: Ditto.
+ * testsuite/libgomp.c/examples-4/e.50.4.c: Ditto.
+ * testsuite/libgomp.c/examples-4/e.50.5.c: Ditto.
+ * testsuite/libgomp.c/examples-4/e.51.1.c: Ditto.
+ * testsuite/libgomp.c/examples-4/e.51.2.c: Ditto.
+ * testsuite/libgomp.c/examples-4/e.51.3.c: Ditto.
+ * testsuite/libgomp.c/examples-4/e.51.4.c: Ditto.
+ * testsuite/libgomp.c/examples-4/e.51.6.c: Ditto.
+ * testsuite/libgomp.c/examples-4/e.51.7.c: Ditto.
+ * testsuite/libgomp.c/examples-4/e.52.1.c: Ditto.
+ * testsuite/libgomp.c/examples-4/e.52.2.c: Ditto.
+ * testsuite/libgomp.c/examples-4/e.53.1.c: Ditto.
+ * testsuite/libgomp.c/examples-4/e.53.3.c: Ditto.
+ * testsuite/libgomp.c/examples-4/e.53.4.c: Ditto.
+ * testsuite/libgomp.c/examples-4/e.53.5.c: Ditto.
+ * testsuite/libgomp.c/examples-4/e.54.2.c: Ditto.
+ * testsuite/libgomp.c/examples-4/e.54.3.c: Ditto.
+ * testsuite/libgomp.c/examples-4/e.54.4.c: Ditto.
+ * testsuite/libgomp.c/examples-4/e.54.5.c: Ditto.
+ * testsuite/libgomp.c/examples-4/e.54.6.c: Ditto.
+ * testsuite/libgomp.c/examples-4/e.55.1.c: Ditto.
+ * testsuite/libgomp.c/examples-4/e.55.2.c: Ditto.
+ * testsuite/libgomp.c/examples-4/e.56.3.c: Ditto.
+ * testsuite/libgomp.c/examples-4/e.56.4.c: Ditto.
+ * testsuite/libgomp.c/examples-4/e.57.1.c: Ditto.
+ * testsuite/libgomp.c/examples-4/e.57.2.c: Ditto.
+ * testsuite/libgomp.c/examples-4/e.57.3.c: Ditto.
+ * testsuite/libgomp.c/target-7.c: Fix test.
+ * testsuite/libgomp.fortran/examples-4/e.50.1.f90: New test.
+ * testsuite/libgomp.fortran/examples-4/e.50.2.f90: Ditto.
+ * testsuite/libgomp.fortran/examples-4/e.50.3.f90: Ditto.
+ * testsuite/libgomp.fortran/examples-4/e.50.4.f90: Ditto.
+ * testsuite/libgomp.fortran/examples-4/e.50.5.f90: Ditto.
+ * testsuite/libgomp.fortran/examples-4/e.51.1.f90: Ditto.
+ * testsuite/libgomp.fortran/examples-4/e.51.2.f90: Ditto.
+ * testsuite/libgomp.fortran/examples-4/e.51.3.f90: Ditto.
+ * testsuite/libgomp.fortran/examples-4/e.51.4.f90: Ditto.
+ * testsuite/libgomp.fortran/examples-4/e.51.5.f90: Ditto.
+ * testsuite/libgomp.fortran/examples-4/e.51.6.f90: Ditto.
+ * testsuite/libgomp.fortran/examples-4/e.51.7.f90: Ditto.
+ * testsuite/libgomp.fortran/examples-4/e.52.1.f90: Ditto.
+ * testsuite/libgomp.fortran/examples-4/e.52.2.f90: Ditto.
+ * testsuite/libgomp.fortran/examples-4/e.53.1.f90: Ditto.
+ * testsuite/libgomp.fortran/examples-4/e.53.2.f90: Ditto.
+ * testsuite/libgomp.fortran/examples-4/e.53.3.f90: Ditto.
+ * testsuite/libgomp.fortran/examples-4/e.53.4.f90: Ditto.
+ * testsuite/libgomp.fortran/examples-4/e.53.5.f90: Ditto.
+ * testsuite/libgomp.fortran/examples-4/e.54.2.f90: Ditto.
+ * testsuite/libgomp.fortran/examples-4/e.54.3.f90: Ditto.
+ * testsuite/libgomp.fortran/examples-4/e.54.4.f90: Ditto.
+ * testsuite/libgomp.fortran/examples-4/e.54.5.f90: Ditto.
+ * testsuite/libgomp.fortran/examples-4/e.54.6.f90: Ditto.
+ * testsuite/libgomp.fortran/examples-4/e.55.1.f90: Ditto.
+ * testsuite/libgomp.fortran/examples-4/e.55.2.f90: Ditto.
+ * testsuite/libgomp.fortran/examples-4/e.56.3.f90: Ditto.
+ * testsuite/libgomp.fortran/examples-4/e.56.4.f90: Ditto.
+ * testsuite/libgomp.fortran/examples-4/e.57.1.f90: Ditto.
+ * testsuite/libgomp.fortran/examples-4/e.57.2.f90: Ditto.
+ * testsuite/libgomp.fortran/examples-4/e.57.3.f90: Ditto.
+
+2014-11-13 Jakub Jelinek <jakub@redhat.com>
+ Ilya Verbin <ilya.verbin@intel.com>
+ Thomas Schwinge <thomas@codesourcery.com>
+ Andrey Turetskiy <andrey.turetskiy@intel.com>
+
+ * libgomp.map (GOMP_4.0.1): New symbol version.
+ Add GOMP_offload_register.
+ * libgomp_target.h: New file.
+ * splay-tree.h: New file.
+ * target.c: Include config.h, libgomp_target.h, dlfcn.h, splay-tree.h.
+ (gomp_target_init): New forward declaration.
+ (gomp_is_initialized): New static variable.
+ (splay_tree_node, splay_tree, splay_tree_key): New typedefs.
+ (struct target_mem_desc, struct splay_tree_key_s, offload_image_descr):
+ New structures.
+ (offload_images, num_offload_images, devices, num_devices): New static
+ variables.
+ (splay_compare): New static function.
+ (struct gomp_device_descr): New structure.
+ (gomp_get_num_devices): Call gomp_target_init.
+ (resolve_device, gomp_map_vars_existing, gomp_map_vars, gomp_unmap_tgt)
+ (gomp_unmap_vars, gomp_update, gomp_init_device): New static functions.
+ (GOMP_offload_register): New function.
+ (GOMP_target): Arrange for host callback to be performed in a separate
+ initial thread and contention group, inheriting ICVs from
+ gomp_global_icv etc. Call gomp_map_vars and gomp_unmap_vars.
+ Add device initialization and lookup for target function in splay tree.
+ (GOMP_target_data): Add device initialization and call gomp_map_vars.
+ (GOMP_target_end_data): Call gomp_unmap_vars.
+ (GOMP_target_update): Add device initialization and call gomp_update.
+ (gomp_load_plugin_for_device, gomp_register_images_for_device)
+ (gomp_target_init): New static functions.
+
+2014-11-13 Bernd Schmidt <bernds@codesourcery.com>
+ Thomas Schwinge <thomas@codesourcery.com>
+ Ilya Verbin <ilya.verbin@intel.com>
+ Andrey Turetskiy <andrey.turetskiy@intel.com>
+
+ * config.h.in: Regenerate.
+ * configure: Regenerate.
+ * configure.ac: Check for libdl, required for plugin support.
+ (PLUGIN_SUPPORT): Define if plugins are supported.
+ (enable_offload_targets): Support Intel MIC targets.
+ (OFFLOAD_TARGETS): List of target names suitable for offloading.
+
2014-11-11 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR target/63610
diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in
index 5cd666f8ec6..8e4774f6c0e 100644
--- a/libgomp/Makefile.in
+++ b/libgomp/Makefile.in
@@ -268,6 +268,9 @@ lt_host_flags = @lt_host_flags@
mandir = @mandir@
mkdir_p = @mkdir_p@
multi_basedir = @multi_basedir@
+offload_additional_lib_paths = @offload_additional_lib_paths@
+offload_additional_options = @offload_additional_options@
+offload_targets = @offload_targets@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
diff --git a/libgomp/config.h.in b/libgomp/config.h.in
index 14c7e2a9a1b..94a2b3b3b32 100644
--- a/libgomp/config.h.in
+++ b/libgomp/config.h.in
@@ -30,6 +30,9 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
+/* Define to 1 if you have the `dl' library (-ldl). */
+#undef HAVE_LIBDL
+
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
@@ -86,6 +89,9 @@
*/
#undef LT_OBJDIR
+/* Define to hold the list of target names suitable for offloading. */
+#undef OFFLOAD_TARGETS
+
/* Name of package */
#undef PACKAGE
@@ -107,6 +113,9 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
+/* Define if all infrastructure, needed for plugins, is supported. */
+#undef PLUGIN_SUPPORT
+
/* The size of `char', as computed by sizeof. */
#undef SIZEOF_CHAR
diff --git a/libgomp/configure b/libgomp/configure
index 0f553aa80a3..19f36c6db0c 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -616,6 +616,9 @@ OMP_LOCK_SIZE
USE_FORTRAN_FALSE
USE_FORTRAN_TRUE
link_gomp
+offload_additional_lib_paths
+offload_additional_options
+offload_targets
XLDFLAGS
XCFLAGS
config_path
@@ -11094,7 +11097,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11097 "configure"
+#line 11100 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11200,7 +11203,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11203 "configure"
+#line 11206 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -15052,6 +15055,60 @@ fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
+plugin_support=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlsym in -ldl" >&5
+$as_echo_n "checking for dlsym in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dlsym+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 dlsym ();
+int
+main ()
+{
+return dlsym ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dlsym=yes
+else
+ ac_cv_lib_dl_dlsym=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_dlsym" >&5
+$as_echo "$ac_cv_lib_dl_dlsym" >&6; }
+if test "x$ac_cv_lib_dl_dlsym" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBDL 1
+_ACEOF
+
+ LIBS="-ldl $LIBS"
+
+else
+ plugin_support=no
+fi
+
+if test x"$plugin_support" = xyes; then
+
+$as_echo "#define PLUGIN_SUPPORT 1" >>confdefs.h
+
+fi
+
# Check for functions needed.
for ac_func in getloadavg clock_gettime strtoull
do :
@@ -16153,6 +16210,43 @@ else
multilib_arg=
fi
+# Get accel target and path to install tree of accel compiler
+offload_additional_options=
+offload_additional_lib_paths=
+offload_targets=
+if test x"$enable_offload_targets" != x; then
+ for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do
+ tgt_dir=`echo $tgt | grep '=' | sed 's/.*=//'`
+ tgt=`echo $tgt | sed 's/=.*//'`
+ case $tgt in
+ *-intelmic-* | *-intelmicemul-*)
+ tgt_name="intelmic" ;;
+ *)
+ as_fn_error "unknown offload target specified" "$LINENO" 5 ;;
+ esac
+ if test x"$offload_targets" = x; then
+ offload_targets=$tgt_name
+ else
+ offload_targets=$offload_targets,$tgt_name
+ fi
+ if test x"$tgt_dir" != x; then
+ offload_additional_options="$offload_additional_options -B$tgt_dir/libexec/gcc/\$(target_alias)/\$(gcc_version) -B$tgt_dir/bin"
+ offload_additional_lib_paths="$offload_additional_lib_paths:$tgt_dir/lib64:$tgt_dir/lib"
+ else
+ offload_additional_options="$offload_additional_options -B\$(libexecdir)/gcc/\$(target_alias)/\$(gcc_version) -B\$(bindir)"
+ offload_additional_lib_paths="$offload_additional_lib_paths:$toolexeclibdir"
+ fi
+ done
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define OFFLOAD_TARGETS "$offload_targets"
+_ACEOF
+
+
+
+
+
# Set up the set of libraries that we need to link against for libgomp.
# Note that the GOMP_SELF_SPEC in gcc.c may force -pthread,
# which will force linkage against -lpthread (or equivalent for the system).
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index 84d250f0b19..cea63660c5a 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -193,6 +193,13 @@ AC_LINK_IFELSE(
[],
[AC_MSG_ERROR([Pthreads are required to build libgomp])])])
+plugin_support=yes
+AC_CHECK_LIB(dl, dlsym, , [plugin_support=no])
+if test x"$plugin_support" = xyes; then
+ AC_DEFINE(PLUGIN_SUPPORT, 1,
+ [Define if all infrastructure, needed for plugins, is supported.])
+fi
+
# Check for functions needed.
AC_CHECK_FUNCS(getloadavg clock_gettime strtoull)
@@ -273,6 +280,40 @@ else
multilib_arg=
fi
+# Get accel target and path to install tree of accel compiler
+offload_additional_options=
+offload_additional_lib_paths=
+offload_targets=
+if test x"$enable_offload_targets" != x; then
+ for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do
+ tgt_dir=`echo $tgt | grep '=' | sed 's/.*=//'`
+ tgt=`echo $tgt | sed 's/=.*//'`
+ case $tgt in
+ *-intelmic-* | *-intelmicemul-*)
+ tgt_name="intelmic" ;;
+ *)
+ AC_MSG_ERROR([unknown offload target specified]) ;;
+ esac
+ if test x"$offload_targets" = x; then
+ offload_targets=$tgt_name
+ else
+ offload_targets=$offload_targets,$tgt_name
+ fi
+ if test x"$tgt_dir" != x; then
+ offload_additional_options="$offload_additional_options -B$tgt_dir/libexec/gcc/\$(target_alias)/\$(gcc_version) -B$tgt_dir/bin"
+ offload_additional_lib_paths="$offload_additional_lib_paths:$tgt_dir/lib64:$tgt_dir/lib"
+ else
+ offload_additional_options="$offload_additional_options -B\$(libexecdir)/gcc/\$(target_alias)/\$(gcc_version) -B\$(bindir)"
+ offload_additional_lib_paths="$offload_additional_lib_paths:$toolexeclibdir"
+ fi
+ done
+fi
+AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets",
+ [Define to hold the list of target names suitable for offloading.])
+AC_SUBST(offload_targets)
+AC_SUBST(offload_additional_options)
+AC_SUBST(offload_additional_lib_paths)
+
# Set up the set of libraries that we need to link against for libgomp.
# Note that the GOMP_SELF_SPEC in gcc.c may force -pthread,
# which will force linkage against -lpthread (or equivalent for the system).
diff --git a/libgomp/libgomp.map b/libgomp/libgomp.map
index b102fd88357..f36df23e795 100644
--- a/libgomp/libgomp.map
+++ b/libgomp/libgomp.map
@@ -227,3 +227,8 @@ GOMP_4.0 {
GOMP_target_update;
GOMP_teams;
} GOMP_3.0;
+
+GOMP_4.0.1 {
+ global:
+ GOMP_offload_register;
+} GOMP_4.0;
diff --git a/libgomp/libgomp_target.h b/libgomp/libgomp_target.h
new file mode 100644
index 00000000000..f7d19d051f0
--- /dev/null
+++ b/libgomp/libgomp_target.h
@@ -0,0 +1,44 @@
+/* Copyright (C) 2014 Free Software Foundation, Inc.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp 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.
+
+ Libgomp 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.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef LIBGOMP_TARGET_H
+#define LIBGOMP_TARGET_H 1
+
+/* Type of offload target device. */
+enum offload_target_type
+{
+ OFFLOAD_TARGET_TYPE_HOST,
+ OFFLOAD_TARGET_TYPE_INTEL_MIC
+};
+
+/* Auxiliary struct, used for transferring a host-target address range mapping
+ from plugin to libgomp. */
+struct mapping_table
+{
+ uintptr_t host_start;
+ uintptr_t host_end;
+ uintptr_t tgt_start;
+ uintptr_t tgt_end;
+};
+
+#endif /* LIBGOMP_TARGET_H */
diff --git a/libgomp/splay-tree.h b/libgomp/splay-tree.h
new file mode 100644
index 00000000000..eb8011a8b5c
--- /dev/null
+++ b/libgomp/splay-tree.h
@@ -0,0 +1,232 @@
+/* A splay-tree datatype.
+ Copyright 1998-2014
+ Free Software Foundation, Inc.
+ Contributed by Mark Mitchell (mark@markmitchell.com).
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp 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.
+
+ Libgomp 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.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* The splay tree code copied from include/splay-tree.h and adjusted,
+ so that all the data lives directly in splay_tree_node_s structure
+ and no extra allocations are needed.
+
+ Files including this header should before including it add:
+typedef struct splay_tree_node_s *splay_tree_node;
+typedef struct splay_tree_s *splay_tree;
+typedef struct splay_tree_key_s *splay_tree_key;
+ define splay_tree_key_s structure, and define
+ splay_compare inline function. */
+
+/* For an easily readable description of splay-trees, see:
+
+ Lewis, Harry R. and Denenberg, Larry. Data Structures and Their
+ Algorithms. Harper-Collins, Inc. 1991.
+
+ The major feature of splay trees is that all basic tree operations
+ are amortized O(log n) time for a tree with n nodes. */
+
+/* The nodes in the splay tree. */
+struct splay_tree_node_s {
+ struct splay_tree_key_s key;
+ /* The left and right children, respectively. */
+ splay_tree_node left;
+ splay_tree_node right;
+};
+
+/* The splay tree. */
+struct splay_tree_s {
+ splay_tree_node root;
+};
+
+/* Rotate the edge joining the left child N with its parent P. PP is the
+ grandparents' pointer to P. */
+
+static inline void
+rotate_left (splay_tree_node *pp, splay_tree_node p, splay_tree_node n)
+{
+ splay_tree_node tmp;
+ tmp = n->right;
+ n->right = p;
+ p->left = tmp;
+ *pp = n;
+}
+
+/* Rotate the edge joining the right child N with its parent P. PP is the
+ grandparents' pointer to P. */
+
+static inline void
+rotate_right (splay_tree_node *pp, splay_tree_node p, splay_tree_node n)
+{
+ splay_tree_node tmp;
+ tmp = n->left;
+ n->left = p;
+ p->right = tmp;
+ *pp = n;
+}
+
+/* Bottom up splay of KEY. */
+
+static void
+splay_tree_splay (splay_tree sp, splay_tree_key key)
+{
+ if (sp->root == NULL)
+ return;
+
+ do {
+ int cmp1, cmp2;
+ splay_tree_node n, c;
+
+ n = sp->root;
+ cmp1 = splay_compare (key, &n->key);
+
+ /* Found. */
+ if (cmp1 == 0)
+ return;
+
+ /* Left or right? If no child, then we're done. */
+ if (cmp1 < 0)
+ c = n->left;
+ else
+ c = n->right;
+ if (!c)
+ return;
+
+ /* Next one left or right? If found or no child, we're done
+ after one rotation. */
+ cmp2 = splay_compare (key, &c->key);
+ if (cmp2 == 0
+ || (cmp2 < 0 && !c->left)
+ || (cmp2 > 0 && !c->right))
+ {
+ if (cmp1 < 0)
+ rotate_left (&sp->root, n, c);
+ else
+ rotate_right (&sp->root, n, c);
+ return;
+ }
+
+ /* Now we have the four cases of double-rotation. */
+ if (cmp1 < 0 && cmp2 < 0)
+ {
+ rotate_left (&n->left, c, c->left);
+ rotate_left (&sp->root, n, n->left);
+ }
+ else if (cmp1 > 0 && cmp2 > 0)
+ {
+ rotate_right (&n->right, c, c->right);
+ rotate_right (&sp->root, n, n->right);
+ }
+ else if (cmp1 < 0 && cmp2 > 0)
+ {
+ rotate_right (&n->left, c, c->right);
+ rotate_left (&sp->root, n, n->left);
+ }
+ else if (cmp1 > 0 && cmp2 < 0)
+ {
+ rotate_left (&n->right, c, c->left);
+ rotate_right (&sp->root, n, n->right);
+ }
+ } while (1);
+}
+
+/* Insert a new NODE into SP. The NODE shouldn't exist in the tree. */
+
+static void
+splay_tree_insert (splay_tree sp, splay_tree_node node)
+{
+ int comparison = 0;
+
+ splay_tree_splay (sp, &node->key);
+
+ if (sp->root)
+ comparison = splay_compare (&sp->root->key, &node->key);
+
+ if (sp->root && comparison == 0)
+ abort ();
+ else
+ {
+ /* Insert it at the root. */
+ if (sp->root == NULL)
+ node->left = node->right = NULL;
+ else if (comparison < 0)
+ {
+ node->left = sp->root;
+ node->right = node->left->right;
+ node->left->right = NULL;
+ }
+ else
+ {
+ node->right = sp->root;
+ node->left = node->right->left;
+ node->right->left = NULL;
+ }
+
+ sp->root = node;
+ }
+}
+
+/* Remove node with KEY from SP. It is not an error if it did not exist. */
+
+static void
+splay_tree_remove (splay_tree sp, splay_tree_key key)
+{
+ splay_tree_splay (sp, key);
+
+ if (sp->root && splay_compare (&sp->root->key, key) == 0)
+ {
+ splay_tree_node left, right;
+
+ left = sp->root->left;
+ right = sp->root->right;
+
+ /* One of the children is now the root. Doesn't matter much
+ which, so long as we preserve the properties of the tree. */
+ if (left)
+ {
+ sp->root = left;
+
+ /* If there was a right child as well, hang it off the
+ right-most leaf of the left child. */
+ if (right)
+ {
+ while (left->right)
+ left = left->right;
+ left->right = right;
+ }
+ }
+ else
+ sp->root = right;
+ }
+}
+
+/* Lookup KEY in SP, returning NODE if present, and NULL
+ otherwise. */
+
+static splay_tree_key
+splay_tree_lookup (splay_tree sp, splay_tree_key key)
+{
+ splay_tree_splay (sp, key);
+
+ if (sp->root && splay_compare (&sp->root->key, key) == 0)
+ return &sp->root->key;
+ else
+ return NULL;
+}
diff --git a/libgomp/target.c b/libgomp/target.c
index 46acc588dda..5b4873b4ffc 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -22,19 +22,641 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-/* This file handles the maintainence of threads in response to team
- creation and termination. */
+/* This file contains the support of offloading. */
+#include "config.h"
#include "libgomp.h"
+#include "libgomp_target.h"
#include <limits.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
+#ifdef PLUGIN_SUPPORT
+#include <dlfcn.h>
+#endif
+
+static void gomp_target_init (void);
+
+static pthread_once_t gomp_is_initialized = PTHREAD_ONCE_INIT;
+
+/* Forward declaration for a node in the tree. */
+typedef struct splay_tree_node_s *splay_tree_node;
+typedef struct splay_tree_s *splay_tree;
+typedef struct splay_tree_key_s *splay_tree_key;
+
+struct target_mem_desc {
+ /* Reference count. */
+ uintptr_t refcount;
+ /* All the splay nodes allocated together. */
+ splay_tree_node array;
+ /* Start of the target region. */
+ uintptr_t tgt_start;
+ /* End of the targer region. */
+ uintptr_t tgt_end;
+ /* Handle to free. */
+ void *to_free;
+ /* Previous target_mem_desc. */
+ struct target_mem_desc *prev;
+ /* Number of items in following list. */
+ size_t list_count;
+
+ /* Corresponding target device descriptor. */
+ struct gomp_device_descr *device_descr;
+
+ /* List of splay keys to remove (or decrease refcount)
+ at the end of region. */
+ splay_tree_key list[];
+};
+
+struct splay_tree_key_s {
+ /* Address of the host object. */
+ uintptr_t host_start;
+ /* Address immediately after the host object. */
+ uintptr_t host_end;
+ /* Descriptor of the target memory. */
+ struct target_mem_desc *tgt;
+ /* Offset from tgt->tgt_start to the start of the target object. */
+ uintptr_t tgt_offset;
+ /* Reference count. */
+ uintptr_t refcount;
+ /* True if data should be copied from device to host at the end. */
+ bool copy_from;
+};
+
+/* This structure describes an offload image.
+ It contains type of the target device, pointer to host table descriptor, and
+ pointer to target data. */
+struct offload_image_descr {
+ enum offload_target_type type;
+ void *host_table;
+ void *target_data;
+};
+
+/* Array of descriptors of offload images. */
+static struct offload_image_descr *offload_images;
+
+/* Total number of offload images. */
+static int num_offload_images;
+
+/* Array of descriptors for all available devices. */
+static struct gomp_device_descr *devices;
+
+/* Total number of available devices. */
+static int num_devices;
+
+/* The comparison function. */
+
+static int
+splay_compare (splay_tree_key x, splay_tree_key y)
+{
+ if (x->host_start == x->host_end
+ && y->host_start == y->host_end)
+ return 0;
+ if (x->host_end <= y->host_start)
+ return -1;
+ if (x->host_start >= y->host_end)
+ return 1;
+ return 0;
+}
+
+#include "splay-tree.h"
+
+/* This structure describes accelerator device.
+ It contains ID-number of the device, its type, function handlers for
+ interaction with the device, and information about mapped memory. */
+struct gomp_device_descr
+{
+ /* This is the ID number of device. It could be specified in DEVICE-clause of
+ TARGET construct. */
+ int id;
+
+ /* This is the ID number of device among devices of the same type. */
+ int target_id;
+
+ /* This is the TYPE of device. */
+ enum offload_target_type type;
+
+ /* Set to true when device is initialized. */
+ bool is_initialized;
+
+ /* Function handlers. */
+ int (*get_type_func) (void);
+ int (*get_num_devices_func) (void);
+ void (*register_image_func) (void *, void *);
+ void (*init_device_func) (int);
+ int (*get_table_func) (int, void *);
+ void *(*alloc_func) (int, size_t);
+ void (*free_func) (int, void *);
+ void *(*host2dev_func) (int, void *, const void *, size_t);
+ void *(*dev2host_func) (int, void *, const void *, size_t);
+ void (*run_func) (int, void *, void *);
+
+ /* Splay tree containing information about mapped memory regions. */
+ struct splay_tree_s dev_splay_tree;
+
+ /* Mutex for operating with the splay tree and other shared structures. */
+ gomp_mutex_t dev_env_lock;
+};
+
attribute_hidden int
gomp_get_num_devices (void)
{
- return 0;
+ (void) pthread_once (&gomp_is_initialized, gomp_target_init);
+ return num_devices;
+}
+
+static struct gomp_device_descr *
+resolve_device (int device_id)
+{
+ if (device_id == -1)
+ {
+ struct gomp_task_icv *icv = gomp_icv (false);
+ device_id = icv->default_device_var;
+ }
+
+ if (device_id < 0 || device_id >= gomp_get_num_devices ())
+ return NULL;
+
+ return &devices[device_id];
+}
+
+
+/* Handle the case where splay_tree_lookup found oldn for newn.
+ Helper function of gomp_map_vars. */
+
+static inline void
+gomp_map_vars_existing (splay_tree_key oldn, splay_tree_key newn,
+ unsigned char kind)
+{
+ if (oldn->host_start > newn->host_start
+ || oldn->host_end < newn->host_end)
+ gomp_fatal ("Trying to map into device [%p..%p) object when"
+ "[%p..%p) is already mapped",
+ (void *) newn->host_start, (void *) newn->host_end,
+ (void *) oldn->host_start, (void *) oldn->host_end);
+ oldn->refcount++;
+}
+
+static struct target_mem_desc *
+gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum,
+ void **hostaddrs, size_t *sizes, unsigned char *kinds,
+ bool is_target)
+{
+ size_t i, tgt_align, tgt_size, not_found_cnt = 0;
+ struct splay_tree_key_s cur_node;
+ struct target_mem_desc *tgt
+ = gomp_malloc (sizeof (*tgt) + sizeof (tgt->list[0]) * mapnum);
+ tgt->list_count = mapnum;
+ tgt->refcount = 1;
+ tgt->device_descr = devicep;
+
+ if (mapnum == 0)
+ return tgt;
+
+ tgt_align = sizeof (void *);
+ tgt_size = 0;
+ if (is_target)
+ {
+ size_t align = 4 * sizeof (void *);
+ tgt_align = align;
+ tgt_size = mapnum * sizeof (void *);
+ }
+
+ gomp_mutex_lock (&devicep->dev_env_lock);
+ for (i = 0; i < mapnum; i++)
+ {
+ if (hostaddrs[i] == NULL)
+ {
+ tgt->list[i] = NULL;
+ continue;
+ }
+ cur_node.host_start = (uintptr_t) hostaddrs[i];
+ if ((kinds[i] & 7) != 4)
+ cur_node.host_end = cur_node.host_start + sizes[i];
+ else
+ cur_node.host_end = cur_node.host_start + sizeof (void *);
+ splay_tree_key n = splay_tree_lookup (&devicep->dev_splay_tree,
+ &cur_node);
+ if (n)
+ {
+ tgt->list[i] = n;
+ gomp_map_vars_existing (n, &cur_node, kinds[i]);
+ }
+ else
+ {
+ size_t align = (size_t) 1 << (kinds[i] >> 3);
+ tgt->list[i] = NULL;
+ not_found_cnt++;
+ if (tgt_align < align)
+ tgt_align = align;
+ tgt_size = (tgt_size + align - 1) & ~(align - 1);
+ tgt_size += cur_node.host_end - cur_node.host_start;
+ if ((kinds[i] & 7) == 5)
+ {
+ size_t j;
+ for (j = i + 1; j < mapnum; j++)
+ if ((kinds[j] & 7) != 4)
+ break;
+ else if ((uintptr_t) hostaddrs[j] < cur_node.host_start
+ || ((uintptr_t) hostaddrs[j] + sizeof (void *)
+ > cur_node.host_end))
+ break;
+ else
+ {
+ tgt->list[j] = NULL;
+ i++;
+ }
+ }
+ }
+ }
+
+ if (not_found_cnt || is_target)
+ {
+ /* Allocate tgt_align aligned tgt_size block of memory. */
+ /* FIXME: Perhaps change interface to allocate properly aligned
+ memory. */
+ tgt->to_free = devicep->alloc_func (devicep->target_id,
+ tgt_size + tgt_align - 1);
+ tgt->tgt_start = (uintptr_t) tgt->to_free;
+ tgt->tgt_start = (tgt->tgt_start + tgt_align - 1) & ~(tgt_align - 1);
+ tgt->tgt_end = tgt->tgt_start + tgt_size;
+ }
+ else
+ {
+ tgt->to_free = NULL;
+ tgt->tgt_start = 0;
+ tgt->tgt_end = 0;
+ }
+
+ tgt_size = 0;
+ if (is_target)
+ tgt_size = mapnum * sizeof (void *);
+
+ tgt->array = NULL;
+ if (not_found_cnt)
+ {
+ tgt->array = gomp_malloc (not_found_cnt * sizeof (*tgt->array));
+ splay_tree_node array = tgt->array;
+ size_t j;
+
+ for (i = 0; i < mapnum; i++)
+ if (tgt->list[i] == NULL)
+ {
+ if (hostaddrs[i] == NULL)
+ continue;
+ splay_tree_key k = &array->key;
+ k->host_start = (uintptr_t) hostaddrs[i];
+ if ((kinds[i] & 7) != 4)
+ k->host_end = k->host_start + sizes[i];
+ else
+ k->host_end = k->host_start + sizeof (void *);
+ splay_tree_key n
+ = splay_tree_lookup (&devicep->dev_splay_tree, k);
+ if (n)
+ {
+ tgt->list[i] = n;
+ gomp_map_vars_existing (n, k, kinds[i]);
+ }
+ else
+ {
+ size_t align = (size_t) 1 << (kinds[i] >> 3);
+ tgt->list[i] = k;
+ tgt_size = (tgt_size + align - 1) & ~(align - 1);
+ k->tgt = tgt;
+ k->tgt_offset = tgt_size;
+ tgt_size += k->host_end - k->host_start;
+ k->copy_from = false;
+ if ((kinds[i] & 7) == 2 || (kinds[i] & 7) == 3)
+ k->copy_from = true;
+ k->refcount = 1;
+ tgt->refcount++;
+ array->left = NULL;
+ array->right = NULL;
+ splay_tree_insert (&devicep->dev_splay_tree, array);
+ switch (kinds[i] & 7)
+ {
+ case 0: /* ALLOC */
+ case 2: /* FROM */
+ break;
+ case 1: /* TO */
+ case 3: /* TOFROM */
+ /* FIXME: Perhaps add some smarts, like if copying
+ several adjacent fields from host to target, use some
+ host buffer to avoid sending each var individually. */
+ devicep->host2dev_func (devicep->target_id,
+ (void *) (tgt->tgt_start
+ + k->tgt_offset),
+ (void *) k->host_start,
+ k->host_end - k->host_start);
+ break;
+ case 4: /* POINTER */
+ cur_node.host_start
+ = (uintptr_t) *(void **) k->host_start;
+ if (cur_node.host_start == (uintptr_t) NULL)
+ {
+ cur_node.tgt_offset = (uintptr_t) NULL;
+ devicep->host2dev_func (devicep->target_id,
+ (void *) (tgt->tgt_start
+ + k->tgt_offset),
+ (void *) &cur_node.tgt_offset,
+ sizeof (void *));
+ break;
+ }
+ /* Add bias to the pointer value. */
+ cur_node.host_start += sizes[i];
+ cur_node.host_end = cur_node.host_start + 1;
+ n = splay_tree_lookup (&devicep->dev_splay_tree,
+ &cur_node);
+ if (n == NULL)
+ {
+ /* Could be possibly zero size array section. */
+ cur_node.host_end--;
+ n = splay_tree_lookup (&devicep->dev_splay_tree,
+ &cur_node);
+ if (n == NULL)
+ {
+ cur_node.host_start--;
+ n = splay_tree_lookup (&devicep->dev_splay_tree,
+ &cur_node);
+ cur_node.host_start++;
+ }
+ }
+ if (n == NULL)
+ gomp_fatal ("Pointer target of array section "
+ "wasn't mapped");
+ cur_node.host_start -= n->host_start;
+ cur_node.tgt_offset = n->tgt->tgt_start + n->tgt_offset
+ + cur_node.host_start;
+ /* At this point tgt_offset is target address of the
+ array section. Now subtract bias to get what we want
+ to initialize the pointer with. */
+ cur_node.tgt_offset -= sizes[i];
+ devicep->host2dev_func (devicep->target_id,
+ (void *) (tgt->tgt_start
+ + k->tgt_offset),
+ (void *) &cur_node.tgt_offset,
+ sizeof (void *));
+ break;
+ case 5: /* TO_PSET */
+ devicep->host2dev_func (devicep->target_id,
+ (void *) (tgt->tgt_start
+ + k->tgt_offset),
+ (void *) k->host_start,
+ k->host_end - k->host_start);
+ for (j = i + 1; j < mapnum; j++)
+ if ((kinds[j] & 7) != 4)
+ break;
+ else if ((uintptr_t) hostaddrs[j] < k->host_start
+ || ((uintptr_t) hostaddrs[j] + sizeof (void *)
+ > k->host_end))
+ break;
+ else
+ {
+ tgt->list[j] = k;
+ k->refcount++;
+ cur_node.host_start
+ = (uintptr_t) *(void **) hostaddrs[j];
+ if (cur_node.host_start == (uintptr_t) NULL)
+ {
+ cur_node.tgt_offset = (uintptr_t) NULL;
+ devicep->host2dev_func (devicep->target_id,
+ (void *) (tgt->tgt_start + k->tgt_offset
+ + ((uintptr_t) hostaddrs[j]
+ - k->host_start)),
+ (void *) &cur_node.tgt_offset,
+ sizeof (void *));
+ i++;
+ continue;
+ }
+ /* Add bias to the pointer value. */
+ cur_node.host_start += sizes[j];
+ cur_node.host_end = cur_node.host_start + 1;
+ n = splay_tree_lookup (&devicep->dev_splay_tree,
+ &cur_node);
+ if (n == NULL)
+ {
+ /* Could be possibly zero size array section. */
+ cur_node.host_end--;
+ n = splay_tree_lookup (&devicep->dev_splay_tree,
+ &cur_node);
+ if (n == NULL)
+ {
+ cur_node.host_start--;
+ n = splay_tree_lookup
+ (&devicep->dev_splay_tree, &cur_node);
+ cur_node.host_start++;
+ }
+ }
+ if (n == NULL)
+ gomp_fatal ("Pointer target of array section "
+ "wasn't mapped");
+ cur_node.host_start -= n->host_start;
+ cur_node.tgt_offset = n->tgt->tgt_start
+ + n->tgt_offset
+ + cur_node.host_start;
+ /* At this point tgt_offset is target address of the
+ array section. Now subtract bias to get what we
+ want to initialize the pointer with. */
+ cur_node.tgt_offset -= sizes[j];
+ devicep->host2dev_func (devicep->target_id,
+ (void *) (tgt->tgt_start + k->tgt_offset
+ + ((uintptr_t) hostaddrs[j]
+ - k->host_start)),
+ (void *) &cur_node.tgt_offset,
+ sizeof (void *));
+ i++;
+ }
+ break;
+ }
+ array++;
+ }
+ }
+ }
+ if (is_target)
+ {
+ for (i = 0; i < mapnum; i++)
+ {
+ if (tgt->list[i] == NULL)
+ cur_node.tgt_offset = (uintptr_t) NULL;
+ else
+ cur_node.tgt_offset = tgt->list[i]->tgt->tgt_start
+ + tgt->list[i]->tgt_offset;
+ devicep->host2dev_func (devicep->target_id,
+ (void *) (tgt->tgt_start
+ + i * sizeof (void *)),
+ (void *) &cur_node.tgt_offset,
+ sizeof (void *));
+ }
+ }
+
+ gomp_mutex_unlock (&devicep->dev_env_lock);
+ return tgt;
+}
+
+static void
+gomp_unmap_tgt (struct target_mem_desc *tgt)
+{
+ /* Deallocate on target the tgt->tgt_start .. tgt->tgt_end region. */
+ if (tgt->tgt_end)
+ tgt->device_descr->free_func (tgt->device_descr->target_id, tgt->to_free);
+
+ free (tgt->array);
+ free (tgt);
+}
+
+static void
+gomp_unmap_vars (struct target_mem_desc *tgt)
+{
+ struct gomp_device_descr *devicep = tgt->device_descr;
+
+ if (tgt->list_count == 0)
+ {
+ free (tgt);
+ return;
+ }
+
+ size_t i;
+ gomp_mutex_lock (&devicep->dev_env_lock);
+ for (i = 0; i < tgt->list_count; i++)
+ if (tgt->list[i] == NULL)
+ ;
+ else if (tgt->list[i]->refcount > 1)
+ tgt->list[i]->refcount--;
+ else
+ {
+ splay_tree_key k = tgt->list[i];
+ if (k->copy_from)
+ devicep->dev2host_func (devicep->target_id, (void *) k->host_start,
+ (void *) (k->tgt->tgt_start + k->tgt_offset),
+ k->host_end - k->host_start);
+ splay_tree_remove (&devicep->dev_splay_tree, k);
+ if (k->tgt->refcount > 1)
+ k->tgt->refcount--;
+ else
+ gomp_unmap_tgt (k->tgt);
+ }
+
+ if (tgt->refcount > 1)
+ tgt->refcount--;
+ else
+ gomp_unmap_tgt (tgt);
+ gomp_mutex_unlock (&devicep->dev_env_lock);
+}
+
+static void
+gomp_update (struct gomp_device_descr *devicep, size_t mapnum,
+ void **hostaddrs, size_t *sizes, unsigned char *kinds)
+{
+ size_t i;
+ struct splay_tree_key_s cur_node;
+
+ if (!devicep)
+ return;
+
+ if (mapnum == 0)
+ return;
+
+ gomp_mutex_lock (&devicep->dev_env_lock);
+ for (i = 0; i < mapnum; i++)
+ if (sizes[i])
+ {
+ cur_node.host_start = (uintptr_t) hostaddrs[i];
+ cur_node.host_end = cur_node.host_start + sizes[i];
+ splay_tree_key n = splay_tree_lookup (&devicep->dev_splay_tree,
+ &cur_node);
+ if (n)
+ {
+ if (n->host_start > cur_node.host_start
+ || n->host_end < cur_node.host_end)
+ gomp_fatal ("Trying to update [%p..%p) object when"
+ "only [%p..%p) is mapped",
+ (void *) cur_node.host_start,
+ (void *) cur_node.host_end,
+ (void *) n->host_start,
+ (void *) n->host_end);
+ if ((kinds[i] & 7) == 1)
+ devicep->host2dev_func (devicep->target_id,
+ (void *) (n->tgt->tgt_start
+ + n->tgt_offset
+ + cur_node.host_start
+ - n->host_start),
+ (void *) cur_node.host_start,
+ cur_node.host_end - cur_node.host_start);
+ else if ((kinds[i] & 7) == 2)
+ devicep->dev2host_func (devicep->target_id,
+ (void *) cur_node.host_start,
+ (void *) (n->tgt->tgt_start
+ + n->tgt_offset
+ + cur_node.host_start
+ - n->host_start),
+ cur_node.host_end - cur_node.host_start);
+ }
+ else
+ gomp_fatal ("Trying to update [%p..%p) object that is not mapped",
+ (void *) cur_node.host_start,
+ (void *) cur_node.host_end);
+ }
+ gomp_mutex_unlock (&devicep->dev_env_lock);
+}
+
+/* This function should be called from every offload image.
+ It gets the descriptor of the host func and var tables HOST_TABLE, TYPE of
+ the target, and TARGET_DATA needed by target plugin. */
+
+void
+GOMP_offload_register (void *host_table, enum offload_target_type target_type,
+ void *target_data)
+{
+ offload_images = gomp_realloc (offload_images,
+ (num_offload_images + 1)
+ * sizeof (struct offload_image_descr));
+
+ offload_images[num_offload_images].type = target_type;
+ offload_images[num_offload_images].host_table = host_table;
+ offload_images[num_offload_images].target_data = target_data;
+
+ num_offload_images++;
+}
+
+/* This function initializes the target device, specified by DEVICEP. */
+
+static void
+gomp_init_device (struct gomp_device_descr *devicep)
+{
+ devicep->init_device_func (devicep->target_id);
+
+ /* Get address mapping table for device. */
+ struct mapping_table *table = NULL;
+ int num_entries = devicep->get_table_func (devicep->target_id, &table);
+
+ /* Insert host-target address mapping into dev_splay_tree. */
+ int i;
+ for (i = 0; i < num_entries; i++)
+ {
+ struct target_mem_desc *tgt = gomp_malloc (sizeof (*tgt));
+ tgt->refcount = 1;
+ tgt->array = gomp_malloc (sizeof (*tgt->array));
+ tgt->tgt_start = table[i].tgt_start;
+ tgt->tgt_end = table[i].tgt_end;
+ tgt->to_free = NULL;
+ tgt->list_count = 0;
+ tgt->device_descr = devicep;
+ splay_tree_node node = tgt->array;
+ splay_tree_key k = &node->key;
+ k->host_start = table[i].host_start;
+ k->host_end = table[i].host_end;
+ k->tgt_offset = 0;
+ k->refcount = 1;
+ k->copy_from = false;
+ k->tgt = tgt;
+ node->left = NULL;
+ node->right = NULL;
+ splay_tree_insert (&devicep->dev_splay_tree, node);
+ }
+
+ free (table);
+ devicep->is_initialized = true;
}
/* Called when encountering a target directive. If DEVICE
@@ -52,7 +674,38 @@ GOMP_target (int device, void (*fn) (void *), const void *openmp_target,
size_t mapnum, void **hostaddrs, size_t *sizes,
unsigned char *kinds)
{
- /* Host fallback. */
+ struct gomp_device_descr *devicep = resolve_device (device);
+ if (devicep == NULL)
+ {
+ /* Host fallback. */
+ struct gomp_thread old_thr, *thr = gomp_thread ();
+ old_thr = *thr;
+ memset (thr, '\0', sizeof (*thr));
+ if (gomp_places_list)
+ {
+ thr->place = old_thr.place;
+ thr->ts.place_partition_len = gomp_places_list_len;
+ }
+ fn (hostaddrs);
+ gomp_free_thread (thr);
+ *thr = old_thr;
+ return;
+ }
+
+ gomp_mutex_lock (&devicep->dev_env_lock);
+ if (!devicep->is_initialized)
+ gomp_init_device (devicep);
+
+ struct splay_tree_key_s k;
+ k.host_start = (uintptr_t) fn;
+ k.host_end = k.host_start + 1;
+ splay_tree_key tgt_fn = splay_tree_lookup (&devicep->dev_splay_tree, &k);
+ if (tgt_fn == NULL)
+ gomp_fatal ("Target function wasn't mapped");
+ gomp_mutex_unlock (&devicep->dev_env_lock);
+
+ struct target_mem_desc *tgt_vars
+ = gomp_map_vars (devicep, mapnum, hostaddrs, sizes, kinds, true);
struct gomp_thread old_thr, *thr = gomp_thread ();
old_thr = *thr;
memset (thr, '\0', sizeof (*thr));
@@ -61,26 +714,74 @@ GOMP_target (int device, void (*fn) (void *), const void *openmp_target,
thr->place = old_thr.place;
thr->ts.place_partition_len = gomp_places_list_len;
}
- fn (hostaddrs);
+ devicep->run_func (devicep->target_id, (void *) tgt_fn->tgt->tgt_start,
+ (void *) tgt_vars->tgt_start);
gomp_free_thread (thr);
*thr = old_thr;
+ gomp_unmap_vars (tgt_vars);
}
void
GOMP_target_data (int device, const void *openmp_target, size_t mapnum,
void **hostaddrs, size_t *sizes, unsigned char *kinds)
{
+ struct gomp_device_descr *devicep = resolve_device (device);
+ if (devicep == NULL)
+ {
+ /* Host fallback. */
+ struct gomp_task_icv *icv = gomp_icv (false);
+ if (icv->target_data)
+ {
+ /* Even when doing a host fallback, if there are any active
+ #pragma omp target data constructs, need to remember the
+ new #pragma omp target data, otherwise GOMP_target_end_data
+ would get out of sync. */
+ struct target_mem_desc *tgt
+ = gomp_map_vars (NULL, 0, NULL, NULL, NULL, false);
+ tgt->prev = icv->target_data;
+ icv->target_data = tgt;
+ }
+ return;
+ }
+
+ gomp_mutex_lock (&devicep->dev_env_lock);
+ if (!devicep->is_initialized)
+ gomp_init_device (devicep);
+ gomp_mutex_unlock (&devicep->dev_env_lock);
+
+ struct target_mem_desc *tgt
+ = gomp_map_vars (devicep, mapnum, hostaddrs, sizes, kinds, false);
+ struct gomp_task_icv *icv = gomp_icv (true);
+ tgt->prev = icv->target_data;
+ icv->target_data = tgt;
}
void
GOMP_target_end_data (void)
{
+ struct gomp_task_icv *icv = gomp_icv (false);
+ if (icv->target_data)
+ {
+ struct target_mem_desc *tgt = icv->target_data;
+ icv->target_data = tgt->prev;
+ gomp_unmap_vars (tgt);
+ }
}
void
GOMP_target_update (int device, const void *openmp_target, size_t mapnum,
void **hostaddrs, size_t *sizes, unsigned char *kinds)
{
+ struct gomp_device_descr *devicep = resolve_device (device);
+ if (devicep == NULL)
+ return;
+
+ gomp_mutex_lock (&devicep->dev_env_lock);
+ if (!devicep->is_initialized)
+ gomp_init_device (devicep);
+ gomp_mutex_unlock (&devicep->dev_env_lock);
+
+ gomp_update (devicep, mapnum, hostaddrs, sizes, kinds);
}
void
@@ -94,3 +795,143 @@ GOMP_teams (unsigned int num_teams, unsigned int thread_limit)
}
(void) num_teams;
}
+
+#ifdef PLUGIN_SUPPORT
+
+/* This function tries to load a plugin for DEVICE. Name of plugin is passed
+ in PLUGIN_NAME.
+ The handles of the found functions are stored in the corresponding fields
+ of DEVICE. The function returns TRUE on success and FALSE otherwise. */
+
+static bool
+gomp_load_plugin_for_device (struct gomp_device_descr *device,
+ const char *plugin_name)
+{
+ void *plugin_handle = dlopen (plugin_name, RTLD_LAZY);
+ if (!plugin_handle)
+ return false;
+
+ /* Check if all required functions are available in the plugin and store
+ their handlers. */
+#define DLSYM(f) \
+ do \
+ { \
+ device->f##_func = dlsym (plugin_handle, "GOMP_OFFLOAD_"#f); \
+ if (!device->f##_func) \
+ return false; \
+ } \
+ while (0)
+ DLSYM (get_type);
+ DLSYM (get_num_devices);
+ DLSYM (register_image);
+ DLSYM (init_device);
+ DLSYM (get_table);
+ DLSYM (alloc);
+ DLSYM (free);
+ DLSYM (dev2host);
+ DLSYM (host2dev);
+ DLSYM (run);
+#undef DLSYM
+
+ return true;
+}
+
+/* This function finds OFFLOAD_IMAGES corresponding to DEVICE type, and
+ registers them in the plugin. */
+
+static void
+gomp_register_images_for_device (struct gomp_device_descr *device)
+{
+ int i;
+ for (i = 0; i < num_offload_images; i++)
+ {
+ struct offload_image_descr *image = &offload_images[i];
+ if (image->type == device->type)
+ device->register_image_func (image->host_table, image->target_data);
+ }
+}
+
+/* This function initializes the runtime needed for offloading.
+ It parses the list of offload targets and tries to load the plugins for these
+ targets. Result of the function is properly initialized variable NUM_DEVICES
+ and array DEVICES, containing descriptors for corresponding devices. */
+
+static void
+gomp_target_init (void)
+{
+ const char *prefix ="libgomp-plugin-";
+ const char *suffix = ".so.1";
+ const char *cur, *next;
+ char *plugin_name;
+ int i, new_num_devices;
+
+ num_devices = 0;
+ devices = NULL;
+
+ cur = OFFLOAD_TARGETS;
+ if (*cur)
+ do
+ {
+ struct gomp_device_descr current_device;
+
+ next = strchr (cur, ',');
+
+ plugin_name = (char *) malloc (1 + (next ? next - cur : strlen (cur))
+ + strlen (prefix) + strlen (suffix));
+ if (!plugin_name)
+ {
+ num_devices = 0;
+ break;
+ }
+
+ strcpy (plugin_name, prefix);
+ strncat (plugin_name, cur, next ? next - cur : strlen (cur));
+ strcat (plugin_name, suffix);
+
+ if (gomp_load_plugin_for_device (&current_device, plugin_name))
+ {
+ new_num_devices = current_device.get_num_devices_func ();
+ if (new_num_devices >= 1)
+ {
+ devices = realloc (devices, (num_devices + new_num_devices)
+ * sizeof (struct gomp_device_descr));
+ if (!devices)
+ {
+ num_devices = 0;
+ free (plugin_name);
+ break;
+ }
+
+ current_device.type = current_device.get_type_func ();
+ current_device.is_initialized = false;
+ current_device.dev_splay_tree.root = NULL;
+ gomp_register_images_for_device (&current_device);
+ for (i = 0; i < new_num_devices; i++)
+ {
+ current_device.id = num_devices + 1;
+ current_device.target_id = i;
+ devices[num_devices] = current_device;
+ gomp_mutex_init (&devices[num_devices].dev_env_lock);
+ num_devices++;
+ }
+ }
+ }
+
+ free (plugin_name);
+ cur = next + 1;
+ }
+ while (next);
+
+ free (offload_images);
+ offload_images = NULL;
+ num_offload_images = 0;
+}
+
+#else /* PLUGIN_SUPPORT */
+/* If dlfcn.h is unavailable we always fallback to host execution.
+ GOMP_target* routines are just stubs for this case. */
+static void
+gomp_target_init (void)
+{
+}
+#endif /* PLUGIN_SUPPORT */
diff --git a/libgomp/testsuite/Makefile.am b/libgomp/testsuite/Makefile.am
index 561b7e25448..9cc103a1c4d 100644
--- a/libgomp/testsuite/Makefile.am
+++ b/libgomp/testsuite/Makefile.am
@@ -11,3 +11,8 @@ EXPECT = $(shell if test -f $(top_builddir)/../expect/expect; then \
_RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)"
+
+# Used for support non-fallback offloading.
+export OFFLOAD_TARGETS = $(offload_targets)
+export OFFLOAD_ADDITIONAL_OPTIONS = $(offload_additional_options)
+export OFFLOAD_ADDITIONAL_LIB_PATHS = $(offload_additional_lib_paths)
diff --git a/libgomp/testsuite/Makefile.in b/libgomp/testsuite/Makefile.in
index 5273eaa2b35..2f845f0c7cb 100644
--- a/libgomp/testsuite/Makefile.in
+++ b/libgomp/testsuite/Makefile.in
@@ -184,6 +184,9 @@ lt_host_flags = @lt_host_flags@
mandir = @mandir@
mkdir_p = @mkdir_p@
multi_basedir = @multi_basedir@
+offload_additional_lib_paths = @offload_additional_lib_paths@
+offload_additional_options = @offload_additional_options@
+offload_targets = @offload_targets@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
@@ -408,6 +411,11 @@ uninstall-am:
uninstall uninstall-am
+# Used for support non-fallback offloading.
+export OFFLOAD_TARGETS = $(offload_targets)
+export OFFLOAD_ADDITIONAL_OPTIONS = $(offload_additional_options)
+export OFFLOAD_ADDITIONAL_LIB_PATHS = $(offload_additional_lib_paths)
+
# 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/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp
index 094e5ed1b0c..a1546847323 100644
--- a/libgomp/testsuite/lib/libgomp.exp
+++ b/libgomp/testsuite/lib/libgomp.exp
@@ -107,6 +107,25 @@ proc libgomp_init { args } {
# Compute what needs to be put into LD_LIBRARY_PATH
set always_ld_library_path ".:${blddir}/.libs"
+ # Get offload-related variables from environment (exported by Makefile)
+ set offload_targets [getenv OFFLOAD_TARGETS]
+ set offload_additional_options [getenv OFFLOAD_ADDITIONAL_OPTIONS]
+ set offload_additional_lib_paths [getenv OFFLOAD_ADDITIONAL_LIB_PATHS]
+
+ # Add liboffloadmic build directory in LD_LIBRARY_PATH to support
+ # non-fallback testing for Intel MIC targets
+ if { [string match "*-intelmic-*" $offload_targets]
+ || [string match "*-intelmicemul-*" $offload_targets] } {
+ append always_ld_library_path ":${blddir}/../liboffloadmic/.libs"
+ append always_ld_library_path ":${blddir}/../liboffloadmic/plugin/.libs"
+ # libstdc++ is required by liboffloadmic
+ append always_ld_library_path ":${blddir}/../libstdc++-v3/src/.libs"
+ }
+
+ if { $offload_additional_lib_paths != "" } {
+ append always_ld_library_path "${offload_additional_lib_paths}"
+ }
+
# Compute what needs to be added to the existing LD_LIBRARY_PATH.
if {$gccdir != ""} {
# Add AIX pthread directory first.
@@ -169,6 +188,12 @@ proc libgomp_init { args } {
# Disable color diagnostics
lappend ALWAYS_CFLAGS "additional_flags=-fdiagnostics-color=never"
+
+ # Used for support non-fallback offloading.
+ # Help GCC to find target mkoffload.
+ if { $offload_additional_options != "" } {
+ lappend ALWAYS_CFLAGS "additional_flags=${offload_additional_options}"
+ }
}
#
@@ -239,3 +264,17 @@ proc libgomp_option_proc { option } {
return 0
}
}
+
+# Return 1 if offload device is available.
+proc check_effective_target_offload_device { } {
+ return [check_runtime_nocache offload_device_available_ {
+ #include <omp.h>
+ int main ()
+ {
+ int a;
+ #pragma omp target map(from: a)
+ a = omp_is_initial_device ();
+ return a;
+ }
+ } ]
+}
diff --git a/libgomp/testsuite/libgomp.c++/c++.exp b/libgomp/testsuite/libgomp.c++/c++.exp
index a9cf41aba4b..da42e6213b0 100644
--- a/libgomp/testsuite/libgomp.c++/c++.exp
+++ b/libgomp/testsuite/libgomp.c++/c++.exp
@@ -42,7 +42,7 @@ if { $blddir != "" } {
if { $lang_test_file_found } {
# Gather a list of all tests.
- set tests [lsort [glob -nocomplain $srcdir/$subdir/*.C]]
+ set tests [lsort [find $srcdir/$subdir *.C]]
if { $blddir != "" } {
set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}"
diff --git a/libgomp/testsuite/libgomp.c++/examples-4/e.51.5.C b/libgomp/testsuite/libgomp.c++/examples-4/e.51.5.C
new file mode 100644
index 00000000000..4298e234217
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/examples-4/e.51.5.C
@@ -0,0 +1,62 @@
+// { dg-do run }
+
+#include <omp.h>
+
+#define EPS 0.000001
+#define N 1000
+
+extern "C" void abort (void);
+
+void init (float *a1, float *a2, int n)
+{
+ int s = -1;
+ for (int i = 0; i < n; i++)
+ {
+ a1[i] = s * 0.01;
+ a2[i] = i;
+ s = -s;
+ }
+}
+
+void check (float *a, float *b, int n)
+{
+ for (int i = 0; i < n; i++)
+ if (a[i] - b[i] > EPS || b[i] - a[i] > EPS)
+ abort ();
+}
+
+void vec_mult_ref (float *&p, float *&v1, float *&v2, int n)
+{
+ for (int i = 0; i < n; i++)
+ p[i] = v1[i] * v2[i];
+}
+
+void vec_mult (float *&p, float *&v1, float *&v2, int n)
+{
+ #pragma omp target map(to: v1[0:n], v2[:n]) map(from: p[0:n])
+ #pragma omp parallel for
+ for (int i = 0; i < n; i++)
+ p[i] = v1[i] * v2[i];
+}
+
+int main ()
+{
+ float *p = new float [N];
+ float *p1 = new float [N];
+ float *v1 = new float [N];
+ float *v2 = new float [N];
+
+ init (v1, v2, N);
+
+ vec_mult_ref (p, v1, v2, N);
+ vec_mult (p1, v1, v2, N);
+
+ check (p, p1, N);
+
+ delete [] p;
+ delete [] p1;
+ delete [] v1;
+ delete [] v2;
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c++/examples-4/e.53.2.C b/libgomp/testsuite/libgomp.c++/examples-4/e.53.2.C
new file mode 100644
index 00000000000..75276e7c5c6
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/examples-4/e.53.2.C
@@ -0,0 +1,43 @@
+// { dg-do run }
+// { dg-require-effective-target offload_device }
+
+#include <stdlib.h>
+
+struct typeX
+{
+ int a;
+};
+
+class typeY
+{
+public:
+ int foo () { return a^0x01; }
+ int a;
+};
+
+#pragma omp declare target
+struct typeX varX;
+class typeY varY;
+#pragma omp end declare target
+
+int main ()
+{
+ varX.a = 0;
+ varY.a = 0;
+
+ #pragma omp target
+ {
+ varX.a = 100;
+ varY.a = 100;
+ }
+
+ if (varX.a != 0 || varY.a != 0)
+ abort ();
+
+ #pragma omp target update from(varX, varY)
+
+ if (varX.a != 100 || varY.a != 100)
+ abort ();
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.50.1.c b/libgomp/testsuite/libgomp.c/examples-4/e.50.1.c
new file mode 100644
index 00000000000..45adbe00f3c
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.50.1.c
@@ -0,0 +1,63 @@
+/* { dg-do run } */
+
+#include <stdlib.h>
+
+#define N 100000
+
+void init (int *a1, int *a2)
+{
+ int i, s = -1;
+ for (i = 0; i < N; i++)
+ {
+ a1[i] = s;
+ a2[i] = i;
+ s = -s;
+ }
+}
+
+void check (int *a, int *b)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ if (a[i] != b[i])
+ abort ();
+}
+
+void vec_mult_ref (int *p)
+{
+ int i;
+ int v1[N], v2[N];
+
+ init (v1, v2);
+
+ for (i = 0; i < N; i++)
+ p[i] = v1[i] * v2[i];
+}
+
+void vec_mult (int *p)
+{
+ int i;
+ int v1[N], v2[N];
+
+ init (v1, v2);
+
+ #pragma omp target map(p[0:N])
+ #pragma omp parallel for
+ for (i = 0; i < N; i++)
+ p[i] = v1[i] * v2[i];
+}
+
+int main ()
+{
+ int p1[N], p2[N];
+ int v1[N], v2[N];
+
+ init (v1, v2);
+
+ vec_mult_ref (p1);
+ vec_mult (p2);
+
+ check (p1, p2);
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.50.2.c b/libgomp/testsuite/libgomp.c/examples-4/e.50.2.c
new file mode 100644
index 00000000000..55d667aa775
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.50.2.c
@@ -0,0 +1,64 @@
+/* { dg-do run } */
+
+#include <stdlib.h>
+
+#define N 100000
+
+void init (char *a1, char *a2)
+{
+ char s = -1;
+ int i;
+ for (i = 0; i < N; i++)
+ {
+ a1[i] = s;
+ a2[i] = i;
+ s = -s;
+ }
+}
+
+void check (char *a, char *b)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ if (a[i] != b[i])
+ abort ();
+}
+
+void vec_mult_ref (char *p)
+{
+ int i;
+ char v1[N], v2[N];
+
+ init (v1, v2);
+
+ for (i = 0; i < N; i++)
+ p[i] = v1[i] * v2[i];
+}
+
+void vec_mult (char *p)
+{
+ int i;
+ char v1[N], v2[N];
+
+ init (v1, v2);
+
+ #pragma omp target map(from: p[0:N])
+ #pragma omp parallel for
+ for (i = 0; i < N; i++)
+ p[i] = v1[i] * v2[i];
+}
+
+int main ()
+{
+ char p1[N], p2[N];
+ char v1[N], v2[N];
+
+ init (v1, v2);
+
+ vec_mult_ref (p1);
+ vec_mult (p2);
+
+ check (p1, p2);
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.50.3.c b/libgomp/testsuite/libgomp.c/examples-4/e.50.3.c
new file mode 100644
index 00000000000..8d5125f07ee
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.50.3.c
@@ -0,0 +1,64 @@
+/* { dg-do run } */
+
+#include <stdlib.h>
+
+#define N 100000
+
+void init (long long *a1, long long *a2)
+{
+ long long s = -1;
+ int i;
+ for (i = 0; i < N; i++)
+ {
+ a1[i] = s;
+ a2[i] = i;
+ s = -s;
+ }
+}
+
+void check (long long *a, long long *b)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ if (a[i] != b[i])
+ abort ();
+}
+
+void vec_mult_ref (long long *p)
+{
+ int i;
+ long long v1[N], v2[N];
+
+ init (v1, v2);
+
+ for (i = 0; i < N; i++)
+ p[i] = v1[i] * v2[i];
+}
+
+void vec_mult (long long *p)
+{
+ int i;
+ long long v1[N], v2[N];
+
+ init (v1, v2);
+
+ #pragma omp target map(v1, v2, p[0:N])
+ #pragma omp parallel for
+ for (i = 0; i < N; i++)
+ p[i] = v1[i] * v2[i];
+}
+
+int main ()
+{
+ long long p1[N], p2[N];
+ long long v1[N], v2[N];
+
+ init (v1, v2);
+
+ vec_mult_ref (p1);
+ vec_mult (p2);
+
+ check (p1, p2);
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.50.4.c b/libgomp/testsuite/libgomp.c/examples-4/e.50.4.c
new file mode 100644
index 00000000000..545f02ae9e4
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.50.4.c
@@ -0,0 +1,57 @@
+/* { dg-do run } */
+
+#include <stdlib.h>
+
+#define EPS 0.000001
+#define N 100000
+
+void init (double *a1, double *a2)
+{
+ double s = -1;
+ int i;
+ for (i = 0; i < N; i++)
+ {
+ a1[i] = s;
+ a2[i] = i;
+ s = -s;
+ }
+}
+
+void check (double *a, double *b)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ if (a[i] - b[i] > EPS || b[i] - a[i] > EPS)
+ abort ();
+}
+
+void vec_mult_ref (double *p, double *v1, double *v2)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ p[i] = v1[i] * v2[i];
+}
+
+void vec_mult (double *p, double *v1, double *v2)
+{
+ int i;
+ #pragma omp target map(to: v1[0:N], v2[:N]) map(from: p[0:N])
+ #pragma omp parallel for
+ for (i = 0; i < N; i++)
+ p[i] = v1[i] * v2[i];
+}
+
+int main ()
+{
+ double p1[N], p2[N];
+ double v1[N], v2[N];
+
+ init (v1, v2);
+
+ vec_mult_ref (p1, v1, v2);
+ vec_mult (p2, v1, v2);
+
+ check (p1, p2);
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.50.5.c b/libgomp/testsuite/libgomp.c/examples-4/e.50.5.c
new file mode 100644
index 00000000000..1853fba684b
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.50.5.c
@@ -0,0 +1,67 @@
+/* { dg-do run } */
+/* { dg-require-effective-target offload_device } */
+
+#include <omp.h>
+#include <stdlib.h>
+
+#define EPS 0.000001
+#define N 100000
+#define THRESHOLD1 10000
+#define THRESHOLD2 1000
+
+void init (float *a1, float *a2)
+{
+ float s = -1;
+ int i;
+ for (i = 0; i < N; i++)
+ {
+ a1[i] = s;
+ a2[i] = i;
+ s = -s;
+ }
+}
+
+void check (float *a, float *b)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ if (a[i] - b[i] > EPS || b[i] - a[i] > EPS)
+ abort ();
+}
+
+void vec_mult_ref (float *p, float *v1, float *v2)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ p[i] = v1[i] * v2[i];
+}
+
+void vec_mult (float *p, float *v1, float *v2)
+{
+ int i;
+ #pragma omp target if(N > THRESHOLD1) map(to: v1[0:N], v2[:N]) \
+ map(from: p[0:N])
+ {
+ if (omp_is_initial_device ())
+ abort ();
+
+ #pragma omp parallel for if(N > THRESHOLD2)
+ for (i = 0; i < N; i++)
+ p[i] = v1[i] * v2[i];
+ }
+}
+
+int main ()
+{
+ float p1[N], p2[N];
+ float v1[N], v2[N];
+
+ init (v1, v2);
+
+ vec_mult_ref (p1, v1, v2);
+ vec_mult (p2, v1, v2);
+
+ check (p1, p2);
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.51.1.c b/libgomp/testsuite/libgomp.c/examples-4/e.51.1.c
new file mode 100644
index 00000000000..6b0331bf04c
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.51.1.c
@@ -0,0 +1,64 @@
+/* { dg-do run } */
+
+#include <stdlib.h>
+
+const int MAX = 1800;
+
+void check (long long *a, long long *b, int N)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ if (a[i] != b[i])
+ abort ();
+}
+
+void init (long long *a1, long long *a2, int N)
+{
+ long long s = -1;
+ int i;
+ for (i = 0; i < N; i++)
+ {
+ a1[i] = s;
+ a2[i] = i;
+ s = -s;
+ }
+}
+
+void vec_mult_ref (long long *p, long long *v1, long long *v2, int N)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ p[i] = v1[i] * v2[i];
+}
+
+void vec_mult (long long *p, long long *v1, long long *v2, int N)
+{
+ int i;
+ #pragma omp target data map(to: v1[0:N], v2[:N]) map(from: p[0:N])
+ #pragma omp target
+ #pragma omp parallel for
+ for (i = 0; i < N; i++)
+ p[i] = v1[i] * v2[i];
+}
+
+int main ()
+{
+ long long *p1 = (long long *) malloc (MAX * sizeof (long long));
+ long long *p2 = (long long *) malloc (MAX * sizeof (long long));
+ long long *v1 = (long long *) malloc (MAX * sizeof (long long));
+ long long *v2 = (long long *) malloc (MAX * sizeof (long long));
+
+ init (v1, v2, MAX);
+
+ vec_mult_ref (p1, v1, v2, MAX);
+ vec_mult (p2, v1, v2, MAX);
+
+ check (p1, p2, MAX);
+
+ free (p1);
+ free (p2);
+ free (v1);
+ free (v2);
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.51.2.c b/libgomp/testsuite/libgomp.c/examples-4/e.51.2.c
new file mode 100644
index 00000000000..ee8f150c1a0
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.51.2.c
@@ -0,0 +1,94 @@
+/* { dg-do run } */
+
+#include <stdlib.h>
+
+const int MAX = 1800;
+
+void check (char *a, char *b, int N)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ if (a[i] != b[i])
+ abort ();
+}
+
+void init (char *a1, char *a2, int N)
+{
+ char s = -1;
+ int i;
+ for (i = 0; i < N; i++)
+ {
+ a1[i] = s;
+ a2[i] = i;
+ s = -s;
+ }
+}
+
+void init_again (char *a1, char *a2, int N)
+{
+ char s = -1;
+ int i;
+ for (i = 0; i < N; i++)
+ {
+ a1[i] = s * 10;
+ a2[i] = i;
+ s = -s;
+ }
+}
+
+void vec_mult_ref (char *p, char *v1, char *v2, int N)
+{
+ int i;
+
+ init (v1, v2, N);
+
+ for (i = 0; i < N; i++)
+ p[i] = v1[i] * v2[i];
+
+ init_again (v1, v2, N);
+
+ for (i = 0; i < N; i++)
+ p[i] = p[i] + (v1[i] * v2[i]);
+}
+
+void vec_mult (char *p, char *v1, char *v2, int N)
+{
+ int i;
+
+ init (v1, v2, N);
+
+ #pragma omp target data map(from: p[0:N])
+ {
+ #pragma omp target map(to: v1[:N], v2[:N])
+ #pragma omp parallel for
+ for (i = 0; i < N; i++)
+ p[i] = v1[i] * v2[i];
+
+ init_again (v1, v2, N);
+
+ #pragma omp target map(to: v1[:N], v2[:N])
+ #pragma omp parallel for
+ for (i = 0; i < N; i++)
+ p[i] = p[i] + (v1[i] * v2[i]);
+ }
+}
+
+int main ()
+{
+ char *p1 = (char *) malloc (MAX * sizeof (char));
+ char *p2 = (char *) malloc (MAX * sizeof (char));
+ char *v1 = (char *) malloc (MAX * sizeof (char));
+ char *v2 = (char *) malloc (MAX * sizeof (char));
+
+ vec_mult_ref (p1, v1, v2, MAX);
+ vec_mult (p2, v1, v2, MAX);
+
+ check (p1, p2, MAX);
+
+ free (p1);
+ free (p2);
+ free (v1);
+ free (v2);
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.51.3.c b/libgomp/testsuite/libgomp.c/examples-4/e.51.3.c
new file mode 100644
index 00000000000..abb283801f8
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.51.3.c
@@ -0,0 +1,79 @@
+/* { dg-do run } */
+
+#include <stdlib.h>
+
+const int ROWS = 5;
+const int COLS = 5;
+
+void init (int Q[][COLS], const int rows, const int cols)
+{
+ int i, j;
+ for (i = 0; i < rows; i++)
+ for (j = 0; j < cols; j++)
+ Q[i][j] = (i + 1) * 100 + (j + 1);
+}
+
+void check (int a[][COLS], int b[][COLS], const int rows, const int cols)
+{
+ int i, j;
+ for (i = 0; i < rows; i++)
+ for (j = 0; j < cols; j++)
+ if (a[i][j] != b[i][j])
+ abort ();
+}
+
+void gramSchmidt_ref (int Q[][COLS], const int rows, const int cols)
+{
+ int i, k;
+
+ for (k = 0; k < cols; k++)
+ {
+ int tmp = 0;
+
+ for (i = 0; i < rows; i++)
+ tmp += (Q[i][k] * Q[i][k]);
+
+ for (i = 0; i < rows; i++)
+ Q[i][k] *= tmp;
+ }
+}
+
+void gramSchmidt (int Q[][COLS], const int rows, const int cols)
+{
+ int i, k;
+
+ #pragma omp target data map(Q[0:rows][0:cols]) map(to:COLS)
+ for (k = 0; k < cols; k++)
+ {
+ int tmp = 0;
+
+ #pragma omp target
+ #pragma omp parallel for reduction(+:tmp)
+ for (i = 0; i < rows; i++)
+ tmp += (Q[i][k] * Q[i][k]);
+
+ #pragma omp target
+ #pragma omp parallel for
+ for (i = 0; i < rows; i++)
+ Q[i][k] *= tmp;
+ }
+}
+
+int main ()
+{
+ int (*Q1)[COLS] = (int(*)[COLS]) malloc (ROWS * COLS * sizeof (int));
+ int (*Q2)[COLS] = (int(*)[COLS]) malloc (ROWS * COLS * sizeof (int));
+
+ init (Q1, ROWS, COLS);
+ init (Q2, ROWS, COLS);
+
+ gramSchmidt_ref (Q1, ROWS, COLS);
+ gramSchmidt (Q2, ROWS, COLS);
+
+ check (Q1, Q2, ROWS, COLS);
+
+ free (Q1);
+ free (Q2);
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.51.4.c b/libgomp/testsuite/libgomp.c/examples-4/e.51.4.c
new file mode 100644
index 00000000000..d2948ae1b54
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.51.4.c
@@ -0,0 +1,77 @@
+/* { dg-do run } */
+
+#include <stdlib.h>
+
+#define EPS 0.000001
+
+const int MAX = 1800;
+
+void check (double *a, double *b, int N)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ if (a[i] - b[i] > EPS || b[i] - a[i] > EPS)
+ abort ();
+}
+
+void init (double *a1, double *a2, int N)
+{
+ double s = -1;
+ int i;
+ for (i = 0; i < N; i++)
+ {
+ a1[i] = s;
+ a2[i] = i;
+ s = -s;
+ }
+}
+
+void vec_mult_ref (double *p1, double *v3, double *v4, int N)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ p1[i] = v3[i] * v4[i];
+}
+
+void foo_ref (double *p0, double *v1, double *v2, int N)
+{
+ init (v1, v2, N);
+ vec_mult_ref (p0, v1, v2, N);
+}
+
+void vec_mult (double *p1, double *v3, double *v4, int N)
+{
+ int i;
+ #pragma omp target map(to: v3[0:N], v4[:N]) map(from: p1[0:N])
+ #pragma omp parallel for
+ for (i = 0; i < N; i++)
+ p1[i] = v3[i] * v4[i];
+}
+
+void foo (double *p0, double *v1, double *v2, int N)
+{
+ init (v1, v2, N);
+
+ #pragma omp target data map(to: v1[0:N], v2[:N]) map(from: p0[0:N])
+ vec_mult (p0, v1, v2, N);
+}
+
+int main ()
+{
+ double *p1 = (double *) malloc (MAX * sizeof (double));
+ double *p2 = (double *) malloc (MAX * sizeof (double));
+ double *v1 = (double *) malloc (MAX * sizeof (double));
+ double *v2 = (double *) malloc (MAX * sizeof (double));
+
+ foo_ref (p1, v1, v2, MAX);
+ foo (p2, v1, v2, MAX);
+
+ check (p1, p2, MAX);
+
+ free (p1);
+ free (p2);
+ free (v1);
+ free (v2);
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.51.6.c b/libgomp/testsuite/libgomp.c/examples-4/e.51.6.c
new file mode 100644
index 00000000000..affeb490021
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.51.6.c
@@ -0,0 +1,109 @@
+/* { dg-do run } */
+/* { dg-require-effective-target offload_device } */
+
+#include <stdlib.h>
+#include <omp.h>
+
+#define EPS 0.000001
+#define THRESHOLD 1000
+
+const int MAX = 1800;
+
+void check (float *a, float *b, int N)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ if (a[i] - b[i] > EPS || b[i] - a[i] > EPS)
+ abort ();
+}
+
+void init (float *a1, float *a2, int N)
+{
+ float s = -1;
+ int i;
+ for (i = 0; i < N; i++)
+ {
+ a1[i] = s;
+ a2[i] = i;
+ s = -s;
+ }
+}
+
+void init_again (float *a1, float *a2, int N)
+{
+ float s = -1;
+ int i;
+ for (i = 0; i < N; i++)
+ {
+ a1[i] = s * 10;
+ a2[i] = i;
+ s = -s;
+ }
+}
+
+void vec_mult_ref (float *p, float *v1, float *v2, int N)
+{
+ int i;
+
+ init (v1, v2, N);
+
+ for (i = 0; i < N; i++)
+ p[i] = v1[i] * v2[i];
+
+ init_again (v1, v2, N);
+
+ for (i = 0; i < N; i++)
+ p[i] = p[i] + (v1[i] * v2[i]);
+}
+
+void vec_mult (float *p, float *v1, float *v2, int N)
+{
+ int i;
+
+ init (v1, v2, N);
+
+ #pragma omp target data if(N > THRESHOLD) map(from: p[0:N])
+ {
+ #pragma omp target if (N > THRESHOLD) map(to: v1[:N], v2[:N])
+ {
+ if (omp_is_initial_device ())
+ abort;
+
+ #pragma omp parallel for
+ for (i = 0; i < N; i++)
+ p[i] = v1[i] * v2[i];
+ }
+
+ init_again (v1, v2, N);
+
+ #pragma omp target if (N > THRESHOLD) map(to: v1[:N], v2[:N])
+ {
+ if (omp_is_initial_device ())
+ abort ();
+
+ #pragma omp parallel for
+ for (i = 0; i < N; i++)
+ p[i] = p[i] + (v1[i] * v2[i]);
+ }
+ }
+}
+
+int main ()
+{
+ float *p1 = (float *) malloc (MAX * sizeof (float));
+ float *p2 = (float *) malloc (MAX * sizeof (float));
+ float *v1 = (float *) malloc (MAX * sizeof (float));
+ float *v2 = (float *) malloc (MAX * sizeof (float));
+
+ vec_mult_ref (p1, v1, v2, MAX);
+ vec_mult (p2, v1, v2, MAX);
+
+ check (p1, p2, MAX);
+
+ free (p1);
+ free (p2);
+ free (v1);
+ free (v2);
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.51.7.c b/libgomp/testsuite/libgomp.c/examples-4/e.51.7.c
new file mode 100644
index 00000000000..c18d4803cf3
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.51.7.c
@@ -0,0 +1,72 @@
+/* { dg-do run } */
+/* { dg-require-effective-target offload_device } */
+
+#include <stdlib.h>
+#include <omp.h>
+
+#define THRESHOLD 1000
+
+const int MAX = 1800;
+
+void check (short *a, short *b, int N)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ if (a[i] != b[i])
+ abort ();
+}
+
+void init (short *a1, short *a2, int N)
+{
+ short s = -1;
+ int i;
+ for (i = 0; i < N; i++)
+ {
+ a1[i] = s;
+ a2[i] = i;
+ s = -s;
+ }
+}
+
+void vec_mult_ref (short *p, short *v1, short *v2, int N)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ p[i] = v1[i] * v2[i];
+}
+
+void vec_mult (short *p, short *v1, short *v2, int N)
+{
+ int i;
+ #pragma omp target data map(from: p[0:N])
+ #pragma omp target if (N > THRESHOLD) map(to: v1[:N], v2[:N])
+ {
+ if (omp_is_initial_device ())
+ abort ();
+ #pragma omp parallel for
+ for (i = 0; i < N; i++)
+ p[i] = v1[i] * v2[i];
+ }
+}
+
+int main ()
+{
+ short *p1 = (short *) malloc (MAX * sizeof (short));
+ short *p2 = (short *) malloc (MAX * sizeof (short));
+ short *v1 = (short *) malloc (MAX * sizeof (short));
+ short *v2 = (short *) malloc (MAX * sizeof (short));
+
+ init (v1, v2, MAX);
+
+ vec_mult_ref (p1, v1, v2, MAX);
+ vec_mult (p2, v1, v2, MAX);
+
+ check (p1, p2, MAX);
+
+ free (p1);
+ free (p2);
+ free (v1);
+ free (v2);
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.52.1.c b/libgomp/testsuite/libgomp.c/examples-4/e.52.1.c
new file mode 100644
index 00000000000..727d475f6c7
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.52.1.c
@@ -0,0 +1,94 @@
+/* { dg-do run } */
+
+#include <stdlib.h>
+
+const int MAX = 1800;
+
+void check (int *a, int *b, int N)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ if (a[i] != b[i])
+ abort ();
+}
+
+void init (int *a1, int *a2, int N)
+{
+ int i, s = -1;
+ for (i = 0; i < N; i++)
+ {
+ a1[i] = s;
+ a2[i] = i;
+ s = -s;
+ }
+}
+
+void init_again (int *a1, int *a2, int N)
+{
+ int i, s = -1;
+ for (i = 0; i < N; i++)
+ {
+ a1[i] = s * 10;
+ a2[i] = i;
+ s = -s;
+ }
+}
+
+void vec_mult_ref (int *p, int *v1, int *v2, int N)
+{
+ int i;
+
+ init (v1, v2, MAX);
+
+ for (i = 0; i < N; i++)
+ p[i] = v1[i] * v2[i];
+
+ init_again (v1, v2, N);
+
+ for (i = 0; i < N; i++)
+ p[i] = p[i] + (v1[i] * v2[i]);
+}
+
+void vec_mult (int *p, int *v1, int *v2, int N)
+{
+ int i;
+
+ init (v1, v2, MAX);
+
+ #pragma omp target data map(to: v1[:N], v2[:N]) map(from: p[0:N])
+ {
+ #pragma omp target
+ #pragma omp parallel for
+ for (i = 0; i < N; i++)
+ p[i] = v1[i] * v2[i];
+
+ init_again (v1, v2, N);
+
+ #pragma omp target update to(v1[:N], v2[:N])
+
+ #pragma omp target
+ #pragma omp parallel for
+ for (i = 0; i < N; i++)
+ p[i] = p[i] + (v1[i] * v2[i]);
+ }
+}
+
+int main ()
+{
+ int *p1 = (int *) malloc (MAX * sizeof (int));
+ int *p2 = (int *) malloc (MAX * sizeof (int));
+ int *v1 = (int *) malloc (MAX * sizeof (int));
+ int *v2 = (int *) malloc (MAX * sizeof (int));
+
+ vec_mult_ref (p1, v1, v2, MAX);
+ vec_mult (p2, v1, v2, MAX);
+
+ check (p1, p2, MAX);
+
+ free (p1);
+ free (p2);
+ free (v1);
+ free (v2);
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.52.2.c b/libgomp/testsuite/libgomp.c/examples-4/e.52.2.c
new file mode 100644
index 00000000000..51262bb24a9
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.52.2.c
@@ -0,0 +1,96 @@
+/* { dg-do run } */
+
+#include <stdlib.h>
+
+const int MAX = 1800;
+
+void check (int *a, int *b, int N)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ if (a[i] != b[i])
+ abort ();
+}
+
+void init (int *a1, int *a2, int N)
+{
+ int i, s = -1;
+ for (i = 0; i < N; i++)
+ {
+ a1[i] = s;
+ a2[i] = i;
+ s = -s;
+ }
+}
+
+int maybe_init_again (int *a, int N)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ a[i] = i;
+ return 1;
+}
+
+void vec_mult_ref (int *p, int *v1, int *v2, int N)
+{
+ int i;
+
+ init (v1, v2, N);
+
+ for (i = 0; i < N; i++)
+ p[i] = v1[i] * v2[i];
+
+ maybe_init_again (v1, N);
+ maybe_init_again (v2, N);
+
+ for (i = 0; i < N; i++)
+ p[i] = p[i] + (v1[i] * v2[i]);
+}
+
+void vec_mult (int *p, int *v1, int *v2, int N)
+{
+ int i;
+
+ init (v1, v2, N);
+
+ #pragma omp target data map(to: v1[:N], v2[:N]) map(from: p[0:N])
+ {
+ int changed;
+
+ #pragma omp target
+ #pragma omp parallel for
+ for (i = 0; i < N; i++)
+ p[i] = v1[i] * v2[i];
+
+ changed = maybe_init_again (v1, N);
+ #pragma omp target update if (changed) to(v1[:N])
+
+ changed = maybe_init_again (v2, N);
+ #pragma omp target update if (changed) to(v2[:N])
+
+ #pragma omp target
+ #pragma omp parallel for
+ for (i = 0; i < N; i++)
+ p[i] = p[i] + (v1[i] * v2[i]);
+ }
+}
+
+int main ()
+{
+ int *p = (int *) malloc (MAX * sizeof (int));
+ int *p1 = (int *) malloc (MAX * sizeof (int));
+ int *v1 = (int *) malloc (MAX * sizeof (int));
+ int *v2 = (int *) malloc (MAX * sizeof (int));
+
+ vec_mult_ref (p, v1, v2, MAX);
+ vec_mult (p1, v1, v2, MAX);
+
+ check (p, p1, MAX);
+
+ free (p);
+ free (p1);
+ free (v1);
+ free (v2);
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.53.1.c b/libgomp/testsuite/libgomp.c/examples-4/e.53.1.c
new file mode 100644
index 00000000000..beca8555780
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.53.1.c
@@ -0,0 +1,36 @@
+/* { dg-do run } */
+
+#include <stdlib.h>
+
+#define THRESHOLD 20
+
+#pragma omp declare target
+int fib (int n)
+{
+ if (n <= 0)
+ return 0;
+ else if (n == 1)
+ return 1;
+ else
+ return fib (n - 1) + fib (n - 2);
+}
+#pragma omp end declare target
+
+int fib_wrapper (int n)
+{
+ int x = 0;
+
+ #pragma omp target if(n > THRESHOLD)
+ x = fib (n);
+
+ return x;
+}
+
+int main ()
+{
+ if (fib (15) != fib_wrapper (15))
+ abort ();
+ if (fib (25) != fib_wrapper (25))
+ abort ();
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.53.3.c b/libgomp/testsuite/libgomp.c/examples-4/e.53.3.c
new file mode 100644
index 00000000000..8025335722a
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.53.3.c
@@ -0,0 +1,62 @@
+/* { dg-do run } */
+
+#include <stdlib.h>
+
+#define EPS 0.000001
+#define N 100000
+
+#pragma omp declare target
+float p1[N], p2[N], v1[N], v2[N];
+#pragma omp end declare target
+
+void init ()
+{
+ int i, s = -1;
+ for (i = 0; i < N; i++)
+ {
+ v1[i] = s * 0.01;
+ v2[i] = i;
+ s = -s;
+ }
+}
+
+void check ()
+{
+ int i;
+ for (i = 0; i < N; i++)
+ if (p1[i] - p2[i] > EPS || p2[i] - p1[i] > EPS)
+ abort ();
+}
+
+void vec_mult_ref ()
+{
+ int i;
+ for (i = 0; i < N; i++)
+ p1[i] = v1[i] * v2[i];
+}
+
+void vec_mult ()
+{
+ int i;
+
+ #pragma omp target update to(v1, v2)
+
+ #pragma omp target
+ #pragma omp parallel for
+ for (i = 0; i < N; i++)
+ p2[i] = v1[i] * v2[i];
+
+ #pragma omp target update from(p2)
+}
+
+int main ()
+{
+ init ();
+
+ vec_mult_ref ();
+ vec_mult ();
+
+ check ();
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.53.4.c b/libgomp/testsuite/libgomp.c/examples-4/e.53.4.c
new file mode 100644
index 00000000000..278e1a41707
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.53.4.c
@@ -0,0 +1,67 @@
+/* { dg-do run } */
+
+#include <stdlib.h>
+
+#define EPS 0.00001
+#define N 1000
+
+#pragma omp declare target
+float Q[N][N];
+float Pfun (const int i, const int k)
+{
+ return Q[i][k] * Q[k][i];
+}
+#pragma omp end declare target
+
+void init ()
+{
+ int i, j;
+ for (i = 0; i < N; i++)
+ for (j = 0; j < N; j++)
+ Q[i][j] = 0.001 * i * j;
+}
+
+float accum_ref (int k)
+{
+ int i;
+ float tmp = 0.0;
+
+ for (i = 0; i < N; i++)
+ tmp += Pfun (i, k);
+
+ return tmp;
+}
+
+float accum (int k)
+{
+ int i;
+ float tmp = 0.0;
+
+ #pragma omp target
+ #pragma omp parallel for reduction(+:tmp)
+ for (i = 0; i < N; i++)
+ tmp += Pfun (i, k);
+
+ return tmp;
+}
+
+void check (float a, float b)
+{
+ float err = (b == 0.0) ? a : (a - b) / b;
+ if (((err > 0) ? err : -err) > EPS)
+ abort ();
+}
+
+int main ()
+{
+ int i;
+
+ init ();
+
+ #pragma omp target update to(Q)
+
+ for (i = 0; i < N; i++)
+ check (accum (i), accum_ref (i));
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.53.5.c b/libgomp/testsuite/libgomp.c/examples-4/e.53.5.c
new file mode 100644
index 00000000000..3bcd753dbbb
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.53.5.c
@@ -0,0 +1,84 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+/* { dg-additional-options "-msse2" { target sse2_runtime } } */
+/* { dg-additional-options "-mavx" { target avx_runtime } } */
+
+#include <stdlib.h>
+
+#define EPS 0.00001
+#define N 10000
+#define M 1024
+
+#pragma omp declare target
+float Q[N][N];
+#pragma omp declare simd uniform(i) linear(k) notinbranch
+float Pfun (const int i, const int k)
+{
+ return Q[i][k] * Q[k][i];
+}
+#pragma omp end declare target
+
+void init ()
+{
+ int i, j;
+ for (i = 0; i < N; i++)
+ for (j = 0; j < N; j++)
+ Q[i][j] = 0.001 * i * j;
+}
+
+float accum_ref ()
+{
+ int i, k;
+ float tmp = 0.0;
+
+ for (i = 0; i < N; i++)
+ {
+ float tmp1 = 0.0;
+
+ for (k = 0; k < M; k++)
+ tmp1 += Pfun(i,k);
+
+ tmp += tmp1;
+ }
+
+ return tmp;
+}
+
+float accum ()
+{
+ int i, k;
+ float tmp = 0.0;
+
+ #pragma omp target
+ #pragma omp parallel for reduction(+:tmp)
+ for (i = 0; i < N; i++)
+ {
+ float tmp1 = 0.0;
+
+ #pragma omp simd reduction(+:tmp1)
+ for (k = 0; k < M; k++)
+ tmp1 += Pfun(i,k);
+
+ tmp += tmp1;
+ }
+
+ return tmp;
+}
+
+void check (float a, float b)
+{
+ float err = (b == 0.0) ? a : (a - b) / b;
+ if (((err > 0) ? err : -err) > EPS)
+ abort ();
+}
+
+int main ()
+{
+ init ();
+
+ #pragma omp target update to(Q)
+
+ check (accum (), accum_ref ());
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.54.2.c b/libgomp/testsuite/libgomp.c/examples-4/e.54.2.c
new file mode 100644
index 00000000000..8bbbc355b17
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.54.2.c
@@ -0,0 +1,72 @@
+/* { dg-do run } */
+
+#include <stdlib.h>
+
+#define EPS 0.0001
+#define N 1024*1024
+
+void init (float B[], float C[], int n)
+{
+ int i;
+ for (i = 0; i < n; i++)
+ {
+ B[i] = 0.1 * i;
+ C[i] = 0.01 * i * i;
+ }
+}
+
+float dotprod_ref (float B[], float C[], int n)
+{
+ int i;
+ float sum = 0.0;
+
+ for (i = 0; i < n; i++)
+ sum += B[i] * C[i];
+
+ return sum;
+}
+
+float dotprod (float B[], float C[], int n, int block_size,
+ int num_teams, int block_threads)
+{
+ int i, i0;
+ float sum = 0;
+
+ #pragma omp target map(to: B[0:n], C[0:n])
+ #pragma omp teams num_teams(num_teams) thread_limit(block_threads) \
+ reduction(+:sum)
+ #pragma omp distribute
+ for (i0 = 0; i0 < n; i0 += block_size)
+ #pragma omp parallel for reduction(+:sum)
+ for (i = i0; i < ((i0 + block_size > n) ? n : i0 + block_size); i++)
+ sum += B[i] * C[i];
+
+ return sum;
+}
+
+void check (float a, float b)
+{
+ float err = (b == 0.0) ? a : (a - b) / b;
+ if (((err > 0) ? err : -err) > EPS)
+ abort ();
+}
+
+int main ()
+{
+ float *v1 = (float *) malloc (N * sizeof (float));
+ float *v2 = (float *) malloc (N * sizeof (float));
+
+ float p1, p2;
+
+ init (v1, v2, N);
+
+ p1 = dotprod_ref (v1, v2, N);
+ p2 = dotprod (v1, v2, N, N / 8, 2, 8);
+
+ check (p1, p2);
+
+ free (v1);
+ free (v2);
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.54.3.c b/libgomp/testsuite/libgomp.c/examples-4/e.54.3.c
new file mode 100644
index 00000000000..b6708785884
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.54.3.c
@@ -0,0 +1,67 @@
+/* { dg-do run } */
+
+#include <stdlib.h>
+
+#define EPS 0.0001
+#define N 1024*1024
+
+void init (float B[], float C[], int n)
+{
+ int i;
+ for (i = 0; i < n; i++)
+ {
+ B[i] = 0.1 * i;
+ C[i] = 0.01 * i * i;
+ }
+}
+
+float dotprod_ref (float B[], float C[], int n)
+{
+ int i;
+ float sum = 0.0;
+
+ for (i = 0; i < n; i++)
+ sum += B[i] * C[i];
+
+ return sum;
+}
+
+float dotprod (float B[], float C[], int n)
+{
+ int i;
+ float sum = 0;
+
+ #pragma omp target teams map(to: B[0:n], C[0:n])
+ #pragma omp distribute parallel for reduction(+:sum)
+ for (i = 0; i < n; i++)
+ sum += B[i] * C[i];
+
+ return sum;
+}
+
+void check (float a, float b)
+{
+ float err = (b == 0.0) ? a : (a - b) / b;
+ if (((err > 0) ? err : -err) > EPS)
+ abort ();
+}
+
+int main ()
+{
+ float *v1 = (float *) malloc (N * sizeof (float));
+ float *v2 = (float *) malloc (N * sizeof (float));
+
+ float p1, p2;
+
+ init (v1, v2, N);
+
+ p1 = dotprod_ref (v1, v2, N);
+ p2 = dotprod (v1, v2, N);
+
+ check (p1, p2);
+
+ free (v1);
+ free (v2);
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.54.4.c b/libgomp/testsuite/libgomp.c/examples-4/e.54.4.c
new file mode 100644
index 00000000000..9aef78ecfba
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.54.4.c
@@ -0,0 +1,70 @@
+/* { dg-do run } */
+
+#include <stdlib.h>
+
+#define EPS 0.0001
+#define N 1024*1024
+
+void init (float B[], float C[], int n)
+{
+ int i;
+ for (i = 0; i < n; i++)
+ {
+ B[i] = 0.1 * i;
+ C[i] = 0.01 * i * i;
+ }
+}
+
+float dotprod_ref (float B[], float C[], int n)
+{
+ int i;
+ float sum = 0.0;
+
+ for (i = 0; i < n; i++)
+ sum += B[i] * C[i];
+
+ return sum;
+}
+
+float dotprod (float B[], float C[], int n)
+{
+ int i;
+ float sum = 0;
+
+ #pragma omp target map(to: B[0:n], C[0:n])
+ #pragma omp teams num_teams(8) thread_limit(16)
+ #pragma omp distribute parallel for reduction(+:sum) \
+ dist_schedule(static, 1024) \
+ schedule(static, 64)
+ for (i = 0; i < n; i++)
+ sum += B[i] * C[i];
+
+ return sum;
+}
+
+void check (float a, float b)
+{
+ float err = (b == 0.0) ? a : (a - b) / b;
+ if (((err > 0) ? err : -err) > EPS)
+ abort ();
+}
+
+int main ()
+{
+ float *v1 = (float *) malloc (N * sizeof (float));
+ float *v2 = (float *) malloc (N * sizeof (float));
+
+ float p1, p2;
+
+ init (v1, v2, N);
+
+ p1 = dotprod_ref (v1, v2, N);
+ p2 = dotprod (v1, v2, N);
+
+ check (p1, p2);
+
+ free (v1);
+ free (v2);
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.54.5.c b/libgomp/testsuite/libgomp.c/examples-4/e.54.5.c
new file mode 100644
index 00000000000..ac99744ebe3
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.54.5.c
@@ -0,0 +1,65 @@
+/* { dg-do run } */
+
+#include <stdlib.h>
+
+#define EPS 0.00001
+#define N 10000
+
+void init (float *a, float *b, int n)
+{
+ int i;
+ for (i = 0; i < n; i++)
+ {
+ a[i] = 0.1 * i;
+ b[i] = 0.01 * i * i;
+ }
+}
+
+void vec_mult_ref (float *p, float *v1, float *v2, int n)
+{
+ int i;
+ for (i = 0; i < n; i++)
+ p[i] = v1[i] * v2[i];
+}
+
+void vec_mult (float *p, float *v1, float *v2, int n)
+{
+ int i;
+ #pragma omp target teams map(to: v1[0:n], v2[:n]) map(from: p[0:n])
+ #pragma omp distribute simd
+ for (i = 0; i < n; i++)
+ p[i] = v1[i] * v2[i];
+}
+
+void check (float *a, float *b, int n)
+{
+ int i;
+ for (i = 0 ; i < n ; i++)
+ {
+ float err = (a[i] == 0.0) ? b[i] : (b[i] - a[i]) / a[i];
+ if (((err > 0) ? err : -err) > EPS)
+ abort ();
+ }
+}
+
+int main ()
+{
+ float *p1 = (float *) malloc (N * sizeof (float));
+ float *p2 = (float *) malloc (N * sizeof (float));
+ float *v1 = (float *) malloc (N * sizeof (float));
+ float *v2 = (float *) malloc (N * sizeof (float));
+
+ init (v1, v2, N);
+
+ vec_mult_ref (p1, v1, v2, N);
+ vec_mult (p2, v1, v2, N);
+
+ check (p1, p2, N);
+
+ free (p1);
+ free (p2);
+ free (v1);
+ free (v2);
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.54.6.c b/libgomp/testsuite/libgomp.c/examples-4/e.54.6.c
new file mode 100644
index 00000000000..388582b51cd
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.54.6.c
@@ -0,0 +1,65 @@
+/* { dg-do run } */
+
+#include <stdlib.h>
+
+#define EPS 0.00001
+#define N 10000
+
+void init (float *a, float *b, int n)
+{
+ int i;
+ for (i = 0; i < n; i++)
+ {
+ a[i] = 0.1 * i;
+ b[i] = 0.01 * i * i;
+ }
+}
+
+void vec_mult_ref (float *p, float *v1, float *v2, int n)
+{
+ int i;
+ for (i = 0; i < n; i++)
+ p[i] = v1[i] * v2[i];
+}
+
+void vec_mult (float *p, float *v1, float *v2, int n)
+{
+ int i;
+ #pragma omp target teams map(to: v1[0:n], v2[:n]) map(from: p[0:n])
+ #pragma omp distribute parallel for simd
+ for (i = 0; i < n; i++)
+ p[i] = v1[i] * v2[i];
+}
+
+void check (float *a, float *b, int n)
+{
+ int i;
+ for (i = 0 ; i < n ; i++)
+ {
+ float err = (a[i] == 0.0) ? b[i] : (b[i] - a[i]) / a[i];
+ if (((err > 0) ? err : -err) > EPS)
+ abort ();
+ }
+}
+
+int main ()
+{
+ float *p1 = (float *) malloc (N * sizeof (float));
+ float *p2 = (float *) malloc (N * sizeof (float));
+ float *v1 = (float *) malloc (N * sizeof (float));
+ float *v2 = (float *) malloc (N * sizeof (float));
+
+ init (v1, v2, N);
+
+ vec_mult_ref (p1, v1, v2, N);
+ vec_mult (p2, v1, v2, N);
+
+ check (p1, p2, N);
+
+ free (p1);
+ free (p2);
+ free (v1);
+ free (v2);
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.55.1.c b/libgomp/testsuite/libgomp.c/examples-4/e.55.1.c
new file mode 100644
index 00000000000..082e78a7ddb
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.55.1.c
@@ -0,0 +1,68 @@
+/* { dg-do run } */
+
+#include <stdlib.h>
+
+#define EPS 0.00001
+#define N 100000
+#define CHUNKSZ 1000
+
+float Y[N];
+float Z[N];
+
+#pragma omp declare target
+float F (float a)
+{
+ return -a;
+}
+#pragma omp end declare target
+
+void pipedF_ref ()
+{
+ int i;
+ for (i = 0; i < N; i++)
+ Y[i] = F (Y[i]);
+}
+
+void pipedF ()
+{
+ int i, C;
+ for (C = 0; C < N; C += CHUNKSZ)
+ {
+ #pragma omp task
+ #pragma omp target map(Z[C:CHUNKSZ])
+ #pragma omp parallel for
+ for (i = C; i < C + CHUNKSZ; i++)
+ Z[i] = F (Z[i]);
+ }
+ #pragma omp taskwait
+}
+
+void init ()
+{
+ int i;
+ for (i = 0; i < N; i++)
+ Y[i] = Z[i] = 0.1 * i;
+}
+
+void check ()
+{
+ int i;
+ for (i = 0; i < N; i++)
+ {
+ float err = (Z[i] == 0.0) ? Y[i] : (Y[i] - Z[i]) / Z[i];
+ if (((err > 0) ? err : -err) > EPS)
+ abort ();
+ }
+}
+
+int main ()
+{
+ init ();
+
+ pipedF_ref ();
+ pipedF ();
+
+ check ();
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.55.2.c b/libgomp/testsuite/libgomp.c/examples-4/e.55.2.c
new file mode 100644
index 00000000000..f03cae372ff
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.55.2.c
@@ -0,0 +1,95 @@
+/* { dg-do run } */
+/* { dg-require-effective-target offload_device } */
+
+#include <omp.h>
+#include <stdlib.h>
+
+#define EPS 0.00001
+#define N 10000
+
+#pragma omp declare target
+void init (float *a, float *b, int n)
+{
+ int i;
+ for (i = 0; i < n; i++)
+ {
+ a[i] = 0.1 * i;
+ b[i] = 0.01 * i * i;
+ }
+}
+#pragma omp end declare target
+
+void vec_mult_ref (float *p, float *v1, float *v2, int n)
+{
+ int i;
+
+ v1 = (float *) malloc (n * sizeof (float));
+ v2 = (float *) malloc (n * sizeof (float));
+
+ init (v1, v2, n);
+
+ for (i = 0; i < n; i++)
+ p[i] = v1[i] * v2[i];
+
+ free (v1);
+ free (v2);
+}
+
+void vec_mult (float *p, float *v1, float *v2, int n)
+{
+ int i;
+
+ #pragma omp task shared(v1, v2) depend(out: v1, v2)
+ #pragma omp target map(v1, v2)
+ {
+ if (omp_is_initial_device ())
+ abort ();
+
+ v1 = (float *) malloc (n * sizeof (float));
+ v2 = (float *) malloc (n * sizeof (float));
+
+ init (v1, v2, n);
+ }
+
+ #pragma omp task shared(v1, v2) depend(in: v1, v2)
+ #pragma omp target map(to: v1, v2) map(from: p[0:n])
+ {
+ if (omp_is_initial_device ())
+ abort ();
+
+ #pragma omp parallel for
+ for (i = 0; i < n; i++)
+ p[i] = v1[i] * v2[i];
+
+ free (v1);
+ free (v2);
+ }
+}
+
+void check (float *a, float *b, int n)
+{
+ int i;
+ for (i = 0 ; i < n ; i++)
+ {
+ float err = (a[i] == 0.0) ? b[i] : (b[i] - a[i]) / a[i];
+ if (((err > 0) ? err : -err) > EPS)
+ abort ();
+ }
+}
+
+int main ()
+{
+ float *p1 = (float *) malloc (N * sizeof (float));
+ float *p2 = (float *) malloc (N * sizeof (float));
+ float *v1, *v2;
+
+ vec_mult_ref (p1, v1, v2, N);
+ vec_mult (p2, v1, v2, N);
+
+ check (p1, p2, N);
+
+ free (p1);
+ free (p2);
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.56.3.c b/libgomp/testsuite/libgomp.c/examples-4/e.56.3.c
new file mode 100644
index 00000000000..4f4649ae244
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.56.3.c
@@ -0,0 +1,26 @@
+/* { dg-do run } */
+
+#include <stdlib.h>
+
+void foo ()
+{
+ int A[30], *p;
+ #pragma omp target data map(A[0:4])
+ {
+ p = &A[0];
+ #pragma omp target map(p[7:20]) map(A[0:4])
+ {
+ A[2] = 777;
+ p[8] = 777;
+ }
+ }
+
+ if (A[2] != 777 || A[8] != 777)
+ abort ();
+}
+
+int main ()
+{
+ foo ();
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.56.4.c b/libgomp/testsuite/libgomp.c/examples-4/e.56.4.c
new file mode 100644
index 00000000000..66234d76f7b
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.56.4.c
@@ -0,0 +1,27 @@
+/* { dg-do run } */
+
+#include <stdlib.h>
+
+void foo ()
+{
+ int A[30], *p;
+ #pragma omp target data map(A[0:10])
+ {
+ p = &A[0];
+ #pragma omp target map(p[3:7]) map(A[0:10])
+ {
+ A[2] = 777;
+ A[8] = 777;
+ p[8] = 999;
+ }
+ }
+
+ if (A[2] != 777 || A[8] != 999)
+ abort ();
+}
+
+int main ()
+{
+ foo ();
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.57.1.c b/libgomp/testsuite/libgomp.c/examples-4/e.57.1.c
new file mode 100644
index 00000000000..f7c84fb4c14
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.57.1.c
@@ -0,0 +1,59 @@
+/* { dg-do run } */
+/* { dg-require-effective-target offload_device } */
+
+#include <omp.h>
+#include <stdlib.h>
+
+int main ()
+{
+ int a = 100;
+ int b = 0;
+ int c, d;
+
+ #pragma omp target if(a > 200 && a < 400)
+ c = omp_is_initial_device ();
+
+ #pragma omp target data map(to: b) if(a > 200 && a < 400)
+ #pragma omp target
+ {
+ b = 100;
+ d = omp_is_initial_device ();
+ }
+
+ if (b != 100 || !c || d)
+ abort ();
+
+ a += 200;
+ b = 0;
+
+ #pragma omp target if(a > 200 && a < 400)
+ c = omp_is_initial_device ();
+
+ #pragma omp target data map(to: b) if(a > 200 && a < 400)
+ #pragma omp target
+ {
+ b = 100;
+ d = omp_is_initial_device ();
+ }
+
+ if (b != 0 || c || d)
+ abort ();
+
+ a += 200;
+ b = 0;
+
+ #pragma omp target if(a > 200 && a < 400)
+ c = omp_is_initial_device ();
+
+ #pragma omp target data map(to: b) if(a > 200 && a < 400)
+ #pragma omp target
+ {
+ b = 100;
+ d = omp_is_initial_device ();
+ }
+
+ if (b != 100 || !c || d)
+ abort ();
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.57.2.c b/libgomp/testsuite/libgomp.c/examples-4/e.57.2.c
new file mode 100644
index 00000000000..be204bd76f5
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.57.2.c
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+/* { dg-require-effective-target offload_device } */
+
+#include <omp.h>
+#include <stdlib.h>
+
+#define N 10
+
+int main ()
+{
+ int i;
+ int offload[N];
+ int num = omp_get_num_devices();
+
+ #pragma omp parallel for
+ for (i = 0; i < N; i++)
+ #pragma omp target device(i) map(from: offload[i:1])
+ offload[i] = omp_is_initial_device ();
+
+ for (i = 0; i < num; i++)
+ if (offload[i])
+ abort ();
+
+ for (i = num; i < N; i++)
+ if (!offload[i])
+ abort ();
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.57.3.c b/libgomp/testsuite/libgomp.c/examples-4/e.57.3.c
new file mode 100644
index 00000000000..8a0cf7c200d
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.57.3.c
@@ -0,0 +1,27 @@
+/* { dg-do run } */
+/* { dg-require-effective-target offload_device } */
+
+#include <omp.h>
+#include <stdlib.h>
+
+int main ()
+{
+ int res;
+ int default_device = omp_get_default_device ();
+
+ #pragma omp target
+ res = omp_is_initial_device ();
+
+ if (res)
+ abort ();
+
+ omp_set_default_device (omp_get_num_devices ());
+
+ #pragma omp target
+ res = omp_is_initial_device ();
+
+ if (!res)
+ abort ();
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/target-7.c b/libgomp/testsuite/libgomp.c/target-7.c
index 90de6c52311..0fe6150283d 100644
--- a/libgomp/testsuite/libgomp.c/target-7.c
+++ b/libgomp/testsuite/libgomp.c/target-7.c
@@ -18,7 +18,7 @@ foo (int f)
if (omp_get_level () != 0 || !omp_is_initial_device ())
abort ();
#pragma omp target if (v <= 1)
- if (omp_get_level () != 0 || (f && !omp_is_initial_device ()))
+ if (omp_get_level () != 0)
abort ();
#pragma omp target device (d) if (v <= 1)
if (omp_get_level () != 0 || (f && !omp_is_initial_device ()))
@@ -30,7 +30,7 @@ foo (int f)
if (omp_get_level () != 0 || !omp_is_initial_device ())
abort ();
#pragma omp target if (1)
- if (omp_get_level () != 0 || (f && !omp_is_initial_device ()))
+ if (omp_get_level () != 0)
abort ();
#pragma omp target device (d) if (1)
if (omp_get_level () != 0 || (f && !omp_is_initial_device ()))
@@ -59,7 +59,7 @@ foo (int f)
#pragma omp target data if (v <= 1) map (to: h)
{
#pragma omp target if (v <= 1)
- if (omp_get_level () != 0 || (f && !omp_is_initial_device ()) || h++ != 8)
+ if (omp_get_level () != 0 || h++ != 8)
abort ();
#pragma omp target update if (v <= 1) from (h)
}
@@ -87,7 +87,7 @@ foo (int f)
#pragma omp target data if (1) map (to: h)
{
#pragma omp target if (1)
- if (omp_get_level () != 0 || (f && !omp_is_initial_device ()) || h++ != 12)
+ if (omp_get_level () != 0 || h++ != 12)
abort ();
#pragma omp target update if (1) from (h)
}
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.50.1.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.50.1.f90
new file mode 100644
index 00000000000..76e9068e30f
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.50.1.f90
@@ -0,0 +1,44 @@
+! { dg-do run }
+
+module e_50_1_mod
+contains
+ subroutine init (v1, v2, N)
+ integer :: i, N
+ real :: v1(N), v2(N)
+ do i = 1, N
+ v1(i) = i + 2.0
+ v2(i) = i - 3.0
+ end do
+ end subroutine
+
+ subroutine check (p, N)
+ integer :: i, N
+ real, parameter :: EPS = 0.00001
+ real :: diff, p(N)
+ do i = 1, N
+ diff = p(i) - (i + 2.0) * (i - 3.0)
+ if (diff > EPS .or. -diff > EPS) call abort
+ end do
+ end subroutine
+
+ subroutine vec_mult (N)
+ integer :: i, N
+ real :: p(N), v1(N), v2(N)
+ call init (v1, v2, N)
+ !$omp target
+ !$omp parallel do
+ do i = 1, N
+ p(i) = v1(i) * v2(i)
+ end do
+ !$omp end target
+ call check (p, N)
+ end subroutine
+
+end module
+
+program e_50_1
+ use e_50_1_mod, only : vec_mult
+ integer :: n
+ n = 1000
+ call vec_mult (n)
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.50.2.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.50.2.f90
new file mode 100644
index 00000000000..af469f4d687
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.50.2.f90
@@ -0,0 +1,43 @@
+! { dg-do run }
+
+module e_50_2_mod
+contains
+ subroutine init (v1, v2, N)
+ integer :: i, N
+ real :: v1(N), v2(N)
+ do i = 1, N
+ v1(i) = i + 2.0
+ v2(i) = i - 3.0
+ end do
+ end subroutine
+
+ subroutine check (p, N)
+ integer :: i, N
+ real, parameter :: EPS = 0.00001
+ real :: diff, p(N)
+ do i = 1, N
+ diff = p(i) - (i + 2.0) * (i - 3.0)
+ if (diff > EPS .or. -diff > EPS) call abort
+ end do
+ end subroutine
+
+ subroutine vec_mult (N)
+ integer :: i, N
+ real :: p(N), v1(N), v2(N)
+ call init (v1, v2, N)
+ !$omp target map(v1,v2,p)
+ !$omp parallel do
+ do i = 1, N
+ p(i) = v1(i) * v2(i)
+ end do
+ !$omp end target
+ call check (p, N)
+ end subroutine
+end module
+
+program e_50_2
+ use e_50_2_mod, only : vec_mult
+ integer :: n
+ n = 1000
+ call vec_mult (n)
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.50.3.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.50.3.f90
new file mode 100644
index 00000000000..975470411cb
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.50.3.f90
@@ -0,0 +1,43 @@
+! { dg-do run }
+
+module e_50_3_mod
+contains
+ subroutine init (v1, v2, N)
+ integer :: i, N
+ real :: v1(N), v2(N)
+ do i = 1, N
+ v1(i) = i + 2.0
+ v2(i) = i - 3.0
+ end do
+ end subroutine
+
+ subroutine check (p, N)
+ integer :: i, N
+ real, parameter :: EPS = 0.00001
+ real :: diff, p(N)
+ do i = 1, N
+ diff = p(i) - (i + 2.0) * (i - 3.0)
+ if (diff > EPS .or. -diff > EPS) call abort
+ end do
+ end subroutine
+
+ subroutine vec_mult (N)
+ integer :: i, N
+ real :: p(N), v1(N), v2(N)
+ call init (v1, v2, N)
+ !$omp target map(to: v1,v2) map(from: p)
+ !$omp parallel do
+ do i = 1, N
+ p(i) = v1(i) * v2(i)
+ end do
+ !$omp end target
+ call check (p, N)
+ end subroutine
+end module
+
+program e_50_3
+ use e_50_3_mod, only : vec_mult
+ integer :: n
+ n = 1000
+ call vec_mult (n)
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.50.4.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.50.4.f90
new file mode 100644
index 00000000000..f94794e16aa
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.50.4.f90
@@ -0,0 +1,59 @@
+! { dg-do run }
+
+module e_50_4_mod
+contains
+ subroutine init (v1, v2, N)
+ integer :: i, N
+ real, pointer, dimension(:) :: v1, v2
+ do i = 1, N
+ v1(i) = i + 2.0
+ v2(i) = i - 3.0
+ end do
+ end subroutine
+
+ subroutine check (p, N)
+ integer :: i, N
+ real, parameter :: EPS = 0.00001
+ real, pointer, dimension(:) :: p
+ do i = 1, N
+ diff = p(i) - (i + 2.0) * (i - 3.0)
+ if (diff > EPS .or. -diff > EPS) call abort
+ end do
+ end subroutine
+
+ subroutine vec_mult_1 (p, v1, v2, N)
+ integer :: i, N
+ real, pointer, dimension(:) :: p, v1, v2
+ !$omp target map(to: v1(1:N), v2(:N)) map(from: p(1:N))
+ !$omp parallel do
+ do i = 1, N
+ p(i) = v1(i) * v2(i)
+ end do
+ !$omp end target
+ end subroutine
+
+ subroutine vec_mult_2 (p, v1, v2, N)
+ real, dimension(*) :: p, v1, v2
+ integer :: i, N
+ !$omp target map(to: v1(1:N), v2(:N)) map(from: p(1:N))
+ !$omp parallel do
+ do i = 1, N
+ p(i) = v1(i) * v2(i)
+ end do
+ !$omp end target
+ end subroutine
+end module
+
+program e_50_4
+ use e_50_4_mod, only : init, check, vec_mult_1, vec_mult_2
+ real, pointer, dimension(:) :: p1, p2, v1, v2
+ integer :: n
+ n = 1000
+ allocate (p1(n), p2(n), v1(n), v2(n))
+ call init (v1, v2, n)
+ call vec_mult_1 (p1, v1, v2, n)
+ call vec_mult_2 (p2, v1, v2, n)
+ call check (p1, N)
+ call check (p2, N)
+ deallocate (p1, p2, v1, v2)
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.50.5.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.50.5.f90
new file mode 100644
index 00000000000..3f454d7d55e
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.50.5.f90
@@ -0,0 +1,47 @@
+! { dg-do run }
+! { dg-require-effective-target offload_device }
+
+module e_50_5_mod
+integer, parameter :: THRESHOLD1 = 500, THRESHOLD2 = 100
+contains
+ subroutine init (v1, v2, N)
+ integer :: i, N
+ real :: v1(N), v2(N)
+ do i = 1, N
+ v1(i) = i + 2.0
+ v2(i) = i - 3.0
+ end do
+ end subroutine
+
+ subroutine check (p, N)
+ integer :: i, N
+ real, parameter :: EPS = 0.00001
+ real :: diff, p(N)
+ do i = 1, N
+ diff = p(i) - (i + 2.0) * (i - 3.0)
+ if (diff > EPS .or. -diff > EPS) call abort
+ end do
+ end subroutine
+
+ subroutine vec_mult (N)
+ use omp_lib, only: omp_is_initial_device
+ integer :: i, N
+ real :: p(N), v1(N), v2(N)
+ call init (v1, v2, N)
+ !$omp target if(N > THRESHOLD1) map(to: v1,v2) map(from: p)
+ if (omp_is_initial_device ()) call abort
+ !$omp parallel do if(N > THRESHOLD2)
+ do i = 1, N
+ p(i) = v1(i) * v2(i)
+ end do
+ !$omp end target
+ call check (p, N)
+ end subroutine
+end module
+
+program e_50_5
+ use e_50_5_mod, only : vec_mult
+ integer :: n
+ n = 1000
+ call vec_mult (n)
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.51.1.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.51.1.f90
new file mode 100644
index 00000000000..98e5c0b8f77
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.51.1.f90
@@ -0,0 +1,45 @@
+! { dg-do run }
+
+module e_51_1_mod
+contains
+ subroutine init (v1, v2, N)
+ integer :: i, N
+ real :: v1(N), v2(N)
+ do i = 1, N
+ v1(i) = i + 2.0
+ v2(i) = i - 3.0
+ end do
+ end subroutine
+
+ subroutine check (p, N)
+ integer :: i, N
+ real, parameter :: EPS = 0.00001
+ real :: diff, p(N)
+ do i = 1, N
+ diff = p(i) - (i + 2.0) * (i - 3.0)
+ if (diff > EPS .or. -diff > EPS) call abort
+ end do
+ end subroutine
+
+ subroutine vec_mult (N)
+ real :: p(N), v1(N), v2(N)
+ integer :: i, N
+ call init (v1, v2, N)
+ !$omp target data map(to: v1, v2) map(from: p)
+ !$omp target
+ !$omp parallel do
+ do i = 1, N
+ p(i) = v1(i) * v2(i)
+ end do
+ !$omp end target
+ !$omp end target data
+ call check (p, N)
+ end subroutine
+end module
+
+program e_51_1
+ use e_51_1_mod, only : vec_mult
+ integer :: n
+ n = 1000
+ call vec_mult (n)
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.51.2.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.51.2.f90
new file mode 100644
index 00000000000..360cdeda7e1
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.51.2.f90
@@ -0,0 +1,61 @@
+! { dg-do run }
+
+module e_51_2_mod
+contains
+ subroutine init (v1, v2, N)
+ integer :: i, N
+ real :: v1(N), v2(N)
+ do i = 1, N
+ v1(i) = i + 2.0
+ v2(i) = i - 3.0
+ end do
+ end subroutine
+
+ subroutine init_again (v1, v2, N)
+ integer :: i, N
+ real :: v1(N), v2(N)
+ do i = 1, N
+ v1(i) = i - 3.0
+ v2(i) = i + 2.0
+ end do
+ end subroutine
+
+ subroutine check (p, N)
+ integer :: i, N
+ real, parameter :: EPS = 0.00001
+ real :: diff, p(N)
+ do i = 1, N
+ diff = p(i) - 2 * (i + 2.0) * (i - 3.0)
+ if (diff > EPS .or. -diff > EPS) call abort
+ end do
+ end subroutine
+
+ subroutine vec_mult (N)
+ real :: p(N), v1(N), v2(N)
+ integer :: i, N
+ call init (v1, v2, N)
+ !$omp target data map(from: p)
+ !$omp target map(to: v1, v2 )
+ !$omp parallel do
+ do i = 1, N
+ p(i) = v1(i) * v2(i)
+ end do
+ !$omp end target
+ call init_again (v1, v2, N)
+ !$omp target map(to: v1, v2 )
+ !$omp parallel do
+ do i = 1, N
+ p(i) = p(i) + v1(i) * v2(i)
+ end do
+ !$omp end target
+ !$omp end target data
+ call check (p, N)
+ end subroutine
+end module
+
+program e_51_2
+ use e_51_2_mod, only : vec_mult
+ integer :: n
+ n = 1000
+ call vec_mult (n)
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.51.3.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.51.3.f90
new file mode 100644
index 00000000000..a3d9c188f93
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.51.3.f90
@@ -0,0 +1,79 @@
+! { dg-do run }
+
+module e_51_3_mod
+contains
+ subroutine init (Q, rows, cols)
+ integer :: i, k, rows, cols
+ double precision :: Q(rows,cols)
+ do k = 1, cols
+ do i = 1, rows
+ Q(i,k) = 10 * i + k
+ end do
+ end do
+ end subroutine
+
+ subroutine check (P, Q, rows, cols)
+ integer :: i, k, rows, cols
+ double precision, parameter :: EPS = 0.00001
+ double precision :: P(rows,cols), Q(rows,cols), diff
+ do k = 1, cols
+ do i = 1, rows
+ diff = P(i,k) - Q(i,k)
+ if (diff > EPS .or. -diff > EPS) call abort
+ end do
+ end do
+ end subroutine
+
+ subroutine gramSchmidt_ref (Q, rows, cols)
+ integer :: i, k, rows, cols
+ double precision :: Q(rows,cols), tmp
+ do k = 1, cols
+ tmp = 0.0d0
+ do i = 1, rows
+ tmp = tmp + (Q(i,k) * Q(i,k))
+ end do
+ tmp = 1.0d0 / sqrt (tmp)
+ do i = 1, rows
+ Q(i,k) = Q(i,k) * tmp
+ end do
+ end do
+ end subroutine
+
+ subroutine gramSchmidt (Q, rows, cols)
+ integer :: i, k, rows, cols
+ double precision :: Q(rows,cols), tmp
+ !$omp target data map(Q)
+ do k = 1, cols
+ tmp = 0.0d0
+ !$omp target
+ !$omp parallel do reduction(+:tmp)
+ do i = 1, rows
+ tmp = tmp + (Q(i,k) * Q(i,k))
+ end do
+ !$omp end target
+ tmp = 1.0d0 / sqrt (tmp)
+ !$omp target
+ !$omp parallel do
+ do i = 1, rows
+ Q(i,k) = Q(i,k) * tmp
+ end do
+ !$omp end target
+ end do
+ !$omp end target data
+ end subroutine
+end module
+
+program e_51_3
+ use e_51_3_mod, only : init, check, gramSchmidt, gramSchmidt_ref
+ integer :: cols, rows
+ double precision, pointer :: P(:,:), Q(:,:)
+ cols = 5
+ rows = 5
+ allocate (P(rows,cols), Q(rows,cols))
+ call init (P, rows, cols)
+ call init (Q, rows, cols)
+ call gramSchmidt_ref (P, rows, cols)
+ call gramSchmidt (Q, rows, cols)
+ call check (P, Q, rows, cols)
+ deallocate (P, Q)
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.51.4.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.51.4.f90
new file mode 100644
index 00000000000..e9de6ae0015
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.51.4.f90
@@ -0,0 +1,54 @@
+! { dg-do run }
+
+module e_51_4_mod
+contains
+ subroutine init (v1, v2, N)
+ integer :: i, N
+ real :: v1(N), v2(N)
+ do i = 1, N
+ v1(i) = i + 2.0
+ v2(i) = i - 3.0
+ end do
+ end subroutine
+
+ subroutine check (p, N)
+ integer :: i, N
+ real, parameter :: EPS = 0.00001
+ real :: diff, p(N)
+ do i = 1, N
+ diff = p(i) - (i + 2.0) * (i - 3.0)
+ if (diff > EPS .or. -diff > EPS) call abort
+ end do
+ end subroutine
+
+ subroutine foo (p, v1, v2, N)
+ real, pointer, dimension(:) :: p, v1, v2
+ integer :: N
+ call init (v1, v2, N)
+ !$omp target data map(to: v1, v2) map(from: p)
+ call vec_mult (p, v1, v2, N)
+ !$omp end target data
+ call check (p, N)
+ end subroutine
+
+ subroutine vec_mult (p, v1, v2, N)
+ real, pointer, dimension(:) :: p, v1, v2
+ integer :: i, N
+ !$omp target map(to: v1, v2) map(from: p)
+ !$omp parallel do
+ do i = 1, N
+ p(i) = v1(i) * v2(i)
+ end do
+ !$omp end target
+ end subroutine
+end module
+
+program e_51_4
+ use e_51_4_mod, only : foo
+ integer :: n
+ real, pointer, dimension(:) :: p, v1, v2
+ n = 1000
+ allocate (p(n), v1(n), v2(n))
+ call foo (p, v1, v2, n)
+ deallocate (p, v1, v2)
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.51.5.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.51.5.f90
new file mode 100644
index 00000000000..01a41adb0f4
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.51.5.f90
@@ -0,0 +1,53 @@
+! { dg-do run }
+
+module e_51_5_mod
+contains
+ subroutine init (v1, v2, N)
+ integer :: i, N
+ real :: v1(N), v2(N)
+ do i = 1, N
+ v1(i) = i + 2.0
+ v2(i) = i - 3.0
+ end do
+ end subroutine
+
+ subroutine check (p, N)
+ integer :: i, N
+ real, parameter :: EPS = 0.00001
+ real :: diff, p(N)
+ do i = 1, N
+ diff = p(i) - (i + 2.0) * (i - 3.0)
+ if (diff > EPS .or. -diff > EPS) call abort
+ end do
+ end subroutine
+
+ subroutine foo (p, v1, v2, N)
+ real, dimension(:) :: p, v1, v2
+ integer :: N
+ call init (v1, v2, N)
+ !$omp target data map(to: v1, v2, N) map(from: p)
+ call vec_mult (p, v1, v2, N)
+ !$omp end target data
+ call check (p, N)
+ end subroutine
+
+ subroutine vec_mult (p, v1, v2, N)
+ real, dimension(:) :: p, v1, v2
+ integer :: i, N
+ !$omp target map(to: v1, v2, N) map(from: p)
+ !$omp parallel do
+ do i = 1, N
+ p(i) = v1(i) * v2(i)
+ end do
+ !$omp end target
+ end subroutine
+end module
+
+program e_51_5
+ use e_51_5_mod, only : foo
+ integer, parameter :: N = 1024
+ real, allocatable, dimension(:) :: p, v1, v2
+ allocate(p(N), v1(N), v2(N))
+ call foo (p, v1, v2, N)
+ deallocate (p, v1, v2)
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.51.6.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.51.6.f90
new file mode 100644
index 00000000000..258da21e8f4
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.51.6.f90
@@ -0,0 +1,66 @@
+! { dg-do run }
+! { dg-require-effective-target offload_device }
+
+module e_51_6_mod
+integer, parameter :: THRESHOLD = 500
+contains
+ subroutine init (v1, v2, N)
+ integer :: i, N
+ real :: v1(N), v2(N)
+ do i = 1, N
+ v1(i) = i + 2.0
+ v2(i) = i - 3.0
+ end do
+ end subroutine
+
+ subroutine init_again (v1, v2, N)
+ integer :: i, N
+ real :: v1(N), v2(N)
+ do i = 1, N
+ v1(i) = i - 3.0
+ v2(i) = i + 2.0
+ end do
+ end subroutine
+
+ subroutine check (p, N)
+ integer :: i, N
+ real, parameter :: EPS = 0.00001
+ real :: diff, p(N)
+ do i = 1, N
+ diff = p(i) - 2 * (i + 2.0) * (i - 3.0)
+ if (diff > EPS .or. -diff > EPS) call abort
+ end do
+ end subroutine
+
+ subroutine vec_mult (N)
+ use omp_lib, only: omp_is_initial_device
+ real :: p(N), v1(N), v2(N)
+ integer :: i, N
+ call init (v1, v2, N)
+ !$omp target data if(N > THRESHOLD) map(from: p)
+ !$omp target if(N > THRESHOLD) map(to: v1, v2)
+ if (omp_is_initial_device ()) call abort
+ !$omp parallel do
+ do i = 1, N
+ p(i) = v1(i) * v2(i)
+ end do
+ !$omp end target
+ call init_again (v1, v2, N)
+ !$omp target if(N > THRESHOLD) map(to: v1, v2)
+ if (omp_is_initial_device ()) call abort
+ !$omp parallel do
+ do i = 1, N
+ p(i) = p(i) + v1(i) * v2(i)
+ end do
+ !$omp end target
+ !$omp end target data
+ call check (p, N)
+ end subroutine
+end module
+
+program e_51_6
+ use e_51_6_mod, only : vec_mult
+ integer :: n
+ n = 1000
+ call vec_mult (n)
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.51.7.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.51.7.f90
new file mode 100644
index 00000000000..2ddac9e4665
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.51.7.f90
@@ -0,0 +1,49 @@
+! { dg-do run }
+! { dg-require-effective-target offload_device }
+
+module e_51_7_mod
+integer, parameter :: THRESHOLD = 500
+contains
+ subroutine init (v1, v2, N)
+ integer :: i, N
+ real :: v1(N), v2(N)
+ do i = 1, N
+ v1(i) = i + 2.0
+ v2(i) = i - 3.0
+ end do
+ end subroutine
+
+ subroutine check (p, N)
+ integer :: i, N
+ real, parameter :: EPS = 0.00001
+ real :: diff, p(N)
+ do i = 1, N
+ diff = p(i) - (i + 2.0) * (i - 3.0)
+ if (diff > EPS .or. -diff > EPS) call abort
+ end do
+ end subroutine
+
+ subroutine vec_mult (N)
+ use omp_lib, only: omp_is_initial_device
+ real :: p(N), v1(N), v2(N)
+ integer :: i, N
+ call init (v1, v2, N)
+ !$omp target data if(N > THRESHOLD) map(to: v1, v2) map(from: p)
+ !$omp target
+ if (omp_is_initial_device ()) call abort
+ !$omp parallel do
+ do i = 1, N
+ p(i) = v1(i) * v2(i)
+ end do
+ !$omp end target
+ !$omp end target data
+ call check (p, N)
+ end subroutine
+end module
+
+program e_51_7
+ use e_51_7_mod, only : vec_mult
+ integer :: n
+ n = 1000
+ call vec_mult (n)
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.52.1.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.52.1.f90
new file mode 100644
index 00000000000..e23c0bb7bca
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.52.1.f90
@@ -0,0 +1,65 @@
+! { dg-do run }
+
+module e_52_1_mod
+contains
+ subroutine init (v1, v2, N)
+ integer :: i, N
+ real :: v1(N), v2(N)
+ do i = 1, N
+ v1(i) = i + 2.0
+ v2(i) = i - 3.0
+ end do
+ end subroutine
+
+ subroutine init_again (v1, v2, N)
+ integer :: i, N
+ real :: v1(N), v2(N)
+ do i = 1, N
+ v1(i) = i - 3.0
+ v2(i) = i + 2.0
+ end do
+ end subroutine
+
+ subroutine check (p, N)
+ integer :: i, N
+ real, parameter :: EPS = 0.00001
+ real :: diff, p(N)
+ do i = 1, N
+ diff = p(i) - 2 * (i + 2.0) * (i - 3.0)
+ if (diff > EPS .or. -diff > EPS) call abort
+ end do
+ end subroutine
+
+ subroutine vec_mult (p, v1, v2, N)
+ real :: p(N), v1(N), v2(N)
+ integer :: i, N
+ call init (v1, v2, N)
+ !$omp target data map(to: v1, v2) map(from: p)
+ !$omp target
+ !$omp parallel do
+ do i = 1, N
+ p(i) = v1(i) * v2(i)
+ end do
+ !$omp end target
+ call init_again (v1, v2, N)
+ !$omp target update to(v1, v2)
+ !$omp target
+ !$omp parallel do
+ do i = 1, N
+ p(i) = p(i) + v1(i) * v2(i)
+ end do
+ !$omp end target
+ !$omp end target data
+ call check (p, N)
+ end subroutine
+end module
+
+program e_52_1
+ use e_52_1_mod, only : vec_mult
+ integer :: n
+ real, pointer :: p(:), v1(:), v2(:)
+ n = 1000
+ allocate (p(n), v1(n), v2(n))
+ call vec_mult (p, v1, v2, n)
+ deallocate (p, v1, v2)
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.52.2.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.52.2.f90
new file mode 100644
index 00000000000..3735e5342e4
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.52.2.f90
@@ -0,0 +1,77 @@
+! { dg-do run }
+
+module e_52_2_mod
+contains
+ subroutine init (v1, v2, N)
+ integer :: i, N
+ real :: v1(N), v2(N)
+ do i = 1, N
+ v1(i) = i + 2.0
+ v2(i) = i - 3.0
+ end do
+ end subroutine
+
+ subroutine init_again (v1, v2, N)
+ integer :: i, N
+ real :: v1(N), v2(N)
+ do i = 1, N
+ v1(i) = i - 3.0
+ v2(i) = i + 2.0
+ end do
+ end subroutine
+
+ subroutine check (p, N)
+ integer :: i, N
+ real, parameter :: EPS = 0.00001
+ real :: diff, p(N)
+ do i = 1, N
+ diff = p(i) - (i * i + (i + 2.0) * (i - 3.0))
+ if (diff > EPS .or. -diff > EPS) call abort
+ end do
+ end subroutine
+
+ logical function maybe_init_again (v, N)
+ real :: v(N)
+ integer :: i, N
+ do i = 1, N
+ v(i) = i
+ end do
+ maybe_init_again = .true.
+ end function
+
+ subroutine vec_mult (p, v1, v2, N)
+ real :: p(N), v1(N), v2(N)
+ integer :: i, N
+ logical :: changed
+ call init (v1, v2, N)
+ !$omp target data map(to: v1, v2) map(from: p)
+ !$omp target
+ !$omp parallel do
+ do i = 1, N
+ p(i) = v1(i) * v2(i)
+ end do
+ !$omp end target
+ changed = maybe_init_again (v1, N)
+ !$omp target update if(changed) to(v1(:N))
+ changed = maybe_init_again (v2, N)
+ !$omp target update if(changed) to(v2(:N))
+ !$omp target
+ !$omp parallel do
+ do i = 1, N
+ p(i) = p(i) + v1(i) * v2(i)
+ end do
+ !$omp end target
+ !$omp end target data
+ call check (p, N)
+ end subroutine
+end module
+
+program e_52_2
+ use e_52_2_mod, only : vec_mult
+ integer :: n
+ real, pointer :: p(:), v1(:), v2(:)
+ n = 1000
+ allocate (p(n), v1(n), v2(n))
+ call vec_mult (p, v1, v2, n)
+ deallocate (p, v1, v2)
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.53.1.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.53.1.f90
new file mode 100644
index 00000000000..a1885afa1b5
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.53.1.f90
@@ -0,0 +1,31 @@
+! { dg-do run }
+
+module e_53_1_mod
+ integer :: THRESHOLD = 20
+contains
+ integer recursive function fib (n) result (f)
+ !$omp declare target
+ integer :: n
+ if (n <= 0) then
+ f = 0
+ else if (n == 1) then
+ f = 1
+ else
+ f = fib (n - 1) + fib (n - 2)
+ end if
+ end function
+
+ integer function fib_wrapper (n)
+ integer :: x
+ !$omp target map(to: n) if(n > THRESHOLD)
+ x = fib (n)
+ !$omp end target
+ fib_wrapper = x
+ end function
+end module
+
+program e_53_1
+ use e_53_1_mod, only : fib, fib_wrapper
+ if (fib (15) /= fib_wrapper (15)) call abort
+ if (fib (25) /= fib_wrapper (25)) call abort
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.53.2.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.53.2.f90
new file mode 100644
index 00000000000..5bc900cac80
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.53.2.f90
@@ -0,0 +1,22 @@
+! { dg-do run }
+
+program e_53_2
+ !$omp declare target (fib)
+ integer :: x, fib
+ !$omp target
+ x = fib (25)
+ !$omp end target
+ if (x /= fib (25)) call abort
+end program
+
+integer recursive function fib (n) result (f)
+ !$omp declare target
+ integer :: n
+ if (n <= 0) then
+ f = 0
+ else if (n == 1) then
+ f = 1
+ else
+ f = fib (n - 1) + fib (n - 2)
+ end if
+end function
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.53.3.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.53.3.f90
new file mode 100644
index 00000000000..fffbb7ff17b
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.53.3.f90
@@ -0,0 +1,45 @@
+! { dg-do run }
+
+module e_53_3_mod
+ !$omp declare target (N, p, v1, v2)
+ integer, parameter :: N = 1000
+ real :: p(N), v1(N), v2(N)
+end module
+
+subroutine init (v1, v2, N)
+ integer :: i, N
+ real :: v1(N), v2(N)
+ do i = 1, N
+ v1(i) = i + 2.0
+ v2(i) = i - 3.0
+ end do
+end subroutine
+
+subroutine check (p, N)
+ integer :: i, N
+ real, parameter :: EPS = 0.00001
+ real :: diff, p(N)
+ do i = 1, N
+ diff = p(i) - (i + 2.0) * (i - 3.0)
+ if (diff > EPS .or. -diff > EPS) call abort
+ end do
+end subroutine
+
+subroutine vec_mult ()
+ use e_53_3_mod
+ integer :: i
+ call init (v1, v2, N);
+ !$omp target update to(v1, v2)
+ !$omp target
+ !$omp parallel do
+ do i = 1,N
+ p(i) = v1(i) * v2(i)
+ end do
+ !$omp end target
+ !$omp target update from (p)
+ call check (p, N)
+end subroutine
+
+program e_53_3
+ call vec_mult ()
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.53.4.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.53.4.f90
new file mode 100644
index 00000000000..41d251aae37
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.53.4.f90
@@ -0,0 +1,68 @@
+! { dg-do run }
+
+module e_53_4_mod
+ !$omp declare target (N, Q)
+ integer, parameter :: N = 10
+ real :: Q(N,N)
+contains
+ real function Pfun (i, k)
+ !$omp declare target
+ integer, intent(in) :: i, k
+ Pfun = (Q(i,k) * Q(k,i))
+ end function
+end module
+
+real function accum (k) result (tmp)
+ use e_53_4_mod
+ integer :: i, k
+ tmp = 0.0e0
+ !$omp target
+ !$omp parallel do reduction(+:tmp)
+ do i = 1, N
+ tmp = tmp + Pfun (k, i)
+ end do
+ !$omp end target
+end function
+
+real function accum_ref (k) result (tmp)
+ use e_53_4_mod
+ integer :: i, k
+ tmp = 0.0e0
+ do i = 1, N
+ tmp = tmp + Pfun (k, i)
+ end do
+end function
+
+subroutine init ()
+ use e_53_4_mod
+ integer :: i, j
+ do i = 1, N
+ do j = 1, N
+ Q(i,j) = 0.001 * i * j
+ end do
+ end do
+end subroutine
+
+subroutine check (a, b)
+ real :: a, b, err
+ real, parameter :: EPS = 0.00001
+ if (b == 0.0) then
+ err = a
+ else if (a == 0.0) then
+ err = b
+ else
+ err = (a - b) / b
+ end if
+ if (err > EPS .or. err < -EPS) call abort
+end subroutine
+
+program e_53_4
+ use e_53_4_mod
+ integer :: i
+ real :: accum, accum_ref
+ call init ()
+ !$omp target update to(Q)
+ do i = 1, N
+ call check (accum (i), accum_ref (i))
+ end do
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.53.5.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.53.5.f90
new file mode 100644
index 00000000000..304c9fb2ada
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.53.5.f90
@@ -0,0 +1,80 @@
+! { dg-do run }
+! { dg-options "-O2" }
+! { dg-additional-options "-msse2" { target sse2_runtime } }
+! { dg-additional-options "-mavx" { target avx_runtime } }
+
+module e_53_5_mod
+ !$omp declare target (N, Q)
+ integer, parameter :: N = 10000, M = 1024
+ real :: Q(N,N)
+contains
+ real function Pfun (k, i)
+ !$omp declare simd(Pfun) uniform(i) linear(k) notinbranch
+ !$omp declare target
+ integer, value, intent(in) :: i, k
+ Pfun = (Q(k,i) * Q(i,k))
+ end function
+end module
+
+real function accum () result (tmp)
+ use e_53_5_mod
+ real :: tmp1
+ integer :: i
+ tmp = 0.0e0
+ !$omp target
+ !$omp parallel do private(tmp1) reduction(+:tmp)
+ do i = 1, N
+ tmp1 = 0.0e0
+ !$omp simd reduction(+:tmp1)
+ do k = 1, M
+ tmp1 = tmp1 + Pfun (k, i)
+ end do
+ tmp = tmp + tmp1
+ end do
+ !$omp end target
+end function
+
+real function accum_ref () result (tmp)
+ use e_53_5_mod
+ real :: tmp1
+ integer :: i
+ tmp = 0.0e0
+ do i = 1, N
+ tmp1 = 0.0e0
+ do k = 1, M
+ tmp1 = tmp1 + Pfun (k, i)
+ end do
+ tmp = tmp + tmp1
+ end do
+end function
+
+subroutine init ()
+ use e_53_5_mod
+ integer :: i, j
+ do i = 1, N
+ do j = 1, N
+ Q(i,j) = 0.001 * i * j
+ end do
+ end do
+end subroutine
+
+subroutine check (a, b)
+ real :: a, b, err
+ real, parameter :: EPS = 0.00001
+ if (b == 0.0) then
+ err = a
+ else if (a == 0.0) then
+ err = b
+ else
+ err = (a - b) / b
+ end if
+ if (err > EPS .or. err < -EPS) call abort
+end subroutine
+
+program e_53_5
+ use e_53_5_mod
+ real :: accum, accum_ref, d
+ call init ()
+ !$omp target update to(Q)
+ call check (accum (), accum_ref ())
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.54.2.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.54.2.f90
new file mode 100644
index 00000000000..6a830184ded
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.54.2.f90
@@ -0,0 +1,65 @@
+! { dg-do run }
+
+function dotprod_ref (B, C, N) result (sum)
+ implicit none
+ real :: B(N), C(N), sum
+ integer :: N, i
+ sum = 0.0e0
+ do i = 1, N
+ sum = sum + B(i) * C(i)
+ end do
+end function
+
+function dotprod (B, C, N, block_size, num_teams, block_threads) result (sum)
+ implicit none
+ real :: B(N), C(N), sum
+ integer :: N, block_size, num_teams, block_threads, i, i0
+ sum = 0.0e0
+ !$omp target map(to: B, C, block_size, num_teams, block_threads)
+ !$omp teams num_teams(num_teams) thread_limit(block_threads) &
+ !$omp& reduction(+:sum)
+ !$omp distribute
+ do i0 = 1, N, block_size
+ !$omp parallel do reduction(+:sum)
+ do i = i0, min (i0 + block_size - 1, N)
+ sum = sum + B(i) * C(i)
+ end do
+ end do
+ !$omp end teams
+ !$omp end target
+end function
+
+subroutine init (B, C, N)
+ real :: B(N), C(N)
+ integer :: N, i
+ do i = 1, N
+ B(i) = 0.0001 * i
+ C(i) = 0.000001 * i * i
+ end do
+end subroutine
+
+subroutine check (a, b)
+ real :: a, b, err
+ real, parameter :: EPS = 0.0001
+ if (b == 0.0) then
+ err = a
+ else if (a == 0.0) then
+ err = b
+ else
+ err = (a - b) / b
+ end if
+ if (err > EPS .or. err < -EPS) call abort
+end subroutine
+
+program e_54_1
+ integer :: n
+ real :: ref, d
+ real, pointer, dimension(:) :: B, C
+ n = 1024 * 1024
+ allocate (B(n), C(n))
+ call init (B, C, n)
+ ref = dotprod_ref (B, C, n)
+ d = dotprod (B, C, n, n / 8, 2, 8)
+ call check (ref, d)
+ deallocate (B, C)
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.54.3.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.54.3.f90
new file mode 100644
index 00000000000..2588d8bb684
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.54.3.f90
@@ -0,0 +1,58 @@
+! { dg-do run }
+
+function dotprod_ref (B, C, N) result (sum)
+ implicit none
+ real :: B(N), C(N), sum
+ integer :: N, i
+ sum = 0.0e0
+ do i = 1, N
+ sum = sum + B(i) * C(i)
+ end do
+end function
+
+function dotprod (B, C, N) result(sum)
+ real :: B(N), C(N), sum
+ integer :: N, i
+ sum = 0.0e0
+ !$omp target teams map(to: B, C)
+ !$omp distribute parallel do reduction(+:sum)
+ do i = 1, N
+ sum = sum + B(i) * C(i)
+ end do
+ !$omp end target teams
+end function
+
+subroutine init (B, C, N)
+ real :: B(N), C(N)
+ integer :: N, i
+ do i = 1, N
+ B(i) = 0.0001 * i
+ C(i) = 0.000001 * i * i
+ end do
+end subroutine
+
+subroutine check (a, b)
+ real :: a, b, err
+ real, parameter :: EPS = 0.0001
+ if (b == 0.0) then
+ err = a
+ else if (a == 0.0) then
+ err = b
+ else
+ err = (a - b) / b
+ end if
+ if (err > EPS .or. err < -EPS) call abort
+end subroutine
+
+program e_54_3
+ integer :: n
+ real :: ref, d
+ real, pointer, dimension(:) :: B, C
+ n = 1024 * 1024
+ allocate (B(n), C(n))
+ call init (B, C, n)
+ ref = dotprod_ref (B, C, n)
+ d = dotprod (B, C, n)
+ call check (ref, d)
+ deallocate (B, C)
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.54.4.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.54.4.f90
new file mode 100644
index 00000000000..efae3c3cc20
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.54.4.f90
@@ -0,0 +1,61 @@
+! { dg-do run }
+
+function dotprod_ref (B, C, N) result (sum)
+ implicit none
+ real :: B(N), C(N), sum
+ integer :: N, i
+ sum = 0.0e0
+ do i = 1, N
+ sum = sum + B(i) * C(i)
+ end do
+end function
+
+function dotprod (B, C, n) result(sum)
+ real :: B(N), C(N), sum
+ integer :: N, i
+ sum = 0.0e0
+ !$omp target map(to: B, C)
+ !$omp teams num_teams(8) thread_limit(16)
+ !$omp distribute parallel do reduction(+:sum) &
+ !$omp& dist_schedule(static, 1024) schedule(static, 64)
+ do i = 1, N
+ sum = sum + B(i) * C(i)
+ end do
+ !$omp end teams
+ !$omp end target
+end function
+
+subroutine init (B, C, N)
+ real :: B(N), C(N)
+ integer :: N, i
+ do i = 1, N
+ B(i) = 0.0001 * i
+ C(i) = 0.000001 * i * i
+ end do
+end subroutine
+
+subroutine check (a, b)
+ real :: a, b, err
+ real, parameter :: EPS = 0.0001
+ if (b == 0.0) then
+ err = a
+ else if (a == 0.0) then
+ err = b
+ else
+ err = (a - b) / b
+ end if
+ if (err > EPS .or. err < -EPS) call abort
+end subroutine
+
+program e_54_4
+ integer :: n
+ real :: ref, d
+ real, pointer, dimension(:) :: B, C
+ n = 1024 * 1024
+ allocate (B(n), C(n))
+ call init (B, C, n)
+ ref = dotprod_ref (B, C, n)
+ d = dotprod (B, C, n)
+ call check (ref, d)
+ deallocate (B, C)
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.54.5.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.54.5.f90
new file mode 100644
index 00000000000..9608d9a2c4e
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.54.5.f90
@@ -0,0 +1,47 @@
+! { dg-do run }
+
+module e_54_5_mod
+contains
+ subroutine init (v1, v2, N)
+ integer :: i, N
+ real, pointer, dimension(:) :: v1, v2
+ do i = 1, N
+ v1(i) = i + 2.0
+ v2(i) = i - 3.0
+ end do
+ end subroutine
+
+ subroutine check (p, N)
+ integer :: i, N
+ real, parameter :: EPS = 0.00001
+ real, pointer, dimension(:) :: p
+ real :: diff
+ do i = 1, N
+ diff = p(i) - (i + 2.0) * (i - 3.0)
+ if (diff > EPS .or. -diff > EPS) call abort
+ end do
+ end subroutine
+
+ subroutine vec_mult (p, v1, v2, N)
+ real :: p(N), v1(N), v2(N)
+ integer :: i, N
+ !$omp target teams map(to: v1, v2) map(from: p)
+ !$omp distribute simd
+ do i = 1, N
+ p(i) = v1(i) * v2(i)
+ end do
+ !$omp end target teams
+ end subroutine
+end module
+
+program e_54_5
+ use e_54_5_mod, only : init, check, vec_mult
+ real, pointer, dimension(:) :: p, v1, v2
+ integer :: n
+ n = 1000
+ allocate (p(n), v1(n), v2(n))
+ call init (v1, v2, n)
+ call vec_mult (p, v1, v2, n)
+ call check (p, N)
+ deallocate (p, v1, v2)
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.54.6.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.54.6.f90
new file mode 100644
index 00000000000..f79118816f2
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.54.6.f90
@@ -0,0 +1,47 @@
+! { dg-do run }
+
+module e_54_6_mod
+contains
+ subroutine init (v1, v2, N)
+ integer :: i, N
+ real, pointer, dimension(:) :: v1, v2
+ do i = 1, N
+ v1(i) = i + 2.0
+ v2(i) = i - 3.0
+ end do
+ end subroutine
+
+ subroutine check (p, N)
+ integer :: i, N
+ real, parameter :: EPS = 0.00001
+ real, pointer, dimension(:) :: p
+ real :: diff
+ do i = 1, N
+ diff = p(i) - (i + 2.0) * (i - 3.0)
+ if (diff > EPS .or. -diff > EPS) call abort
+ end do
+ end subroutine
+
+ subroutine vec_mult (p, v1, v2, N)
+ real :: p(N), v1(N), v2(N)
+ integer :: i, N
+ !$omp target teams map(to: v1, v2) map(from: p)
+ !$omp distribute parallel do simd
+ do i = 1, N
+ p(i) = v1(i) * v2(i)
+ end do
+ !$omp end target teams
+ end subroutine
+end module
+
+program e_54_6
+ use e_54_6_mod, only : init, check, vec_mult
+ real, pointer, dimension(:) :: p, v1, v2
+ integer :: n
+ n = 1000
+ allocate (p(n), v1(n), v2(n))
+ call init (v1, v2, n)
+ call vec_mult (p, v1, v2, n)
+ call check (p, N)
+ deallocate (p, v1, v2)
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.55.1.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.55.1.f90
new file mode 100644
index 00000000000..0dd00b4ba8c
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.55.1.f90
@@ -0,0 +1,70 @@
+! { dg-do run }
+
+module e_55_1_mod
+ integer, parameter :: N = 10000000, CHUNKSZ = 100000
+ real :: Y(N), Z(N)
+end module
+
+subroutine init ()
+ use e_55_1_mod, only : Y, Z, N
+ integer :: i
+ do i = 1, N
+ Y(i) = 0.1 * i
+ Z(i) = Y(i)
+ end do
+end subroutine
+
+subroutine check ()
+ use e_55_1_mod, only : Y, Z, N
+ real :: err
+ real, parameter :: EPS = 0.00001
+ integer :: i
+ do i = 1, N
+ if (Y(i) == 0.0) then
+ err = Z(i)
+ else if (Z(i) == 0.0) then
+ err = Y(i)
+ else
+ err = (Y(i) - Z(i)) / Z(i)
+ end if
+ if (err > EPS .or. err < -EPS) call abort
+ end do
+end subroutine
+
+real function F (z)
+ !$omp declare target
+ real, intent(in) :: z
+ F = -z
+end function
+
+subroutine pipedF ()
+ use e_55_1_mod, only: Z, N, CHUNKSZ
+ integer :: C, i
+ real :: F
+ do C = 1, N, CHUNKSZ
+ !$omp task
+ !$omp target map(Z(C:C+CHUNKSZ-1))
+ !$omp parallel do
+ do i = C, C+CHUNKSZ-1
+ Z(i) = F (Z(i))
+ end do
+ !$omp end target
+ !$omp end task
+ end do
+end subroutine
+
+subroutine pipedF_ref ()
+ use e_55_1_mod, only: Y, N
+ integer :: i
+ real :: F
+ do i = 1, N
+ Y(i) = F (Y(i))
+ end do
+end subroutine
+
+program e_55_1
+ call init ()
+ call pipedF ()
+ call pipedF_ref ()
+ call check ()
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.55.2.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.55.2.f90
new file mode 100644
index 00000000000..dfcb5f40ca9
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.55.2.f90
@@ -0,0 +1,56 @@
+! { dg-do run }
+! { dg-require-effective-target offload_device }
+
+subroutine init (v1, v2, N)
+ !$omp declare target
+ integer :: i, N
+ real :: v1(N), v2(N)
+ do i = 1, N
+ v1(i) = i + 2.0
+ v2(i) = i - 3.0
+ end do
+end subroutine
+
+subroutine check (p, N)
+ integer :: i, N
+ real, parameter :: EPS = 0.00001
+ real :: diff, p(N)
+ do i = 1, N
+ diff = p(i) - (i + 2.0) * (i - 3.0)
+ if (diff > EPS .or. -diff > EPS) call abort
+ end do
+end subroutine
+
+subroutine vec_mult (p, N)
+ use omp_lib, only: omp_is_initial_device
+ real :: p(N)
+ real, allocatable :: v1(:), v2(:)
+ integer :: i
+ !$omp declare target (init)
+ !$omp target data map(to: v1, v2, N) map(from: p)
+ !$omp task shared(v1, v2, p) depend(out: v1, v2)
+ !$omp target map(to: v1, v2, N)
+ if (omp_is_initial_device ()) call abort
+ allocate (v1(N), v2(N))
+ call init (v1, v2, N)
+ !$omp end target
+ !$omp end task
+ !$omp task shared(v1, v2, p) depend(in: v1, v2)
+ !$omp target map(to: v1, v2, N) map(from: p)
+ if (omp_is_initial_device ()) call abort
+ !$omp parallel do
+ do i = 1, N
+ p(i) = v1(i) * v2(i)
+ end do
+ deallocate (v1, v2)
+ !$omp end target
+ !$omp end task
+ !$omp end target data
+ call check (p, N)
+end subroutine
+
+program e_55_2
+ integer, parameter :: N = 1000
+ real :: p(N)
+ call vec_mult (p, N)
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.56.3.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.56.3.f90
new file mode 100644
index 00000000000..94da51e4fc3
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.56.3.f90
@@ -0,0 +1,17 @@
+! { dg-do run }
+
+ call foo ()
+contains
+ subroutine foo ()
+ integer, target :: A(30)
+ integer, pointer :: p(:)
+ !$omp target data map(A(1:4))
+ p => A
+ !$omp target map(p(8:27)) map(A(1:4))
+ A(3) = 777
+ p(9) = 777
+ !$omp end target
+ !$omp end target data
+ if (A(3) /= 777 .or. A(9) /= 777) call abort
+ end subroutine
+end
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.56.4.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.56.4.f90
new file mode 100644
index 00000000000..6eb9bc1e5c3
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.56.4.f90
@@ -0,0 +1,18 @@
+! { dg-do run }
+
+ call foo ()
+contains
+ subroutine foo ()
+ integer, target :: A(30)
+ integer, pointer :: p(:)
+ !$omp target data map(A(1:10))
+ p => A
+ !$omp target map(p(4:10)) map(A(1:10))
+ A(3) = 777
+ p(9) = 777
+ A(9) = 999
+ !$omp end target
+ !$omp end target data
+ if (A(3) /= 777 .or. A(9) /= 999) call abort
+ end subroutine
+end
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.57.1.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.57.1.f90
new file mode 100644
index 00000000000..291604bee7a
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.57.1.f90
@@ -0,0 +1,56 @@
+! { dg-do run }
+! { dg-require-effective-target offload_device }
+
+program e_57_1
+ use omp_lib, only: omp_is_initial_device
+ integer :: a, b
+ logical :: c, d
+
+ a = 100
+ b = 0
+
+ !$omp target if(a > 200 .and. a < 400)
+ c = omp_is_initial_device ()
+ !$omp end target
+
+ !$omp target data map(to: b) if(a > 200 .and. a < 400)
+ !$omp target
+ b = 100
+ d = omp_is_initial_device ()
+ !$omp end target
+ !$omp end target data
+
+ if (b /= 100 .or. .not. c .or. d) call abort
+
+ a = a + 200
+ b = 0
+
+ !$omp target if(a > 200 .and. a < 400)
+ c = omp_is_initial_device ()
+ !$omp end target
+
+ !$omp target data map(to: b) if(a > 200 .and. a < 400)
+ !$omp target
+ b = 100
+ d = omp_is_initial_device ()
+ !$omp end target
+ !$omp end target data
+
+ if (b /= 0 .or. c .or. d) call abort
+
+ a = a + 200
+ b = 0
+
+ !$omp target if(a > 200 .and. a < 400)
+ c = omp_is_initial_device ()
+ !$omp end target
+
+ !$omp target data map(to: b) if(a > 200 .and. a < 400)
+ !$omp target
+ b = 100
+ d = omp_is_initial_device ()
+ !$omp end target
+ !$omp end target data
+
+ if (b /= 100 .or. .not. c .or. d) call abort
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.57.2.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.57.2.f90
new file mode 100644
index 00000000000..4a304b5c799
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.57.2.f90
@@ -0,0 +1,24 @@
+! { dg-do run }
+! { dg-require-effective-target offload_device }
+
+program e_57_2
+ use omp_lib, only: omp_is_initial_device, omp_get_num_devices
+ integer, parameter :: N = 10
+ integer :: i, num
+ logical :: offload(N)
+ num = omp_get_num_devices ()
+ !$omp parallel do
+ do i = 1, N
+ !$omp target device(i-1) map(from: offload(i:i))
+ offload(i) = omp_is_initial_device ()
+ !$omp end target
+ end do
+
+ do i = 1, num
+ if (offload(i)) call abort
+ end do
+
+ do i = num+1, N
+ if (.not. offload(i)) call abort
+ end do
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/e.57.3.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/e.57.3.f90
new file mode 100644
index 00000000000..a29f1b59a26
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/examples-4/e.57.3.f90
@@ -0,0 +1,21 @@
+! { dg-do run }
+! { dg-require-effective-target offload_device }
+
+program e_57_3
+ use omp_lib, only: omp_is_initial_device, omp_get_num_devices,&
+ omp_get_default_device, omp_set_default_device
+ logical :: res
+ integer :: default_device
+
+ default_device = omp_get_default_device ()
+ !$omp target
+ res = omp_is_initial_device ()
+ !$omp end target
+ if (res) call abort
+
+ call omp_set_default_device (omp_get_num_devices ())
+ !$omp target
+ res = omp_is_initial_device ()
+ !$omp end target
+ if (.not. res) call abort
+end program
diff --git a/liboffloadmic/ChangeLog b/liboffloadmic/ChangeLog
new file mode 100644
index 00000000000..9faa452f990
--- /dev/null
+++ b/liboffloadmic/ChangeLog
@@ -0,0 +1,108 @@
+2014-11-13 Ilya Verbin <ilya.verbin@intel.com>
+ Andrey Turetskiy <andrey.turetskiy@intel.com>
+
+ * Makefile.in: Regenerate.
+ * configure: Regenerate.
+ * configure.ac: Add subdirectory 'plugin'.
+ * plugin/Makefile.am: New file.
+ * plugin/Makefile.in: New file, generated by automake.
+ * plugin/aclocal.m4: New file, generated by aclocal.
+ * plugin/configure: New file, generated by autoconf.
+ * plugin/configure.ac: New file.
+ * plugin/libgomp-plugin-intelmic.cpp: New file.
+ * plugin/offload_target_main.cpp: New file.
+
+2014-11-13 Kirill Yukhin <kirill.yukhin@intel.com>
+
+ Initial commit. Imported from upstream:
+ https://www.openmprtl.org/sites/default/files/liboffload_oss.tgz
+ * Makefile.am: New file.
+ * Makefile.in: New file, generated by automake.
+ * aclocal.m4: New file, generated by aclocal.
+ * configure: New file, generated by autoconf.
+ * configure.ac: New file.
+ * configure.tgt: Ditto.
+ * doc/doxygen/config: Ditto.
+ * doc/doxygen/header.tex: Ditto.
+ * include/coi/common/COIEngine_common.h: Ditto.
+ * include/coi/common/COIMacros_common.h: Ditto.
+ * include/coi/common/COIPerf_common.h : Ditto.
+ * include/coi/common/COIResult_common.h : Ditto.
+ * include/coi/common/COITypes_common.h: Ditto.
+ * include/coi/sink/COIBuffer_sink.h: Ditto.
+ * include/coi/sink/COIPipeline_sink.h: Ditto.
+ * include/coi/sink/COIProcess_sink.h: Ditto.
+ * include/coi/source/COIBuffer_source.h: Ditto.
+ * include/coi/source/COIEngine_source.h: Ditto.
+ * include/coi/source/COIEvent_source.h: Ditto.
+ * include/coi/source/COIPipeline_source.h: Ditto.
+ * include/coi/source/COIProcess_source.h: Ditto.
+ * include/myo/myo.h: Ditto.
+ * include/myo/myoimpl.h: Ditto.
+ * include/myo/myotypes.h: Ditto.
+ * liboffloadmic_host.spec.in: Ditto.
+ * liboffloadmic_target.spec.in: Ditto.
+ * runtime/cean_util.cpp: Ditto.
+ * runtime/cean_util.h: Ditto.
+ * runtime/coi/coi_client.cpp: Ditto.
+ * runtime/coi/coi_client.h: Ditto.
+ * runtime/coi/coi_server.cpp: Ditto.
+ * runtime/coi/coi_server.h: Ditto.
+ * runtime/compiler_if_host.cpp: Ditto.
+ * runtime/compiler_if_host.h: Ditto.
+ * runtime/compiler_if_target.cpp: Ditto.
+ * runtime/compiler_if_target.h: Ditto.
+ * runtime/dv_util.cpp: Ditto.
+ * runtime/dv_util.h: Ditto.
+ * runtime/emulator/coi_common.h: Ditto.
+ * runtime/emulator/coi_device.cpp: Ditto.
+ * runtime/emulator/coi_device.h: Ditto.
+ * runtime/emulator/coi_host.cpp: Ditto.
+ * runtime/emulator/coi_host.h: Ditto.
+ * runtime/emulator/coi_version_asm.h: Ditto.
+ * runtime/emulator/coi_version_linker_script.map: Ditto.
+ * runtime/emulator/myo_client.cpp: Ditto.
+ * runtime/emulator/myo_service.cpp: Ditto.
+ * runtime/emulator/myo_service.h: Ditto.
+ * runtime/emulator/myo_version_asm.h: Ditto.
+ * runtime/emulator/myo_version_linker_script.map: Ditto.
+ * runtime/liboffload_error.c: Ditto.
+ * runtime/liboffload_error_codes.h: Ditto.
+ * runtime/liboffload_msg.c: Ditto.
+ * runtime/liboffload_msg.h: Ditto.
+ * runtime/mic_lib.f90: Ditto.
+ * runtime/offload.h: Ditto.
+ * runtime/offload_common.cpp: Ditto.
+ * runtime/offload_common.h: Ditto.
+ * runtime/offload_engine.cpp: Ditto.
+ * runtime/offload_engine.h: Ditto.
+ * runtime/offload_env.cpp: Ditto.
+ * runtime/offload_env.h: Ditto.
+ * runtime/offload_host.cpp: Ditto.
+ * runtime/offload_host.h: Ditto.
+ * runtime/offload_myo_host.cpp: Ditto.
+ * runtime/offload_myo_host.h: Ditto.
+ * runtime/offload_myo_target.cpp: Ditto.
+ * runtime/offload_myo_target.h: Ditto.
+ * runtime/offload_omp_host.cpp: Ditto.
+ * runtime/offload_omp_target.cpp: Ditto.
+ * runtime/offload_orsl.cpp: Ditto.
+ * runtime/offload_orsl.h: Ditto.
+ * runtime/offload_table.cpp: Ditto.
+ * runtime/offload_table.h: Ditto.
+ * runtime/offload_target.cpp: Ditto.
+ * runtime/offload_target.h: Ditto.
+ * runtime/offload_target_main.cpp: Ditto.
+ * runtime/offload_timer.h: Ditto.
+ * runtime/offload_timer_host.cpp: Ditto.
+ * runtime/offload_timer_target.cpp: Ditto.
+ * runtime/offload_trace.cpp: Ditto.
+ * runtime/offload_trace.h: Ditto.
+ * runtime/offload_util.cpp: Ditto.
+ * runtime/offload_util.h: Ditto.
+ * runtime/ofldbegin.cpp: Ditto.
+ * runtime/ofldend.cpp: Ditto.
+ * runtime/orsl-lite/include/orsl-lite.h: Ditto.
+ * runtime/orsl-lite/lib/orsl-lite.c: Ditto.
+ * runtime/orsl-lite/version.txt: Ditto.
+ * runtime/use_mpss2.txt: Ditto.
diff --git a/liboffloadmic/Makefile.am b/liboffloadmic/Makefile.am
new file mode 100644
index 00000000000..adc7c4cf55a
--- /dev/null
+++ b/liboffloadmic/Makefile.am
@@ -0,0 +1,172 @@
+#
+# Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+
+AUTOMAKE_OPTIONS = foreign
+ACLOCAL_AMFLAGS = -I .. -I ../config
+
+# Build plugin for Intel MIC
+SUBDIRS = . plugin
+
+# Directories.
+build_dir = $(top_builddir)
+coi_inc_dir = $(top_srcdir)/include/coi
+myo_inc_dir = $(top_srcdir)/include/myo
+libgomp_dir = $(build_dir)/../libgomp
+source_dir = $(top_srcdir)/runtime
+
+# May be used by toolexeclibdir.
+gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+libsubincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
+
+# Target list.
+if LIBOFFLOADMIC_HOST
+ nodist_toolexeclib_HEADERS = liboffloadmic_host.spec
+ toolexeclib_LTLIBRARIES = libcoi_host.la libmyo-client.la liboffloadmic_host.la
+ nodist_libsubinclude_HEADERS = runtime/compiler_if_host.h
+ ofld_obj =
+else # LIBOFFLOADMIC_TARGET
+ nodist_toolexeclib_HEADERS = liboffloadmic_target.spec
+ toolexeclib_LTLIBRARIES = libcoi_device.la libmyo-service.la liboffloadmic_target.la
+ nodist_libsubinclude_HEADERS = runtime/compiler_if_target.h
+ ofld_obj = ofldbegin.o ofldend.o
+endif
+
+# Liboffloadmic.
+liboffloadmic_sources = runtime/dv_util.cpp \
+ runtime/liboffload_error.c \
+ runtime/liboffload_msg.c \
+ runtime/offload_common.cpp \
+ runtime/offload_table.cpp \
+ runtime/offload_trace.cpp \
+ runtime/offload_util.cpp
+
+liboffloadmic_cppflags = -DLINUX -DCOI_LIBRARY_VERSION=2 -DMYO_SUPPORT -DOFFLOAD_DEBUG=1 -DSEP_SUPPORT -DTIMING_SUPPORT -I$(coi_inc_dir) -I$(myo_inc_dir) -I$(source_dir) -I$(libgomp_dir)
+
+liboffloadmic_host_la_SOURCES = $(liboffloadmic_sources) \
+ runtime/cean_util.cpp \
+ runtime/coi/coi_client.cpp \
+ runtime/compiler_if_host.cpp \
+ runtime/offload_engine.cpp \
+ runtime/offload_env.cpp \
+ runtime/offload_host.cpp \
+ runtime/offload_myo_host.cpp \
+ runtime/offload_omp_host.cpp \
+ runtime/offload_orsl.cpp \
+ runtime/offload_timer_host.cpp \
+ runtime/orsl-lite/lib/orsl-lite.c
+
+liboffloadmic_host_la_CPPFLAGS = $(liboffloadmic_cppflags) -DHOST_LIBRARY=1
+liboffloadmic_host_la_LDFLAGS = @lt_cv_dlopen_libs@ -version-info 5:0:0
+liboffloadmic_host_la_LIBADD = libcoi_host.la libmyo-client.la
+liboffloadmic_host_la_DEPENDENCIES = $(liboffloadmic_host_la_LIBADD)
+
+liboffloadmic_target_la_SOURCES = $(liboffloadmic_sources) \
+ runtime/coi/coi_server.cpp \
+ runtime/compiler_if_target.cpp \
+ runtime/offload_myo_target.cpp \
+ runtime/offload_omp_target.cpp \
+ runtime/offload_target.cpp \
+ runtime/offload_timer_target.cpp
+
+liboffloadmic_target_la_CPPFLAGS = $(liboffloadmic_cppflags) -DHOST_LIBRARY=0
+liboffloadmic_target_la_LDFLAGS = @lt_cv_dlopen_libs@ -version-info 5:0:0
+liboffloadmic_target_la_LIBADD = libcoi_device.la libmyo-service.la
+liboffloadmic_target_la_DEPENDENCIES = $(liboffloadmic_target_la_LIBADD)
+
+# Emulator.
+libcoi_host_la_SOURCES = runtime/emulator/coi_host.cpp
+libcoi_device_la_SOURCES = runtime/emulator/coi_device.cpp
+libmyo_client_la_SOURCES = runtime/emulator/myo_client.cpp
+libmyo_service_la_SOURCES = runtime/emulator/myo_service.cpp
+
+libcoi_host_la_DEPENDENCIES = runtime/emulator/coi_version_linker_script.map
+libcoi_device_la_DEPENDENCIES = runtime/emulator/coi_version_linker_script.map
+libmyo_client_la_DEPENDENCIES = runtime/emulator/myo_version_linker_script.map
+libmyo_service_la_DEPENDENCIES = runtime/emulator/myo_version_linker_script.map
+
+libcoi_host_la_CPPFLAGS = -I$(coi_inc_dir)
+libcoi_device_la_CPPFLAGS = -I$(coi_inc_dir)
+libmyo_client_la_CPPFLAGS = -I$(myo_inc_dir)
+libmyo_service_la_CPPFLAGS = -I$(myo_inc_dir)
+
+libcoi_host_la_LDFLAGS = -lrt -Wl,--version-script=$(source_dir)/emulator/coi_version_linker_script.map
+libcoi_device_la_LDFLAGS = -lrt -Wl,--version-script=$(source_dir)/emulator/coi_version_linker_script.map
+libmyo_client_la_LDFLAGS = -lrt -Wl,--version-script=$(source_dir)/emulator/myo_version_linker_script.map
+libmyo_service_la_LDFLAGS = -lrt -Wl,--version-script=$(source_dir)/emulator/myo_version_linker_script.map
+
+# ofldbegin, ofldend
+all-local: $(ofld_obj)
+
+ofldbegin.o: runtime/ofldbegin.cpp
+ $(CXXCOMPILE) $(liboffloadmic_target_la_CPPFLAGS) -c $< -o $@
+
+ofldend.o: runtime/ofldend.cpp
+ $(CXXCOMPILE) $(liboffloadmic_target_la_CPPFLAGS) -c $< -o $@
+
+# Work around what appears to be a GNU make bug handling MAKEFLAGS
+# values defined in terms of make variables, as is the case for CC and
+# friends when we are called from the top level Makefile.
+AM_MAKEFLAGS = \
+ "AR_FLAGS=$(AR_FLAGS)" \
+ "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
+ "CFLAGS=$(CFLAGS)" \
+ "CXXFLAGS=$(CXXFLAGS)" \
+ "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
+ "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
+ "INSTALL=$(INSTALL)" \
+ "INSTALL_DATA=$(INSTALL_DATA)" \
+ "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
+ "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
+ "JC1FLAGS=$(JC1FLAGS)" \
+ "LDFLAGS=$(LDFLAGS)" \
+ "LIBCFLAGS=$(LIBCFLAGS)" \
+ "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
+ "MAKE=$(MAKE)" \
+ "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
+ "PICFLAG=$(PICFLAG)" \
+ "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
+ "SHELL=$(SHELL)" \
+ "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
+ "exec_prefix=$(exec_prefix)" \
+ "infodir=$(infodir)" \
+ "libdir=$(libdir)" \
+ "prefix=$(prefix)" \
+ "includedir=$(includedir)" \
+ "AR=$(AR)" \
+ "AS=$(AS)" \
+ "LD=$(LD)" \
+ "LIBCFLAGS=$(LIBCFLAGS)" \
+ "NM=$(NM)" \
+ "PICFLAG=$(PICFLAG)" \
+ "RANLIB=$(RANLIB)" \
+ "DESTDIR=$(DESTDIR)"
+
+MAKEOVERRIDES =
+
diff --git a/liboffloadmic/Makefile.in b/liboffloadmic/Makefile.in
new file mode 100644
index 00000000000..98fb86f09f8
--- /dev/null
+++ b/liboffloadmic/Makefile.in
@@ -0,0 +1,1255 @@
+# Makefile.in generated by automake 1.11.1 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@
+
+#
+# Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+
+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@
+target_triplet = @target@
+subdir = .
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+ $(top_srcdir)/configure $(am__configure_deps) \
+ $(srcdir)/../mkinstalldirs \
+ $(srcdir)/liboffloadmic_host.spec.in \
+ $(srcdir)/liboffloadmic_target.spec.in $(srcdir)/../depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
+ $(top_srcdir)/../config/lead-dot.m4 \
+ $(top_srcdir)/../config/multi.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 = liboffloadmic_host.spec liboffloadmic_target.spec
+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)$(toolexeclibdir)" \
+ "$(DESTDIR)$(libsubincludedir)" "$(DESTDIR)$(toolexeclibdir)"
+LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
+libcoi_device_la_LIBADD =
+am_libcoi_device_la_OBJECTS = libcoi_device_la-coi_device.lo
+libcoi_device_la_OBJECTS = $(am_libcoi_device_la_OBJECTS)
+libcoi_device_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+ $(CXXFLAGS) $(libcoi_device_la_LDFLAGS) $(LDFLAGS) -o $@
+@LIBOFFLOADMIC_HOST_FALSE@am_libcoi_device_la_rpath = -rpath \
+@LIBOFFLOADMIC_HOST_FALSE@ $(toolexeclibdir)
+libcoi_host_la_LIBADD =
+am_libcoi_host_la_OBJECTS = libcoi_host_la-coi_host.lo
+libcoi_host_la_OBJECTS = $(am_libcoi_host_la_OBJECTS)
+libcoi_host_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+ $(CXXFLAGS) $(libcoi_host_la_LDFLAGS) $(LDFLAGS) -o $@
+@LIBOFFLOADMIC_HOST_TRUE@am_libcoi_host_la_rpath = -rpath \
+@LIBOFFLOADMIC_HOST_TRUE@ $(toolexeclibdir)
+libmyo_client_la_LIBADD =
+am_libmyo_client_la_OBJECTS = libmyo_client_la-myo_client.lo
+libmyo_client_la_OBJECTS = $(am_libmyo_client_la_OBJECTS)
+libmyo_client_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+ $(CXXFLAGS) $(libmyo_client_la_LDFLAGS) $(LDFLAGS) -o $@
+@LIBOFFLOADMIC_HOST_TRUE@am_libmyo_client_la_rpath = -rpath \
+@LIBOFFLOADMIC_HOST_TRUE@ $(toolexeclibdir)
+libmyo_service_la_LIBADD =
+am_libmyo_service_la_OBJECTS = libmyo_service_la-myo_service.lo
+libmyo_service_la_OBJECTS = $(am_libmyo_service_la_OBJECTS)
+libmyo_service_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+ $(CXXFLAGS) $(libmyo_service_la_LDFLAGS) $(LDFLAGS) -o $@
+@LIBOFFLOADMIC_HOST_FALSE@am_libmyo_service_la_rpath = -rpath \
+@LIBOFFLOADMIC_HOST_FALSE@ $(toolexeclibdir)
+am__objects_1 = liboffloadmic_host_la-dv_util.lo \
+ liboffloadmic_host_la-liboffload_error.lo \
+ liboffloadmic_host_la-liboffload_msg.lo \
+ liboffloadmic_host_la-offload_common.lo \
+ liboffloadmic_host_la-offload_table.lo \
+ liboffloadmic_host_la-offload_trace.lo \
+ liboffloadmic_host_la-offload_util.lo
+am_liboffloadmic_host_la_OBJECTS = $(am__objects_1) \
+ liboffloadmic_host_la-cean_util.lo \
+ liboffloadmic_host_la-coi_client.lo \
+ liboffloadmic_host_la-compiler_if_host.lo \
+ liboffloadmic_host_la-offload_engine.lo \
+ liboffloadmic_host_la-offload_env.lo \
+ liboffloadmic_host_la-offload_host.lo \
+ liboffloadmic_host_la-offload_myo_host.lo \
+ liboffloadmic_host_la-offload_omp_host.lo \
+ liboffloadmic_host_la-offload_orsl.lo \
+ liboffloadmic_host_la-offload_timer_host.lo \
+ liboffloadmic_host_la-orsl-lite.lo
+liboffloadmic_host_la_OBJECTS = $(am_liboffloadmic_host_la_OBJECTS)
+liboffloadmic_host_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+ $(CXXFLAGS) $(liboffloadmic_host_la_LDFLAGS) $(LDFLAGS) -o $@
+@LIBOFFLOADMIC_HOST_TRUE@am_liboffloadmic_host_la_rpath = -rpath \
+@LIBOFFLOADMIC_HOST_TRUE@ $(toolexeclibdir)
+am__objects_2 = liboffloadmic_target_la-dv_util.lo \
+ liboffloadmic_target_la-liboffload_error.lo \
+ liboffloadmic_target_la-liboffload_msg.lo \
+ liboffloadmic_target_la-offload_common.lo \
+ liboffloadmic_target_la-offload_table.lo \
+ liboffloadmic_target_la-offload_trace.lo \
+ liboffloadmic_target_la-offload_util.lo
+am_liboffloadmic_target_la_OBJECTS = $(am__objects_2) \
+ liboffloadmic_target_la-coi_server.lo \
+ liboffloadmic_target_la-compiler_if_target.lo \
+ liboffloadmic_target_la-offload_myo_target.lo \
+ liboffloadmic_target_la-offload_omp_target.lo \
+ liboffloadmic_target_la-offload_target.lo \
+ liboffloadmic_target_la-offload_timer_target.lo
+liboffloadmic_target_la_OBJECTS = \
+ $(am_liboffloadmic_target_la_OBJECTS)
+liboffloadmic_target_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+ $(CXXFLAGS) $(liboffloadmic_target_la_LDFLAGS) $(LDFLAGS) -o \
+ $@
+@LIBOFFLOADMIC_HOST_FALSE@am_liboffloadmic_target_la_rpath = -rpath \
+@LIBOFFLOADMIC_HOST_FALSE@ $(toolexeclibdir)
+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 $@
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libcoi_device_la_SOURCES) $(libcoi_host_la_SOURCES) \
+ $(libmyo_client_la_SOURCES) $(libmyo_service_la_SOURCES) \
+ $(liboffloadmic_host_la_SOURCES) \
+ $(liboffloadmic_target_la_SOURCES)
+MULTISRCTOP =
+MULTIBUILDTOP =
+MULTIDIRS =
+MULTISUBDIR =
+MULTIDO = true
+MULTICLEAN = true
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+HEADERS = $(nodist_libsubinclude_HEADERS) \
+ $(nodist_toolexeclib_HEADERS)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+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@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+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_CXX = @ac_ct_CXX@
+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_os = @build_os@
+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_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+link_offloadmic_host = @link_offloadmic_host@
+link_offloadmic_target = @link_offloadmic_target@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_cv_dlopen_libs = @lt_cv_dlopen_libs@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+subdirs = @subdirs@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+toolexecdir = @toolexecdir@
+toolexeclibdir = @toolexeclibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = foreign
+ACLOCAL_AMFLAGS = -I .. -I ../config
+
+# Build plugin for Intel MIC
+SUBDIRS = . plugin
+
+# Directories.
+build_dir = $(top_builddir)
+coi_inc_dir = $(top_srcdir)/include/coi
+myo_inc_dir = $(top_srcdir)/include/myo
+libgomp_dir = $(build_dir)/../libgomp
+source_dir = $(top_srcdir)/runtime
+
+# May be used by toolexeclibdir.
+gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+libsubincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
+@LIBOFFLOADMIC_HOST_FALSE@nodist_toolexeclib_HEADERS = liboffloadmic_target.spec
+
+# Target list.
+@LIBOFFLOADMIC_HOST_TRUE@nodist_toolexeclib_HEADERS = liboffloadmic_host.spec
+@LIBOFFLOADMIC_HOST_FALSE@toolexeclib_LTLIBRARIES = libcoi_device.la libmyo-service.la liboffloadmic_target.la
+@LIBOFFLOADMIC_HOST_TRUE@toolexeclib_LTLIBRARIES = libcoi_host.la libmyo-client.la liboffloadmic_host.la
+@LIBOFFLOADMIC_HOST_FALSE@nodist_libsubinclude_HEADERS = runtime/compiler_if_target.h
+@LIBOFFLOADMIC_HOST_TRUE@nodist_libsubinclude_HEADERS = runtime/compiler_if_host.h
+@LIBOFFLOADMIC_HOST_FALSE@ofld_obj = ofldbegin.o ofldend.o
+@LIBOFFLOADMIC_HOST_TRUE@ofld_obj =
+
+# Liboffloadmic.
+liboffloadmic_sources = runtime/dv_util.cpp \
+ runtime/liboffload_error.c \
+ runtime/liboffload_msg.c \
+ runtime/offload_common.cpp \
+ runtime/offload_table.cpp \
+ runtime/offload_trace.cpp \
+ runtime/offload_util.cpp
+
+liboffloadmic_cppflags = -DLINUX -DCOI_LIBRARY_VERSION=2 -DMYO_SUPPORT -DOFFLOAD_DEBUG=1 -DSEP_SUPPORT -DTIMING_SUPPORT -I$(coi_inc_dir) -I$(myo_inc_dir) -I$(source_dir) -I$(libgomp_dir)
+liboffloadmic_host_la_SOURCES = $(liboffloadmic_sources) \
+ runtime/cean_util.cpp \
+ runtime/coi/coi_client.cpp \
+ runtime/compiler_if_host.cpp \
+ runtime/offload_engine.cpp \
+ runtime/offload_env.cpp \
+ runtime/offload_host.cpp \
+ runtime/offload_myo_host.cpp \
+ runtime/offload_omp_host.cpp \
+ runtime/offload_orsl.cpp \
+ runtime/offload_timer_host.cpp \
+ runtime/orsl-lite/lib/orsl-lite.c
+
+liboffloadmic_host_la_CPPFLAGS = $(liboffloadmic_cppflags) -DHOST_LIBRARY=1
+liboffloadmic_host_la_LDFLAGS = @lt_cv_dlopen_libs@ -version-info 5:0:0
+liboffloadmic_host_la_LIBADD = libcoi_host.la libmyo-client.la
+liboffloadmic_host_la_DEPENDENCIES = $(liboffloadmic_host_la_LIBADD)
+liboffloadmic_target_la_SOURCES = $(liboffloadmic_sources) \
+ runtime/coi/coi_server.cpp \
+ runtime/compiler_if_target.cpp \
+ runtime/offload_myo_target.cpp \
+ runtime/offload_omp_target.cpp \
+ runtime/offload_target.cpp \
+ runtime/offload_timer_target.cpp
+
+liboffloadmic_target_la_CPPFLAGS = $(liboffloadmic_cppflags) -DHOST_LIBRARY=0
+liboffloadmic_target_la_LDFLAGS = @lt_cv_dlopen_libs@ -version-info 5:0:0
+liboffloadmic_target_la_LIBADD = libcoi_device.la libmyo-service.la
+liboffloadmic_target_la_DEPENDENCIES = $(liboffloadmic_target_la_LIBADD)
+
+# Emulator.
+libcoi_host_la_SOURCES = runtime/emulator/coi_host.cpp
+libcoi_device_la_SOURCES = runtime/emulator/coi_device.cpp
+libmyo_client_la_SOURCES = runtime/emulator/myo_client.cpp
+libmyo_service_la_SOURCES = runtime/emulator/myo_service.cpp
+libcoi_host_la_DEPENDENCIES = runtime/emulator/coi_version_linker_script.map
+libcoi_device_la_DEPENDENCIES = runtime/emulator/coi_version_linker_script.map
+libmyo_client_la_DEPENDENCIES = runtime/emulator/myo_version_linker_script.map
+libmyo_service_la_DEPENDENCIES = runtime/emulator/myo_version_linker_script.map
+libcoi_host_la_CPPFLAGS = -I$(coi_inc_dir)
+libcoi_device_la_CPPFLAGS = -I$(coi_inc_dir)
+libmyo_client_la_CPPFLAGS = -I$(myo_inc_dir)
+libmyo_service_la_CPPFLAGS = -I$(myo_inc_dir)
+libcoi_host_la_LDFLAGS = -lrt -Wl,--version-script=$(source_dir)/emulator/coi_version_linker_script.map
+libcoi_device_la_LDFLAGS = -lrt -Wl,--version-script=$(source_dir)/emulator/coi_version_linker_script.map
+libmyo_client_la_LDFLAGS = -lrt -Wl,--version-script=$(source_dir)/emulator/myo_version_linker_script.map
+libmyo_service_la_LDFLAGS = -lrt -Wl,--version-script=$(source_dir)/emulator/myo_version_linker_script.map
+
+# Work around what appears to be a GNU make bug handling MAKEFLAGS
+# values defined in terms of make variables, as is the case for CC and
+# friends when we are called from the top level Makefile.
+AM_MAKEFLAGS = \
+ "AR_FLAGS=$(AR_FLAGS)" \
+ "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
+ "CFLAGS=$(CFLAGS)" \
+ "CXXFLAGS=$(CXXFLAGS)" \
+ "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
+ "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
+ "INSTALL=$(INSTALL)" \
+ "INSTALL_DATA=$(INSTALL_DATA)" \
+ "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
+ "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
+ "JC1FLAGS=$(JC1FLAGS)" \
+ "LDFLAGS=$(LDFLAGS)" \
+ "LIBCFLAGS=$(LIBCFLAGS)" \
+ "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
+ "MAKE=$(MAKE)" \
+ "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
+ "PICFLAG=$(PICFLAG)" \
+ "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
+ "SHELL=$(SHELL)" \
+ "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
+ "exec_prefix=$(exec_prefix)" \
+ "infodir=$(infodir)" \
+ "libdir=$(libdir)" \
+ "prefix=$(prefix)" \
+ "includedir=$(includedir)" \
+ "AR=$(AR)" \
+ "AS=$(AS)" \
+ "LD=$(LD)" \
+ "LIBCFLAGS=$(LIBCFLAGS)" \
+ "NM=$(NM)" \
+ "PICFLAG=$(PICFLAG)" \
+ "RANLIB=$(RANLIB)" \
+ "DESTDIR=$(DESTDIR)"
+
+MAKEOVERRIDES =
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .cpp .lo .o .obj
+am--refresh:
+ @:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ $(am__cd) $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+$(am__aclocal_m4_deps):
+liboffloadmic_host.spec: $(top_builddir)/config.status $(srcdir)/liboffloadmic_host.spec.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+liboffloadmic_target.spec: $(top_builddir)/config.status $(srcdir)/liboffloadmic_target.spec.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(toolexeclibdir)" || $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)"
+ @list='$(toolexeclib_LTLIBRARIES)'; test -n "$(toolexeclibdir)" || 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)$(toolexeclibdir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(toolexeclibdir)"; \
+ }
+
+uninstall-toolexeclibLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(toolexeclib_LTLIBRARIES)'; test -n "$(toolexeclibdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(toolexeclibdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(toolexeclibdir)/$$f"; \
+ done
+
+clean-toolexeclibLTLIBRARIES:
+ -test -z "$(toolexeclib_LTLIBRARIES)" || rm -f $(toolexeclib_LTLIBRARIES)
+ @list='$(toolexeclib_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
+libcoi_device.la: $(libcoi_device_la_OBJECTS) $(libcoi_device_la_DEPENDENCIES)
+ $(libcoi_device_la_LINK) $(am_libcoi_device_la_rpath) $(libcoi_device_la_OBJECTS) $(libcoi_device_la_LIBADD) $(LIBS)
+libcoi_host.la: $(libcoi_host_la_OBJECTS) $(libcoi_host_la_DEPENDENCIES)
+ $(libcoi_host_la_LINK) $(am_libcoi_host_la_rpath) $(libcoi_host_la_OBJECTS) $(libcoi_host_la_LIBADD) $(LIBS)
+libmyo-client.la: $(libmyo_client_la_OBJECTS) $(libmyo_client_la_DEPENDENCIES)
+ $(libmyo_client_la_LINK) $(am_libmyo_client_la_rpath) $(libmyo_client_la_OBJECTS) $(libmyo_client_la_LIBADD) $(LIBS)
+libmyo-service.la: $(libmyo_service_la_OBJECTS) $(libmyo_service_la_DEPENDENCIES)
+ $(libmyo_service_la_LINK) $(am_libmyo_service_la_rpath) $(libmyo_service_la_OBJECTS) $(libmyo_service_la_LIBADD) $(LIBS)
+liboffloadmic_host.la: $(liboffloadmic_host_la_OBJECTS) $(liboffloadmic_host_la_DEPENDENCIES)
+ $(liboffloadmic_host_la_LINK) $(am_liboffloadmic_host_la_rpath) $(liboffloadmic_host_la_OBJECTS) $(liboffloadmic_host_la_LIBADD) $(LIBS)
+liboffloadmic_target.la: $(liboffloadmic_target_la_OBJECTS) $(liboffloadmic_target_la_DEPENDENCIES)
+ $(liboffloadmic_target_la_LINK) $(am_liboffloadmic_target_la_rpath) $(liboffloadmic_target_la_OBJECTS) $(liboffloadmic_target_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcoi_device_la-coi_device.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcoi_host_la-coi_host.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmyo_client_la-myo_client.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmyo_service_la-myo_service.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_host_la-cean_util.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_host_la-coi_client.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_host_la-compiler_if_host.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_host_la-dv_util.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_host_la-liboffload_error.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_host_la-liboffload_msg.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_host_la-offload_common.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_host_la-offload_engine.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_host_la-offload_env.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_host_la-offload_host.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_host_la-offload_myo_host.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_host_la-offload_omp_host.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_host_la-offload_orsl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_host_la-offload_table.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_host_la-offload_timer_host.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_host_la-offload_trace.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_host_la-offload_util.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_host_la-orsl-lite.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_target_la-coi_server.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_target_la-compiler_if_target.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_target_la-dv_util.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_target_la-liboffload_error.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_target_la-liboffload_msg.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_target_la-offload_common.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_target_la-offload_myo_target.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_target_la-offload_omp_target.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_target_la-offload_table.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_target_la-offload_target.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_target_la-offload_timer_target.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_target_la-offload_trace.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboffloadmic_target_la-offload_util.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 $@ $<
+
+liboffloadmic_host_la-liboffload_error.lo: runtime/liboffload_error.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT liboffloadmic_host_la-liboffload_error.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_host_la-liboffload_error.Tpo -c -o liboffloadmic_host_la-liboffload_error.lo `test -f 'runtime/liboffload_error.c' || echo '$(srcdir)/'`runtime/liboffload_error.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_host_la-liboffload_error.Tpo $(DEPDIR)/liboffloadmic_host_la-liboffload_error.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/liboffload_error.c' object='liboffloadmic_host_la-liboffload_error.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o liboffloadmic_host_la-liboffload_error.lo `test -f 'runtime/liboffload_error.c' || echo '$(srcdir)/'`runtime/liboffload_error.c
+
+liboffloadmic_host_la-liboffload_msg.lo: runtime/liboffload_msg.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT liboffloadmic_host_la-liboffload_msg.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_host_la-liboffload_msg.Tpo -c -o liboffloadmic_host_la-liboffload_msg.lo `test -f 'runtime/liboffload_msg.c' || echo '$(srcdir)/'`runtime/liboffload_msg.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_host_la-liboffload_msg.Tpo $(DEPDIR)/liboffloadmic_host_la-liboffload_msg.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/liboffload_msg.c' object='liboffloadmic_host_la-liboffload_msg.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o liboffloadmic_host_la-liboffload_msg.lo `test -f 'runtime/liboffload_msg.c' || echo '$(srcdir)/'`runtime/liboffload_msg.c
+
+liboffloadmic_host_la-orsl-lite.lo: runtime/orsl-lite/lib/orsl-lite.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT liboffloadmic_host_la-orsl-lite.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_host_la-orsl-lite.Tpo -c -o liboffloadmic_host_la-orsl-lite.lo `test -f 'runtime/orsl-lite/lib/orsl-lite.c' || echo '$(srcdir)/'`runtime/orsl-lite/lib/orsl-lite.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_host_la-orsl-lite.Tpo $(DEPDIR)/liboffloadmic_host_la-orsl-lite.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/orsl-lite/lib/orsl-lite.c' object='liboffloadmic_host_la-orsl-lite.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o liboffloadmic_host_la-orsl-lite.lo `test -f 'runtime/orsl-lite/lib/orsl-lite.c' || echo '$(srcdir)/'`runtime/orsl-lite/lib/orsl-lite.c
+
+liboffloadmic_target_la-liboffload_error.lo: runtime/liboffload_error.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_target_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT liboffloadmic_target_la-liboffload_error.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_target_la-liboffload_error.Tpo -c -o liboffloadmic_target_la-liboffload_error.lo `test -f 'runtime/liboffload_error.c' || echo '$(srcdir)/'`runtime/liboffload_error.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_target_la-liboffload_error.Tpo $(DEPDIR)/liboffloadmic_target_la-liboffload_error.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/liboffload_error.c' object='liboffloadmic_target_la-liboffload_error.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_target_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o liboffloadmic_target_la-liboffload_error.lo `test -f 'runtime/liboffload_error.c' || echo '$(srcdir)/'`runtime/liboffload_error.c
+
+liboffloadmic_target_la-liboffload_msg.lo: runtime/liboffload_msg.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_target_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT liboffloadmic_target_la-liboffload_msg.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_target_la-liboffload_msg.Tpo -c -o liboffloadmic_target_la-liboffload_msg.lo `test -f 'runtime/liboffload_msg.c' || echo '$(srcdir)/'`runtime/liboffload_msg.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_target_la-liboffload_msg.Tpo $(DEPDIR)/liboffloadmic_target_la-liboffload_msg.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/liboffload_msg.c' object='liboffloadmic_target_la-liboffload_msg.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_target_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o liboffloadmic_target_la-liboffload_msg.lo `test -f 'runtime/liboffload_msg.c' || echo '$(srcdir)/'`runtime/liboffload_msg.c
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+libcoi_device_la-coi_device.lo: runtime/emulator/coi_device.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcoi_device_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libcoi_device_la-coi_device.lo -MD -MP -MF $(DEPDIR)/libcoi_device_la-coi_device.Tpo -c -o libcoi_device_la-coi_device.lo `test -f 'runtime/emulator/coi_device.cpp' || echo '$(srcdir)/'`runtime/emulator/coi_device.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcoi_device_la-coi_device.Tpo $(DEPDIR)/libcoi_device_la-coi_device.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/emulator/coi_device.cpp' object='libcoi_device_la-coi_device.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcoi_device_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libcoi_device_la-coi_device.lo `test -f 'runtime/emulator/coi_device.cpp' || echo '$(srcdir)/'`runtime/emulator/coi_device.cpp
+
+libcoi_host_la-coi_host.lo: runtime/emulator/coi_host.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcoi_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libcoi_host_la-coi_host.lo -MD -MP -MF $(DEPDIR)/libcoi_host_la-coi_host.Tpo -c -o libcoi_host_la-coi_host.lo `test -f 'runtime/emulator/coi_host.cpp' || echo '$(srcdir)/'`runtime/emulator/coi_host.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcoi_host_la-coi_host.Tpo $(DEPDIR)/libcoi_host_la-coi_host.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/emulator/coi_host.cpp' object='libcoi_host_la-coi_host.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcoi_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libcoi_host_la-coi_host.lo `test -f 'runtime/emulator/coi_host.cpp' || echo '$(srcdir)/'`runtime/emulator/coi_host.cpp
+
+libmyo_client_la-myo_client.lo: runtime/emulator/myo_client.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmyo_client_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmyo_client_la-myo_client.lo -MD -MP -MF $(DEPDIR)/libmyo_client_la-myo_client.Tpo -c -o libmyo_client_la-myo_client.lo `test -f 'runtime/emulator/myo_client.cpp' || echo '$(srcdir)/'`runtime/emulator/myo_client.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libmyo_client_la-myo_client.Tpo $(DEPDIR)/libmyo_client_la-myo_client.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/emulator/myo_client.cpp' object='libmyo_client_la-myo_client.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmyo_client_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmyo_client_la-myo_client.lo `test -f 'runtime/emulator/myo_client.cpp' || echo '$(srcdir)/'`runtime/emulator/myo_client.cpp
+
+libmyo_service_la-myo_service.lo: runtime/emulator/myo_service.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmyo_service_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmyo_service_la-myo_service.lo -MD -MP -MF $(DEPDIR)/libmyo_service_la-myo_service.Tpo -c -o libmyo_service_la-myo_service.lo `test -f 'runtime/emulator/myo_service.cpp' || echo '$(srcdir)/'`runtime/emulator/myo_service.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libmyo_service_la-myo_service.Tpo $(DEPDIR)/libmyo_service_la-myo_service.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/emulator/myo_service.cpp' object='libmyo_service_la-myo_service.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmyo_service_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmyo_service_la-myo_service.lo `test -f 'runtime/emulator/myo_service.cpp' || echo '$(srcdir)/'`runtime/emulator/myo_service.cpp
+
+liboffloadmic_host_la-dv_util.lo: runtime/dv_util.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT liboffloadmic_host_la-dv_util.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_host_la-dv_util.Tpo -c -o liboffloadmic_host_la-dv_util.lo `test -f 'runtime/dv_util.cpp' || echo '$(srcdir)/'`runtime/dv_util.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_host_la-dv_util.Tpo $(DEPDIR)/liboffloadmic_host_la-dv_util.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/dv_util.cpp' object='liboffloadmic_host_la-dv_util.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o liboffloadmic_host_la-dv_util.lo `test -f 'runtime/dv_util.cpp' || echo '$(srcdir)/'`runtime/dv_util.cpp
+
+liboffloadmic_host_la-offload_common.lo: runtime/offload_common.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT liboffloadmic_host_la-offload_common.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_host_la-offload_common.Tpo -c -o liboffloadmic_host_la-offload_common.lo `test -f 'runtime/offload_common.cpp' || echo '$(srcdir)/'`runtime/offload_common.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_host_la-offload_common.Tpo $(DEPDIR)/liboffloadmic_host_la-offload_common.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/offload_common.cpp' object='liboffloadmic_host_la-offload_common.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o liboffloadmic_host_la-offload_common.lo `test -f 'runtime/offload_common.cpp' || echo '$(srcdir)/'`runtime/offload_common.cpp
+
+liboffloadmic_host_la-offload_table.lo: runtime/offload_table.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT liboffloadmic_host_la-offload_table.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_host_la-offload_table.Tpo -c -o liboffloadmic_host_la-offload_table.lo `test -f 'runtime/offload_table.cpp' || echo '$(srcdir)/'`runtime/offload_table.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_host_la-offload_table.Tpo $(DEPDIR)/liboffloadmic_host_la-offload_table.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/offload_table.cpp' object='liboffloadmic_host_la-offload_table.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o liboffloadmic_host_la-offload_table.lo `test -f 'runtime/offload_table.cpp' || echo '$(srcdir)/'`runtime/offload_table.cpp
+
+liboffloadmic_host_la-offload_trace.lo: runtime/offload_trace.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT liboffloadmic_host_la-offload_trace.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_host_la-offload_trace.Tpo -c -o liboffloadmic_host_la-offload_trace.lo `test -f 'runtime/offload_trace.cpp' || echo '$(srcdir)/'`runtime/offload_trace.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_host_la-offload_trace.Tpo $(DEPDIR)/liboffloadmic_host_la-offload_trace.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/offload_trace.cpp' object='liboffloadmic_host_la-offload_trace.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o liboffloadmic_host_la-offload_trace.lo `test -f 'runtime/offload_trace.cpp' || echo '$(srcdir)/'`runtime/offload_trace.cpp
+
+liboffloadmic_host_la-offload_util.lo: runtime/offload_util.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT liboffloadmic_host_la-offload_util.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_host_la-offload_util.Tpo -c -o liboffloadmic_host_la-offload_util.lo `test -f 'runtime/offload_util.cpp' || echo '$(srcdir)/'`runtime/offload_util.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_host_la-offload_util.Tpo $(DEPDIR)/liboffloadmic_host_la-offload_util.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/offload_util.cpp' object='liboffloadmic_host_la-offload_util.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o liboffloadmic_host_la-offload_util.lo `test -f 'runtime/offload_util.cpp' || echo '$(srcdir)/'`runtime/offload_util.cpp
+
+liboffloadmic_host_la-cean_util.lo: runtime/cean_util.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT liboffloadmic_host_la-cean_util.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_host_la-cean_util.Tpo -c -o liboffloadmic_host_la-cean_util.lo `test -f 'runtime/cean_util.cpp' || echo '$(srcdir)/'`runtime/cean_util.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_host_la-cean_util.Tpo $(DEPDIR)/liboffloadmic_host_la-cean_util.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/cean_util.cpp' object='liboffloadmic_host_la-cean_util.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o liboffloadmic_host_la-cean_util.lo `test -f 'runtime/cean_util.cpp' || echo '$(srcdir)/'`runtime/cean_util.cpp
+
+liboffloadmic_host_la-coi_client.lo: runtime/coi/coi_client.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT liboffloadmic_host_la-coi_client.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_host_la-coi_client.Tpo -c -o liboffloadmic_host_la-coi_client.lo `test -f 'runtime/coi/coi_client.cpp' || echo '$(srcdir)/'`runtime/coi/coi_client.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_host_la-coi_client.Tpo $(DEPDIR)/liboffloadmic_host_la-coi_client.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/coi/coi_client.cpp' object='liboffloadmic_host_la-coi_client.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o liboffloadmic_host_la-coi_client.lo `test -f 'runtime/coi/coi_client.cpp' || echo '$(srcdir)/'`runtime/coi/coi_client.cpp
+
+liboffloadmic_host_la-compiler_if_host.lo: runtime/compiler_if_host.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT liboffloadmic_host_la-compiler_if_host.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_host_la-compiler_if_host.Tpo -c -o liboffloadmic_host_la-compiler_if_host.lo `test -f 'runtime/compiler_if_host.cpp' || echo '$(srcdir)/'`runtime/compiler_if_host.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_host_la-compiler_if_host.Tpo $(DEPDIR)/liboffloadmic_host_la-compiler_if_host.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/compiler_if_host.cpp' object='liboffloadmic_host_la-compiler_if_host.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o liboffloadmic_host_la-compiler_if_host.lo `test -f 'runtime/compiler_if_host.cpp' || echo '$(srcdir)/'`runtime/compiler_if_host.cpp
+
+liboffloadmic_host_la-offload_engine.lo: runtime/offload_engine.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT liboffloadmic_host_la-offload_engine.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_host_la-offload_engine.Tpo -c -o liboffloadmic_host_la-offload_engine.lo `test -f 'runtime/offload_engine.cpp' || echo '$(srcdir)/'`runtime/offload_engine.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_host_la-offload_engine.Tpo $(DEPDIR)/liboffloadmic_host_la-offload_engine.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/offload_engine.cpp' object='liboffloadmic_host_la-offload_engine.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o liboffloadmic_host_la-offload_engine.lo `test -f 'runtime/offload_engine.cpp' || echo '$(srcdir)/'`runtime/offload_engine.cpp
+
+liboffloadmic_host_la-offload_env.lo: runtime/offload_env.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT liboffloadmic_host_la-offload_env.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_host_la-offload_env.Tpo -c -o liboffloadmic_host_la-offload_env.lo `test -f 'runtime/offload_env.cpp' || echo '$(srcdir)/'`runtime/offload_env.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_host_la-offload_env.Tpo $(DEPDIR)/liboffloadmic_host_la-offload_env.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/offload_env.cpp' object='liboffloadmic_host_la-offload_env.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o liboffloadmic_host_la-offload_env.lo `test -f 'runtime/offload_env.cpp' || echo '$(srcdir)/'`runtime/offload_env.cpp
+
+liboffloadmic_host_la-offload_host.lo: runtime/offload_host.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT liboffloadmic_host_la-offload_host.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_host_la-offload_host.Tpo -c -o liboffloadmic_host_la-offload_host.lo `test -f 'runtime/offload_host.cpp' || echo '$(srcdir)/'`runtime/offload_host.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_host_la-offload_host.Tpo $(DEPDIR)/liboffloadmic_host_la-offload_host.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/offload_host.cpp' object='liboffloadmic_host_la-offload_host.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o liboffloadmic_host_la-offload_host.lo `test -f 'runtime/offload_host.cpp' || echo '$(srcdir)/'`runtime/offload_host.cpp
+
+liboffloadmic_host_la-offload_myo_host.lo: runtime/offload_myo_host.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT liboffloadmic_host_la-offload_myo_host.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_host_la-offload_myo_host.Tpo -c -o liboffloadmic_host_la-offload_myo_host.lo `test -f 'runtime/offload_myo_host.cpp' || echo '$(srcdir)/'`runtime/offload_myo_host.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_host_la-offload_myo_host.Tpo $(DEPDIR)/liboffloadmic_host_la-offload_myo_host.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/offload_myo_host.cpp' object='liboffloadmic_host_la-offload_myo_host.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o liboffloadmic_host_la-offload_myo_host.lo `test -f 'runtime/offload_myo_host.cpp' || echo '$(srcdir)/'`runtime/offload_myo_host.cpp
+
+liboffloadmic_host_la-offload_omp_host.lo: runtime/offload_omp_host.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT liboffloadmic_host_la-offload_omp_host.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_host_la-offload_omp_host.Tpo -c -o liboffloadmic_host_la-offload_omp_host.lo `test -f 'runtime/offload_omp_host.cpp' || echo '$(srcdir)/'`runtime/offload_omp_host.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_host_la-offload_omp_host.Tpo $(DEPDIR)/liboffloadmic_host_la-offload_omp_host.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/offload_omp_host.cpp' object='liboffloadmic_host_la-offload_omp_host.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o liboffloadmic_host_la-offload_omp_host.lo `test -f 'runtime/offload_omp_host.cpp' || echo '$(srcdir)/'`runtime/offload_omp_host.cpp
+
+liboffloadmic_host_la-offload_orsl.lo: runtime/offload_orsl.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT liboffloadmic_host_la-offload_orsl.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_host_la-offload_orsl.Tpo -c -o liboffloadmic_host_la-offload_orsl.lo `test -f 'runtime/offload_orsl.cpp' || echo '$(srcdir)/'`runtime/offload_orsl.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_host_la-offload_orsl.Tpo $(DEPDIR)/liboffloadmic_host_la-offload_orsl.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/offload_orsl.cpp' object='liboffloadmic_host_la-offload_orsl.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o liboffloadmic_host_la-offload_orsl.lo `test -f 'runtime/offload_orsl.cpp' || echo '$(srcdir)/'`runtime/offload_orsl.cpp
+
+liboffloadmic_host_la-offload_timer_host.lo: runtime/offload_timer_host.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT liboffloadmic_host_la-offload_timer_host.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_host_la-offload_timer_host.Tpo -c -o liboffloadmic_host_la-offload_timer_host.lo `test -f 'runtime/offload_timer_host.cpp' || echo '$(srcdir)/'`runtime/offload_timer_host.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_host_la-offload_timer_host.Tpo $(DEPDIR)/liboffloadmic_host_la-offload_timer_host.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/offload_timer_host.cpp' object='liboffloadmic_host_la-offload_timer_host.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_host_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o liboffloadmic_host_la-offload_timer_host.lo `test -f 'runtime/offload_timer_host.cpp' || echo '$(srcdir)/'`runtime/offload_timer_host.cpp
+
+liboffloadmic_target_la-dv_util.lo: runtime/dv_util.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_target_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT liboffloadmic_target_la-dv_util.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_target_la-dv_util.Tpo -c -o liboffloadmic_target_la-dv_util.lo `test -f 'runtime/dv_util.cpp' || echo '$(srcdir)/'`runtime/dv_util.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_target_la-dv_util.Tpo $(DEPDIR)/liboffloadmic_target_la-dv_util.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/dv_util.cpp' object='liboffloadmic_target_la-dv_util.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_target_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o liboffloadmic_target_la-dv_util.lo `test -f 'runtime/dv_util.cpp' || echo '$(srcdir)/'`runtime/dv_util.cpp
+
+liboffloadmic_target_la-offload_common.lo: runtime/offload_common.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_target_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT liboffloadmic_target_la-offload_common.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_target_la-offload_common.Tpo -c -o liboffloadmic_target_la-offload_common.lo `test -f 'runtime/offload_common.cpp' || echo '$(srcdir)/'`runtime/offload_common.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_target_la-offload_common.Tpo $(DEPDIR)/liboffloadmic_target_la-offload_common.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/offload_common.cpp' object='liboffloadmic_target_la-offload_common.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_target_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o liboffloadmic_target_la-offload_common.lo `test -f 'runtime/offload_common.cpp' || echo '$(srcdir)/'`runtime/offload_common.cpp
+
+liboffloadmic_target_la-offload_table.lo: runtime/offload_table.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_target_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT liboffloadmic_target_la-offload_table.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_target_la-offload_table.Tpo -c -o liboffloadmic_target_la-offload_table.lo `test -f 'runtime/offload_table.cpp' || echo '$(srcdir)/'`runtime/offload_table.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_target_la-offload_table.Tpo $(DEPDIR)/liboffloadmic_target_la-offload_table.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/offload_table.cpp' object='liboffloadmic_target_la-offload_table.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_target_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o liboffloadmic_target_la-offload_table.lo `test -f 'runtime/offload_table.cpp' || echo '$(srcdir)/'`runtime/offload_table.cpp
+
+liboffloadmic_target_la-offload_trace.lo: runtime/offload_trace.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_target_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT liboffloadmic_target_la-offload_trace.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_target_la-offload_trace.Tpo -c -o liboffloadmic_target_la-offload_trace.lo `test -f 'runtime/offload_trace.cpp' || echo '$(srcdir)/'`runtime/offload_trace.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_target_la-offload_trace.Tpo $(DEPDIR)/liboffloadmic_target_la-offload_trace.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/offload_trace.cpp' object='liboffloadmic_target_la-offload_trace.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_target_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o liboffloadmic_target_la-offload_trace.lo `test -f 'runtime/offload_trace.cpp' || echo '$(srcdir)/'`runtime/offload_trace.cpp
+
+liboffloadmic_target_la-offload_util.lo: runtime/offload_util.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_target_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT liboffloadmic_target_la-offload_util.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_target_la-offload_util.Tpo -c -o liboffloadmic_target_la-offload_util.lo `test -f 'runtime/offload_util.cpp' || echo '$(srcdir)/'`runtime/offload_util.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_target_la-offload_util.Tpo $(DEPDIR)/liboffloadmic_target_la-offload_util.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/offload_util.cpp' object='liboffloadmic_target_la-offload_util.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_target_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o liboffloadmic_target_la-offload_util.lo `test -f 'runtime/offload_util.cpp' || echo '$(srcdir)/'`runtime/offload_util.cpp
+
+liboffloadmic_target_la-coi_server.lo: runtime/coi/coi_server.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_target_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT liboffloadmic_target_la-coi_server.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_target_la-coi_server.Tpo -c -o liboffloadmic_target_la-coi_server.lo `test -f 'runtime/coi/coi_server.cpp' || echo '$(srcdir)/'`runtime/coi/coi_server.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_target_la-coi_server.Tpo $(DEPDIR)/liboffloadmic_target_la-coi_server.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/coi/coi_server.cpp' object='liboffloadmic_target_la-coi_server.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_target_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o liboffloadmic_target_la-coi_server.lo `test -f 'runtime/coi/coi_server.cpp' || echo '$(srcdir)/'`runtime/coi/coi_server.cpp
+
+liboffloadmic_target_la-compiler_if_target.lo: runtime/compiler_if_target.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_target_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT liboffloadmic_target_la-compiler_if_target.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_target_la-compiler_if_target.Tpo -c -o liboffloadmic_target_la-compiler_if_target.lo `test -f 'runtime/compiler_if_target.cpp' || echo '$(srcdir)/'`runtime/compiler_if_target.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_target_la-compiler_if_target.Tpo $(DEPDIR)/liboffloadmic_target_la-compiler_if_target.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/compiler_if_target.cpp' object='liboffloadmic_target_la-compiler_if_target.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_target_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o liboffloadmic_target_la-compiler_if_target.lo `test -f 'runtime/compiler_if_target.cpp' || echo '$(srcdir)/'`runtime/compiler_if_target.cpp
+
+liboffloadmic_target_la-offload_myo_target.lo: runtime/offload_myo_target.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_target_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT liboffloadmic_target_la-offload_myo_target.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_target_la-offload_myo_target.Tpo -c -o liboffloadmic_target_la-offload_myo_target.lo `test -f 'runtime/offload_myo_target.cpp' || echo '$(srcdir)/'`runtime/offload_myo_target.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_target_la-offload_myo_target.Tpo $(DEPDIR)/liboffloadmic_target_la-offload_myo_target.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/offload_myo_target.cpp' object='liboffloadmic_target_la-offload_myo_target.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_target_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o liboffloadmic_target_la-offload_myo_target.lo `test -f 'runtime/offload_myo_target.cpp' || echo '$(srcdir)/'`runtime/offload_myo_target.cpp
+
+liboffloadmic_target_la-offload_omp_target.lo: runtime/offload_omp_target.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_target_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT liboffloadmic_target_la-offload_omp_target.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_target_la-offload_omp_target.Tpo -c -o liboffloadmic_target_la-offload_omp_target.lo `test -f 'runtime/offload_omp_target.cpp' || echo '$(srcdir)/'`runtime/offload_omp_target.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_target_la-offload_omp_target.Tpo $(DEPDIR)/liboffloadmic_target_la-offload_omp_target.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/offload_omp_target.cpp' object='liboffloadmic_target_la-offload_omp_target.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_target_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o liboffloadmic_target_la-offload_omp_target.lo `test -f 'runtime/offload_omp_target.cpp' || echo '$(srcdir)/'`runtime/offload_omp_target.cpp
+
+liboffloadmic_target_la-offload_target.lo: runtime/offload_target.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_target_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT liboffloadmic_target_la-offload_target.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_target_la-offload_target.Tpo -c -o liboffloadmic_target_la-offload_target.lo `test -f 'runtime/offload_target.cpp' || echo '$(srcdir)/'`runtime/offload_target.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_target_la-offload_target.Tpo $(DEPDIR)/liboffloadmic_target_la-offload_target.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/offload_target.cpp' object='liboffloadmic_target_la-offload_target.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_target_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o liboffloadmic_target_la-offload_target.lo `test -f 'runtime/offload_target.cpp' || echo '$(srcdir)/'`runtime/offload_target.cpp
+
+liboffloadmic_target_la-offload_timer_target.lo: runtime/offload_timer_target.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_target_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT liboffloadmic_target_la-offload_timer_target.lo -MD -MP -MF $(DEPDIR)/liboffloadmic_target_la-offload_timer_target.Tpo -c -o liboffloadmic_target_la-offload_timer_target.lo `test -f 'runtime/offload_timer_target.cpp' || echo '$(srcdir)/'`runtime/offload_timer_target.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/liboffloadmic_target_la-offload_timer_target.Tpo $(DEPDIR)/liboffloadmic_target_la-offload_timer_target.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime/offload_timer_target.cpp' object='liboffloadmic_target_la-offload_timer_target.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liboffloadmic_target_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o liboffloadmic_target_la-offload_timer_target.lo `test -f 'runtime/offload_timer_target.cpp' || echo '$(srcdir)/'`runtime/offload_timer_target.cpp
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool config.lt
+
+# GNU Make needs to see an explicit $(MAKE) variable in the command it
+# runs to enable its job server during parallel builds. Hence the
+# comments below.
+all-multi:
+ $(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do # $(MAKE)
+install-multi:
+ $(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do # $(MAKE)
+
+mostlyclean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=mostlyclean multi-clean # $(MAKE)
+clean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=clean multi-clean # $(MAKE)
+distclean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean # $(MAKE)
+maintainer-clean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean # $(MAKE)
+install-nodist_libsubincludeHEADERS: $(nodist_libsubinclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(libsubincludedir)" || $(MKDIR_P) "$(DESTDIR)$(libsubincludedir)"
+ @list='$(nodist_libsubinclude_HEADERS)'; test -n "$(libsubincludedir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libsubincludedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(libsubincludedir)" || exit $$?; \
+ done
+
+uninstall-nodist_libsubincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(nodist_libsubinclude_HEADERS)'; test -n "$(libsubincludedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(libsubincludedir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(libsubincludedir)" && rm -f $$files
+install-nodist_toolexeclibHEADERS: $(nodist_toolexeclib_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(toolexeclibdir)" || $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)"
+ @list='$(nodist_toolexeclib_HEADERS)'; test -n "$(toolexeclibdir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(toolexeclibdir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(toolexeclibdir)" || exit $$?; \
+ done
+
+uninstall-nodist_toolexeclibHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(nodist_toolexeclib_HEADERS)'; test -n "$(toolexeclibdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(toolexeclibdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(toolexeclibdir)" && rm -f $$files
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+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: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ 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: ctags-recursive $(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
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES) all-multi $(HEADERS) all-local
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(libsubincludedir)" "$(DESTDIR)$(toolexeclibdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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-multi clean-recursive
+
+clean-am: clean-generic clean-libtool clean-toolexeclibLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-multi distclean-recursive
+ -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-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-nodist_libsubincludeHEADERS
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am: install-multi install-nodist_toolexeclibHEADERS \
+ install-toolexeclibLTLIBRARIES
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-multi maintainer-clean-recursive
+ -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-multi mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-nodist_libsubincludeHEADERS \
+ uninstall-nodist_toolexeclibHEADERS \
+ uninstall-toolexeclibLTLIBRARIES
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all-multi \
+ clean-multi ctags-recursive distclean-multi install-am \
+ install-multi install-strip maintainer-clean-multi \
+ mostlyclean-multi tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am all-local all-multi am--refresh check check-am \
+ clean clean-generic clean-libtool clean-multi \
+ clean-toolexeclibLTLIBRARIES ctags ctags-recursive distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-multi distclean-tags 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-man install-multi install-nodist_libsubincludeHEADERS \
+ install-nodist_toolexeclibHEADERS install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip \
+ install-toolexeclibLTLIBRARIES installcheck installcheck-am \
+ installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic maintainer-clean-multi mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ mostlyclean-multi pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-nodist_libsubincludeHEADERS \
+ uninstall-nodist_toolexeclibHEADERS \
+ uninstall-toolexeclibLTLIBRARIES
+
+
+# ofldbegin, ofldend
+all-local: $(ofld_obj)
+
+ofldbegin.o: runtime/ofldbegin.cpp
+ $(CXXCOMPILE) $(liboffloadmic_target_la_CPPFLAGS) -c $< -o $@
+
+ofldend.o: runtime/ofldend.cpp
+ $(CXXCOMPILE) $(liboffloadmic_target_la_CPPFLAGS) -c $< -o $@
+
+# 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/liboffloadmic/aclocal.m4 b/liboffloadmic/aclocal.m4
new file mode 100644
index 00000000000..68107caffa0
--- /dev/null
+++ b/liboffloadmic/aclocal.m4
@@ -0,0 +1,979 @@
+# generated automatically by aclocal 1.11.1 -*- 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.1], [],
+ [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.1])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)])
+
+# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
+# From Jim Meyering
+
+# Copyright (C) 1996, 1998, 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_MAINTAINER_MODE([DEFAULT-MODE])
+# ----------------------------------
+# Control maintainer-specific portions of Makefiles.
+# Default is to disable them, unless `enable' is passed literally.
+# For symmetry, `disable' may be passed as well. Anyway, the user
+# can override the default with the --enable/--disable switch.
+AC_DEFUN([AM_MAINTAINER_MODE],
+[m4_case(m4_default([$1], [disable]),
+ [enable], [m4_define([am_maintainer_other], [disable])],
+ [disable], [m4_define([am_maintainer_other], [enable])],
+ [m4_define([am_maintainer_other], [enable])
+ m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
+AC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
+ dnl maintainer-mode's default is 'disable' unless 'enable' is passed
+ AC_ARG_ENABLE([maintainer-mode],
+[ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer],
+ [USE_MAINTAINER_MODE=$enableval],
+ [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
+ AC_MSG_RESULT([$USE_MAINTAINER_MODE])
+ AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
+ MAINT=$MAINTAINER_MODE_TRUE
+ AC_SUBST([MAINT])dnl
+]
+)
+
+AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
+
+# 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 <conftest.tar])
+ grep GrepMe conftest.dir/file >/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/depstand.m4])
+m4_include([../config/lead-dot.m4])
+m4_include([../config/multi.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/liboffloadmic/configure b/liboffloadmic/configure
new file mode 100644
index 00000000000..46f2f7be1ff
--- /dev/null
+++ b/liboffloadmic/configure
@@ -0,0 +1,17108 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.64 for MIC Offload Runtime Library 1.0.
+#
+# 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
+
+ test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
+ ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+ ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+ PATH=/empty FPATH=/empty; export PATH FPATH
+ test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\
+ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || 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'"
+
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+
+exec 7<&0 </dev/null 6>&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='MIC Offload Runtime Library'
+PACKAGE_TARNAME='liboffloadmic'
+PACKAGE_VERSION='1.0'
+PACKAGE_STRING='MIC Offload Runtime Library 1.0'
+PACKAGE_BUGREPORT=''
+PACKAGE_URL=''
+
+enable_option_checking=no
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='am__EXEEXT_FALSE
+am__EXEEXT_TRUE
+LTLIBOBJS
+LIBOBJS
+link_offloadmic_target
+link_offloadmic_host
+lt_cv_dlopen_libs
+toolexeclibdir
+toolexecdir
+CXXCPP
+OTOOL64
+OTOOL
+LIPO
+NMEDIT
+DSYMUTIL
+RANLIB
+AR
+OBJDUMP
+LN_S
+NM
+ac_ct_DUMPBIN
+DUMPBIN
+LD
+FGREP
+SED
+LIBTOOL
+LIBOFFLOADMIC_HOST_FALSE
+LIBOFFLOADMIC_HOST_TRUE
+EGREP
+GREP
+CPP
+ALLOCA
+subdirs
+multi_basedir
+am__fastdepCXX_FALSE
+am__fastdepCXX_TRUE
+CXXDEPMODE
+ac_ct_CXX
+CXXFLAGS
+CXX
+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
+MAINT
+MAINTAINER_MODE_FALSE
+MAINTAINER_MODE_TRUE
+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_os
+target_vendor
+target_cpu
+target
+host_os
+host_vendor
+host_cpu
+host
+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
+enable_maintainer_mode
+enable_dependency_tracking
+enable_multilib
+enable_version_specific_runtime_libs
+enable_shared
+enable_static
+with_pic
+enable_fast_install
+with_gnu_ld
+enable_libtool_lock
+'
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CXX
+CXXFLAGS
+CCC
+CPP
+CXXCPP'
+ac_subdirs_all='plugin'
+
+# 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 MIC Offload Runtime Library 1.0 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/liboffloadmic]
+ --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]
+ --target=TARGET configure for building compilers for TARGET [HOST]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of MIC Offload Runtime Library 1.0:";;
+ 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]
+ --enable-maintainer-mode enable make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer
+ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors
+ --enable-multilib build many library versions (default)
+ --enable-version-specific-runtime-libs
+ Specify that runtime libraries should be installed
+ in a compiler-specific directory
+ --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)
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --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<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ LIBS libraries to pass to the linker, e.g. -l<library>
+ CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
+ CXX C++ compiler command
+ CXXFLAGS C++ compiler flags
+ CPP C preprocessor
+ CXXCPP 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
+MIC Offload Runtime Library configure 1.0
+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_cxx_try_compile LINENO
+# ----------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_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_cxx_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_cxx_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_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_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 <limits.h> declares $2.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $2 (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#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
+
+# 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
+
+# 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_cxx_try_cpp LINENO
+# ------------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_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_cxx_preproc_warn_flag$ac_cxx_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_cxx_try_cpp
+
+# ac_fn_cxx_try_link LINENO
+# -------------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_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_cxx_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_cxx_try_link
+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 MIC Offload Runtime Library $as_me 1.0, 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
+
+
+{ $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 target system type" >&5
+$as_echo_n "checking target system type... " >&6; }
+if test "${ac_cv_target+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "x$target_alias" = x; then
+ ac_cv_target=$ac_cv_host
+else
+ ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
+ as_fn_error "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5
+$as_echo "$ac_cv_target" >&6; }
+case $ac_cv_target in
+*-*-*) ;;
+*) as_fn_error "invalid value of canonical target" "$LINENO" 5;;
+esac
+target=$ac_cv_target
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_target
+shift
+target_cpu=$1
+target_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+target_os=$*
+IFS=$ac_save_IFS
+case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac
+
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+test -n "$target_alias" &&
+ test "$program_prefix$program_suffix$program_transform_name" = \
+ NONENONEs,x,x, &&
+ program_prefix=${target_alias}-
+
+target_alias=${target_alias-$host_alias}
+
+
+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='liboffloadmic'
+ VERSION='1.0'
+
+
+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 -'
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
+$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
+ # Check whether --enable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then :
+ enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
+else
+ USE_MAINTAINER_MODE=no
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5
+$as_echo "$USE_MAINTAINER_MODE" >&6; }
+ if test $USE_MAINTAINER_MODE = yes; then
+ MAINTAINER_MODE_TRUE=
+ MAINTAINER_MODE_FALSE='#'
+else
+ MAINTAINER_MODE_TRUE='#'
+ MAINTAINER_MODE_FALSE=
+fi
+
+ MAINT=$MAINTAINER_MODE_TRUE
+
+
+
+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 <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* 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
+
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -z "$CXX"; then
+ if test -n "$CCC"; then
+ CXX=$CCC
+ else
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+ 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_CXX+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CXX"; then
+ ac_cv_prog_CXX="$CXX" # 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_CXX="$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
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
+$as_echo "$CXX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CXX" && break
+ done
+fi
+if test -z "$CXX"; then
+ ac_ct_CXX=$CXX
+ for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+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_CXX+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CXX"; then
+ ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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_CXX="$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_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
+$as_echo "$ac_ct_CXX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CXX" && break
+done
+
+ if test "x$ac_ct_CXX" = x; then
+ CXX="g++"
+ 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
+ CXX=$ac_ct_CXX
+ fi
+fi
+
+ fi
+fi
+# 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
+
+{ $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_cxx_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_cxx_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_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
+$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GXX=yes
+else
+ GXX=
+fi
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
+$as_echo_n "checking whether $CXX accepts -g... " >&6; }
+if test "${ac_cv_prog_cxx_g+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+ ac_cxx_werror_flag=yes
+ ac_cv_prog_cxx_g=no
+ CXXFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_cv_prog_cxx_g=yes
+else
+ CXXFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+else
+ ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+ CXXFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_cv_prog_cxx_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_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
+$as_echo "$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+ CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+ if test "$GXX" = yes; then
+ CXXFLAGS="-g -O2"
+ else
+ CXXFLAGS="-g"
+ fi
+else
+ if test "$GXX" = yes; then
+ CXXFLAGS="-O2"
+ else
+ CXXFLAGS=
+ fi
+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
+
+depcc="$CXX" 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_CXX_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_CXX_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_CXX_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CXX_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; }
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
+
+ if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+ am__fastdepCXX_TRUE=
+ am__fastdepCXX_FALSE='#'
+else
+ am__fastdepCXX_TRUE='#'
+ am__fastdepCXX_FALSE=
+fi
+
+
+ac_config_files="$ac_config_files Makefile liboffloadmic_host.spec liboffloadmic_target.spec"
+
+# Default to --enable-multilib
+# Check whether --enable-multilib was given.
+if test "${enable_multilib+set}" = set; then :
+ enableval=$enable_multilib; case "$enableval" in
+ yes) multilib=yes ;;
+ no) multilib=no ;;
+ *) as_fn_error "bad value $enableval for multilib option" "$LINENO" 5 ;;
+ esac
+else
+ multilib=yes
+fi
+
+
+# We may get other options which we leave undocumented:
+# --with-target-subdir, --with-multisrctop, --with-multisubdir
+# See config-ml.in if you want the gory details.
+
+if test "$srcdir" = "."; then
+ if test "$with_target_subdir" != "."; then
+ multi_basedir="$srcdir/$with_multisrctop../.."
+ else
+ multi_basedir="$srcdir/$with_multisrctop.."
+ fi
+else
+ multi_basedir="$srcdir/.."
+fi
+
+
+# Even if the default multilib is not a cross compilation,
+# it may be that some of the other multilibs are.
+if test $cross_compiling = no && test $multilib = yes \
+ && test "x${with_multisubdir}" != x ; then
+ cross_compiling=maybe
+fi
+
+ac_config_commands="$ac_config_commands default-1"
+
+
+
+subdirs="$subdirs plugin"
+
+
+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 <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> 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 <limits.h>
+#else
+# include <assert.h>
+#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 <ac_nonexistent.h>
+_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 <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> 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 <limits.h>
+#else
+# include <assert.h>
+#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 <ac_nonexistent.h>
+_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 <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+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 <string.h>
+
+_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 <stdlib.h>
+
+_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 <ctype.h>
+#include <stdlib.h>
+#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
+
+
+# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
+# for constant arguments. Useless!
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5
+$as_echo_n "checking for working alloca.h... " >&6; }
+if test "${ac_cv_working_alloca_h+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <alloca.h>
+int
+main ()
+{
+char *p = (char *) alloca (2 * sizeof (int));
+ if (p) return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_working_alloca_h=yes
+else
+ ac_cv_working_alloca_h=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5
+$as_echo "$ac_cv_working_alloca_h" >&6; }
+if test $ac_cv_working_alloca_h = yes; then
+
+$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5
+$as_echo_n "checking for alloca... " >&6; }
+if test "${ac_cv_func_alloca_works+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# ifdef _MSC_VER
+# include <malloc.h>
+# define alloca _alloca
+# else
+# ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifdef _AIX
+ #pragma alloca
+# else
+# ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+# endif
+# endif
+# endif
+# endif
+#endif
+
+int
+main ()
+{
+char *p = (char *) alloca (1);
+ if (p) return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_func_alloca_works=yes
+else
+ ac_cv_func_alloca_works=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5
+$as_echo "$ac_cv_func_alloca_works" >&6; }
+
+if test $ac_cv_func_alloca_works = yes; then
+
+$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h
+
+else
+ # The SVR3 libPW and SVR4 libucb both contain incompatible functions
+# that cause trouble. Some versions do not even contain alloca or
+# contain a buggy version. If you still want to use their alloca,
+# use ar to extract alloca.o from them instead of compiling alloca.c.
+
+ALLOCA=\${LIBOBJDIR}alloca.$ac_objext
+
+$as_echo "#define C_ALLOCA 1" >>confdefs.h
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5
+$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; }
+if test "${ac_cv_os_cray+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#if defined CRAY && ! defined CRAY2
+webecray
+#else
+wenotbecray
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "webecray" >/dev/null 2>&1; then :
+ ac_cv_os_cray=yes
+else
+ ac_cv_os_cray=no
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5
+$as_echo "$ac_cv_os_cray" >&6; }
+if test $ac_cv_os_cray = yes; then
+ for ac_func in _getb67 GETB67 getb67; do
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+ if test "x$as_val" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define CRAY_STACKSEG_END $ac_func
+_ACEOF
+
+ break
+fi
+
+ done
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5
+$as_echo_n "checking stack direction for C alloca... " >&6; }
+if test "${ac_cv_c_stack_direction+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ ac_cv_c_stack_direction=0
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+int
+find_stack_direction ()
+{
+ static char *addr = 0;
+ auto char dummy;
+ if (addr == 0)
+ {
+ addr = &dummy;
+ return find_stack_direction ();
+ }
+ else
+ return (&dummy > addr) ? 1 : -1;
+}
+
+int
+main ()
+{
+ return find_stack_direction () < 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_c_stack_direction=1
+else
+ ac_cv_c_stack_direction=-1
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5
+$as_echo "$ac_cv_c_stack_direction" >&6; }
+cat >>confdefs.h <<_ACEOF
+#define STACK_DIRECTION $ac_cv_c_stack_direction
+_ACEOF
+
+
+fi
+
+for ac_header in mm_malloc.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "mm_malloc.h" "ac_cv_header_mm_malloc_h" "$ac_includes_default"
+if test "x$ac_cv_header_mm_malloc_h" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_MM_MALLOC_H 1
+_ACEOF
+
+else
+ as_fn_error "\"Couldn't find mm_malloc.h\"" "$LINENO" 5
+fi
+
+done
+
+for ac_func in __secure_getenv secure_getenv
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+ if test "x$as_val" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+# Get target configure.
+. ${srcdir}/configure.tgt
+if test -n "$UNSUPPORTED"; then
+ as_fn_error "Configuration ${target} is unsupported" "$LINENO" 5
+fi
+
+if test "${multilib}" = "yes"; then
+ multilib_arg="--enable-multilib"
+else
+ multilib_arg=
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --enable-version-specific-runtime-libs" >&5
+$as_echo_n "checking for --enable-version-specific-runtime-libs... " >&6; }
+# Check whether --enable-version-specific-runtime-libs was given.
+if test "${enable_version_specific_runtime_libs+set}" = set; then :
+ enableval=$enable_version_specific_runtime_libs; case "$enableval" in
+ yes) enable_version_specific_runtime_libs=yes ;;
+ no) enable_version_specific_runtime_libs=no ;;
+ *) as_fn_error "Unknown argument to enable/disable version-specific libs" "$LINENO" 5;;
+ esac
+else
+ enable_version_specific_runtime_libs=no
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_version_specific_runtime_libs" >&5
+$as_echo "$enable_version_specific_runtime_libs" >&6; }
+
+# Make sure liboffloadmic is enabled
+case "$enable_liboffloadmic" in
+ host | target)
+ ;;
+ *)
+ as_fn_error "Liboffloadmic is disabled" "$LINENO" 5 ;;
+esac
+ if test x"$enable_liboffloadmic" = xhost; then
+ LIBOFFLOADMIC_HOST_TRUE=
+ LIBOFFLOADMIC_HOST_FALSE='#'
+else
+ LIBOFFLOADMIC_HOST_TRUE='#'
+ LIBOFFLOADMIC_HOST_FALSE=
+fi
+
+
+# Calculate toolexeclibdir.
+# Also toolexecdir, though it's only used in toolexeclibdir.
+case ${enable_version_specific_runtime_libs} in
+ yes)
+ # Need the gcc compiler version to know where to install libraries
+ # and header files if --enable-version-specific-runtime-libs option
+ # is selected.
+ toolexecdir='$(libdir)/gcc/$(target_alias)'
+ toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
+ ;;
+ no)
+ if test -n "$with_cross_host" &&
+ test x"$with_cross_host" != x"no"; then
+ # Install a library built with a cross compiler in tooldir, not libdir.
+ toolexecdir='$(exec_prefix)/$(target_alias)'
+ toolexeclibdir='$(toolexecdir)/lib'
+ else
+ toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
+ toolexeclibdir='$(libdir)'
+ fi
+ multi_os_directory=`$CC -print-multi-os-directory`
+ case $multi_os_directory in
+ .) ;; # Avoid trailing /.
+ *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
+ esac
+ ;;
+esac
+
+enable_dlopen=yes
+
+
+
+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.7a'
+macro_revision='1.3134'
+
+
+
+
+
+
+
+
+
+
+
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+# Backslashify 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'
+
+ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
+$as_echo_n "checking how to print strings... " >&6; }
+# Test print first, because it will be a builtin if present.
+if test "X`print -r -- -n 2>/dev/null`" = X-n && \
+ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='printf %s\n'
+else
+ # Use this function as a fallback that always works.
+ func_fallback_echo ()
+ {
+ eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+ }
+ ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+ $ECHO ""
+}
+
+case "$ECHO" in
+ printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
+$as_echo "printf" >&6; } ;;
+ print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
+$as_echo "print -r" >&6; } ;;
+ *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
+$as_echo "cat" >&6; } ;;
+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 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 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&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 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&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 "$DUMPBIN"; then :
+ # Let the user override the test.
+ else
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in dumpbin "link -dump"
+ 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 "link -dump"
+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
+
+ case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+ *COFF*)
+ DUMPBIN="$DUMPBIN -symbols"
+ ;;
+ *)
+ DUMPBIN=:
+ ;;
+ esac
+ 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:$LINENO: $ac_compile\"" >&5)
+ (eval "$ac_compile" 2>conftest.err)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:$LINENO: 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;
+ ;;
+
+ mint*)
+ # On MiNT this can take a long time and run out of memory.
+ 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"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
+ = "X$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.
+ # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+ if ( test "$lt_cv_nm_interface" = "BSD nm" && 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
+ ;;
+
+haiku*)
+ 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])(-bit)?( [LM]SB)? 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
+
+case $host_os in
+ darwin*)
+ lock_old_archive_extraction=yes ;;
+ *)
+ lock_old_archive_extraction=no ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 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 '$LINENO' "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*|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*)
+ case `/usr/bin/file conftest.o` in
+ *x86-64*)
+ LD="${LD-ld} -m elf32_x86_64"
+ ;;
+ *)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ esac
+ ;;
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ 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"
+ ;;
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ 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; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
+$as_echo_n "checking for -force_load linker flag... " >&6; }
+if test "${lt_cv_ld_force_load+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_force_load=no
+ cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
+ $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
+ echo "$AR cru libconftest.a conftest.o" >&5
+ $AR cru libconftest.a conftest.o 2>&5
+ cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
+ $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+ _lt_result=$?
+ if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then
+ lt_cv_ld_force_load=yes
+ else
+ cat conftest.err >&5
+ fi
+ rm -f conftest.err libconftest.a conftest conftest.c
+ rm -rf conftest.dSYM
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
+$as_echo "$lt_cv_ld_force_load" >&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" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+ _lt_dsymutil='~$DSYMUTIL $lib || :'
+ else
+ _lt_dsymutil=
+ fi
+ ;;
+ esac
+
+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_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
+
+# 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 "$cc_temp" | $SED "s%.*/%%; 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
+ case $cc_basename in
+ nvcc*)
+ lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
+ *)
+ lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;;
+ esac
+
+ { $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:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+
+ 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'
+ ;;
+
+ haiku*)
+ # PIC is the default for Haiku.
+ # The "-static" flag exists, but is broken.
+ lt_prog_compiler_static=
+ ;;
+
+ 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
+
+ case $cc_basename in
+ nvcc*) # Cuda Compiler Driver 2.2
+ lt_prog_compiler_wl='-Xlinker '
+ lt_prog_compiler_pic='-Xcompiler -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* | pgfortran*)
+ # 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* | bgxl* | bgf* | mpixl*)
+ # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-qpic'
+ lt_prog_compiler_static='-qstaticlink'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ F* | *Sun*Fortran*)
+ # 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=''
+ ;;
+ *Sun\ C*)
+ # Sun C 5.9
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl='-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:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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 "$_lt_linker_boilerplate" | $SED '/^$/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:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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
+
+ # On some targets, GNU ld is compatible enough with the native linker
+ # that we're better off using the native interface for both.
+ lt_use_gnu_ld_interface=no
+ if test "$with_gnu_ld" = yes; then
+ case $host_os in
+ aix*)
+ # The AIX port of GNU ld has always aspired to compatibility
+ # with the native linker. However, as the warning in the GNU ld
+ # block says, versions before 2.19.5* couldn't really create working
+ # shared libraries, regardless of the interface used.
+ case `$LD -v 2>&1` in
+ *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+ *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;;
+ *\ \(GNU\ Binutils\)\ [3-9]*) ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ fi
+
+ if test "$lt_use_gnu_ld_interface" = 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
+ *GNU\ gold*) supports_anon_versioning=yes ;;
+ *\ [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.19, 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 install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_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 <jrb3@best.com> 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'
+ export_dynamic_flag_spec='${wl}--export-all-symbols'
+ 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
+ ;;
+
+ haiku*)
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ link_all_deplibs=yes
+ ;;
+
+ 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; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95* | pgfortran*)
+ # 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; func_echo_all \"$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]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+ tmp_sharedflag='-qmkshrobj'
+ tmp_addflag= ;;
+ nvcc*) # Cuda Compiler Driver 2.2
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ compiler_needs_object=yes
+ ;;
+ 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; func_echo_all \"$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* | bgf* | bgxlf* | mpixlf*)
+ # 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
+ # Also, AIX nm treats weak defined symbols like other global
+ # defined symbols, whereas GNU nm marks them as "W".
+ 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") || (\$ 2 == "W")) && (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 func_echo_all "${wl}${allow_undefined_flag}"; 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'
+ if test "$with_gnu_ld" = yes; then
+ # We only use this code for GNU lds that support --whole-archive.
+ whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ else
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec='$convenience'
+ fi
+ 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 `func_echo_all "$deplibs" | $SED '\''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
+ if test "$lt_cv_ld_force_load" = "yes"; then
+ whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+ else
+ whole_archive_flag_spec=''
+ fi
+ 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=func_echo_all
+ 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
+ ;;
+
+ # 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 && test "$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 && test "$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'
+ ;;
+ *)
+
+ # Older versions of the 11.00 compiler do not understand -b yet
+ # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
+$as_echo_n "checking if $CC understands -b... " >&6; }
+if test "${lt_cv_prog_compiler__b+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler__b=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -b"
+ 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 "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler__b=yes
+ fi
+ else
+ lt_cv_prog_compiler__b=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
+$as_echo "$lt_cv_prog_compiler__b" >&6; }
+
+if test x"$lt_cv_prog_compiler__b" = xyes; then
+ archive_cmds='$CC -b ${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
+
+ ;;
+ 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" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${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" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${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" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -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" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${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" && func_echo_all "-set_version $verstring"` -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" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${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" && func_echo_all "-set_version $verstring"` -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 "-set_version $verstring"` -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
+ case $host_os in
+ mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;;
+ *) lt_sed_strip_eq="s,=/,/,g" ;;
+ esac
+ lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+ case $lt_search_path_spec in
+ *\;*)
+ # 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 's/;/ /g'`
+ ;;
+ *)
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+ ;;
+ esac
+ # 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; }
+}'`
+ # AWK program above erroneously prepends '/' to C:/dos/paths
+ # for these hosts.
+ case $host_os in
+ mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+ $SED 's,/\([A-Za-z]:\),\1,g'` ;;
+ esac
+ sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+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<name>.so
+ # instead of lib<name>.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=`func_echo_all "$lib" | $SED '\''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="$sys_lib_search_path_spec /usr/lib/w32api"
+ ;;
+ mingw* | cegcc*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ 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
+ ;;
+
+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[23].*) 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
+ ;;
+
+haiku*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ dynamic_linker="$host_os runtime_loader"
+ 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=LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib'
+ 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'
+ # or fails outright, so override atomically:
+ install_override_mode=555
+ ;;
+
+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;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 11103 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#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
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+ correspondingly for the symbols needed. */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+void fnord () __attribute__((visibility("default")));
+#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;
+ else puts (dlerror ());
+ }
+ /* 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 11209 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#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
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+ correspondingly for the symbols needed. */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+void fnord () __attribute__((visibility("default")));
+#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;
+ else puts (dlerror ());
+ }
+ /* 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"
+
+ if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+ (test "X$CXX" != "Xg++"))) ; then
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_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; }
+if test -z "$CXXCPP"; then
+ if test "${ac_cv_prog_CXXCPP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ # Double quotes because CXXCPP needs to be expanded
+ for CXXCPP in "$CXX -E" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> 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 <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_cxx_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 <ac_nonexistent.h>
+_ACEOF
+if ac_fn_cxx_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_CXXCPP=$CXXCPP
+
+fi
+ CXXCPP=$ac_cv_prog_CXXCPP
+else
+ ac_cv_prog_CXXCPP=$CXXCPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5
+$as_echo "$CXXCPP" >&6; }
+ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> 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 <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_cxx_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 <ac_nonexistent.h>
+_ACEOF
+if ac_fn_cxx_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 \"$CXXCPP\" 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
+
+else
+ _lt_caught_CXX_error=yes
+fi
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+archive_cmds_need_lc_CXX=no
+allow_undefined_flag_CXX=
+always_export_symbols_CXX=no
+archive_expsym_cmds_CXX=
+compiler_needs_object_CXX=no
+export_dynamic_flag_spec_CXX=
+hardcode_direct_CXX=no
+hardcode_direct_absolute_CXX=no
+hardcode_libdir_flag_spec_CXX=
+hardcode_libdir_flag_spec_ld_CXX=
+hardcode_libdir_separator_CXX=
+hardcode_minus_L_CXX=no
+hardcode_shlibpath_var_CXX=unsupported
+hardcode_automatic_CXX=no
+inherit_rpath_CXX=no
+module_cmds_CXX=
+module_expsym_cmds_CXX=
+link_all_deplibs_CXX=unknown
+old_archive_cmds_CXX=$old_archive_cmds
+reload_flag_CXX=$reload_flag
+reload_cmds_CXX=$reload_cmds
+no_undefined_flag_CXX=
+whole_archive_flag_spec_CXX=
+enable_shared_with_static_runtimes_CXX=no
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+objext_CXX=$objext
+
+# No sense in running all these tests if we already determined that
+# the CXX compiler isn't working. Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_caught_CXX_error" != yes; then
+ # 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(int, char *[]) { return(0); }'
+
+ # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+
+
+
+
+
+# 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 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*
+
+
+ # Allow CC to be a program name with arguments.
+ lt_save_CC=$CC
+ lt_save_LD=$LD
+ lt_save_GCC=$GCC
+ GCC=$GXX
+ lt_save_with_gnu_ld=$with_gnu_ld
+ lt_save_path_LD=$lt_cv_path_LD
+ if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+ lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+ else
+ $as_unset lt_cv_prog_gnu_ld
+ fi
+ if test -n "${lt_cv_path_LDCXX+set}"; then
+ lt_cv_path_LD=$lt_cv_path_LDCXX
+ else
+ $as_unset lt_cv_path_LD
+ fi
+ test -z "${LDCXX+set}" || LD=$LDCXX
+ CC=${CXX-"c++"}
+ compiler=$CC
+ compiler_CXX=$CC
+ for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+
+
+ if test -n "$compiler"; then
+ # We don't want -fno-exception when compiling C++ code, so set the
+ # no_builtin_flag separately
+ if test "$GXX" = yes; then
+ lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin'
+ else
+ lt_prog_compiler_no_builtin_flag_CXX=
+ fi
+
+ if test "$GXX" = yes; then
+ # Set up default GNU C++ configuration
+
+
+
+# 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 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&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 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+
+
+
+
+ # Check if GNU C++ uses GNU ld as the underlying linker, since the
+ # archiving commands below assume that GNU ld is being used.
+ if test "$with_gnu_ld" = yes; then
+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+ # investigate it a little bit more. (MM)
+ wlarc='${wl}'
+
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if eval "`$CC -print-prog-name=ld` --help 2>&1" |
+ $GREP 'no-whole-archive' > /dev/null; then
+ whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec_CXX=
+ fi
+ else
+ with_gnu_ld=no
+ wlarc=
+
+ # A generic and very simple default shared library creation
+ # command for GNU C++ for the case where it uses the native
+ # linker, instead of GNU ld. If possible, this setting should
+ # overridden to take advantage of the native linker features on
+ # the platform it is being used on.
+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ fi
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+ else
+ GXX=no
+ with_gnu_ld=no
+ wlarc=
+ fi
+
+ # PORTME: fill in a description of your system's C++ link characteristics
+ { $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; }
+ ld_shlibs_CXX=yes
+ case $host_os in
+ aix3*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ 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
+ 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
+ case $ld_flag in
+ *-brtl*)
+ aix_use_runtimelinking=yes
+ break
+ ;;
+ esac
+ 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_CXX=''
+ hardcode_direct_CXX=yes
+ hardcode_direct_absolute_CXX=yes
+ hardcode_libdir_separator_CXX=':'
+ link_all_deplibs_CXX=yes
+ file_list_spec_CXX='${wl}-f,'
+
+ if test "$GXX" = 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_CXX=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_CXX=yes
+ hardcode_libdir_flag_spec_CXX='-L$libdir'
+ hardcode_libdir_separator_CXX=
+ 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_CXX='${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_CXX=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_CXX='-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_cxx_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_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+ archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag_CXX="-z nodefs"
+ archive_expsym_cmds_CXX="\$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_cxx_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_CXX='${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_CXX=' ${wl}-bernotok'
+ allow_undefined_flag_CXX=' ${wl}-berok'
+ if test "$with_gnu_ld" = yes; then
+ # We only use this code for GNU lds that support --whole-archive.
+ whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ else
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec_CXX='$convenience'
+ fi
+ archive_cmds_need_lc_CXX=yes
+ # This is similar to how AIX traditionally builds its shared
+ # libraries.
+ archive_expsym_cmds_CXX="\$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
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag_CXX=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs_CXX=no
+ fi
+ ;;
+
+ chorus*)
+ case $cc_basename in
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
+ # as there is no search path for DLLs.
+ hardcode_libdir_flag_spec_CXX='-L$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-all-symbols'
+ allow_undefined_flag_CXX=unsupported
+ always_export_symbols_CXX=no
+ enable_shared_with_static_runtimes_CXX=yes
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $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_CXX='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 -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ ld_shlibs_CXX=no
+ fi
+ ;;
+ darwin* | rhapsody*)
+
+
+ archive_cmds_need_lc_CXX=no
+ hardcode_direct_CXX=no
+ hardcode_automatic_CXX=yes
+ hardcode_shlibpath_var_CXX=unsupported
+ if test "$lt_cv_ld_force_load" = "yes"; then
+ whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+ else
+ whole_archive_flag_spec_CXX=''
+ fi
+ link_all_deplibs_CXX=yes
+ allow_undefined_flag_CXX="$_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=func_echo_all
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="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_CXX="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}"
+ if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+ fi
+
+ else
+ ld_shlibs_CXX=no
+ fi
+
+ ;;
+
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ ;;
+
+ freebsd2.*)
+ # C++ shared libraries reported to be fairly broken before
+ # switch to ELF
+ ld_shlibs_CXX=no
+ ;;
+
+ freebsd-elf*)
+ archive_cmds_need_lc_CXX=no
+ ;;
+
+ freebsd* | dragonfly*)
+ # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+ # conventions
+ ld_shlibs_CXX=yes
+ ;;
+
+ gnu*)
+ ;;
+
+ haiku*)
+ archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ link_all_deplibs_CXX=yes
+ ;;
+
+ hpux9*)
+ hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator_CXX=:
+ export_dynamic_flag_spec_CXX='${wl}-E'
+ hardcode_direct_CXX=yes
+ hardcode_minus_L_CXX=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+
+ case $cc_basename in
+ CC*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ aCC*)
+ archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ fi
+ ;;
+ esac
+ ;;
+
+ hpux10*|hpux11*)
+ if test $with_gnu_ld = no; then
+ hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator_CXX=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ ;;
+ *)
+ export_dynamic_flag_spec_CXX='${wl}-E'
+ ;;
+ esac
+ fi
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_direct_CXX=no
+ hardcode_shlibpath_var_CXX=no
+ ;;
+ *)
+ hardcode_direct_CXX=yes
+ hardcode_direct_absolute_CXX=yes
+ hardcode_minus_L_CXX=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+ ;;
+ esac
+
+ case $cc_basename in
+ CC*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ aCC*)
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test $with_gnu_ld = no; then
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ fi
+ else
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ fi
+ ;;
+ esac
+ ;;
+
+ interix[3-9]*)
+ hardcode_direct_CXX=no
+ hardcode_shlibpath_var_CXX=no
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec_CXX='${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_CXX='$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_CXX='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'
+ ;;
+ irix5* | irix6*)
+ case $cc_basename in
+ CC*)
+ # SGI C++
+ archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+
+ # Archives containing C++ object files must be created using
+ # "CC -ar", where "CC" is the IRIX C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test "$with_gnu_ld" = no; then
+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
+ fi
+ fi
+ link_all_deplibs_CXX=yes
+ ;;
+ esac
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_CXX=:
+ inherit_rpath_CXX=yes
+ ;;
+
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+ archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+ # Archives containing C++ object files must be created using
+ # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+ old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+ ;;
+ icpc* | ecpc* )
+ # Intel C++
+ with_gnu_ld=yes
+ # version 8.0 and above of icpc choke on multiply defined symbols
+ # if we add $predep_objects and $postdep_objects, however 7.1 and
+ # earlier do not add the objects themselves.
+ case `$CC -V 2>&1` in
+ *"Version 7."*)
+ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ *) # Version 8.0 or newer
+ tmp_idyn=
+ case $host_cpu in
+ ia64*) tmp_idyn=' -i_dynamic';;
+ esac
+ archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ esac
+ archive_cmds_need_lc_CXX=no
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+ whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ ;;
+ pgCC* | pgcpp*)
+ # Portland Group C++ compiler
+ case `$CC -V` in
+ *pgCC\ [1-5].* | *pgcpp\ [1-5].*)
+ prelink_cmds_CXX='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+ compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
+ old_archive_cmds_CXX='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
+ $RANLIB $oldlib'
+ archive_cmds_CXX='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ archive_expsym_cmds_CXX='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ ;;
+ *) # Version 6 and above use weak symbols
+ archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ ;;
+ esac
+
+ hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+ whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ ;;
+ cxx*)
+ # Compaq C++
+ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+ hardcode_libdir_separator_CXX=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
+ ;;
+ xl* | mpixl* | bgxl*)
+ # IBM XL 8.0 on PPC, with GNU ld
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+ archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ if test "x$supports_anon_versioning" = xyes; then
+ archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+ no_undefined_flag_CXX=' -zdefs'
+ archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+ hardcode_libdir_flag_spec_CXX='-R$libdir'
+ whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ compiler_needs_object_CXX=yes
+
+ # Not sure whether something based on
+ # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+ # would be better.
+ output_verbose_link_cmd='func_echo_all'
+
+ # Archives containing C++ object files must be created using
+ # "CC -xar", where "CC" is the Sun C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ lynxos*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+
+ m88k*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+ wlarc=
+ hardcode_libdir_flag_spec_CXX='-R$libdir'
+ hardcode_direct_CXX=yes
+ hardcode_shlibpath_var_CXX=no
+ fi
+ # Workaround some broken pre-1.5 toolchains
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+ ;;
+
+ *nto* | *qnx*)
+ ld_shlibs_CXX=yes
+ ;;
+
+ openbsd2*)
+ # C++ shared libraries are fairly broken
+ ld_shlibs_CXX=no
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ hardcode_direct_CXX=yes
+ hardcode_shlibpath_var_CXX=no
+ hardcode_direct_absolute_CXX=yes
+ archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+ export_dynamic_flag_spec_CXX='${wl}-E'
+ whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ fi
+ output_verbose_link_cmd=func_echo_all
+ else
+ ld_shlibs_CXX=no
+ fi
+ ;;
+
+ osf3* | osf4* | osf5*)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ hardcode_libdir_separator_CXX=:
+
+ # Archives containing C++ object files must be created using
+ # the KAI C++ compiler.
+ case $host in
+ osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;;
+ *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;;
+ esac
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ cxx*)
+ case $host in
+ osf3*)
+ allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+ ;;
+ *)
+ allow_undefined_flag_CXX=' -expect_unresolved \*'
+ archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+ echo "-hidden">> $lib.exp~
+ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
+ $RM $lib.exp'
+ hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+ ;;
+ esac
+
+ hardcode_libdir_separator_CXX=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+ ;;
+ *)
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+ case $host in
+ osf3*)
+ archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ ;;
+ *)
+ archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ ;;
+ esac
+
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_CXX=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+ else
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ fi
+ ;;
+ esac
+ ;;
+
+ psos*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ lcc*)
+ # Lucid
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ ;;
+
+ solaris*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ archive_cmds_need_lc_CXX=yes
+ no_undefined_flag_CXX=' -zdefs'
+ archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+ hardcode_libdir_flag_spec_CXX='-R$libdir'
+ hardcode_shlibpath_var_CXX=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'.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract'
+ ;;
+ esac
+ link_all_deplibs_CXX=yes
+
+ output_verbose_link_cmd='func_echo_all'
+
+ # Archives containing C++ object files must be created using
+ # "CC -xar", where "CC" is the Sun C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+ # The C++ compiler must be used to create the archive.
+ old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+ ;;
+ *)
+ # GNU C++ compiler with Solaris linker
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ no_undefined_flag_CXX=' ${wl}-z ${wl}defs'
+ if $CC --version | $GREP -v '^2\.7' > /dev/null; then
+ archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+ else
+ # g++ 2.7 appears to require `-G' NOT `-shared' on this
+ # platform.
+ archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+ fi
+
+ hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir'
+ case $host_os in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *)
+ whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+ no_undefined_flag_CXX='${wl}-z,text'
+ archive_cmds_need_lc_CXX=no
+ hardcode_shlibpath_var_CXX=no
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+
+ 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_CXX='${wl}-z,text'
+ allow_undefined_flag_CXX='${wl}-z,nodefs'
+ archive_cmds_need_lc_CXX=no
+ hardcode_shlibpath_var_CXX=no
+ hardcode_libdir_flag_spec_CXX='${wl}-R,$libdir'
+ hardcode_libdir_separator_CXX=':'
+ link_all_deplibs_CXX=yes
+ export_dynamic_flag_spec_CXX='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~
+ '"$old_archive_cmds_CXX"
+ reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~
+ '"$reload_cmds_CXX"
+ ;;
+ *)
+ archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ ;;
+
+ vxworks*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5
+$as_echo "$ld_shlibs_CXX" >&6; }
+ test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+ GCC_CXX="$GXX"
+ LD_CXX="$LD"
+
+ ## 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...
+ # Dependencies to place before and after the object being linked:
+predep_objects_CXX=
+postdep_objects_CXX=
+predeps_CXX=
+postdeps_CXX=
+compiler_lib_search_path_CXX=
+
+cat > conftest.$ac_ext <<_LT_EOF
+class Foo
+{
+public:
+ Foo (void) { a = 0; }
+private:
+ int a;
+};
+_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
+ # Parse the compiler output and extract the necessary
+ # objects, libraries and library flags.
+
+ # Sentinel used to keep track of whether or not we are before
+ # the conftest object file.
+ pre_test_object_deps_done=no
+
+ for p in `eval "$output_verbose_link_cmd"`; do
+ case $p in
+
+ -L* | -R* | -l*)
+ # Some compilers place space between "-{L,R}" and the path.
+ # Remove the space.
+ if test $p = "-L" ||
+ test $p = "-R"; then
+ prev=$p
+ continue
+ else
+ prev=
+ fi
+
+ if test "$pre_test_object_deps_done" = no; then
+ case $p in
+ -L* | -R*)
+ # Internal compiler library paths should come after those
+ # provided the user. The postdeps already come after the
+ # user supplied libs so there is no need to process them.
+ if test -z "$compiler_lib_search_path_CXX"; then
+ compiler_lib_search_path_CXX="${prev}${p}"
+ else
+ compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}"
+ fi
+ ;;
+ # The "-l" case would never come before the object being
+ # linked, so don't bother handling this case.
+ esac
+ else
+ if test -z "$postdeps_CXX"; then
+ postdeps_CXX="${prev}${p}"
+ else
+ postdeps_CXX="${postdeps_CXX} ${prev}${p}"
+ fi
+ fi
+ ;;
+
+ *.$objext)
+ # This assumes that the test object file only shows up
+ # once in the compiler output.
+ if test "$p" = "conftest.$objext"; then
+ pre_test_object_deps_done=yes
+ continue
+ fi
+
+ if test "$pre_test_object_deps_done" = no; then
+ if test -z "$predep_objects_CXX"; then
+ predep_objects_CXX="$p"
+ else
+ predep_objects_CXX="$predep_objects_CXX $p"
+ fi
+ else
+ if test -z "$postdep_objects_CXX"; then
+ postdep_objects_CXX="$p"
+ else
+ postdep_objects_CXX="$postdep_objects_CXX $p"
+ fi
+ fi
+ ;;
+
+ *) ;; # Ignore the rest.
+
+ esac
+ done
+
+ # Clean up.
+ rm -f a.out a.exe
+else
+ echo "libtool.m4: error: problem compiling CXX test program"
+fi
+
+$RM -f confest.$objext
+
+# PORTME: override above test on systems where it is broken
+case $host_os in
+interix[3-9]*)
+ # Interix 3.5 installs completely hosed .la files for C++, so rather than
+ # hack all around it, let's just trust "g++" to DTRT.
+ predep_objects_CXX=
+ postdep_objects_CXX=
+ postdeps_CXX=
+ ;;
+
+linux*)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+
+ # The more standards-conforming stlport4 library is
+ # incompatible with the Cstd library. Avoid specifying
+ # it if it's in CXXFLAGS. Ignore libCrun as
+ # -library=stlport4 depends on it.
+ case " $CXX $CXXFLAGS " in
+ *" -library=stlport4 "*)
+ solaris_use_stlport4=yes
+ ;;
+ esac
+
+ if test "$solaris_use_stlport4" != yes; then
+ postdeps_CXX='-library=Cstd -library=Crun'
+ fi
+ ;;
+ esac
+ ;;
+
+solaris*)
+ case $cc_basename in
+ CC*)
+ # The more standards-conforming stlport4 library is
+ # incompatible with the Cstd library. Avoid specifying
+ # it if it's in CXXFLAGS. Ignore libCrun as
+ # -library=stlport4 depends on it.
+ case " $CXX $CXXFLAGS " in
+ *" -library=stlport4 "*)
+ solaris_use_stlport4=yes
+ ;;
+ esac
+
+ # Adding this requires a known-good setup of shared libraries for
+ # Sun compiler versions before 5.6, else PIC objects from an old
+ # archive will be linked into the output, leading to subtle bugs.
+ if test "$solaris_use_stlport4" != yes; then
+ postdeps_CXX='-library=Cstd -library=Crun'
+ fi
+ ;;
+ esac
+ ;;
+esac
+
+
+case " $postdeps_CXX " in
+*" -lc "*) archive_cmds_need_lc_CXX=no ;;
+esac
+ compiler_lib_search_dirs_CXX=
+if test -n "${compiler_lib_search_path_CXX}"; then
+ compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ lt_prog_compiler_wl_CXX=
+lt_prog_compiler_pic_CXX=
+lt_prog_compiler_static_CXX=
+
+{ $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; }
+
+ # C++ specific cases for pic, static, wl, etc.
+ if test "$GXX" = yes; then
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_static_CXX='-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_CXX='-Bstatic'
+ fi
+ lt_prog_compiler_pic_CXX='-fPIC'
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ lt_prog_compiler_pic_CXX='-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_CXX='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ esac
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+ mingw* | cygwin* | os2* | pw32* | 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_CXX='-DDLL_EXPORT'
+ ;;
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ lt_prog_compiler_pic_CXX='-fno-common'
+ ;;
+ *djgpp*)
+ # DJGPP does not support shared libraries at all
+ lt_prog_compiler_pic_CXX=
+ ;;
+ haiku*)
+ # PIC is the default for Haiku.
+ # The "-static" flag exists, but is broken.
+ lt_prog_compiler_static_CXX=
+ ;;
+ interix[3-9]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ lt_prog_compiler_pic_CXX=-Kconform_pic
+ fi
+ ;;
+ 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*)
+ ;;
+ *)
+ lt_prog_compiler_pic_CXX='-fPIC'
+ ;;
+ esac
+ ;;
+ *qnx* | *nto*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic_CXX='-fPIC -shared'
+ ;;
+ *)
+ lt_prog_compiler_pic_CXX='-fPIC'
+ ;;
+ esac
+ else
+ case $host_os in
+ aix[4-9]*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static_CXX='-Bstatic'
+ else
+ lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+ chorus*)
+ case $cc_basename in
+ cxch68*)
+ # Green Hills C++ Compiler
+ # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+ ;;
+ esac
+ ;;
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ lt_prog_compiler_pic_CXX='-KPIC'
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ lt_prog_compiler_pic_CXX='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ freebsd* | dragonfly*)
+ # FreeBSD uses GNU C++
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ case $cc_basename in
+ CC*)
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+ if test "$host_cpu" != ia64; then
+ lt_prog_compiler_pic_CXX='+Z'
+ fi
+ ;;
+ aCC*)
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic_CXX='+Z'
+ ;;
+ esac
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ interix*)
+ # This is c89, which is MS Visual C++ (no shared libs)
+ # Anyone wants to do a port?
+ ;;
+ irix5* | irix6* | nonstopux*)
+ case $cc_basename in
+ CC*)
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_static_CXX='-non_shared'
+ # CC pic flag -KPIC is the default.
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ case $cc_basename in
+ KCC*)
+ # KAI C++ Compiler
+ lt_prog_compiler_wl_CXX='--backend -Wl,'
+ lt_prog_compiler_pic_CXX='-fPIC'
+ ;;
+ ecpc* )
+ # old Intel C++ for x86_64 which still supported -KPIC.
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_pic_CXX='-KPIC'
+ lt_prog_compiler_static_CXX='-static'
+ ;;
+ icpc* )
+ # Intel C++, used to be incompatible with GCC.
+ # ICC 10 doesn't accept -KPIC any more.
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_pic_CXX='-fPIC'
+ lt_prog_compiler_static_CXX='-static'
+ ;;
+ pgCC* | pgcpp*)
+ # Portland Group C++ compiler
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_pic_CXX='-fpic'
+ lt_prog_compiler_static_CXX='-Bstatic'
+ ;;
+ cxx*)
+ # Compaq C++
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ lt_prog_compiler_pic_CXX=
+ lt_prog_compiler_static_CXX='-non_shared'
+ ;;
+ xlc* | xlC* | bgxl[cC]* | mpixl[cC]*)
+ # IBM XL 8.0, 9.0 on PPC and BlueGene
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_pic_CXX='-qpic'
+ lt_prog_compiler_static_CXX='-qstaticlink'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+ lt_prog_compiler_pic_CXX='-KPIC'
+ lt_prog_compiler_static_CXX='-Bstatic'
+ lt_prog_compiler_wl_CXX='-Qoption ld '
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ lynxos*)
+ ;;
+ m88k*)
+ ;;
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ lt_prog_compiler_pic_CXX='-W c,exportall'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ netbsd*)
+ ;;
+ *qnx* | *nto*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic_CXX='-fPIC -shared'
+ ;;
+ osf3* | osf4* | osf5*)
+ case $cc_basename in
+ KCC*)
+ lt_prog_compiler_wl_CXX='--backend -Wl,'
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ lt_prog_compiler_pic_CXX='-pic'
+ ;;
+ cxx*)
+ # Digital/Compaq C++
+ lt_prog_compiler_wl_CXX='-Wl,'
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ lt_prog_compiler_pic_CXX=
+ lt_prog_compiler_static_CXX='-non_shared'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ psos*)
+ ;;
+ solaris*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ lt_prog_compiler_pic_CXX='-KPIC'
+ lt_prog_compiler_static_CXX='-Bstatic'
+ lt_prog_compiler_wl_CXX='-Qoption ld '
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ lt_prog_compiler_pic_CXX='-PIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ lt_prog_compiler_pic_CXX='-pic'
+ lt_prog_compiler_static_CXX='-Bstatic'
+ ;;
+ lcc*)
+ # Lucid
+ lt_prog_compiler_pic_CXX='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ case $cc_basename in
+ CC*)
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_pic_CXX='-KPIC'
+ lt_prog_compiler_static_CXX='-Bstatic'
+ ;;
+ esac
+ ;;
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ lt_prog_compiler_pic_CXX='-KPIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ vxworks*)
+ ;;
+ *)
+ lt_prog_compiler_can_build_shared_CXX=no
+ ;;
+ esac
+ fi
+
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ lt_prog_compiler_pic_CXX=
+ ;;
+ *)
+ lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC"
+ ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic_CXX" >&5
+$as_echo "$lt_prog_compiler_pic_CXX" >&6; }
+
+
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_CXX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; }
+if test "${lt_cv_prog_compiler_pic_works_CXX+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_pic_works_CXX=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$lt_prog_compiler_pic_CXX -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:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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_CXX=yes
+ fi
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then
+ case $lt_prog_compiler_pic_CXX in
+ "" | " "*) ;;
+ *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;;
+ esac
+else
+ lt_prog_compiler_pic_CXX=
+ lt_prog_compiler_can_build_shared_CXX=no
+fi
+
+fi
+
+
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\"
+{ $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_CXX+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_static_works_CXX=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 "$_lt_linker_boilerplate" | $SED '/^$/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_CXX=yes
+ fi
+ else
+ lt_cv_prog_compiler_static_works_CXX=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then
+ :
+else
+ lt_prog_compiler_static_CXX=
+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_CXX+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_c_o_CXX=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:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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_CXX=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_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&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_CXX+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_c_o_CXX=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:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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_CXX=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_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; }
+
+
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_CXX" = 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; }
+
+ export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ case $host_os in
+ aix[4-9]*)
+ # 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
+ # Also, AIX nm treats weak defined symbols like other global defined
+ # symbols, whereas GNU nm marks them as "W".
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+ export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ else
+ export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ fi
+ ;;
+ pw32*)
+ export_symbols_cmds_CXX="$ltdll_cmds"
+ ;;
+ cygwin* | mingw* | cegcc*)
+ export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;/^.*[ ]__nm__/s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
+ ;;
+ *)
+ export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ ;;
+ esac
+ exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5
+$as_echo "$ld_shlibs_CXX" >&6; }
+test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+with_gnu_ld_CXX=$with_gnu_ld
+
+
+
+
+
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_CXX" in
+x|xyes)
+ # Assume -lc should be added
+ archive_cmds_need_lc_CXX=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $archive_cmds_CXX 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_CXX+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_CXX
+ pic_flag=$lt_prog_compiler_pic_CXX
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$allow_undefined_flag_CXX
+ allow_undefined_flag_CXX=
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+ (eval $archive_cmds_CXX 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_CXX=no
+ else
+ lt_cv_archive_cmds_need_lc_CXX=yes
+ fi
+ allow_undefined_flag_CXX=$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_CXX" >&5
+$as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; }
+ archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
+
+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<name>.so
+ # instead of lib<name>.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=`func_echo_all "$lib" | $SED '\''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}'
+
+ ;;
+ mingw* | cegcc*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ 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_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
+ ;;
+
+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[23].*) 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
+ ;;
+
+haiku*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ dynamic_linker="$host_os runtime_loader"
+ 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=LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib'
+ 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'
+ # or fails outright, so override atomically:
+ install_override_mode=555
+ ;;
+
+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_CXX\"; \
+ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_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;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_CXX=
+if test -n "$hardcode_libdir_flag_spec_CXX" ||
+ test -n "$runpath_var_CXX" ||
+ test "X$hardcode_automatic_CXX" = "Xyes" ; then
+
+ # We can hardcode non-existent directories.
+ if test "$hardcode_direct_CXX" != 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, CXX)" != no &&
+ test "$hardcode_minus_L_CXX" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action_CXX=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action_CXX=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action_CXX=unsupported
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5
+$as_echo "$hardcode_action_CXX" >&6; }
+
+if test "$hardcode_action_CXX" = relink ||
+ test "$inherit_rpath_CXX" = 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
+
+
+
+
+
+
+
+ fi # test -n "$compiler"
+
+ CC=$lt_save_CC
+ LDCXX=$LD
+ LD=$lt_save_LD
+ GCC=$lt_save_GCC
+ with_gnu_ld=$lt_save_with_gnu_ld
+ lt_cv_path_LDCXX=$lt_cv_path_LD
+ lt_cv_path_LD=$lt_save_path_LD
+ lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+ lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+fi # test "$_lt_caught_CXX_error" != yes
+
+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_config_commands="$ac_config_commands libtool"
+
+
+
+
+# Only expand once:
+
+
+# Forbid libtool to hardcode RPATH, because we want to be able to specify
+# library search directory using LD_LIBRARY_PATH
+hardcode_into_libs=no
+
+
+
+
+
+if test $enable_shared = yes; then
+ link_offloadmic_host="-loffloadmic_host %{static: $LIBS}"
+ link_offloadmic_target="-loffloadmic_target %{static: $LIBS}"
+else
+ link_offloadmic_host="-loffloadmic_host $LIBS"
+ link_offloadmic_target="-loffloadmic_target $LIBS"
+fi
+
+
+
+# Must be last
+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 "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
+ as_fn_error "conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+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
+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+ as_fn_error "conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LIBOFFLOADMIC_HOST_TRUE}" && test -z "${LIBOFFLOADMIC_HOST_FALSE}"; then
+ as_fn_error "conditional \"LIBOFFLOADMIC_HOST\" 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 MIC Offload Runtime Library $as_me 1.0, 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="\\
+MIC Offload Runtime Library config.status 1.0
+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"
+
+srcdir="$srcdir"
+host="$host"
+target="$target"
+with_multisubdir="$with_multisubdir"
+with_multisrctop="$with_multisrctop"
+with_target_subdir="$with_target_subdir"
+ac_configure_args="${multilib_arg} ${ac_configure_args}"
+multi_basedir="$multi_basedir"
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+CC="$CC"
+CXX="$CXX"
+GFORTRAN="$GFORTRAN"
+GCJ="$GCJ"
+
+
+# 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 "$macro_version" | $SED "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
+enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
+enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
+SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
+ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
+host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
+host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
+host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
+build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`'
+build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`'
+build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`'
+SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`'
+Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`'
+GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`'
+EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`'
+FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`'
+LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`'
+NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`'
+LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`'
+exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
+AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
+STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`'
+lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`'
+CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`'
+compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`'
+GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
+objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
+need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
+DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
+NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
+LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
+OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`'
+OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`'
+libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
+fix_srcfile_path='`$ECHO "$fix_srcfile_path" | $SED "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
+need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`'
+version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`'
+install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`'
+striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`'
+predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`'
+postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`'
+predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`'
+postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`'
+LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`'
+reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`'
+reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`'
+GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld_CXX='`$ECHO "$hardcode_libdir_flag_spec_ld_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`'
+inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`'
+fix_srcfile_path_CXX='`$ECHO "$fix_srcfile_path_CXX" | $SED "$delay_single_quote_subst"`'
+always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`'
+include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`'
+prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`'
+predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`'
+postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`'
+predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`'
+postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`'
+
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+ eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+
+# Quote evaled strings.
+for var in SHELL \
+ECHO \
+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 \
+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 \
+install_override_mode \
+finish_eval \
+old_striplib \
+striplib \
+compiler_lib_search_dirs \
+predep_objects \
+postdep_objects \
+predeps \
+postdeps \
+compiler_lib_search_path \
+LD_CXX \
+reload_flag_CXX \
+compiler_CXX \
+lt_prog_compiler_no_builtin_flag_CXX \
+lt_prog_compiler_wl_CXX \
+lt_prog_compiler_pic_CXX \
+lt_prog_compiler_static_CXX \
+lt_cv_prog_compiler_c_o_CXX \
+export_dynamic_flag_spec_CXX \
+whole_archive_flag_spec_CXX \
+compiler_needs_object_CXX \
+with_gnu_ld_CXX \
+allow_undefined_flag_CXX \
+no_undefined_flag_CXX \
+hardcode_libdir_flag_spec_CXX \
+hardcode_libdir_flag_spec_ld_CXX \
+hardcode_libdir_separator_CXX \
+fix_srcfile_path_CXX \
+exclude_expsyms_CXX \
+include_expsyms_CXX \
+file_list_spec_CXX \
+compiler_lib_search_dirs_CXX \
+predep_objects_CXX \
+postdep_objects_CXX \
+predeps_CXX \
+postdeps_CXX \
+compiler_lib_search_path_CXX; do
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$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 \
+reload_cmds_CXX \
+old_archive_cmds_CXX \
+old_archive_from_new_cmds_CXX \
+old_archive_from_expsyms_cmds_CXX \
+archive_cmds_CXX \
+archive_expsym_cmds_CXX \
+module_cmds_CXX \
+module_expsym_cmds_CXX \
+export_symbols_cmds_CXX \
+prelink_cmds_CXX; do
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+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" ;;
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "liboffloadmic_host.spec") CONFIG_FILES="$CONFIG_FILES liboffloadmic_host.spec" ;;
+ "liboffloadmic_target.spec") CONFIG_FILES="$CONFIG_FILES liboffloadmic_target.spec" ;;
+ "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
+ "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
+
+ *) 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 2>/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
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$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
+}
+ ;;
+ "default-1":C)
+# Only add multilib support code if we just rebuilt the top-level
+# Makefile.
+case " $CONFIG_FILES " in
+ *" Makefile "*)
+ ac_file=Makefile . ${multi_basedir}/config-ml.in
+ ;;
+esac ;;
+ "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, 2009 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="CXX "
+
+# ### 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
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that protects backslashes.
+ECHO=$lt_ECHO
+
+# 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
+
+# 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
+
+# Whether to use a lock for old archive extraction.
+lock_old_archive_extraction=$lock_old_archive_extraction
+
+# 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
+
+# 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
+
+# Permission mode override for installation of shared libraries.
+install_override_mode=$lt_install_override_mode
+
+# 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
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# 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
+
+# The directories searched by this compiler when creating a shared library.
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs
+
+# Dependencies to place before and after the objects being linked to
+# create a shared library.
+predep_objects=$lt_predep_objects
+postdep_objects=$lt_postdep_objects
+predeps=$lt_predeps
+postdeps=$lt_postdeps
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path
+
+# ### 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 "${1}" | $SED "$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 "${1}" | $SED "$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 "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+ *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; 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 "${1}" | $SED "$my_sed_long_opt"`
+ func_opt_split_arg=`$ECHO "${1}" | $SED "$my_sed_long_arg"`
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+ func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+ func_xform_result=`$ECHO "${1}" | $SED '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"
+
+
+ cat <<_LT_EOF >> "$ofile"
+
+# ### BEGIN LIBTOOL TAG CONFIG: CXX
+
+# The linker used to build libraries.
+LD=$lt_LD_CXX
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag_CXX
+reload_cmds=$lt_reload_cmds_CXX
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds_CXX
+
+# A language specific compiler.
+CC=$lt_compiler_CXX
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC_CXX
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_CXX
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_CXX
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_CXX
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_CXX
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object_CXX
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds_CXX
+archive_expsym_cmds=$lt_archive_expsym_cmds_CXX
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds_CXX
+module_expsym_cmds=$lt_module_expsym_cmds_CXX
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld_CXX
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_CXX
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_CXX
+
+# 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_CXX
+
+# 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_CXX
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct_CXX
+
+# 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_CXX
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L_CXX
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX
+
+# 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_CXX
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath_CXX
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_CXX
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path_CXX
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols_CXX
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_CXX
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_CXX
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_CXX
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds_CXX
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec_CXX
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_CXX
+
+# The directories searched by this compiler when creating a shared library.
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX
+
+# Dependencies to place before and after the objects being linked to
+# create a shared library.
+predep_objects=$lt_predep_objects_CXX
+postdep_objects=$lt_postdep_objects_CXX
+predeps=$lt_predeps_CXX
+postdeps=$lt_postdeps_CXX
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
+
+# ### END LIBTOOL TAG CONFIG: CXX
+_LT_EOF
+
+ ;;
+
+ 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
+
+#
+# CONFIG_SUBDIRS section.
+#
+if test "$no_recursion" != yes; then
+
+ # Remove --cache-file, --srcdir, and --disable-option-checking arguments
+ # so they do not pile up.
+ ac_sub_configure_args=
+ ac_prev=
+ eval "set x $ac_configure_args"
+ shift
+ for ac_arg
+ do
+ if test -n "$ac_prev"; then
+ ac_prev=
+ continue
+ fi
+ case $ac_arg in
+ -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=*)
+ ;;
+ --config-cache | -C)
+ ;;
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ ;;
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ ;;
+ --disable-option-checking)
+ ;;
+ *)
+ case $ac_arg in
+ *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ as_fn_append ac_sub_configure_args " '$ac_arg'" ;;
+ esac
+ done
+
+ # Always prepend --prefix to ensure using the same prefix
+ # in subdir configurations.
+ ac_arg="--prefix=$prefix"
+ case $ac_arg in
+ *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args"
+
+ # Pass --silent
+ if test "$silent" = yes; then
+ ac_sub_configure_args="--silent $ac_sub_configure_args"
+ fi
+
+ # Always prepend --disable-option-checking to silence warnings, since
+ # different subdirs can have different --enable and --with options.
+ ac_sub_configure_args="--disable-option-checking $ac_sub_configure_args"
+
+ ac_popdir=`pwd`
+ for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue
+
+ # Do not complain, so a configure script can configure whichever
+ # parts of a large source tree are present.
+ test -d "$srcdir/$ac_dir" || continue
+
+ ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)"
+ $as_echo "$as_me:${as_lineno-$LINENO}: $ac_msg" >&5
+ $as_echo "$ac_msg" >&6
+ 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
+
+
+ cd "$ac_dir"
+
+ # Check for guested configure; otherwise get Cygnus style configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ ac_sub_configure=$ac_srcdir/configure.gnu
+ elif test -f "$ac_srcdir/configure"; then
+ ac_sub_configure=$ac_srcdir/configure
+ elif test -f "$ac_srcdir/configure.in"; then
+ # This should be Cygnus configure.
+ ac_sub_configure=$ac_aux_dir/configure
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no configuration information is in $ac_dir" >&5
+$as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;}
+ ac_sub_configure=
+ fi
+
+ # The recursion is here.
+ if test -n "$ac_sub_configure"; then
+ # Make the cache file name correct relative to the subdirectory.
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;;
+ *) # Relative name.
+ ac_sub_cache_file=$ac_top_build_prefix$cache_file ;;
+ esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5
+$as_echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;}
+ # The eval makes quoting arguments work.
+ eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \
+ --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" ||
+ as_fn_error "$ac_sub_configure failed for $ac_dir" "$LINENO" 5
+ fi
+
+ cd "$ac_popdir"
+ done
+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
+
diff --git a/liboffloadmic/configure.ac b/liboffloadmic/configure.ac
new file mode 100644
index 00000000000..81fae8f9441
--- /dev/null
+++ b/liboffloadmic/configure.ac
@@ -0,0 +1,132 @@
+# Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# Process this file with autoconf to produce a configure script, like so:
+# aclocal -I .. -I ../config && autoconf && automake
+
+AC_PREREQ([2.64])
+AC_INIT([MIC Offload Runtime Library], [1.0], ,[liboffloadmic])
+
+AC_CANONICAL_SYSTEM
+target_alias=${target_alias-$host_alias}
+AC_SUBST(target_alias)
+
+AM_INIT_AUTOMAKE(foreign no-dist)
+AM_MAINTAINER_MODE
+
+AC_PROG_CC
+AC_PROG_CXX
+AC_CONFIG_FILES([Makefile liboffloadmic_host.spec liboffloadmic_target.spec])
+AM_ENABLE_MULTILIB(, ..)
+AC_CONFIG_SUBDIRS(plugin)
+AC_FUNC_ALLOCA
+AC_CHECK_HEADERS([mm_malloc.h], [], [AC_MSG_ERROR(["Couldn't find mm_malloc.h"])])
+AC_CHECK_FUNCS([__secure_getenv secure_getenv])
+
+# Get target configure.
+. ${srcdir}/configure.tgt
+if test -n "$UNSUPPORTED"; then
+ AC_MSG_ERROR([Configuration ${target} is unsupported])
+fi
+
+if test "${multilib}" = "yes"; then
+ multilib_arg="--enable-multilib"
+else
+ multilib_arg=
+fi
+
+AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
+AC_ARG_ENABLE([version-specific-runtime-libs],
+ AC_HELP_STRING([--enable-version-specific-runtime-libs],
+ [Specify that runtime libraries should be installed in a compiler-specific directory]),
+ [case "$enableval" in
+ yes) enable_version_specific_runtime_libs=yes ;;
+ no) enable_version_specific_runtime_libs=no ;;
+ *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
+ esac],
+ [enable_version_specific_runtime_libs=no])
+AC_MSG_RESULT($enable_version_specific_runtime_libs)
+
+# Make sure liboffloadmic is enabled
+case "$enable_liboffloadmic" in
+ host | target)
+ ;;
+ *)
+ AC_MSG_ERROR([Liboffloadmic is disabled]) ;;
+esac
+AM_CONDITIONAL(LIBOFFLOADMIC_HOST, [test x"$enable_liboffloadmic" = xhost])
+
+# Calculate toolexeclibdir.
+# Also toolexecdir, though it's only used in toolexeclibdir.
+case ${enable_version_specific_runtime_libs} in
+ yes)
+ # Need the gcc compiler version to know where to install libraries
+ # and header files if --enable-version-specific-runtime-libs option
+ # is selected.
+ toolexecdir='$(libdir)/gcc/$(target_alias)'
+ toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
+ ;;
+ no)
+ if test -n "$with_cross_host" &&
+ test x"$with_cross_host" != x"no"; then
+ # Install a library built with a cross compiler in tooldir, not libdir.
+ toolexecdir='$(exec_prefix)/$(target_alias)'
+ toolexeclibdir='$(toolexecdir)/lib'
+ else
+ toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
+ toolexeclibdir='$(libdir)'
+ fi
+ multi_os_directory=`$CC -print-multi-os-directory`
+ case $multi_os_directory in
+ .) ;; # Avoid trailing /.
+ *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
+ esac
+ ;;
+esac
+
+AC_LIBTOOL_DLOPEN
+AM_PROG_LIBTOOL
+# Forbid libtool to hardcode RPATH, because we want to be able to specify
+# library search directory using LD_LIBRARY_PATH
+hardcode_into_libs=no
+AC_SUBST(toolexecdir)
+AC_SUBST(toolexeclibdir)
+
+AC_SUBST(lt_cv_dlopen_libs)
+
+if test $enable_shared = yes; then
+ link_offloadmic_host="-loffloadmic_host %{static: $LIBS}"
+ link_offloadmic_target="-loffloadmic_target %{static: $LIBS}"
+else
+ link_offloadmic_host="-loffloadmic_host $LIBS"
+ link_offloadmic_target="-loffloadmic_target $LIBS"
+fi
+AC_SUBST(link_offloadmic_host)
+AC_SUBST(link_offloadmic_target)
+
+# Must be last
+AC_OUTPUT
diff --git a/liboffloadmic/configure.tgt b/liboffloadmic/configure.tgt
new file mode 100644
index 00000000000..3c0310cb477
--- /dev/null
+++ b/liboffloadmic/configure.tgt
@@ -0,0 +1,39 @@
+# Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# Disable Offload Runtime library for non x86 architecture.
+case "${target}" in
+ x86_64-*-linux*)
+ ;;
+ i?86-*-linux*)
+ ;;
+ *-*-*)
+ UNSUPPORTED=1 ;;
+esac
+
+# Disable liboffloadmic on non POSIX hosted systems.
+. ${srcdir}/../config/target-posix
diff --git a/liboffloadmic/doc/doxygen/config b/liboffloadmic/doc/doxygen/config
new file mode 100644
index 00000000000..3ef1019b5ce
--- /dev/null
+++ b/liboffloadmic/doc/doxygen/config
@@ -0,0 +1,2328 @@
+# Doxyfile 1.8.6
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a double hash (##) is considered a comment and is placed in
+# front of the TAG it is preceding.
+#
+# All text after a single hash (#) is considered a comment and will be ignored.
+# The format is:
+# TAG = value [value, ...]
+# For lists, items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (\" \").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all text
+# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
+# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
+# for the list of possible encodings.
+# The default value is: UTF-8.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
+# double-quotes, unless you are using Doxywizard) that should identify the
+# project for which the documentation is generated. This name is used in the
+# title of most generated pages and in a few other places.
+# The default value is: My Project.
+
+PROJECT_NAME = "Intel&reg;&nbsp;Offload Runtime Library"
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
+# could be handy for archiving the generated documentation or if some version
+# control system is used.
+
+PROJECT_NUMBER =
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer a
+# quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF =
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
+# the documentation. The maximum height of the logo should not exceed 55 pixels
+# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
+# to the output directory.
+
+PROJECT_LOGO =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
+# into which the generated documentation will be written. If a relative path is
+# entered, it will be relative to the location where doxygen was started. If
+# left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = doc/doxygen/generated
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
+# directories (in 2 levels) under the output directory of each output format and
+# will distribute the generated files over these directories. Enabling this
+# option can be useful when feeding doxygen a huge amount of source files, where
+# putting all generated files in the same directory would otherwise causes
+# performance problems for the file system.
+# The default value is: NO.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
+# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
+# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
+# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
+# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
+# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
+# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
+# Ukrainian and Vietnamese.
+# The default value is: English.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member
+# descriptions after the members that are listed in the file and class
+# documentation (similar to Javadoc). Set to NO to disable this.
+# The default value is: YES.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief
+# description of a member or function before the detailed description
+#
+# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+# The default value is: YES.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator that is
+# used to form the text in various listings. Each string in this list, if found
+# as the leading text of the brief description, will be stripped from the text
+# and the result, after processing the whole list, is used as the annotated
+# text. Otherwise, the brief description is used as-is. If left blank, the
+# following values are used ($name is automatically replaced with the name of
+# the entity):The $name class, The $name widget, The $name file, is, provides,
+# specifies, contains, represents, a, an and the.
+
+ABBREVIATE_BRIEF = "The $name class" \
+ "The $name widget" \
+ "The $name file" \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# doxygen will generate a detailed section even if there is only a brief
+# description.
+# The default value is: NO.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+# The default value is: NO.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path
+# before files name in the file list and in the header files. If set to NO the
+# shortest path that makes the file name unique will be used
+# The default value is: YES.
+
+FULL_PATH_NAMES = YES
+
+# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
+# Stripping is only done if one of the specified strings matches the left-hand
+# part of the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the path to
+# strip.
+#
+# Note that you can specify absolute paths here, but also relative paths, which
+# will be relative from the directory where doxygen is started.
+# This tag requires that the tag FULL_PATH_NAMES is set to YES.
+
+STRIP_FROM_PATH = src/
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
+# path mentioned in the documentation of a class, which tells the reader which
+# header file to include in order to use a class. If left blank only the name of
+# the header file containing the class definition is used. Otherwise one should
+# specify the list of include paths that are normally passed to the compiler
+# using the -I flag.
+
+STRIP_FROM_INC_PATH = src/
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
+# less readable) file names. This can be useful is your file systems doesn't
+# support long names like on DOS, Mac, or CD-ROM.
+# The default value is: NO.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
+# first line (until the first dot) of a Javadoc-style comment as the brief
+# description. If set to NO, the Javadoc-style will behave just like regular Qt-
+# style comments (thus requiring an explicit @brief command for a brief
+# description.)
+# The default value is: NO.
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
+# line (until the first dot) of a Qt-style comment as the brief description. If
+# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
+# requiring an explicit \brief command for a brief description.)
+# The default value is: NO.
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
+# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
+# a brief description. This used to be the default behavior. The new default is
+# to treat a multi-line C++ comment block as a detailed description. Set this
+# tag to YES if you prefer the old behavior instead.
+#
+# Note that setting this tag to YES also means that rational rose comments are
+# not recognized any more.
+# The default value is: NO.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
+# documentation from any documented member that it re-implements.
+# The default value is: YES.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a
+# new page for each member. If set to NO, the documentation of a member will be
+# part of the file/class/namespace that contains it.
+# The default value is: NO.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
+# uses this value to replace tabs by spaces in code fragments.
+# Minimum value: 1, maximum value: 16, default value: 4.
+
+TAB_SIZE = 8
+
+# This tag can be used to specify a number of aliases that act as commands in
+# the documentation. An alias has the form:
+# name=value
+# For example adding
+# "sideeffect=@par Side Effects:\n"
+# will allow you to put the command \sideeffect (or @sideeffect) in the
+# documentation, which will result in a user-defined paragraph with heading
+# "Side Effects:". You can put \n's in the value part of an alias to insert
+# newlines.
+
+ALIASES =
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding "class=itcl::class"
+# will allow you to use the command class in the itcl::class meaning.
+
+TCL_SUBST =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
+# only. Doxygen will then generate output that is more tailored for C. For
+# instance, some of the names that are used will be different. The list of all
+# members will be omitted, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
+# Python sources only. Doxygen will then generate output that is more tailored
+# for that language. For instance, namespaces will be presented as packages,
+# qualified scopes will look different, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources. Doxygen will then generate output that is tailored for Fortran.
+# The default value is: NO.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for VHDL.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given
+# extension. Doxygen has a built-in mapping, but you can override or extend it
+# using this tag. The format is ext=language, where ext is a file extension, and
+# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
+# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make
+# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
+# (default is Fortran), use: inc=Fortran f=C.
+#
+# Note For files without extension you can use no_extension as a placeholder.
+#
+# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
+# the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
+# according to the Markdown format, which allows for more readable
+# documentation. See http://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you can
+# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
+# case of backward compatibilities issues.
+# The default value is: YES.
+
+MARKDOWN_SUPPORT = YES
+
+# When enabled doxygen tries to link words that correspond to documented
+# classes, or namespaces to their corresponding documentation. Such a link can
+# be prevented in individual cases by by putting a % sign in front of the word
+# or globally by setting AUTOLINK_SUPPORT to NO.
+# The default value is: YES.
+
+AUTOLINK_SUPPORT = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should set this
+# tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string);
+# versus func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+# The default value is: NO.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+# The default value is: NO.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
+# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
+# will parse them like normal C++ but will assume all classes use public instead
+# of private inheritance when no explicit protection keyword is present.
+# The default value is: NO.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate
+# getter and setter methods for a property. Setting this option to YES will make
+# doxygen to replace the get and set methods by a property in the documentation.
+# This will only work if the methods are indeed getting or setting a simple
+# type. If this is not the case, or you want to show the methods anyway, you
+# should set this option to NO.
+# The default value is: YES.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+# The default value is: NO.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES to allow class member groups of the same type
+# (for instance a group of public functions) to be put as a subgroup of that
+# type (e.g. under the Public Functions section). Set it to NO to prevent
+# subgrouping. Alternatively, this can be done per class using the
+# \nosubgrouping command.
+# The default value is: YES.
+
+SUBGROUPING = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
+# are shown inside the group in which they are included (e.g. using \ingroup)
+# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
+# and RTF).
+#
+# Note that this feature does not work in combination with
+# SEPARATE_MEMBER_PAGES.
+# The default value is: NO.
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
+# with only public data fields or simple typedef fields will be shown inline in
+# the documentation of the scope in which they are defined (i.e. file,
+# namespace, or group documentation), provided this scope is documented. If set
+# to NO, structs, classes, and unions are shown on a separate page (for HTML and
+# Man pages) or section (for LaTeX and RTF).
+# The default value is: NO.
+
+INLINE_SIMPLE_STRUCTS = NO
+
+# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
+# enum is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically be
+# useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+# The default value is: NO.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
+# cache is used to resolve symbols given their name and scope. Since this can be
+# an expensive process and often the same symbol appears multiple times in the
+# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
+# doxygen will become slower. If the cache is too large, memory is wasted. The
+# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
+# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
+# symbols. At the end of a run doxygen will report the cache usage and suggest
+# the optimal cache size from a speed point of view.
+# Minimum value: 0, maximum value: 9, default value: 0.
+
+LOOKUP_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available. Private
+# class members and static file members will be hidden unless the
+# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
+# Note: This will also disable the warnings about undocumented members that are
+# normally produced when WARNINGS is set to YES.
+# The default value is: NO.
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will
+# be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIVATE = YES
+
+# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
+# scope will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PACKAGE = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file will be
+# included in the documentation.
+# The default value is: NO.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined
+# locally in source files will be included in the documentation. If set to NO
+# only classes defined in header files are included. Does not have any effect
+# for Java sources.
+# The default value is: YES.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local methods,
+# which are defined in the implementation section but not in the interface are
+# included in the documentation. If set to NO only methods in the interface are
+# included.
+# The default value is: NO.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base name of
+# the file that contains the anonymous namespace. By default anonymous namespace
+# are hidden.
+# The default value is: NO.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
+# undocumented members inside documented classes or files. If set to NO these
+# members will be included in the various overviews, but no documentation
+# section is generated. This option has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy. If set
+# to NO these classes will be included in the various overviews. This option has
+# no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
+# (class|struct|union) declarations. If set to NO these declarations will be
+# included in the documentation.
+# The default value is: NO.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
+# documentation blocks found inside the body of a function. If set to NO these
+# blocks will be appended to the function's detailed documentation block.
+# The default value is: NO.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation that is typed after a
+# \internal command is included. If the tag is set to NO then the documentation
+# will be excluded. Set it to YES to include the internal documentation.
+# The default value is: NO.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
+# names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+# The default value is: system dependent.
+
+CASE_SENSE_NAMES = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
+# their full class and namespace scopes in the documentation. If set to YES the
+# scope will be hidden.
+# The default value is: NO.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
+# the files that are included by a file in the documentation of that file.
+# The default value is: YES.
+
+SHOW_INCLUDE_FILES = YES
+
+
+SHOW_GROUPED_MEMB_INC = NO
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
+# files with double quotes in the documentation rather than with sharp brackets.
+# The default value is: NO.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
+# documentation for inline members.
+# The default value is: YES.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
+# (detailed) documentation of file and class members alphabetically by member
+# name. If set to NO the members will appear in declaration order.
+# The default value is: YES.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
+# descriptions of file, namespace and class members alphabetically by member
+# name. If set to NO the members will appear in declaration order. Note that
+# this will also influence the order of the classes in the class list.
+# The default value is: NO.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
+# (brief and detailed) documentation of class members so that constructors and
+# destructors are listed first. If set to NO the constructors will appear in the
+# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
+# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
+# member documentation.
+# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
+# detailed member documentation.
+# The default value is: NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
+# of group names into alphabetical order. If set to NO the group names will
+# appear in their defined order.
+# The default value is: NO.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
+# fully-qualified names, including namespaces. If set to NO, the class list will
+# be sorted only by class name, not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the alphabetical
+# list.
+# The default value is: NO.
+
+SORT_BY_SCOPE_NAME = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
+# type resolution of all parameters of a function it will reject a match between
+# the prototype and the implementation of a member function even if there is
+# only one candidate or it is obvious which candidate to choose by doing a
+# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
+# accept a match between prototype and implementation in such cases.
+# The default value is: NO.
+
+STRICT_PROTO_MATCHING = NO
+
+# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the
+# todo list. This list is created by putting \todo commands in the
+# documentation.
+# The default value is: YES.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the
+# test list. This list is created by putting \test commands in the
+# documentation.
+# The default value is: YES.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug
+# list. This list is created by putting \bug commands in the documentation.
+# The default value is: YES.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO)
+# the deprecated list. This list is created by putting \deprecated commands in
+# the documentation.
+# The default value is: YES.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional documentation
+# sections, marked by \if <section_label> ... \endif and \cond <section_label>
+# ... \endcond blocks.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
+# initial value of a variable or macro / define can have for it to appear in the
+# documentation. If the initializer consists of more lines than specified here
+# it will be hidden. Use a value of 0 to hide initializers completely. The
+# appearance of the value of individual variables and macros / defines can be
+# controlled using \showinitializer or \hideinitializer command in the
+# documentation regardless of this setting.
+# Minimum value: 0, maximum value: 10000, default value: 30.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
+# the bottom of the documentation of classes and structs. If set to YES the list
+# will mention the files that were used to generate the documentation.
+# The default value is: YES.
+
+SHOW_USED_FILES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
+# will remove the Files entry from the Quick Index and from the Folder Tree View
+# (if specified).
+# The default value is: YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
+# page. This will remove the Namespaces entry from the Quick Index and from the
+# Folder Tree View (if specified).
+# The default value is: YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command command input-file, where command is the value of the
+# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
+# by doxygen. Whatever the program writes to standard output is used as the file
+# version. For an example see the documentation.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. To create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option. You can
+# optionally specify a file name after the option, if omitted DoxygenLayout.xml
+# will be used as the name of the layout file.
+#
+# Note that if you run doxygen from a directory containing a file called
+# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
+# tag is left empty.
+
+LAYOUT_FILE =
+
+# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
+# the reference definitions. This must be a list of .bib files. The .bib
+# extension is automatically appended if omitted. This requires the bibtex tool
+# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
+# For LaTeX the style of the bibliography can be controlled using
+# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
+# search path. Do not use file names with spaces, bibtex cannot handle them. See
+# also \cite for info how to create references.
+
+CITE_BIB_FILES =
+
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated to
+# standard output by doxygen. If QUIET is set to YES this implies that the
+# messages are off.
+# The default value is: NO.
+
+QUIET = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES
+# this implies that the warnings are on.
+#
+# Tip: Turn warnings on while writing the documentation.
+# The default value is: YES.
+
+WARNINGS = YES
+
+# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate
+# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
+# will automatically be disabled.
+# The default value is: YES.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some parameters
+# in a documented function, or documenting parameters that don't exist or using
+# markup commands wrongly.
+# The default value is: YES.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
+# are documented, but have no documentation for their parameters or return
+# value. If set to NO doxygen will only warn about wrong or incomplete parameter
+# documentation, but not about the absence of documentation.
+# The default value is: NO.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that doxygen
+# can produce. The string should contain the $file, $line, and $text tags, which
+# will be replaced by the file and line number from which the warning originated
+# and the warning text. Optionally the format may contain $version, which will
+# be replaced by the version of the file (if it could be obtained via
+# FILE_VERSION_FILTER)
+# The default value is: $file:$line: $text.
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning and error
+# messages should be written. If left blank the output is written to standard
+# error (stderr).
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag is used to specify the files and/or directories that contain
+# documented source files. You may enter file names like myfile.cpp or
+# directories like /usr/src/myproject. Separate the files or directories with
+# spaces.
+# Note: If this tag is empty the current directory is searched.
+
+INPUT = src
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
+# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
+# documentation (see: http://www.gnu.org/software/libiconv) for the list of
+# possible encodings.
+# The default value is: UTF-8.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank the
+# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,
+# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
+# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
+# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
+# *.qsf, *.as and *.js.
+
+FILE_PATTERNS = *.c *.h *.cpp *.f90
+
+# The RECURSIVE tag can be used to specify whether or not subdirectories should
+# be searched for input files as well.
+# The default value is: NO.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should be
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+#
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
+
+EXCLUDE = src/imported src/rdtsc.h
+
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+# The default value is: NO.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories use the pattern */test/*
+
+EXCLUDE_SYMBOLS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or directories
+# that contain example code fragments that are included (see the \include
+# command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank all
+# files are included.
+
+EXAMPLE_PATTERNS = *
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude commands
+# irrespective of the value of the RECURSIVE tag.
+# The default value is: NO.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or directories
+# that contain images that are to be included in the documentation (see the
+# \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command:
+#
+# <filter> <input-file>
+#
+# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
+# name of an input file. Doxygen will then use the output that the filter
+# program writes to standard output. If FILTER_PATTERNS is specified, this tag
+# will be ignored.
+#
+# Note that the filter must not add or remove lines; it is applied before the
+# code is scanned, but not when the output code is generated. If lines are added
+# or removed, the anchors will not be placed correctly.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form: pattern=filter
+# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
+# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
+# patterns match the file name, INPUT_FILTER is applied.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER ) will also be used to filter the input files that are used for
+# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
+# The default value is: NO.
+
+FILTER_SOURCE_FILES = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
+# it is also possible to disable source filtering for a specific pattern using
+# *.ext= (so without naming a filter).
+# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
+
+FILTER_SOURCE_PATTERNS =
+
+# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
+# is part of the input, its contents will be placed on the main page
+# (index.html). This can be useful if you have a project on for instance GitHub
+# and want to reuse the introduction page also for the doxygen output.
+
+USE_MDFILE_AS_MAINPAGE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
+# generated. Documented entities will be cross-referenced with these sources.
+#
+# Note: To get rid of all source code in the generated output, make sure that
+# also VERBATIM_HEADERS is set to NO.
+# The default value is: NO.
+
+SOURCE_BROWSER = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body of functions,
+# classes and enums directly into the documentation.
+# The default value is: NO.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
+# special comment blocks from generated source code fragments. Normal C, C++ and
+# Fortran comments will always remain visible.
+# The default value is: YES.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
+# function all documented functions referencing it will be listed.
+# The default value is: NO.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES then for each documented function
+# all documented entities called/used by that function will be listed.
+# The default value is: NO.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
+# to YES, then the hyperlinks from functions in REFERENCES_RELATION and
+# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
+# link to the documentation.
+# The default value is: YES.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
+# source code will show a tooltip with additional information such as prototype,
+# brief description and links to the definition and documentation. Since this
+# will make the HTML file larger and loading of large files a bit slower, you
+# can opt to disable this feature.
+# The default value is: YES.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+SOURCE_TOOLTIPS = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code will
+# point to the HTML generated by the htags(1) tool instead of doxygen built-in
+# source browser. The htags tool is part of GNU's global source tagging system
+# (see http://www.gnu.org/software/global/global.html). You will need version
+# 4.8.6 or higher.
+#
+# To use it do the following:
+# - Install the latest version of global
+# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
+# - Make sure the INPUT points to the root of the source tree
+# - Run doxygen as normal
+#
+# Doxygen will invoke htags (and that will in turn invoke gtags), so these
+# tools must be available from the command line (i.e. in the search path).
+#
+# The result: instead of the source browser generated by doxygen, the links to
+# source code will now point to the output of htags.
+# The default value is: NO.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
+# verbatim copy of the header file for each class for which an include is
+# specified. Set to NO to disable this.
+# See also: Section \class.
+# The default value is: YES.
+
+VERBATIM_HEADERS = YES
+
+# If the CLANG_ASSISTED_PARSING tag is set to YES, then doxygen will use the
+# clang parser (see: http://clang.llvm.org/) for more acurate parsing at the
+# cost of reduced performance. This can be particularly helpful with template
+# rich C++ code for which doxygen's built-in parser lacks the necessary type
+# information.
+# Note: The availability of this option depends on whether or not doxygen was
+# compiled with the --with-libclang option.
+# The default value is: NO.
+
+CLANG_ASSISTED_PARSING = NO
+
+# If clang assisted parsing is enabled you can provide the compiler with command
+# line options that you would normally use when invoking the compiler. Note that
+# the include paths will already be set by doxygen for the files and directories
+# specified with INPUT and INCLUDE_PATH.
+# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
+
+CLANG_OPTIONS =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
+# compounds will be generated. Enable this if the project contains a lot of
+# classes, structs, unions or interfaces.
+# The default value is: YES.
+
+ALPHABETICAL_INDEX = YES
+
+# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
+# which the alphabetical index list will be split.
+# Minimum value: 1, maximum value: 20, default value: 5.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all classes will
+# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
+# can be used to specify a prefix (or a list of prefixes) that should be ignored
+# while generating the index headers.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output
+# The default value is: YES.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
+# generated HTML page (for example: .htm, .php, .asp).
+# The default value is: .html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
+# each generated HTML page. If the tag is left blank doxygen will generate a
+# standard header.
+#
+# To get valid HTML the header file that includes any scripts and style sheets
+# that doxygen needs, which is dependent on the configuration options used (e.g.
+# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
+# default header using
+# doxygen -w html new_header.html new_footer.html new_stylesheet.css
+# YourConfigFile
+# and then modify the file new_header.html. See also section "Doxygen usage"
+# for information on how to generate the default header that doxygen normally
+# uses.
+# Note: The header is subject to change so you typically have to regenerate the
+# default header when upgrading to a newer version of doxygen. For a description
+# of the possible markers and block names see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
+# generated HTML page. If the tag is left blank doxygen will generate a standard
+# footer. See HTML_HEADER for more information on how to generate a default
+# footer and what special commands can be used inside the footer. See also
+# section "Doxygen usage" for information on how to generate the default footer
+# that doxygen normally uses.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
+# sheet that is used by each HTML page. It can be used to fine-tune the look of
+# the HTML output. If left blank doxygen will generate a default style sheet.
+# See also section "Doxygen usage" for information on how to generate the style
+# sheet that doxygen normally uses.
+# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
+# it is more robust and this tag (HTML_STYLESHEET) will in the future become
+# obsolete.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_STYLESHEET =
+
+# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user-
+# defined cascading style sheet that is included after the standard style sheets
+# created by doxygen. Using this option one can overrule certain style aspects.
+# This is preferred over using HTML_STYLESHEET since it does not replace the
+# standard style sheet and is therefor more robust against future updates.
+# Doxygen will copy the style sheet file to the output directory. For an example
+# see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_STYLESHEET =
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
+# files will be copied as-is; there are no commands or markers available.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_FILES =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
+# will adjust the colors in the stylesheet and background images according to
+# this color. Hue is specified as an angle on a colorwheel, see
+# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
+# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
+# purple, and 360 is red again.
+# Minimum value: 0, maximum value: 359, default value: 220.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_HUE = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
+# in the HTML output. For a value of 0 the output will use grayscales only. A
+# value of 255 will produce the most vivid colors.
+# Minimum value: 0, maximum value: 255, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_SAT = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
+# luminance component of the colors in the HTML output. Values below 100
+# gradually make the output lighter, whereas values above 100 make the output
+# darker. The value divided by 100 is the actual gamma applied, so 80 represents
+# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
+# change the gamma.
+# Minimum value: 40, maximum value: 240, default value: 80.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_GAMMA = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting this
+# to NO can help when comparing the output of multiple runs.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_TIMESTAMP = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
+# shown in the various tree structured indices initially; the user can expand
+# and collapse entries dynamically later on. Doxygen will expand the tree to
+# such a level that at most the specified number of entries are visible (unless
+# a fully collapsed tree already exceeds this amount). So setting the number of
+# entries 1 will produce a full collapsed tree by default. 0 is a special value
+# representing an infinite number of entries and will result in a full expanded
+# tree by default.
+# Minimum value: 0, maximum value: 9999, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files will be
+# generated that can be used as input for Apple's Xcode 3 integrated development
+# environment (see: http://developer.apple.com/tools/xcode/), introduced with
+# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
+# Makefile in the HTML output directory. Running make will produce the docset in
+# that directory and running make install will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
+# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_DOCSET = NO
+
+# This tag determines the name of the docset feed. A documentation feed provides
+# an umbrella under which multiple documentation sets from a single provider
+# (such as a company or product suite) can be grouped.
+# The default value is: Doxygen generated docs.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# This tag specifies a string that should uniquely identify the documentation
+# set bundle. This should be a reverse domain-name style string, e.g.
+# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+# The default value is: org.doxygen.Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_ID = org.doxygen.Publisher
+
+# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
+# The default value is: Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_NAME = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
+# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
+# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
+# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
+# Windows.
+#
+# The HTML Help Workshop contains a compiler that can convert all HTML output
+# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
+# files are now used as the Windows 98 help format, and will replace the old
+# Windows help format (.hlp) on all Windows platforms in the future. Compressed
+# HTML files also contain an index, a table of contents, and you can search for
+# words in the documentation. The HTML workshop also contains a viewer for
+# compressed HTML files.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_HTMLHELP = NO
+
+# The CHM_FILE tag can be used to specify the file name of the resulting .chm
+# file. You can add a path in front of the file if the result should not be
+# written to the html output directory.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_FILE =
+
+# The HHC_LOCATION tag can be used to specify the location (absolute path
+# including file name) of the HTML help compiler ( hhc.exe). If non-empty
+# doxygen will try to run the HTML help compiler on the generated index.hhp.
+# The file has to be specified with full path.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+HHC_LOCATION =
+
+# The GENERATE_CHI flag controls if a separate .chi index file is generated (
+# YES) or that it should be included in the master .chm file ( NO).
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+GENERATE_CHI = NO
+
+# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc)
+# and project file content.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_INDEX_ENCODING =
+
+# The BINARY_TOC flag controls whether a binary table of contents is generated (
+# YES) or a normal table of contents ( NO) in the .chm file.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members to
+# the table of contents of the HTML help documentation and to the tree view.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+TOC_EXPAND = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
+# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
+# (.qch) of the generated HTML documentation.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
+# the file name of the resulting .qch file. The path specified is relative to
+# the HTML output folder.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
+# Project output. For more information please see Qt Help Project / Namespace
+# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
+# Help Project output. For more information please see Qt Help Project / Virtual
+# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
+# folders).
+# The default value is: doc.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
+# filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's filter section matches. Qt Help Project / Filter Attributes (see:
+# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_SECT_FILTER_ATTRS =
+
+# The QHG_LOCATION tag can be used to specify the location of Qt's
+# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
+# generated .qhp file.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
+# generated, together with the HTML files, they form an Eclipse help plugin. To
+# install this plugin and make it available under the help contents menu in
+# Eclipse, the contents of the directory containing the HTML and XML files needs
+# to be copied into the plugins directory of eclipse. The name of the directory
+# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
+# After copying Eclipse needs to be restarted before the help appears.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the Eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have this
+# name. Each documentation set should have its own identifier.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# If you want full control over the layout of the generated HTML pages it might
+# be necessary to disable the index and replace it with your own. The
+# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
+# of each HTML page. A value of NO enables the index and the value YES disables
+# it. Since the tabs in the index contain the same information as the navigation
+# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+DISABLE_INDEX = NO
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information. If the tag
+# value is set to YES, a side panel will be generated containing a tree-like
+# index structure (just like the one that is generated for HTML Help). For this
+# to work a browser that supports JavaScript, DHTML, CSS and frames is required
+# (i.e. any modern browser). Windows users are probably better off using the
+# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can
+# further fine-tune the look of the index. As an example, the default style
+# sheet generated by doxygen has an example that shows how to put an image at
+# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
+# the same information as the tab index, you could consider setting
+# DISABLE_INDEX to YES when enabling this option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_TREEVIEW = NO
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
+# doxygen will group on one line in the generated HTML documentation.
+#
+# Note that a value of 0 will completely suppress the enum values from appearing
+# in the overview section.
+# Minimum value: 0, maximum value: 20, default value: 4.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+ENUM_VALUES_PER_LINE = 4
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
+# to set the initial width (in pixels) of the frame in which the tree is shown.
+# Minimum value: 0, maximum value: 1500, default value: 250.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+TREEVIEW_WIDTH = 250
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to
+# external symbols imported via tag files in a separate window.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+EXT_LINKS_IN_WINDOW = NO
+
+# Use this tag to change the font size of LaTeX formulas included as images in
+# the HTML documentation. When you change the font size after a successful
+# doxygen run you need to manually remove any form_*.png images from the HTML
+# output directory to force them to be regenerated.
+# Minimum value: 8, maximum value: 50, default value: 10.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_FONTSIZE = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are not
+# supported properly for IE 6.0, but are supported on all modern browsers.
+#
+# Note that when changing this option you need to delete any form_*.png files in
+# the HTML output directory before the changes have effect.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_TRANSPARENT = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
+# http://www.mathjax.org) which uses client side Javascript for the rendering
+# instead of using prerendered bitmaps. Use this if you do not have LaTeX
+# installed or if you want to formulas look prettier in the HTML output. When
+# enabled you may also need to install MathJax separately and configure the path
+# to it using the MATHJAX_RELPATH option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+USE_MATHJAX = NO
+
+# When MathJax is enabled you can set the default output format to be used for
+# the MathJax output. See the MathJax site (see:
+# http://docs.mathjax.org/en/latest/output.html) for more details.
+# Possible values are: HTML-CSS (which is slower, but has the best
+# compatibility), NativeMML (i.e. MathML) and SVG.
+# The default value is: HTML-CSS.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_FORMAT = HTML-CSS
+
+# When MathJax is enabled you need to specify the location relative to the HTML
+# output directory using the MATHJAX_RELPATH option. The destination directory
+# should contain the MathJax.js script. For instance, if the mathjax directory
+# is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
+# Content Delivery Network so you can quickly see the result without installing
+# MathJax. However, it is strongly recommended to install a local copy of
+# MathJax from http://www.mathjax.org before deployment.
+# The default value is: http://cdn.mathjax.org/mathjax/latest.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
+# extension names that should be enabled during MathJax rendering. For example
+# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_EXTENSIONS =
+
+# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
+# of code that will be used on startup of the MathJax code. See the MathJax site
+# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
+# example see the documentation.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_CODEFILE =
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
+# the HTML output. The underlying search engine uses javascript and DHTML and
+# should work on any modern browser. Note that when using HTML help
+# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
+# there is already a search function so this one should typically be disabled.
+# For large projects the javascript based search engine can be slow, then
+# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
+# search using the keyboard; to jump to the search box use <access key> + S
+# (what the <access key> is depends on the OS and browser, but it is typically
+# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
+# key> to jump into the search results window, the results can be navigated
+# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
+# the search. The filter options can be selected when the cursor is inside the
+# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
+# to select a filter and <Enter> or <escape> to activate or cancel the filter
+# option.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+SEARCHENGINE = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a web server instead of a web client using Javascript. There
+# are two flavours of web server based searching depending on the
+# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
+# searching and an index file used by the script. When EXTERNAL_SEARCH is
+# enabled the indexing and searching needs to be provided by external tools. See
+# the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SERVER_BASED_SEARCH = NO
+
+# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
+# script for searching. Instead the search results are written to an XML file
+# which needs to be processed by an external indexer. Doxygen will invoke an
+# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
+# search results.
+#
+# Doxygen ships with an example indexer ( doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/).
+#
+# See the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH = NO
+
+# The SEARCHENGINE_URL should point to a search engine hosted by a web server
+# which will return the search results when EXTERNAL_SEARCH is enabled.
+#
+# Doxygen ships with an example indexer ( doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/). See the section "External Indexing and
+# Searching" for details.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHENGINE_URL =
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
+# search data is written to a file for indexing by an external tool. With the
+# SEARCHDATA_FILE tag the name of this file can be specified.
+# The default file is: searchdata.xml.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHDATA_FILE = searchdata.xml
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
+# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
+# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
+# projects and redirect the results back to the right project.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH_ID =
+
+# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
+# projects other than the one defined by this configuration file, but that are
+# all added to the same external search index. Each project needs to have a
+# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
+# to a relative location where the documentation can be found. The format is:
+# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTRA_SEARCH_MAPPINGS =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output.
+# The default value is: YES.
+
+GENERATE_LATEX = YES
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked.
+#
+# Note that when enabling USE_PDFLATEX this option is only used for generating
+# bitmaps for formulas in the HTML output, but not in the Makefile that is
+# written to the output directory.
+# The default file is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
+# index for LaTeX.
+# The default file is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used by the
+# printer.
+# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
+# 14 inches) and executive (7.25 x 10.5 inches).
+# The default value is: a4.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PAPER_TYPE = a4
+
+# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
+# that should be included in the LaTeX output. To get the times font for
+# instance you can specify
+# EXTRA_PACKAGES=times
+# If left blank no extra packages will be included.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
+# generated LaTeX document. The header should contain everything until the first
+# chapter. If it is left blank doxygen will generate a standard header. See
+# section "Doxygen usage" for information on how to let doxygen write the
+# default header to a separate file.
+#
+# Note: Only use a user-defined header if you know what you are doing! The
+# following commands have a special meaning inside the header: $title,
+# $datetime, $date, $doxygenversion, $projectname, $projectnumber. Doxygen will
+# replace them by respectively the title of the page, the current date and time,
+# only the current date, the version number of doxygen, the project name (see
+# PROJECT_NAME), or the project number (see PROJECT_NUMBER).
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HEADER = doc/doxygen/header.tex
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
+# generated LaTeX document. The footer should contain everything after the last
+# chapter. If it is left blank doxygen will generate a standard footer.
+#
+# Note: Only use a user-defined footer if you know what you are doing!
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_FOOTER =
+
+# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the LATEX_OUTPUT output
+# directory. Note that the files will be copied as-is; there are no commands or
+# markers available.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_FILES =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
+# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
+# contain links (just like the HTML output) instead of page references. This
+# makes the output suitable for online browsing using a PDF viewer.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PDF_HYPERLINKS = YES
+
+# If the LATEX_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
+# the PDF file directly from the LaTeX files. Set this option to YES to get a
+# higher quality PDF documentation.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
+# command to the generated LaTeX files. This will instruct LaTeX to keep running
+# if errors occur, instead of asking the user for help. This option is also used
+# when generating formulas in HTML.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BATCHMODE = NO
+
+# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
+# index chapters (such as File Index, Compound Index, etc.) in the output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HIDE_INDICES = NO
+
+# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
+# code with syntax highlighting in the LaTeX output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_SOURCE_CODE = NO
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. See
+# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
+# The default value is: plain.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BIB_STYLE = plain
+
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The
+# RTF output is optimized for Word 97 and may not look too pretty with other RTF
+# readers/editors.
+# The default value is: NO.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: rtf.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
+# contain hyperlink fields. The RTF file will contain links (just like the HTML
+# output) instead of page references. This makes the output suitable for online
+# browsing using Word or some other Word compatible readers that support those
+# fields.
+#
+# Note: WordPad (write) and others do not support links.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's config
+# file, i.e. a series of assignments. You only have to provide replacements,
+# missing definitions are set to their default value.
+#
+# See also section "Doxygen usage" for information on how to generate the
+# default style sheet that doxygen normally uses.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an RTF document. Syntax is
+# similar to doxygen's config file. A template extensions file can be generated
+# using doxygen -e rtf extensionFile.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES doxygen will generate man pages for
+# classes and files.
+# The default value is: NO.
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it. A directory man3 will be created inside the directory specified by
+# MAN_OUTPUT.
+# The default directory is: man.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to the generated
+# man pages. In case the manual section does not start with a number, the number
+# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
+# optional.
+# The default value is: .3.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
+# will generate one additional man file for each entity documented in the real
+# man page(s). These additional files only source the real man page, but without
+# them the man command would be unable to find the correct page.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES doxygen will generate an XML file that
+# captures the structure of the code including all documentation.
+# The default value is: NO.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: xml.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by a
+# validating XML parser to check the syntax of the XML files.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify a XML DTD, which can be used by a
+# validating XML parser to check the syntax of the XML files.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
+# listings (including syntax highlighting and cross-referencing information) to
+# the XML output. Note that enabling this will significantly increase the size
+# of the XML output.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files
+# that can be used to generate PDF.
+# The default value is: NO.
+
+GENERATE_DOCBOOK = NO
+
+# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
+# front of it.
+# The default directory is: docbook.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_OUTPUT = docbook
+
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen
+# Definitions (see http://autogen.sf.net) file that captures the structure of
+# the code including all documentation. Note that this feature is still
+# experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module
+# file that captures the structure of the code including all documentation.
+#
+# Note that this feature is still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary
+# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
+# output from the Perl module output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely
+# formatted so it can be parsed by a human reader. This is useful if you want to
+# understand what is going on. On the other hand, if this tag is set to NO the
+# size of the Perl module output will be much smaller and Perl will parse it
+# just the same.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file are
+# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
+# so different doxyrules.make files included by the same Makefile don't
+# overwrite each other's variables.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all
+# C-preprocessor directives found in the sources and include files.
+# The default value is: YES.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names
+# in the source code. If set to NO only conditional compilation will be
+# performed. Macro expansion can be done in a controlled way by setting
+# EXPAND_ONLY_PREDEF to YES.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+MACRO_EXPANSION = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
+# the macro expansion is limited to the macros specified with the PREDEFINED and
+# EXPAND_AS_DEFINED tags.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_ONLY_PREDEF = YES
+
+# If the SEARCH_INCLUDES tag is set to YES the includes files in the
+# INCLUDE_PATH will be searched if a #include is found.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by the
+# preprocessor.
+# This tag requires that the tag SEARCH_INCLUDES is set to YES.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will be
+# used.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that are
+# defined before the preprocessor is started (similar to the -D option of e.g.
+# gcc). The argument of the tag is a list of macros of the form: name or
+# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
+# is assumed. To prevent a macro definition from being undefined via #undef or
+# recursively expanded use the := operator instead of the = operator.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+PREDEFINED = COI_LIBRARY_VERSION=2 -DMYO_SUPPORT -DOFFLOAD_DEBUG=1 -DSEP_SUPPORT -DTIMING_SUPPORT
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
+# tag can be used to specify a list of macro names that should be expanded. The
+# macro definition that is found in the sources will be used. Use the PREDEFINED
+# tag if you want to use a different macro definition that overrules the
+# definition found in the source code.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
+# remove all refrences to function-like macros that are alone on a line, have an
+# all uppercase name, and do not end with a semicolon. Such function macros are
+# typically used for boiler-plate code, and will confuse the parser if not
+# removed.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tag files. For each tag
+# file the location of the external documentation should be added. The format of
+# a tag file without this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where loc1 and loc2 can be relative or absolute paths or URLs. See the
+# section "Linking to external documentation" for more information about the use
+# of tag files.
+# Note: Each tag file must have an unique name (where the name does NOT include
+# the path). If a tag file is not located in the directory in which doxygen is
+# run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
+# tag file that is based on the input files it reads. See section "Linking to
+# external documentation" for more information about the usage of tag files.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external class will be listed in the
+# class index. If set to NO only the inherited external classes will be listed.
+# The default value is: NO.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in
+# the modules index. If set to NO, only the current project's groups will be
+# listed.
+# The default value is: YES.
+
+EXTERNAL_GROUPS = YES
+
+# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in
+# the related pages index. If set to NO, only the current project's pages will
+# be listed.
+# The default value is: YES.
+
+EXTERNAL_PAGES = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of 'which perl').
+# The default file (with absolute path) is: /usr/bin/perl.
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram
+# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
+# NO turns the diagrams off. Note that this option also works with HAVE_DOT
+# disabled, but it is recommended to install and use dot, since it yields more
+# powerful graphs.
+# The default value is: YES.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see:
+# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# You can include diagrams made with dia in doxygen documentation. Doxygen will
+# then run dia to produce the diagram and insert it in the documentation. The
+# DIA_PATH tag allows you to specify the directory where the dia binary resides.
+# If left empty dia is assumed to be found in the default search path.
+
+DIA_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide inheritance
+# and usage relations if the target is undocumented or is not a class.
+# The default value is: YES.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz (see:
+# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
+# Bell Labs. The other options in this section have no effect if this option is
+# set to NO
+# The default value is: NO.
+
+HAVE_DOT = NO
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
+# to run in parallel. When set to 0 doxygen will base this on the number of
+# processors available in the system. You can set it explicitly to a value
+# larger than 0 to get control over the balance between CPU load and processing
+# speed.
+# Minimum value: 0, maximum value: 32, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_NUM_THREADS = 0
+
+# When you want a differently looking font n the dot files that doxygen
+# generates you can specify the font name using DOT_FONTNAME. You need to make
+# sure dot is able to find the font, which can be done by putting it in a
+# standard location or by setting the DOTFONTPATH environment variable or by
+# setting DOT_FONTPATH to the directory containing the font.
+# The default value is: Helvetica.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTNAME = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
+# dot graphs.
+# Minimum value: 4, maximum value: 24, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the default font as specified with
+# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
+# the path where dot can find it using this tag.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
+# each documented class showing the direct and indirect inheritance relations.
+# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
+# graph for each documented class showing the direct and indirect implementation
+# dependencies (inheritance, containment, and class references variables) of the
+# class with other documented classes.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+COLLABORATION_GRAPH = YES
+
+# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
+# groups, showing the direct groups dependencies.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LOOK = NO
+
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
+# class node. If there are many fields or methods and many nodes the graph may
+# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
+# number of items for each type to make the size more manageable. Set this to 0
+# for no limit. Note that the threshold may be exceeded by 50% before the limit
+# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
+# but if the number exceeds 15, the total amount of fields shown is limited to
+# 10.
+# Minimum value: 0, maximum value: 100, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LIMIT_NUM_FIELDS = 10
+
+# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
+# collaboration graphs will show the relations between templates and their
+# instances.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+TEMPLATE_RELATIONS = NO
+
+# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
+# YES then doxygen will generate a graph for each documented file showing the
+# direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDE_GRAPH = YES
+
+# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
+# set to YES then doxygen will generate a graph for each documented file showing
+# the direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable call graphs for selected
+# functions only using the \callgraph command.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable caller graphs for selected
+# functions only using the \callergraph command.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
+# hierarchy of all classes instead of a textual one.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
+# dependencies a directory has on other directories in a graphical way. The
+# dependency relations are determined by the #include relations between the
+# files in the directories.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot.
+# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
+# to make the SVG files visible in IE 9+ (other browsers do not have this
+# requirement).
+# Possible values are: png, jpg, gif and svg.
+# The default value is: png.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_IMAGE_FORMAT = png
+
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+#
+# Note that this requires a modern browser other than Internet Explorer. Tested
+# and working are Firefox, Chrome, Safari, and Opera.
+# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
+# the SVG files visible. Older versions of IE do not have SVG support.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INTERACTIVE_SVG = NO
+
+# The DOT_PATH tag can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the \dotfile
+# command).
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOTFILE_DIRS =
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the \mscfile
+# command).
+
+MSCFILE_DIRS =
+
+# The DIAFILE_DIRS tag can be used to specify one or more directories that
+# contain dia files that are included in the documentation (see the \diafile
+# command).
+
+DIAFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
+# that will be shown in the graph. If the number of nodes in a graph becomes
+# larger than this value, doxygen will truncate the graph, which is visualized
+# by representing a node as a red box. Note that doxygen if the number of direct
+# children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
+# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+# Minimum value: 0, maximum value: 10000, default value: 50.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
+# generated by dot. A depth value of 3 means that only nodes reachable from the
+# root by following a path via at most 3 edges will be shown. Nodes that lay
+# further from the root node will be omitted. Note that setting this option to 1
+# or 2 may greatly reduce the computation time needed for large code bases. Also
+# note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+# Minimum value: 0, maximum value: 1000, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not seem
+# to support this out of the box.
+#
+# Warning: Depending on the platform used, enabling this option may lead to
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
+# read).
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10) support
+# this, this feature is disabled by default.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_MULTI_TARGETS = NO
+
+# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
+# explaining the meaning of the various boxes and arrows in the dot generated
+# graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot
+# files that are used to generate the various graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_CLEANUP = YES
diff --git a/liboffloadmic/doc/doxygen/header.tex b/liboffloadmic/doc/doxygen/header.tex
new file mode 100644
index 00000000000..b64a4636b9a
--- /dev/null
+++ b/liboffloadmic/doc/doxygen/header.tex
@@ -0,0 +1,90 @@
+% Latex header for doxygen 1.8.3.1
+\documentclass{book}
+\usepackage[a4paper,top=2.5cm,bottom=2.5cm,left=2.5cm,right=2.5cm]{geometry}
+\usepackage{makeidx}
+\usepackage{natbib}
+\usepackage{graphicx}
+\usepackage{multicol}
+\usepackage{float}
+\usepackage{listings}
+\usepackage{color}
+\usepackage{ifthen}
+\usepackage[table]{xcolor}
+\usepackage{textcomp}
+\usepackage{alltt}
+\usepackage{ifpdf}
+\ifpdf
+\usepackage[pdftex,
+ pagebackref=true,
+ colorlinks=true,
+ linkcolor=blue,
+ unicode
+ ]{hyperref}
+\else
+\usepackage[ps2pdf,
+ pagebackref=true,
+ colorlinks=true,
+ linkcolor=blue,
+ unicode
+ ]{hyperref}
+\usepackage{pspicture}
+\fi
+\usepackage[utf8]{inputenc}
+\usepackage{mathptmx}
+\usepackage[scaled=.90]{helvet}
+\usepackage{courier}
+\usepackage{sectsty}
+\usepackage{amssymb}
+\usepackage[titles]{tocloft}
+\usepackage{doxygen}
+\usepackage{fancyhdr}
+\pagestyle{fancy}
+\lstset{language=C++,inputencoding=utf8,basicstyle=\footnotesize,breaklines=true,breakatwhitespace=true,tabsize=4,numbers=left }
+\makeindex
+\setcounter{tocdepth}{3}
+\renewcommand{\footrulewidth}{0.4pt}
+\renewcommand{\familydefault}{\sfdefault}
+\hfuzz=15pt
+\setlength{\emergencystretch}{15pt}
+\hbadness=750
+\tolerance=750
+\begin{document}
+\hypersetup{pageanchor=false,citecolor=blue}
+\begin{titlepage}
+\vspace*{7cm}
+\begin{center}
+{\Large Intel\textsuperscript{\textregistered} Offload Runtime Library }\\
+\vspace*{1cm}
+{\large Generated by Doxygen $doxygenversion }\\
+\vspace*{0.5cm}
+{\small $datetime }\\
+\end{center}
+\end{titlepage}
+
+{\bf FTC Optimization Notice}
+
+Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for
+optimizations that are not unique to Intel microprocessors. These optimizations include SSE2,
+SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the
+availability, functionality, or effectiveness of any optimization on microprocessors not
+manufactured by Intel.
+
+Microprocessor-dependent optimizations in this product are intended for use with Intel
+microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for
+Intel microprocessors. Please refer to the applicable product User and Reference Guides for
+more information regarding the specific instruction sets covered by this notice.
+
+Notice revision \#20110804
+
+\vspace*{0.5cm}
+
+{\bf Trademarks}
+
+Intel, Xeon, and Intel Xeon Phi are trademarks of Intel Corporation in the U.S. and/or other countries.
+
+This document is Copyright \textcopyright 2014, Intel Corporation. All rights reserved.
+
+\pagenumbering{roman}
+\tableofcontents
+\pagenumbering{arabic}
+\hypersetup{pageanchor=true,citecolor=blue}
diff --git a/liboffloadmic/include/coi/common/COIEngine_common.h b/liboffloadmic/include/coi/common/COIEngine_common.h
new file mode 100644
index 00000000000..87123128cf9
--- /dev/null
+++ b/liboffloadmic/include/coi/common/COIEngine_common.h
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2010-2013 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 2.1.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ *
+ * Disclaimer: The codes contained in these modules may be specific
+ * to the Intel Software Development Platform codenamed Knights Ferry,
+ * and the Intel product codenamed Knights Corner, and are not backward
+ * compatible with other Intel products. Additionally, Intel will NOT
+ * support the codes or instruction set in future products.
+ *
+ * Intel offers no warranty of any kind regarding the code. This code is
+ * licensed on an "AS IS" basis and Intel is not obligated to provide
+ * any support, assistance, installation, training, or other services
+ * of any kind. Intel is also not obligated to provide any updates,
+ * enhancements or extensions. Intel specifically disclaims any warranty
+ * of merchantability, non-infringement, fitness for any particular
+ * purpose, and any other warranty.
+ *
+ * Further, Intel disclaims all liability of any kind, including but
+ * not limited to liability for infringement of any proprietary rights,
+ * relating to the use of the code, even if Intel is notified of the
+ * possibility of such liability. Except as expressly stated in an Intel
+ * license agreement provided with this code and agreed upon with Intel,
+ * no license, express or implied, by estoppel or otherwise, to any
+ * intellectual property rights is granted herein.
+ */
+
+#ifndef _COIENGINE_COMMON_H
+#define _COIENGINE_COMMON_H
+
+/** @ingroup COIEngine
+ * @addtogroup COIEnginecommon
+@{
+* @file common/COIEngine_common.h
+*/
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+#include "../common/COITypes_common.h"
+#include "../common/COIResult_common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
+#define COI_MAX_ISA_x86_64_DEVICES 1
+#define COI_MAX_ISA_MIC_DEVICES 128
+#define COI_MAX_ISA_KNF_DEVICES COI_MAX_ISA_MIC_DEVICES
+#define COI_MAX_ISA_KNC_DEVICES COI_MAX_ISA_MIC_DEVICES
+
+
+///////////////////////////////////////////////////////////////////////////////
+///
+/// List of ISA types of supported engines.
+///
+typedef enum
+{
+ COI_ISA_INVALID = 0, ///< Represents an invalid ISA.
+ COI_ISA_x86_64, ///< The ISA for an x86_64 host engine.
+ COI_ISA_MIC, ///< Special value used to represent any device
+ ///< in the Intel(R) Many Integrated Core
+ ///< architecture family.
+ COI_ISA_KNF, ///< ISA for L1OM devices.
+ COI_ISA_KNC ///< ISA for K1OM devices.
+} COI_ISA_TYPE;
+
+
+///////////////////////////////////////////////////////////////////////////////
+///
+/// Get the information about the COIEngine executing this function call.
+///
+/// @param out_pType
+/// [out] The COI_ISA_TYPE of the engine.
+///
+/// @param out_pIndex
+/// [out] The zero-based index of this engine in the collection of
+/// engines of the ISA returned in out_pType.
+///
+/// @return COI_INVALID_POINTER if the any of the parameters are NULL.
+///
+/// @return COI_SUCCESS
+///
+COIACCESSAPI
+COIRESULT
+COIEngineGetIndex(
+ COI_ISA_TYPE* out_pType,
+ uint32_t* out_pIndex);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* _COIENGINE_COMMON_H */
+
+/*! @} */
diff --git a/liboffloadmic/include/coi/common/COIMacros_common.h b/liboffloadmic/include/coi/common/COIMacros_common.h
new file mode 100644
index 00000000000..6abddfedaf3
--- /dev/null
+++ b/liboffloadmic/include/coi/common/COIMacros_common.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2010-2013 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 2.1.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ *
+ * Disclaimer: The codes contained in these modules may be specific
+ * to the Intel Software Development Platform codenamed Knights Ferry,
+ * and the Intel product codenamed Knights Corner, and are not backward
+ * compatible with other Intel products. Additionally, Intel will NOT
+ * support the codes or instruction set in future products.
+ *
+ * Intel offers no warranty of any kind regarding the code. This code is
+ * licensed on an "AS IS" basis and Intel is not obligated to provide
+ * any support, assistance, installation, training, or other services
+ * of any kind. Intel is also not obligated to provide any updates,
+ * enhancements or extensions. Intel specifically disclaims any warranty
+ * of merchantability, non-infringement, fitness for any particular
+ * purpose, and any other warranty.
+ *
+ * Further, Intel disclaims all liability of any kind, including but
+ * not limited to liability for infringement of any proprietary rights,
+ * relating to the use of the code, even if Intel is notified of the
+ * possibility of such liability. Except as expressly stated in an Intel
+ * license agreement provided with this code and agreed upon with Intel,
+ * no license, express or implied, by estoppel or otherwise, to any
+ * intellectual property rights is granted herein.
+ */
+
+#ifndef _COIMACROS_COMMON_H
+#define _COIMACROS_COMMON_H
+
+/// @file common/COIMacros_common.h
+/// Commonly used macros
+
+// Note that UNUSUED_ATTR means that it is "possibly" unused, not "definitely".
+// This should compile out in release mode if indeed it is unused.
+ #define UNUSED_ATTR __attribute__((unused))
+#ifndef UNREFERENCED_CONST_PARAM
+#define UNREFERENCED_CONST_PARAM(P) { void* x UNUSED_ATTR = \
+ (void*)(uint64_t)P; \
+ }
+#endif
+
+// This seems to work on everything.
+#ifndef UNREFERENCED_PARAM
+#define UNREFERENCED_PARAM(P) (P = P)
+#endif
+
+#ifndef SYMBOL_VERSION
+
+/* Linux support: */
+
+ #define SYMBOL_VERSION( SYMBOL , VERSION ) SYMBOL ## VERSION
+
+#endif
+
+#endif /* _COIMACROS_COMMON_H */
diff --git a/liboffloadmic/include/coi/common/COIPerf_common.h b/liboffloadmic/include/coi/common/COIPerf_common.h
new file mode 100644
index 00000000000..b81756f1cc1
--- /dev/null
+++ b/liboffloadmic/include/coi/common/COIPerf_common.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2010-2013 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 2.1.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ *
+ * Disclaimer: The codes contained in these modules may be specific
+ * to the Intel Software Development Platform codenamed Knights Ferry,
+ * and the Intel product codenamed Knights Corner, and are not backward
+ * compatible with other Intel products. Additionally, Intel will NOT
+ * support the codes or instruction set in future products.
+ *
+ * Intel offers no warranty of any kind regarding the code. This code is
+ * licensed on an "AS IS" basis and Intel is not obligated to provide
+ * any support, assistance, installation, training, or other services
+ * of any kind. Intel is also not obligated to provide any updates,
+ * enhancements or extensions. Intel specifically disclaims any warranty
+ * of merchantability, non-infringement, fitness for any particular
+ * purpose, and any other warranty.
+ *
+ * Further, Intel disclaims all liability of any kind, including but
+ * not limited to liability for infringement of any proprietary rights,
+ * relating to the use of the code, even if Intel is notified of the
+ * possibility of such liability. Except as expressly stated in an Intel
+ * license agreement provided with this code and agreed upon with Intel,
+ * no license, express or implied, by estoppel or otherwise, to any
+ * intellectual property rights is granted herein.
+ */
+
+#ifndef _COIPERF_COMMON_H
+#define _COIPERF_COMMON_H
+
+/** @ingroup COIPerf
+ * @addtogroup COIPerfCommon
+@{
+
+* @file common/COIPerf_common.h
+* Performance Analysis API */
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+#include "../common/COITypes_common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
+///////////////////////////////////////////////////////////////////////////////
+///
+/// Returns a performance counter value
+///
+/// This function returns a performance counter value that increments
+/// at a constant rate for all time and is coherent across all cores.
+///
+/// @return Current performance counter value or 0 if no performance counter
+///// is available
+///
+///
+COIACCESSAPI
+uint64_t COIPerfGetCycleCounter(void);
+
+///////////////////////////////////////////////////////////////////////////////
+///
+/// Returns the calculated system frequency in hertz.
+///
+/// @return Current system frequency in hertz.
+///
+COIACCESSAPI
+uint64_t COIPerfGetCycleFrequency(void);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+/*! @} */
+
+#endif /* _COIPERF_COMMON_H */
diff --git a/liboffloadmic/include/coi/common/COIResult_common.h b/liboffloadmic/include/coi/common/COIResult_common.h
new file mode 100644
index 00000000000..df8a4f68149
--- /dev/null
+++ b/liboffloadmic/include/coi/common/COIResult_common.h
@@ -0,0 +1,145 @@
+/*
+ * Copyright 2010-2013 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 2.1.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ *
+ * Disclaimer: The codes contained in these modules may be specific
+ * to the Intel Software Development Platform codenamed Knights Ferry,
+ * and the Intel product codenamed Knights Corner, and are not backward
+ * compatible with other Intel products. Additionally, Intel will NOT
+ * support the codes or instruction set in future products.
+ *
+ * Intel offers no warranty of any kind regarding the code. This code is
+ * licensed on an "AS IS" basis and Intel is not obligated to provide
+ * any support, assistance, installation, training, or other services
+ * of any kind. Intel is also not obligated to provide any updates,
+ * enhancements or extensions. Intel specifically disclaims any warranty
+ * of merchantability, non-infringement, fitness for any particular
+ * purpose, and any other warranty.
+ *
+ * Further, Intel disclaims all liability of any kind, including but
+ * not limited to liability for infringement of any proprietary rights,
+ * relating to the use of the code, even if Intel is notified of the
+ * possibility of such liability. Except as expressly stated in an Intel
+ * license agreement provided with this code and agreed upon with Intel,
+ * no license, express or implied, by estoppel or otherwise, to any
+ * intellectual property rights is granted herein.
+ */
+
+#ifndef _COIRESULT_COMMON_H
+#define _COIRESULT_COMMON_H
+
+/** @ingroup COIResult
+ * @addtogroup COIResultCommon
+@{
+
+* @file common/COIResult_common.h
+* Result codes and definitions. */
+
+#include "../common/COITypes_common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum COIRESULT
+{
+ COI_SUCCESS = 0, ///< The function succeeded without error.
+ COI_ERROR, ///< Unspecified error.
+ COI_NOT_INITIALIZED, ///< The function was called before the
+ ///< system was initialized.
+ COI_ALREADY_INITIALIZED, ///< The function was called after the
+ ///< system was initialized.
+ COI_ALREADY_EXISTS, ///< Cannot complete the request due to
+ ///< the existence of a similar object.
+ COI_DOES_NOT_EXIST, ///< The specified object was not found.
+ COI_INVALID_POINTER, ///< One of the provided addresses was not
+ ///< valid.
+ COI_OUT_OF_RANGE, ///< One of the arguments contains a value
+ ///< that is invalid.
+ COI_NOT_SUPPORTED, ///< This function is not currently
+ ///< supported as used.
+ COI_TIME_OUT_REACHED, ///< The specified time out caused the
+ ///< function to abort.
+ COI_MEMORY_OVERLAP, ///< The source and destination range
+ ///< specified overlaps for the same
+ ///< buffer.
+ COI_ARGUMENT_MISMATCH, ///< The specified arguments are not
+ ///< compatible.
+ COI_SIZE_MISMATCH, ///< The specified size does not match the
+ ///< expected size.
+ COI_OUT_OF_MEMORY, ///< The function was unable to allocate
+ ///< the required memory.
+ COI_INVALID_HANDLE, ///< One of the provided handles was not
+ ///< valid.
+ COI_RETRY, ///< This function currently can't
+ ///< complete, but might be able to later.
+ COI_RESOURCE_EXHAUSTED, ///< The resource was not large enough.
+ COI_ALREADY_LOCKED, ///< The object was expected to be
+ ///< unlocked, but was locked.
+ COI_NOT_LOCKED, ///< The object was expected to be locked,
+ ///< but was unlocked.
+ COI_MISSING_DEPENDENCY, ///< One or more dependent components
+ ///< could not be found.
+ COI_UNDEFINED_SYMBOL, ///< One or more symbols the component
+ ///< required was not defined in any
+ ///< library.
+ COI_PENDING, ///< Operation is not finished
+ COI_BINARY_AND_HARDWARE_MISMATCH, ///< A specified binary will not run on
+ ///< the specified hardware.
+ COI_PROCESS_DIED,
+ COI_INVALID_FILE, ///< The file is invalid for its intended
+ ///< usage in the function.
+ COI_EVENT_CANCELED, ///< Event wait on a user event that
+ ///< was unregistered or is being
+ ///< unregistered returns
+ ///< COI_EVENT_CANCELED.
+ COI_VERSION_MISMATCH, ///< The version of Intel(R) Coprocessor
+ ///< Offload Infrastructure on the host
+ ///< is not compatible with the version
+ ///< on the device.
+ COI_BAD_PORT, ///< The port that the host is set to
+ ///< connect to is invalid.
+ COI_AUTHENTICATION_FAILURE, ///< The daemon was unable to authenticate
+ ///< the user that requested an engine.
+ ///< Only reported if daemon is set up for
+ ///< authorization.
+ COI_NUM_RESULTS ///< Reserved, do not use.
+}
+COIRESULT;
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// Returns the string version of the passed in COIRESULT. Thus if
+/// COI_RETRY is passed in, this function returns the string "COI_RETRY". If
+/// the error code passed ins is not valid then "COI_ERROR" will be returned.
+///
+/// @param in_ResultCode
+/// [in] COIRESULT code to return the string version of.
+///
+/// @return String version of the passed in COIRESULT code.
+///
+COIACCESSAPI
+const char*
+COIResultGetName(
+ COIRESULT in_ResultCode);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* _COIRESULT_COMMON_H */
+
+/*! @} */
diff --git a/liboffloadmic/include/coi/common/COITypes_common.h b/liboffloadmic/include/coi/common/COITypes_common.h
new file mode 100644
index 00000000000..78180dce81b
--- /dev/null
+++ b/liboffloadmic/include/coi/common/COITypes_common.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2010-2013 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 2.1.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ *
+ * Disclaimer: The codes contained in these modules may be specific
+ * to the Intel Software Development Platform codenamed Knights Ferry,
+ * and the Intel product codenamed Knights Corner, and are not backward
+ * compatible with other Intel products. Additionally, Intel will NOT
+ * support the codes or instruction set in future products.
+ *
+ * Intel offers no warranty of any kind regarding the code. This code is
+ * licensed on an "AS IS" basis and Intel is not obligated to provide
+ * any support, assistance, installation, training, or other services
+ * of any kind. Intel is also not obligated to provide any updates,
+ * enhancements or extensions. Intel specifically disclaims any warranty
+ * of merchantability, non-infringement, fitness for any particular
+ * purpose, and any other warranty.
+ *
+ * Further, Intel disclaims all liability of any kind, including but
+ * not limited to liability for infringement of any proprietary rights,
+ * relating to the use of the code, even if Intel is notified of the
+ * possibility of such liability. Except as expressly stated in an Intel
+ * license agreement provided with this code and agreed upon with Intel,
+ * no license, express or implied, by estoppel or otherwise, to any
+ * intellectual property rights is granted herein.
+ */
+
+#ifndef _COITYPES_COMMON_H
+#define _COITYPES_COMMON_H
+
+/** @ingroup COITypes
+ * @addtogroup COITypesSource
+@{
+
+* @file common/COITypes_common.h
+*/
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+ #include <stdint.h>
+ #include <wchar.h>
+ #define COIACCESSAPI /* nothing */
+ #define COIACCESSAPI2 /* nothing */
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct coievent { uint64_t opaque[2]; };
+
+typedef struct coiprocess * COIPROCESS;
+typedef struct coipipeline * COIPIPELINE;
+typedef struct coifunction * COIFUNCTION;
+typedef struct coiengine * COIENGINE;
+typedef struct coievent COIEVENT;
+typedef struct coibuffer * COIBUFFER;
+typedef struct coilibrary * COILIBRARY;
+typedef struct coimapinst * COIMAPINSTANCE;
+
+typedef uint64_t COI_CPU_MASK[16];
+
+/**
+ * On Windows, coi_wchar_t is a uint32_t. On Windows, wchar_t is 16 bits wide, and on Linux it is 32 bits wide, so uint32_t is used for portability.
+ */
+typedef wchar_t coi_wchar_t;
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* _COITYPES_COMMON_H */
diff --git a/liboffloadmic/include/coi/sink/COIBuffer_sink.h b/liboffloadmic/include/coi/sink/COIBuffer_sink.h
new file mode 100644
index 00000000000..66d0549010d
--- /dev/null
+++ b/liboffloadmic/include/coi/sink/COIBuffer_sink.h
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2010-2013 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 2.1.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ *
+ * Disclaimer: The codes contained in these modules may be specific
+ * to the Intel Software Development Platform codenamed Knights Ferry,
+ * and the Intel product codenamed Knights Corner, and are not backward
+ * compatible with other Intel products. Additionally, Intel will NOT
+ * support the codes or instruction set in future products.
+ *
+ * Intel offers no warranty of any kind regarding the code. This code is
+ * licensed on an "AS IS" basis and Intel is not obligated to provide
+ * any support, assistance, installation, training, or other services
+ * of any kind. Intel is also not obligated to provide any updates,
+ * enhancements or extensions. Intel specifically disclaims any warranty
+ * of merchantability, non-infringement, fitness for any particular
+ * purpose, and any other warranty.
+ *
+ * Further, Intel disclaims all liability of any kind, including but
+ * not limited to liability for infringement of any proprietary rights,
+ * relating to the use of the code, even if Intel is notified of the
+ * possibility of such liability. Except as expressly stated in an Intel
+ * license agreement provided with this code and agreed upon with Intel,
+ * no license, express or implied, by estoppel or otherwise, to any
+ * intellectual property rights is granted herein.
+ */
+
+#ifndef _COIBUFFER_SINK_H
+#define _COIBUFFER_SINK_H
+
+/** @ingroup COIBuffer
+ * @addtogroup COIBufferSink
+@{
+
+* @file sink\COIBuffer_sink.h
+*/
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+#include "../common/COITypes_common.h"
+#include "../common/COIResult_common.h"
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// Adds a reference to the memory of a buffer. The memory of the buffer
+/// will remain on the device until both a corresponding COIBufferReleaseRef()
+/// call is made and the run function that delivered the buffer returns.
+///
+/// Intel® Coprocessor Offload Infrastructure (Intel® COI) streaming buffers should not be AddRef'd. Doing so may result in
+/// unpredictable results or may cause the sink process to crash.
+///
+/// @warning 1.It is possible for enqueued run functions to be unable to
+/// execute due to all card memory being occupied by addref'ed
+/// buffers. As such, it is important that whenever a buffer is
+/// addref'd that there be no dependencies on future run functions
+/// for progress to be made towards releasing the buffer.
+/// 2.It is important that AddRef is called within the scope of
+/// run function that carries the buffer to be addref'ed.
+///
+/// @param in_pBuffer
+/// [in] Pointer to the start of a buffer being addref'ed, that was
+/// passed in at the start of the run function.
+///
+/// @return COI_SUCCESS if the buffer ref count was successfully incremented.
+///
+/// @return COI_INVALID_POINTER if the buffer pointer is NULL.
+///
+/// @return COI_INVALID_HANDLE if the buffer pointer is invalid.
+///
+COIRESULT
+COIBufferAddRef(
+ void* in_pBuffer);
+
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// Removes a reference to the memory of a buffer. The memory of the buffer
+/// will be eligible for being freed on the device when the following
+/// conditions are met: the run function that delivered the buffer
+/// returns, and the number of calls to COIBufferReleaseRef() matches the
+/// number of calls to COIBufferAddRef().
+///
+/// @warning When a buffer is addref'ed it is assumed that it is in use and all
+/// other operations on that buffer waits for ReleaseRef() to happen.
+/// So you cannot pass the addref'ed buffer's handle to RunFunction
+/// that calls ReleaseRef(). This is a circular dependency and will
+/// cause a deadlock. Buffer's pointer (buffer's sink side
+/// address/pointer which is different than source side BUFFER handle)
+/// needs to be stored somewhere to retrieve it later to use in
+/// ReleaseRef.
+///
+/// @param in_pBuffer
+/// [in] Pointer to the start of a buffer previously addref'ed, that
+/// was passed in at the start of the run function.
+///
+/// @return COI_SUCCESS if the buffer refcount was successfully decremented.
+///
+/// @return COI_INVALID_POINTER if the buffer pointer was invalid.
+///
+/// @return COI_INVALID_HANDLE if the buffer did not have COIBufferAddRef()
+/// previously called on it.
+///
+COIRESULT
+COIBufferReleaseRef(
+ void* in_pBuffer);
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* _COIBUFFER_SINK_H */
+
+/*! @} */
diff --git a/liboffloadmic/include/coi/sink/COIPipeline_sink.h b/liboffloadmic/include/coi/sink/COIPipeline_sink.h
new file mode 100644
index 00000000000..ccfde205dea
--- /dev/null
+++ b/liboffloadmic/include/coi/sink/COIPipeline_sink.h
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2010-2013 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 2.1.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ *
+ * Disclaimer: The codes contained in these modules may be specific
+ * to the Intel Software Development Platform codenamed Knights Ferry,
+ * and the Intel product codenamed Knights Corner, and are not backward
+ * compatible with other Intel products. Additionally, Intel will NOT
+ * support the codes or instruction set in future products.
+ *
+ * Intel offers no warranty of any kind regarding the code. This code is
+ * licensed on an "AS IS" basis and Intel is not obligated to provide
+ * any support, assistance, installation, training, or other services
+ * of any kind. Intel is also not obligated to provide any updates,
+ * enhancements or extensions. Intel specifically disclaims any warranty
+ * of merchantability, non-infringement, fitness for any particular
+ * purpose, and any other warranty.
+ *
+ * Further, Intel disclaims all liability of any kind, including but
+ * not limited to liability for infringement of any proprietary rights,
+ * relating to the use of the code, even if Intel is notified of the
+ * possibility of such liability. Except as expressly stated in an Intel
+ * license agreement provided with this code and agreed upon with Intel,
+ * no license, express or implied, by estoppel or otherwise, to any
+ * intellectual property rights is granted herein.
+ */
+
+#ifndef _COIPIPELINE_SINK_H
+#define _COIPIPELINE_SINK_H
+
+/** @ingroup COIPipeline
+ * @addtogroup COIPipelineSink
+@{
+* @file sink/COIPipeline_sink.h
+*/
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+#include "../common/COITypes_common.h"
+#include "../common/COIResult_common.h"
+
+#ifdef __FreeBSD__
+#define COINATIVELIBEXPORT_VISIBILITY "extern"
+#else
+#define COINATIVELIBEXPORT_VISIBILITY "default"
+#endif
+
+#ifdef __cplusplus
+#define COINATIVELIBEXPORT \
+ extern "C" __attribute__ ((visibility(COINATIVELIBEXPORT_VISIBILITY)))
+#else
+#define COINATIVELIBEXPORT \
+ __attribute__ ((visibility(COINATIVELIBEXPORT_VISIBILITY)))
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// This is the prototype that run functions should follow.
+///
+/// @param in_BufferCount
+/// The number of buffers passed to the run function.
+///
+/// @param in_ppBufferPointers
+/// An array that is in_BufferCount in length that contains the
+/// sink side virtual addresses for each buffer passed in to
+/// the run function.
+///
+/// @param in_pBufferLengths
+/// An array that is in_BufferCount in length of uint32_t integers
+/// describing the length of each passed in buffer in bytes.
+///
+/// @param in_pMiscData
+/// Pointer to the MiscData passed in when the run function
+/// was enqueued on the source.
+///
+/// @param in_MiscDataLen
+/// Length in bytes of the MiscData passed in when the run function
+/// was enqueued on the source.
+///
+/// @param in_pReturnValue
+/// Pointer to the location where the return value from this run
+/// function will be stored.
+///
+/// @param in_ReturnValueLength
+/// Length in bytes of the user-allocated ReturnValue pointer.
+///
+/// @return A uint64_t that can be retrieved in the out_UserData parameter
+/// from the COIPipelineWaitForEvent function.
+///
+typedef void
+(*RunFunctionPtr_t)(
+ uint32_t in_BufferCount,
+ void** in_ppBufferPointers,
+ uint64_t* in_pBufferLengths,
+ void* in_pMiscData,
+ uint16_t in_MiscDataLength,
+ void* in_pReturnValue,
+ uint16_t in_ReturnValueLength);
+
+///////////////////////////////////////////////////////////////////////////////
+///
+/// Start processing pipelines on the Sink. This should be done after any
+/// required initialization in the Sink's application has finished. No
+/// run functions will actually be executed (although they may be queued)
+/// until this function is called.
+///
+///
+/// @return COI_SUCCESS if the pipelines were successfully started.
+///
+COIRESULT
+COIPipelineStartExecutingRunFunctions();
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* _COIPIPELINE_SINK_H */
+
+/*! @} */
diff --git a/liboffloadmic/include/coi/sink/COIProcess_sink.h b/liboffloadmic/include/coi/sink/COIProcess_sink.h
new file mode 100644
index 00000000000..90603262c8b
--- /dev/null
+++ b/liboffloadmic/include/coi/sink/COIProcess_sink.h
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2010-2013 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 2.1.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ *
+ * Disclaimer: The codes contained in these modules may be specific
+ * to the Intel Software Development Platform codenamed Knights Ferry,
+ * and the Intel product codenamed Knights Corner, and are not backward
+ * compatible with other Intel products. Additionally, Intel will NOT
+ * support the codes or instruction set in future products.
+ *
+ * Intel offers no warranty of any kind regarding the code. This code is
+ * licensed on an "AS IS" basis and Intel is not obligated to provide
+ * any support, assistance, installation, training, or other services
+ * of any kind. Intel is also not obligated to provide any updates,
+ * enhancements or extensions. Intel specifically disclaims any warranty
+ * of merchantability, non-infringement, fitness for any particular
+ * purpose, and any other warranty.
+ *
+ * Further, Intel disclaims all liability of any kind, including but
+ * not limited to liability for infringement of any proprietary rights,
+ * relating to the use of the code, even if Intel is notified of the
+ * possibility of such liability. Except as expressly stated in an Intel
+ * license agreement provided with this code and agreed upon with Intel,
+ * no license, express or implied, by estoppel or otherwise, to any
+ * intellectual property rights is granted herein.
+ */
+
+#ifndef _COIPROCESS_SINK_H
+#define _COIPROCESS_SINK_H
+
+/** @ingroup COIProcess
+ * @addtogroup COIProcessSink
+@{
+* @file sink/COIProcess_sink.h
+*/
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+#include "../common/COITypes_common.h"
+#include "../common/COIResult_common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// This call will block while waiting for the source to send a process destroy
+/// message. This provides the sink side application with an event to keep the
+/// main() function from exiting until it is directed to by the source. When
+/// the shutdown message is received this function will stop any future run
+/// functions from executing but will wait for any current run functions to
+/// complete. All Intel® Coprocessor Offload Infrastructure (Intel® COI) resources will be cleaned up and no additional Intel® Coprocessor Offload Infrastructure (Intel® COI) APIs
+/// should be called after this function returns. This function does not
+/// invoke exit() so the application can perform any of its own cleanup once
+/// this call returns.
+///
+/// @return COI_SUCCESS once the process receives the shutdown message.
+///
+COIRESULT
+COIProcessWaitForShutdown();
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// This call will block until all stdout and stderr output has been proxied
+/// to and written by the source. This call guarantees that any output in a
+/// run function is transmitted to the source before the run function signals
+/// its completion event back to the source.
+///
+/// Note that having an additional thread printing forever while another
+/// calls COIProxyFlush may lead to a hang because the process will be forced
+/// to wait until all that output can be flushed to the source before returning
+/// from this call.
+///
+/// @return COI_SUCCESS once the proxy output has been flushed to and written
+/// written by the host. Note that Intel® Coprocessor Offload Infrastructure (Intel® COI) on the source writes to stdout
+/// and stderr, but does not flush this output.
+/// @return COI_SUCCESS if the process was created without enabling
+/// proxy IO this function.
+///
+COIRESULT
+COIProcessProxyFlush();
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* _COIPROCESS_SINK_H */
+
+/*! @} */
diff --git a/liboffloadmic/include/coi/source/COIBuffer_source.h b/liboffloadmic/include/coi/source/COIBuffer_source.h
new file mode 100644
index 00000000000..4a08856f5d1
--- /dev/null
+++ b/liboffloadmic/include/coi/source/COIBuffer_source.h
@@ -0,0 +1,1311 @@
+/*
+ * Copyright 2010-2013 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 2.1.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ *
+ * Disclaimer: The codes contained in these modules may be specific
+ * to the Intel Software Development Platform codenamed Knights Ferry,
+ * and the Intel product codenamed Knights Corner, and are not backward
+ * compatible with other Intel products. Additionally, Intel will NOT
+ * support the codes or instruction set in future products.
+ *
+ * Intel offers no warranty of any kind regarding the code. This code is
+ * licensed on an "AS IS" basis and Intel is not obligated to provide
+ * any support, assistance, installation, training, or other services
+ * of any kind. Intel is also not obligated to provide any updates,
+ * enhancements or extensions. Intel specifically disclaims any warranty
+ * of merchantability, non-infringement, fitness for any particular
+ * purpose, and any other warranty.
+ *
+ * Further, Intel disclaims all liability of any kind, including but
+ * not limited to liability for infringement of any proprietary rights,
+ * relating to the use of the code, even if Intel is notified of the
+ * possibility of such liability. Except as expressly stated in an Intel
+ * license agreement provided with this code and agreed upon with Intel,
+ * no license, express or implied, by estoppel or otherwise, to any
+ * intellectual property rights is granted herein.
+ */
+
+#ifndef _COIBUFFER_SOURCE_H
+#define _COIBUFFER_SOURCE_H
+
+/** @ingroup COIBuffer
+ * @addtogroup COIBufferSource
+@{
+
+* @file source\COIBuffer_source.h
+*/
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+#include "../common/COITypes_common.h"
+#include "../common/COIResult_common.h"
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+///////////////////////////////////////////////////////////////////////////////
+/// The valid buffer types that may be created using COIBufferCreate.
+/// Please see the COI_VALID_BUFFER_TYPES_AND_FLAGS matrix
+/// below which describes the valid combinations of buffer types and flags.
+///
+typedef enum COI_BUFFER_TYPE
+{
+ /// Normal buffers exist as a single physical buffer in either Source or
+ /// Sink physical memory. Mapping the buffer may stall the pipelines.
+ COI_BUFFER_NORMAL = 1,
+
+ /// A streaming buffer creates new versions each time it is passed to
+ /// Runfunction. These new versions are consumed by run functions.
+
+ /// To_SINK buffers are used to send data from SOURCE to SINK
+ /// These buffers are SOURCE write only buffers. If read, won't
+ /// get Data written by SINK
+ COI_BUFFER_STREAMING_TO_SINK,
+
+ /// To_SOURCE buffers are used to get data from SINK to SOURCE
+ /// These buffers are SOURCE Read only buffers. If written, data
+ /// won't get reflected on SINK side.
+ COI_BUFFER_STREAMING_TO_SOURCE,
+
+ /// A pinned buffer exists in a shared memory region and is always
+ /// available for read or write operations.
+ COI_BUFFER_PINNED,
+
+ /// OpenCL buffers are similar to Normal buffers except they don't
+ /// stall pipelines and don't follow any read write dependencies.
+ COI_BUFFER_OPENCL
+
+} COI_BUFFER_TYPE;
+
+
+/// @name COIBUFFER creation flags.
+/// Please see the COI_VALID_BUFFER_TYPES_AND_FLAGS matrix
+/// below which describes the valid combinations of buffer types and flags.
+//@{
+
+/// Create the buffer such that it has the same virtual address on all of the
+/// sink processes with which it is associated.
+#define COI_SAME_ADDRESS_SINKS 0x00000001
+
+/// Create the buffer such that it has the same virtual address on all of the
+/// sink processes with which it is associated and in the source process.
+#define COI_SAME_ADDRESS_SINKS_AND_SOURCE 0x00000002
+
+/// Hint to the runtime that the source will frequently read the buffer
+#define COI_OPTIMIZE_SOURCE_READ 0x00000004
+
+/// Hint to the runtime that the source will frequently write the buffer
+#define COI_OPTIMIZE_SOURCE_WRITE 0x00000008
+
+/// Hint to the runtime that the sink will frequently read the buffer
+#define COI_OPTIMIZE_SINK_READ 0x00000010
+
+/// Hint to the runtime that the sink will frequently write the buffer
+#define COI_OPTIMIZE_SINK_WRITE 0x00000020
+
+/// Used to delay the pinning of memory into physical pages, until required
+/// for DMA. This can be used to delay the cost of time spent pinning memory
+/// until absolutely necessary. Might speed up the execution of COIBufferCreate
+/// calls, but slow down the first access of the buffer in
+/// COIPipelineRunFunction(s) or other COIBuffer access API's.
+/// Also of important note, that with this flag enabled COI will not be able to
+/// check to see if this memory is read only. Ordinarily this is checked
+/// and an error is thrown upon buffer creation. With this flag, the error
+/// might occur later, and cause undetermined behavior. Be sure to always
+/// use writeable memory for COIBuffers.
+#define COI_OPTIMIZE_NO_DMA 0x00000040
+
+/// Hint to the runtime to try to use huge page sizes for backing store on the
+/// sink. Is currently not compatible with PINNED buffers or the SAME_ADDRESS
+/// flags or the SINK_MEMORY flag.
+#define COI_OPTIMIZE_HUGE_PAGE_SIZE 0x00000080
+
+/// Used to tell Intel(R) Coprocessor Offload Infrastructure (Intel(R) COI)
+/// to create a buffer using memory that has already been
+/// allocated on the sink. This flag is only valid when passed in to the
+/// COIBufferCreateFromMemory API.
+#define COI_SINK_MEMORY 0x00000100
+
+//@}
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+// Make the flag mask
+#ifdef F
+#undef F
+#endif
+#define F 0
+#ifdef T
+#undef T
+#endif
+#define T 1
+#define MTM(_BUFFER, B1, B2, B3, B4, B5, B6, B7, B8, B9) \
+(B1 | B2<<1 | B3<<2 | B4<<3 | B5<<4 | B6<<5 | B7<<6 | B8<<7 | B9<<8)
+#endif
+
+/// \enum COI_BUFFER_TYPE
+/// This matrix shows the valid combinations of buffer types and buffer flags
+/// that may be passed in to COIBufferCreate and COIBufferCreateFromMemory.
+/// \code
+static const uint64_t
+COI_VALID_BUFFER_TYPES_AND_FLAGS[COI_BUFFER_OPENCL+1] = {
+/* | | SAME | | | | | | | |
+ | SAME | ADDR | OPT | OPT | OPT | OPT | OPT | HUGE | COI |
+ | ADDR | SINK | SRC | SRC | SINK | SINK | NO | PAGE | SINK |
+ | SINKS | SRC | READ | WRITE | READ | WRITE | DMA | SIZE | MEM |
+ +-------+------+------+-------+------+-------+-----+------+-----*/
+MTM(INVALID , F , F , F , F , F , F , F , F , F ),
+MTM(NORMAL , T , T , T , T , T , T , T , T , T ),
+MTM(TO_SINK , F , F , F , T , T , T , F , F , F ),
+MTM(TO_SOURCE, F , F , T , F , F , T , F , F , F ),
+MTM(PINNED , T , T , T , T , T , T , F , F , F ),
+MTM(OPENCL , T , T , T , T , T , T , T , T , F ),
+};
+///\endcode
+#undef MTM
+
+//////////////////////////////////////////////////////////////////////////////
+/// These flags control how the buffer will be accessed on the source after
+/// it is mapped.
+/// Please see the COI_VALID_BUFFER_TYPES_AND_MAP matrix below for the
+/// valid buffer type and map operation combinations.
+typedef enum COI_MAP_TYPE
+{
+ /// Allows the application to read and write the contents of the buffer
+ /// after it is mapped.
+ COI_MAP_READ_WRITE = 1,
+
+ /// If this flag is set then the application must only read from the
+ /// buffer after it is mapped. If the application writes to the buffer
+ /// the contents will not be reflected back to the sink or stored for
+ /// the next time the buffer is mapped on the source.
+ /// This allows the runtime to make significant performance optimizations
+ /// in buffer handling.
+ COI_MAP_READ_ONLY,
+
+ /// Setting this flag means that the source will overwrite the entire
+ /// buffer once it is mapped. The app must not read from the buffer and
+ /// must not expect the contents of the buffer to be synchronized from
+ /// the sink side during the map operation.
+ /// This allows the runtime to make significant performance optimizations
+ /// in buffer handling.
+ COI_MAP_WRITE_ENTIRE_BUFFER
+} COI_MAP_TYPE;
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+// Make the flag mask
+#define MMM(_BUFFER, B1, B2, B3) \
+ { F , B1, B2, B3}
+#endif
+/// \enum COI_MAP_TYPE
+/// This matrix shows the valid combinations of buffer types and map
+/// operations that may be passed in to COIBufferMap.
+/// \code
+static const uint64_t
+COI_VALID_BUFFER_TYPES_AND_MAP
+[COI_BUFFER_OPENCL+1][COI_MAP_WRITE_ENTIRE_BUFFER+1] = {
+/* | MAP | MAP | MAP |
+ | READ | READ | WRITE |
+ | WRITE | ONLY | ENTIRE|
+ +-------+-------+-------+*/
+MMM(INVALID , F , F , F ),
+MMM(NORMAL , T , T , T ),
+MMM(STREAMING_TO_SINK , F , F , T ),
+MMM(STREAMING_TO_SOURCE , F , T , F ),
+MMM(PINNED , T , T , T ),
+MMM(OPENCL , T , T , T ),
+};
+///\endcode
+#undef MMM
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+#undef F
+#undef T
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+/// The valid copy operation types for the COIBufferWrite, COIBufferRead,
+/// and COIBufferCopy APIs.
+///
+typedef enum COI_COPY_TYPE
+{
+ /// The runtime can pick the best suitable way to copy the data.
+ COI_COPY_UNSPECIFIED = 0,
+
+ /// The runtime should use DMA to copy the data.
+ COI_COPY_USE_DMA,
+
+ /// The runtime should use a CPU copy to copy the data.
+ /// CPU copy is a synchronous copy. So the resulting operations are always
+ /// blocking (even though a out_pCompletion event is specified).
+ COI_COPY_USE_CPU
+
+} COI_COPY_TYPE;
+
+
+//////////////////////////////////////////////////////////////////////////////
+/// The buffer states are used to indicate whether a buffer is available for
+/// access in a COIPROCESS. This is used with COIBufferSetState.
+///
+/// Buffer state holds only for NORMAL Buffers and OPENCL buffers. Pinned
+/// buffers are always valid everywhere they get created. Streaming buffers
+/// do not follow the state transition rules, as a new version of the
+/// buffer is created every time it is Mapped or you issue a RunFunction.
+///
+/// Rules on State Transition of the buffer:
+/// -. When a Buffer is created by default it is valid only on the source,
+/// except for buffers created with COI_SINK_MEMORY flag which are valid
+/// only on the sink where the memory lies when created.
+/// -. Apart from SetState following APIs also alters the state of the buffer
+/// internally:
+///
+/// - COIBufferMap alters state of buffer depending on the COI_MAP_TYPE.
+/// COI_MAP_READ_ONLY: Makes Valid on the Source. Doesn't affect the state
+/// of the buffer on the other devices.
+/// COI_MAP_READ_WRITE: Makes it Valid only the Source and Invalid
+/// everywhere else. OPENCL buffers are invalidated
+/// only if it is not in use.
+/// COI_MAP_WRITE_ENTIRE_BUFFER: Makes it valid only on the Source. OPENCL
+/// buffers are invalidated only if not in use.
+///
+/// - COIPipelineRunfunction alters the state of the buffer depending on the
+/// COI_ACCESS_FLAGS
+/// COI_SINK_READ: Makes it valid on the sink where RunFunction is being
+/// issued. Doesn't affect the state of the buffer on other
+/// devices.
+/// COI_SINK_WRITE: Makes it valid only on the sink where Runfunction is
+/// being issued and invalid everywhere else. OPENCL
+/// buffers are invalidated only if the buffer is not in
+/// use.
+/// COI_SINK_WRITE_ENTIRE: Makes it valid only on the sink where
+/// Runfunction is being issued and invalid everywhere else
+/// OPENCL buffers are invalidated only if the buffer is
+/// not in use.
+///
+/// - COIBufferWrite makes the buffer exclusively valid where the write
+/// happens. Write gives preference to Source over Sink. In other words
+/// if a buffer is valid on the Source and multiple Sinks, Write will
+/// happen on the Source and will Invalidate all other Sinks. If the
+/// buffer is valid on multiple Sinks ( and not on the Source) then
+/// Intel® Coprocessor Offload Infrastructure (Intel® COI)
+/// selects process handle with the lowest numerical value to do the
+/// exclusive write Again, OPENCL buffers are invalidated only if the
+/// buffer is not in use on that SINK/SOURCE.
+///
+/// The preference rule mentioned above holds true even for SetState API,
+/// when data needs to be moved from a valid location. The selection of
+/// valid location happens as stated above.
+///
+/// - It is possible to alter only parts of the buffer and change it state
+/// In other words it is possible for different parts of the buffer to have
+/// different states on different devices. A byte is the minimum size at
+/// which state can be maintained internally. Granularity level is completely
+/// determined by how the buffer gets fragmented.
+///
+/// Note: Buffer is considered 'in use' if is
+/// - Being used in RunFunction : In use on a Sink
+/// - Mapped: In use on a Source
+/// - AddRef'd: In use on Sink
+///
+
+//////////////////////////////////////////////////////////////////////////////
+/// The buffer states used with COIBufferSetState call to indicate the new
+/// state of the buffer on a given process
+///
+typedef enum {
+ COI_BUFFER_VALID = 0, // Buffer is valid and up-to-date on the process
+ COI_BUFFER_INVALID , // Buffer is not valid, need valid data
+ COI_BUFFER_VALID_MAY_DROP, // Same as valid but will drop the content when
+ // evicted to avoid overwriting the shadow
+ // memory
+ COI_BUFFER_RESERVED // Reserved for internal use
+} COI_BUFFER_STATE;
+///
+/// Note: A VALID_MAY_DROP declares a buffer's copy as secondary on a given
+/// process. This means that there needs to be at least one primary copy of the
+/// the buffer somewhere in order to mark the buffer as VALID_MAY_DROP on a
+/// process. In other words to make a buffer VALID_MAY_DROP on a given process
+/// it needs to be in COI_BUFFER_VALID state somewhere else. The operation gets
+/// ignored (or is a nop) if there is no primary copy of the buffer. The nature
+/// of this state to "drop the content" when evicted is a side effect of
+/// marking the buffer as secondary copy. So when a buffer marked
+/// VALID_MAY_DROP is evicted Intel® Coprocessor Offload Infrastructure
+/// (Intel® COI) doesn't back it up as it is assumed that
+/// there is a primary copy somewhere.
+
+//////////////////////////////////////////////////////////////////////////////
+/// The buffer move flags are used to indicate when a buffer should be moved
+/// when it's state is changed. This is used with COIBufferSetState.
+typedef enum {
+ COI_BUFFER_MOVE = 0,// Dirty data is moved if state change requires it
+ COI_BUFFER_NO_MOVE // Change state without moving data
+} COI_BUFFER_MOVE_FLAG;
+
+// A process handle for COIBufferSetState call to indicate all the sink
+// processes where the given buffer is valid
+#define COI_SINK_OWNERS ((COIPROCESS)-2)
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// Creates a buffer that can be used in RunFunctions that are queued in
+/// pipelines. The address space for the buffer is reserved when it is
+/// created although the memory may not be committed until the buffer is
+/// used for the first time. Please note that the Intel® Coprocessor Offload
+/// Infrastructure (Intel® COI) runtime may also
+/// allocate space for the source process to use as shadow memory for
+/// certain types of buffers. If Intel® Coprocessor Offload Infrastructure
+/// (Intel® COI) does allocate this memory it will not
+/// be released or reallocated until the COIBuffer is destroyed.
+///
+/// @param in_Size
+/// [in] The number of bytes to allocate for the buffer. If in_Size
+/// is not page aligned, it will be rounded up.
+///
+/// @param in_Type
+/// [in] The type of the buffer to create.
+///
+/// @param in_Flags
+/// [in] A bitmask of attributes for the newly created buffer.
+/// Some of these flags are required for correctness while others
+/// are provided as hints to the runtime system so it can make
+/// certain performance optimizations.
+///
+/// @param in_pInitData
+/// [in] If non-NULL the buffer will be initialized with the data
+/// pointed to by pInitData. The memory at in_pInitData must hold
+/// at least in_Size bytes.
+///
+/// @param in_NumProcesses
+/// [in] The number of processes with which this buffer might be used.
+///
+/// @param in_pProcesses
+/// [in] An array of COIPROCESS handles identifying the processes with
+/// which this buffer might be used.
+///
+/// @param out_pBuffer
+/// [out] Pointer to a buffer handle. The handle will be filled in
+/// with a value that uniquely identifies the newly created buffer.
+/// This handle should be disposed of via COIBufferDestroy()
+/// once it is no longer needed.
+///
+/// @return COI_SUCCESS if the buffer was created
+///
+/// @return COI_ARGUMENT_MISMATCH if the in_Type and in_Flags parameters
+/// are not compatible with one another. Please see the
+/// COI_VALID_BUFFER_TYPES_AND_FLAGS map above for information about
+/// which flags and types are compatible.
+///
+/// @return COI_OUT_OF_RANGE if in_Size is zero, if the bits set in
+/// the in_Flags parameter are not recognized flags, or if
+/// in_NumProcesses is zero.
+///
+/// @return COI_INVALID_POINTER if the in_pProcesses or out_pBuffer parameter
+/// is NULL.
+///
+/// @return COI_NOT_SUPPORTED if one of the in_Flags is COI_SINK_MEMORY.
+///
+/// @return COI_NOT_SUPPORTED if the flags include either
+/// COI_SAME_ADDRESS_SINKS or COI_SAME_ADDRESS_SINKS_AND_SOURCE and
+/// COI_OPTIMIZE_HUGE_PAGE_SIZE.
+///
+/// @return COI_INVALID_HANDLE if one of the COIPROCESS handles in the
+/// in_pProcesses array does not identify a valid process.
+///
+/// @return COI_OUT_OF_MEMORY if allocating the buffer fails.
+///
+/// @return COI_RESOURCE_EXHAUSTED if the sink is out of buffer memory.
+///
+COIACCESSAPI
+COIRESULT
+COIBufferCreate(
+ uint64_t in_Size,
+ COI_BUFFER_TYPE in_Type,
+ uint32_t in_Flags,
+ const void* in_pInitData,
+ uint32_t in_NumProcesses,
+ const COIPROCESS* in_pProcesses,
+ COIBUFFER* out_pBuffer);
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// Creates a buffer from some existing memory that can be used in
+/// RunFunctions that are queued in pipelines. If the flag COI_SINK_MEMORY
+/// is specified then Intel® Coprocessor Offload I
+/// nfrastructure (Intel® COI) will use that memory for the buffer on the sink.
+/// If that flag isn't set then the memory provided is used as backing store
+/// for the buffer on the source. In either case the memory must not be freed
+/// before the buffer is destroyed.
+/// While the user still owns the memory passed in they must use the
+/// appropriate access flags when accessing the buffer in COIPipelinRunFunction
+/// or COIBufferMap calls so that the runtime knows when the
+/// memory has been modified. If the user just writes directly to the memory
+/// location then those changes may not be visible when the corresponding
+/// buffer is accessed.
+/// Whatever values are already present in the memory location when this call
+/// is made are preserved. The memory values are also preserved when
+/// COIBufferDestroy is called.
+///
+/// @warning: Use of this function is highly discouraged if the calling program
+/// program forks at all (including calls to system(3), popen(3), or similar
+/// functions) during the life of this buffer. See the discussion around the
+/// in_Memory parameter below regarding this.
+///
+/// @param in_Size
+/// [in] The size of in_Memory in bytes. If in_Size
+/// is not page aligned, it will be rounded up.
+///
+/// @param in_Type
+/// [in] The type of the buffer to create. Note that streaming buffers
+/// can not be created from user memory. Only COI_BUFFER_NORMAL and
+/// COI_BUFFER_PINNED buffer types are supported.
+///
+/// @param in_Flags
+/// [in] A bitmask of attributes for the newly created buffer.
+/// Some of these flags are required for correctness while others
+/// are provided as hints to the runtime system so it can make
+/// certain performance optimizations. Note that the flag
+/// COI_SAME_ADDRESS_SINKS_AND_SOURCE is still valid but may fail
+/// if the same address as in_Memory can not be allocated on the sink.
+///
+/// @param in_Memory
+/// [in] A pointer to an already allocated memory region
+/// that should be turned into a COIBUFFER. Although the user still
+/// owns this memory they should not free it before calling
+/// COIBufferDestroy. They must also only access the memory using
+/// COIBUFFER semantics, for example using COIBufferMap/COIBufferUnmap
+/// when they wish to read or write the data. There are no alignment
+/// or size requirements for this memory region.
+///
+/// WARNING:
+/// Since the backing memory passed in can be the target of a DMA
+/// the caller must ensure that there is no call to clone(2) (without
+/// the CLONE_VM argument) during the life of this buffer. This
+/// includes higher level functions that call clone such as fork(2),
+/// system(3), popen(3), among others).
+///
+/// For forked processes, Linux uses copy-on-write semantics for
+/// performances reasons. Conseqeuently, if the parent forks and then
+/// writes to this memory, the physical page mapping changes causing
+/// the DMA to fail (and thus data corruption).
+///
+/// In Linux you can mark a set of pages to not be copied across
+/// across the clone by calling madvise(2) with an argument of
+/// MADV_DONTFORK and then safely use that memory in this scenario.
+/// Alternately, if the memory is from a region marked MAP_SHARED,
+/// this will work.
+///
+/// @param in_NumProcesses
+/// [in] The number of processes with which this buffer might be used.
+/// If the flag COI_SINK_MEMORY is specified then this must be 1.
+///
+/// @param in_pProcesses
+/// [in] An array of COIPROCESS handles identifying the processes with
+/// which this buffer might be used.
+///
+/// @param out_pBuffer
+/// [out] Pointer to a buffer handle. The handle will be filled in
+/// with a value that uniquely identifies the newly created buffer.
+/// This handle should be disposed of via COIBufferDestroy()
+/// once it is no longer needed.
+///
+/// @return COI_SUCCESS if the buffer was created
+///
+/// @return COI_NOT_SUPPORTED if the in_Type value is not COI_BUFFER_NORMAL or
+/// COI_BUFFER_PINNED.
+///
+/// @return COI_NOT_SUPPORTED if in_Memory is read-only memory
+///
+/// @return COI_NOT_SUPPORTED if one of the in_Flags is COI_SINK_MEMORY and
+/// in_Type is not COI_BUFFER_NORMAL
+///
+/// @return COI_NOT_SUPPORTED if the flag COI_SAME_ADDRESS_SINKS is set
+///
+/// @return COI_NOT_SUPPORTED if the flag COI_SAME_ADDRESS_SINKS_AND_SOURCE is
+/// set
+///
+/// @return COI_ARGUMENT_MISMATCH if the in_Type and in_Flags parameters
+/// are not compatible with one another. Please see the
+/// COI_VALID_BUFFER_TYPES_AND_FLAGS map above for information about
+/// which flags and types are compatible.
+///
+/// @return COI_ARGUMENT_MISMATCH if the flag COI_SINK_MEMORY is specified and
+/// in_NumProcesses > 1.
+///
+/// @return COI_ARGUMENT_MISMATCH if the flags COI_SINK_MEMORY and
+/// COI_OPTIMIZE_HUGE_PAGE_SIZE are both set.
+///
+/// @return COI_OUT_OF_RANGE if in_Size is zero, if the bits set in
+/// the in_Flags parameter are not recognized flags, or if
+/// in_NumProcesses is zero.
+///
+/// @return COI_INVALID_POINTER if in_Memory, in_pProcesses or
+/// out_pBuffer parameter is NULL.
+///
+/// @return COI_INVALID_HANDLE if one of the COIPROCESS handles in the
+/// in_pProcesses array does not identify a valid process.
+///
+COIACCESSAPI
+COIRESULT
+COIBufferCreateFromMemory(
+ uint64_t in_Size,
+ COI_BUFFER_TYPE in_Type,
+ uint32_t in_Flags,
+ void* in_Memory,
+ uint32_t in_NumProcesses,
+ const COIPROCESS* in_pProcesses,
+ COIBUFFER* out_pBuffer);
+
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// Destroys a buffer. Will block on completion of any operations on the
+/// buffer, such as COIPipelineRunFunction or COIBufferCopy. Will block until
+/// all COIBufferAddRef calls have had a matching COIBufferReleaseRef call
+/// made. Will not block on an outstanding COIBufferUnmap but will instead
+/// return COI_RETRY.
+///
+/// @param in_Buffer
+/// [in] Handle of the buffer to destroy.
+///
+/// @return COI_SUCCESS if the buffer was destroyed.
+///
+/// @return COI_INVALID_HANDLE if the buffer handle was invalid.
+///
+/// @return COI_RETRY if the buffer is currently mapped. The buffer must
+/// first be unmapped before it can be destroyed.
+///
+/// @return COI_RETRY if the sub-buffers created from this buffer are not yet
+/// destroyed
+///
+COIACCESSAPI
+COIRESULT
+COIBufferDestroy(
+ COIBUFFER in_Buffer);
+
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// This call initiates a request to access a region of a buffer. Multiple
+/// overlapping (or non overlapping) regions can be mapped simultaneously for
+/// any given buffer. If a completion event is specified this call will
+/// queue a request for the data which will be satisfied when the buffer is
+/// available. Once all conditions are met the completion event will be
+/// signaled and the user can access the data at out_ppData. The user can call
+/// COIEventWait with out_pCompletion to find out when the map operation has
+/// completed. If the user accesses the data before the map operation is
+/// complete the results are undefined. If out_pCompletion is NULL then this
+/// call blocks until the map operation completes and when this call returns
+/// out_ppData can be safely accessed. This call returns a map instance handle
+/// in an out parameter which must be passed into COIBufferUnmap when the user
+/// no longer needs access to that region of the buffer.
+///
+/// The address returned from COIBufferMap may point to memory that
+/// Intel® Coprocessor Offload Infrastructure (Intel® COI)
+/// manages on behalf of the user. The user must not free or reallocate this
+/// memory, Intel® Coprocessor Offload Infrastructure (Intel® COI)
+/// will perform any necessary cleanup when the buffer is
+/// destroyed.
+///
+/// Note that different types of buffers behave differently when mapped.
+/// For instance, mapping a COI_BUFFER_NORMAL for write must stall if the
+/// buffer is currently being written to by a run function. Mapping a
+/// COI_BUFFER_STREAMING_TO_SINK will create a new physical copy of the buffer
+/// and make it available immediately. Mapping a COI_BUFFER_PINNED buffer will
+/// not affect other functions that use that buffer since a COI_BUFFER_PINNED
+/// buffer can be mapped at any time.
+/// The asynchronous operation of COIBufferMap will likely be most useful when
+/// paired with a COI_BUFFER_NORMAL.
+///
+/// @param in_Buffer
+/// [in] Handle for the buffer to map.
+///
+/// @param in_Offset
+/// [in] Offset into the buffer that a pointer should be returned
+/// for. The value 0 can be passed in to signify that the mapped
+/// region should start at the beginning of the buffer.
+///
+/// @param in_Length
+/// [in] Length of the buffer area to map. This parameter, in
+/// combination with in_Offset, allows the caller to specify
+/// that only a subset of an entire buffer need be mapped. A
+/// value of 0 can be passed in only if in_Offset is 0, to signify
+/// that the mapped region is the entire buffer.
+///
+/// @param in_Type
+/// [in] The access type that is needed by the application. This will
+/// affect how the data can be accessed once the map operation
+/// completes. See the COI_MAP_TYPE enum for more details.
+///
+/// @param in_NumDependencies
+/// [in] The number of dependencies specified in the in_pDependencies
+/// array. This may be 0 if the caller does not want the map
+/// call initiation to wait for any events to be signaled before
+/// starting the map operations.
+///
+/// @param in_pDependencies
+/// [in] An optional array of handles to previously created COIEVENT
+/// objects that this map operation will wait for before starting.
+/// This allows the user to create dependencies between asynchronous
+/// map calls and other operations such as run functions or other
+/// asynchronous map calls. The user may pass in NULL if they do not
+/// wish to wait for any dependencies to complete before initiating map
+/// operations.
+///
+/// @param out_pCompletion
+/// [out] An optional pointer to a COIEVENT object
+/// that will be signaled when a map call with the passed in buffer
+/// would complete immediately, that is, the buffer memory has been
+/// allocated on the source and its contents updated. The user may pass
+/// in NULL if the user wants COIBufferMap to perform a blocking map
+/// operation.
+///
+/// @param out_pMapInstance
+/// [out] A pointer to a COIMAPINSTANCE which represents this mapping
+/// of the buffer and must be passed in to COIBufferUnmap when access
+/// to this region of the buffer data is no longer needed.
+///
+/// @param out_ppData
+/// [out] Pointer to the buffer data. The data will only be valid
+/// when the completion object is signaled, or for a synchronous
+/// map operation with the call to map returns.
+///
+///
+/// @return COI_SUCCESS if the map request succeeds.
+///
+/// @return COI_OUT_OF_RANGE if in_Offset of (in_Offset + in_Length) exceeds
+/// the size of the buffer.
+///
+/// @return COI_OUT_OF_RANGE if in_Length is 0, but in_Offset is not 0.
+///
+/// @return COI_OUT_OF_RANGE if in_Type is not a valid COI_MAP_TYPE.
+///
+/// @return COI_ARGUMENT_MISMATCH if in_NumDependencies is non-zero while
+/// in_pDependencies was passed in as NULL.
+///
+/// @return COI_ARGUMENT_MISMATCH if in_pDependencies is non-NULL but
+/// in_NumDependencies is zero.
+///
+/// @return COI_ARGUMENT_MISMATCH if the in_Type of map is not a valid type
+/// for in_Buffer's type of buffer.
+///
+/// @return COI_RESOURCE_EXHAUSTED if could not create a version for TO_SINK
+/// streaming buffer. It can fail if enough memory is not available to
+/// register. This call will succeed eventually when the registered
+/// memory becomes available.
+///
+/// @return COI_INVALID_HANDLE if in_Buffer is not a valid buffer handle.
+///
+/// @return COI_INVALID_POINTER if out_pMapInstance or out_ppData is NULL.
+///
+COIACCESSAPI
+COIRESULT
+COIBufferMap(
+ COIBUFFER in_Buffer,
+ uint64_t in_Offset,
+ uint64_t in_Length,
+ COI_MAP_TYPE in_Type,
+ uint32_t in_NumDependencies,
+ const COIEVENT* in_pDependencies,
+ COIEVENT* out_pCompletion,
+ COIMAPINSTANCE* out_pMapInstance,
+ void** out_ppData);
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// Disables Source access to the region of the buffer that was provided
+/// through the corresponding call to COIBufferMap. The number of calls to
+/// COIBufferUnmap() should always match the number of calls made to
+/// COIBufferMap(). The data pointer returned from the COIBufferMap() call
+/// will be invalid after this call.
+///
+/// @param in_MapInstance
+/// [in] buffer map instance handle to unmap.
+///
+/// @param in_NumDependencies
+/// [in] The number of dependencies specified in the in_pDependencies
+/// array. This may be 0 if the caller does not want the unmap call to
+/// wait for any events to be signaled before performing the unmap
+/// operation.
+///
+/// @param in_pDependencies
+/// [in] An optional array of handles to previously created COIEVENT
+/// objects that this unmap operation will wait for before starting.
+/// This allows the user to create dependencies between asynchronous
+/// unmap calls and other operations such as run functions or other
+/// asynchronous unmap calls. The user may pass in NULL if they do not
+/// wish to wait for any dependencies to complete before initiating
+/// unmap operations.
+///
+/// @param out_pCompletion
+/// [out] An optional pointer to a COIEVENT object that will be
+/// signaled when the unmap is complete. The user may pass in NULL if
+/// the user wants COIBufferUnmap to perform a blocking unmap
+/// operation.
+///
+/// @return COI_SUCCESS upon successful unmapping of the buffer instance.
+///
+/// @return COI_INVALID_HANDLE if the passed in map instance handle was NULL.
+///
+/// @return COI_ARGUMENT_MISMATCH if the in_pDependencies is non NULL but
+/// in_NumDependencies is 0.
+///
+/// @return COI_ARGUMENT_MISMATCH if in_pDependencies is NULL but
+/// in_NumDependencies is not 0.
+///
+COIACCESSAPI
+COIRESULT
+COIBufferUnmap(
+ COIMAPINSTANCE in_MapInstance,
+ uint32_t in_NumDependencies,
+ const COIEVENT* in_pDependencies,
+ COIEVENT* out_pCompletion);
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// Gets the Sink's virtual address of the buffer. This is the same
+/// address that is passed to the run function on the Sink. The virtual
+/// address assigned to the buffer for use on the sink is fixed;
+/// the buffer will always be present at that virtual address on the sink
+/// and will not get a different virtual address across different
+/// RunFunctions.
+/// This address is only valid on the Sink and should not be dereferenced on
+/// the Source (except for the special case of buffers created with the
+/// COI_SAME_ADDRESS flag).
+///
+/// @param in_Buffer
+/// [in] Buffer handle
+///
+/// @param out_pAddress
+/// [out] pointer to a uint64_t* that will be filled with the address.
+///
+/// @return COI_SUCCESS upon successful return of the buffer's address.
+///
+/// @return COI_INVALID_HANDLE if the passed in buffer handle was invalid.
+///
+/// @return COI_INVALID_POINTER if the out_pAddress parameter was invalid.
+///
+/// @return COI_NOT_SUPPORTED if the buffer passed in is of type
+/// COI_BUFFER_STREAMING_TO_SOURCE or COI_BUFFER_STREAMING_TO_SINK.
+///
+COIACCESSAPI
+COIRESULT
+COIBufferGetSinkAddress(
+ COIBUFFER in_Buffer,
+ uint64_t* out_pAddress);
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// Copy data from a normal virtual address into an existing COIBUFFER.
+/// Note that it is not possible to use this API with any type of
+/// Intel® Coprocessor Offload Infrastructure (Intel® COI) Streaming Buffers.
+/// Please note that COIBufferWrite does not follow implicit buffer
+/// dependencies. If a buffer is in use in a run function or has been added
+/// to a process using COIBufferAddRef the call to COIBufferWrite will not
+/// wait, it will still copy data immediately.
+/// This is to facilitate a usage model where a buffer is being used outside
+/// of a run function, for example in a spawned thread, but data still needs
+/// to be transferred to or from the buffer.
+///
+/// @param in_DestBuffer
+/// [in] Buffer to write into.
+///
+#ifdef COI_PROTOTYPE_TARGET_PROCESS
+/// @param in_DestProcess
+/// [in] A pointer to the processes which are used as hints
+/// to to COI. Buffers are updated upon these processes first.
+/// Can be left NULL and default behavior will be chosen, which
+/// chooses the lowest SCIF node with an active regions first. Others
+/// buffer regions are invalidated in both cases. Will only update a single
+/// process at this time.
+#endif
+///
+/// @param in_Offset
+/// [in] Location in the buffer to start writing to.
+///
+/// @param in_pSourceData
+/// [in] A pointer to local memory that should be copied into the
+/// provided buffer.
+///
+/// @param in_Length
+/// [in] The number of bytes to write from in_pSourceData into
+/// in_DestBuffer. Must not be larger than the size of in_DestBuffer
+/// and must not over run in_DestBuffer if an in_Offset is provided.
+///
+/// @param in_Type
+/// [in] The type of copy operation to use, one of either
+/// COI_COPY_UNSPECIFIED, COI_COPY_USE_DMA, COI_COPY_USE_CPU.
+///
+/// @param in_NumDependencies
+/// [in] The number of dependencies specified in the in_pDependencies
+/// array. This may be 0 if the caller does not want the write call to
+/// wait for any additional events to be signaled before starting the
+/// write operation.
+///
+/// @param in_pDependencies
+/// [in] An optional array of handles to previously created COIEVENT
+/// objects that this write operation will wait for before starting.
+/// This allows the user to create dependencies between buffer write
+/// calls and other operations such as run functions and map calls. The
+/// user may pass in NULL if they do not wish to wait for any
+/// additional dependencies to complete before doing the write.
+///
+/// @param out_pCompletion
+/// [out] An optional event to be signaled when the write has
+/// completed. This event can be used as a dependency to order
+/// the write with regard to future operations.
+/// If no completion event is passed in then the write is
+/// synchronous and will block until the transfer is complete.
+///
+///
+/// @return COI_SUCCESS if the buffer was copied successfully.
+///
+/// @return COI_INVALID_HANDLE if the buffer handle was invalid.
+///
+/// @return COI_OUT_OF_RANGE if in_Offset is beyond the end of the buffer.
+///
+/// @return COI_ARGUMENT_MISMATCH if the in_pDependencies is non NULL but
+/// in_NumDependencies is 0.
+///
+/// @return COI_ARGUMENT_MISMATCH if in_pDependencies is NULL but
+/// in_NumDependencies is not 0.
+///
+/// @return COI_NOT_SUPPORTED if the source buffer is of type
+/// COI_BUFFER_STREAMING_TO_SINK or COI_BUFFER_STREAMING_TO_SOURCE.
+///
+/// @return COI_INVALID_POINTER if the in_pSourceData pointer is NULL.
+///
+/// @return COI_OUT_OF_RANGE if in_Offset + in_Length exceeds the size of
+/// the buffer.
+///
+/// @return COI_OUT_OF_RANGE if in_Length is 0.
+///
+/// @return COI_RETRY if in_DestBuffer is mapped and is not a COI_BUFFER_PINNED
+/// buffer or COI_BUFFER_OPENCL buffer.
+///
+#ifdef COI_PROTOTYPE_TARGET_PROCESS
+COIACCESSAPI
+COIRESULT
+COIBufferWrite(
+ COIBUFFER in_DestBuffer,
+ const COIPROCESS in_DestProcess,
+ uint64_t in_Offset,
+ const void* in_pSourceData,
+ uint64_t in_Length,
+ COI_COPY_TYPE in_Type,
+ uint32_t in_NumDependencies,
+ const COIEVENT* in_pDependencies,
+ COIEVENT* out_pCompletion);
+__asm__(".symver COIBufferWrite,COIBufferWrite@COI_2.0");
+#else
+COIACCESSAPI
+COIRESULT
+COIBufferWrite(
+ COIBUFFER in_DestBuffer,
+ uint64_t in_Offset,
+ const void* in_pSourceData,
+ uint64_t in_Length,
+ COI_COPY_TYPE in_Type,
+ uint32_t in_NumDependencies,
+ const COIEVENT* in_pDependencies,
+ COIEVENT* out_pCompletion);
+__asm__(".symver COIBufferWrite,COIBufferWrite@COI_1.0");
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// Copy data from a buffer into local memory.
+/// Note that it is not possible to use this API with any type of
+/// Intel® Coprocessor Offload Infrastructure (Intel® COI) Streaming Buffers.
+/// Please note that COIBufferRead does not follow implicit buffer
+/// dependencies. If a buffer is in use in a run function or has been added
+/// to a process using COIBufferAddRef the call to COIBufferRead will not
+/// wait, it will still copy data immediately.
+/// This is to facilitate a usage model where a buffer is being used outside
+/// of a run function, for example in a spawned thread, but data still needs
+/// to be transferred to or from the buffer.
+///
+///
+/// @param in_SourceBuffer
+/// [in] Buffer to read from.
+///
+/// @param in_Offset
+/// [in] Location in the buffer to start reading from.
+///
+/// @param in_pDestData
+/// [in] A pointer to local memory that should be written into from
+/// the provided buffer.
+///
+/// @param in_Length
+/// [in] The number of bytes to write from in_SourceBuffer into
+/// in_pDestData. Must not be larger than the size of in_SourceBuffer
+/// and must not over run in_SourceBuffer if an in_Offset is provided.
+///
+/// @param in_Type
+/// [in] The type of copy operation to use, one of either
+/// COI_COPY_UNSPECIFIED, COI_COPY_USE_DMA, COI_COPY_USE_CPU.
+///
+/// @param in_NumDependencies
+/// [in] The number of dependencies specified in the in_pDependencies
+/// array. This may be 0 if the caller does not want the read call to
+/// wait for any additional events to be signaled before starting the
+/// read operation.
+///
+/// @param in_pDependencies
+/// [in] An optional array of handles to previously created COIEVENT
+/// objects that this read operation will wait for before starting.
+/// This allows the user to create dependencies between buffer read
+/// calls and other operations such as run functions and map calls. The
+/// user may pass in NULL if they do not wish to wait for any
+/// additional dependencies to complete before doing the read.
+///
+/// @param out_pCompletion
+/// [out] An optional event to be signaled when the read has
+/// completed. This event can be used as a dependency to order
+/// the read with regard to future operations.
+/// If no completion event is passed in then the read is
+/// synchronous and will block until the transfer is complete.
+///
+/// @return COI_SUCCESS if the buffer was copied successfully.
+///
+/// @return COI_INVALID_HANDLE if the buffer handle was invalid.
+///
+/// @return COI_OUT_OF_RANGE if in_Offset is beyond the end of the buffer.
+///
+/// @return COI_ARGUMENT_MISMATCH if the in_pDependencies is non NULL but
+/// in_NumDependencies is 0.
+///
+/// @return COI_ARGUMENT_MISMATCH if in_pDependencies is NULL but
+/// in_NumDependencies is not 0.
+///
+/// @return COI_NOT_SUPPORTED if the source buffer is of type
+/// COI_BUFFER_STREAMING_TO_SINK or COI_BUFFER_STREAMING_TO_SOURCE.
+///
+/// @return COI_OUT_OF_RANGE if in_Offset + in_Length exceeds the size of
+/// the buffer.
+///
+/// @return COI_OUT_OF_RANGE if in_Length is 0.
+///
+/// @return COI_INVALID_POINTER if the in_pDestData pointer is NULL.
+///
+/// @return COI_RETRY if in_SourceBuffer is mapped and is not a
+/// COI_BUFFER_PINNED buffer or COI_BUFFER_OPENCL buffer.
+///
+COIACCESSAPI
+COIRESULT
+COIBufferRead(
+ COIBUFFER in_SourceBuffer,
+ uint64_t in_Offset,
+ void* in_pDestData,
+ uint64_t in_Length,
+ COI_COPY_TYPE in_Type,
+ uint32_t in_NumDependencies,
+ const COIEVENT* in_pDependencies,
+ COIEVENT* out_pCompletion);
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// Copy data between two buffers. It also allows copying within the same
+/// buffer. For copy within the same buffer, if source and destination regions
+/// overlap then this API returns error.
+/// Note that it is not possible to use this API with any type of
+/// Intel® Coprocessor Offload Infrastructure (Intel® COI) Streaming Buffers.
+/// Please note that COIBufferCopy does not follow implicit buffer
+/// dependencies. If a buffer is in use in a run function or has been added
+/// to a process using COIBufferAddRef the call to COIBufferCopy will not
+/// wait, it will still copy data immediately.
+/// This is to facilitate a usage model where a buffer is being used outside
+/// of a run function, for example in a spawned thread, but data still needs
+/// to be transferred to or from the buffer.
+///
+/// @param in_DestBuffer
+/// [in] Buffer to copy into.
+#ifdef COI_PROTOTYPE_TARGET_PROCESS
+/// @param in_DestProcess
+/// [in] A pointer to the processes which are used as hints
+/// to to COI. Buffers are updated upon these processes first.
+/// Can be left NULL and default behavior will be chosen, which
+/// chooses the lowest SCIF node with an active regions first. Others
+/// buffer regions are invalidated in both cases. Will only update a single
+/// process at this time.
+#endif
+///
+/// @param in_SourceBuffer
+/// [in] Buffer to copy from.
+///
+/// @param in_DestOffset
+/// [in] Location in the destination buffer to start writing to.
+///
+/// @param in_SourceOffset
+/// [in] Location in the source buffer to start reading from.
+///
+/// @param in_Length
+/// [in] The number of bytes to copy from in_SourceBuffer into
+/// in_DestinationBuffer.
+/// If the length is specified as zero then length to be copied
+// is entire destination buffer's length.
+/// Must not be larger than the size of in_SourceBuffer or
+/// in_DestBuffer and must not over run in_SourceBuffer or
+/// in_DestBuffer if offsets are specified.
+///
+/// @param in_Type
+/// [in] The type of copy operation to use, one of either
+/// COI_COPY_UNSPECIFIED, COI_COPY_USE_DMA, COI_COPY_USE_CPU.
+///
+/// @param in_NumDependencies
+/// [in] The number of dependencies specified in the in_pDependencies
+/// array. This may be 0 if the caller does not want the copy call to
+/// wait for any additional events to be signaled before starting the
+/// copy operation.
+///
+/// @param in_pDependencies
+/// [in] An optional array of handles to previously created COIEVENT
+/// objects that this copy operation will wait for before starting.
+/// This allows the user to create dependencies between buffer copy
+/// calls and other operations such as run functions and map calls. The
+/// user may pass in NULL if they do not wish to wait for any
+/// additional dependencies to complete before doing the copy.
+///
+/// @param out_pCompletion
+/// [out] An optional event to be signaled when the copy has
+/// completed. This event can be used as a dependency to order
+/// the copy with regard to future operations.
+/// If no completion event is passed in then the copy is
+/// synchronous and will block until the transfer is complete.
+///
+/// @return COI_SUCCESS if the buffer was copied successfully.
+///
+/// @return COI_INVALID_HANDLE if either buffer handle was invalid.
+///
+/// @return COI_MEMORY_OVERLAP if in_SourceBuffer and in_DestBuffer are the
+/// same buffer(or have the same parent buffer) and the source and
+/// destination regions overlap
+///
+/// @return COI_OUT_OF_RANGE if in_DestOffset is is beyond the end of
+/// in_DestBuffer
+///
+/// @return COI_OUT_OF_RANGE if in_SourceOffset is beyond the end of
+/// in_SourceBuffer.
+///
+/// @return COI_OUT_OF_RANGE if in_DestOffset + in_Length exceeds the size of
+/// the in_DestBuffer
+///
+/// @return COI_OUT_OF_RANGE if in_SourceOffset + in_Length exceeds
+/// the size of in_SourceBuffer.
+///
+/// @return COI_ARGUMENT_MISMATCH if the in_pDependencies is non NULL but
+/// in_NumDependencies is 0.
+///
+/// @return COI_ARGUMENT_MISMATCH if in_pDependencies is NULL but
+/// in_NumDependencies is not 0.
+///
+/// @return COI_NOT_SUPPORTED if the source or destination buffers are of type
+/// COI_BUFFER_STREAMING_TO_SINK or COI_BUFFER_STREAMING_TO_SOURCE.
+///
+/// @return COI_NOT_SUPPORTED if either buffer is of type
+/// COI_BUFFER_STREAMING_TO_SINK or COI_BUFFER_STREAMING_TO_SOURCE.
+///
+/// @return COI_RETRY if in_DestBuffer or in_SourceBuffer are mapped and not
+/// COI_BUFFER_PINNED buffers or COI_BUFFER_OPENCL buffers.
+///
+#ifdef COI_PROTOTYPE_TARGET_PROCESS
+COIACCESSAPI
+COIRESULT
+COIBufferCopy(
+ COIBUFFER in_DestBuffer,
+ const COIPROCESS in_DestProcess,
+ COIBUFFER in_SourceBuffer,
+ uint64_t in_DestOffset,
+ uint64_t in_SourceOffset,
+ uint64_t in_Length,
+ COI_COPY_TYPE in_Type,
+ uint32_t in_NumDependencies,
+ const COIEVENT* in_pDependencies,
+ COIEVENT* out_pCompletion);
+__asm__(".symver COIBufferCopy,COIBufferCopy@COI_2.0");
+#else
+COIACCESSAPI
+COIRESULT
+COIBufferCopy(
+ COIBUFFER in_DestBuffer,
+ COIBUFFER in_SourceBuffer,
+ uint64_t in_DestOffset,
+ uint64_t in_SourceOffset,
+ uint64_t in_Length,
+ COI_COPY_TYPE in_Type,
+ uint32_t in_NumDependencies,
+ const COIEVENT* in_pDependencies,
+ COIEVENT* out_pCompletion);
+__asm__(".symver COIBufferCopy,COIBufferCopy@COI_1.0");
+#endif
+//////////////////////////////////////////////////////////////////////////////
+///
+/// This API allows an experienced Intel® Coprocessor Offload Infrastructure
+/// (Intel® COI) developer to set where a COIBUFFER is
+/// located and when the COIBUFFER's data is moved. This functionality is
+/// useful when the developer knows when and where a buffer is going to be
+/// accessed. It allows the data movement to happen sooner than if the
+/// Intel® Coprocessor Offload Infrastructure (Intel® COI)
+/// runtime tried to manage the buffer placement itself. The advantage of
+/// this API is that the developer knows much more about their own
+/// application's data access patterns and can therefore optimize the data
+/// access to be much more efficient than the Intel® Coprocessor Offload
+/// Infrastructure (Intel® COI) runtime. Using this API may yield better
+/// memory utilization, lower latency and overall improved workload
+/// throughput.
+/// This API does respect implicit dependencies for buffer read/write hazards.
+/// For example, if the buffer is being written in one COIPROCESS and the user
+/// requests the buffer be placed in another COIPROCESS then this API will wait
+/// for the first access to complete before moving the buffer.
+/// This API is not required for program correctness. It is intended solely
+/// for advanced Intel® Coprocessor Offload Infrastructure (Intel® COI)
+/// developers who wish to fine tune their application performance
+/// Cases where "a change in state" is an error condition the change just gets
+/// ignored without any error. This is because the SetState can be a
+/// nonblocking call and in such cases we can't rely on the state of the buffer
+/// at the time of the call. We can do the transition checks only at the time
+/// when the actual state change happens (which is something in future).
+/// Currently there is no way to report an error from something that happens in
+/// future and that is why such state transitions are nop. One example is using
+/// VALID_MAY_DROP with COI_SINK_OWNERS when buffer is not valid at source.
+/// This operation will be a nop if at the time of actual state change the
+/// buffer is not valid at source.
+///
+/// @param in_Buffer
+/// [in] The buffer to modify.
+///
+/// @param in_Process
+/// [in] The process where the state is being modified for this
+/// buffer. To modify buffer's state on source process use
+/// COI_PROCESS_SOURCE as process handle. To modify buffer's
+/// state on all processes where buffer is valid use COI_SINK_OWNERS
+/// as the process handle.
+///
+/// @param in_State
+/// [in] The new state for the buffer. The buffer's state could be
+/// set to invalid on one of the sink processes where it is being
+/// used.
+///
+/// @param in_DataMove
+/// [in] A flag to indicate if the buffer's data should be moved
+/// when the state is changed. For instance, a buffer's state may
+/// be set to valid on a process and the data move flag may be set to
+/// COI_BUFFER_MOVE which would cause the buffer contents to be
+/// copied to the process where it is now valid.
+///
+/// @param in_NumDependencies
+/// [in] The number of dependencies specified in the in_pDependencies
+/// array. This may be 0 if the caller does not want the SetState call
+/// to wait for any additional events to be signaled before starting
+/// this operation.
+///
+/// @param in_pDependencies
+/// [in] An optional array of handles to previously created COIEVENT
+/// objects that this SetState operation will wait for before starting
+/// This allows the user to create dependencies between buffer
+/// SetState calls and other operations such as run functions and map
+/// calls. The user may pass in NULL if they do not wish to wait for
+/// any additional dependencies to complete before doing the SetState
+///
+/// @param out_pCompletion
+/// [out] An optional event to be signaled when the SetState has
+/// completed. This event can be used as a dependency to order
+/// the SetState with regard to future operations.
+/// If no completion event is passed in then the is
+/// synchronous and will block until the SetState and dma transfers
+/// related to this operation are complete.
+///
+/// @return COI_SUCCESS if the buffer's state was changed successfully.
+///
+/// @return COI_INVALID_HANDLE if in_Buffer or in_Process is invalid.
+///
+/// @return COI_NOT_SUPPORTED if the in_Buffer is of any type other than
+/// COI_BUFFER_NORMAL or COI_BUFFER_OPENCL.
+///
+/// @return COI_ARGUMENT_MISMATCH if the in_State is COI_BUFFER_VALID_MAY_DROP
+/// and the in_Process is COI_PROCESS_SOURCE.
+///
+/// @return COI_ARGUMENT_MISMATCH if the in_Process is COI_SINK_OWNERS and the
+/// COI_BUFFER_MOVE is passed as move flag.
+///
+/// @return COI_MISSING_DEPENDENCY if buffer was not created on the process
+/// handle that was passed in.
+///
+
+COIACCESSAPI
+COIRESULT
+COIBufferSetState(
+ COIBUFFER in_Buffer,
+ COIPROCESS in_Process,
+ COI_BUFFER_STATE in_State,
+ COI_BUFFER_MOVE_FLAG in_DataMove,
+ uint32_t in_NumDependencies,
+ const COIEVENT* in_pDependencies,
+ COIEVENT* out_pCompletion);
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// Creates a sub-buffer that is a reference to a portion of an existing
+/// buffer. The returned buffer handle can be used in all API calls that the
+/// original buffer handle could be used in except COIBufferCreateSubBuffer.
+/// Sub buffers out of Huge Page Buffer are also supported but the original
+/// buffer needs to be a OPENCL buffer created with COI_OPTIMIZE_HUGE_PAGE_SIZE
+/// flag.
+///
+/// When the sub-buffer is used only the corresponding sub-section of the
+/// original buffer is used or affected.
+///
+/// @param in_Buffer
+/// [in] The original buffer that this new sub-buffer is a reference
+/// to.
+///
+/// @param in_Length
+/// [in] The length of the sub-buffer in number of bytes.
+///
+/// @param in_Offset
+/// [in] Where in the original buffer to start this sub-buffer.
+///
+/// @param out_pSubBuffer
+/// [out] Pointer to a buffer handle that is filled in with the newly
+/// created sub-buffer.
+///
+/// @return COI_SUCCESS if the sub-buffer was created
+///
+/// @return COI_INVALID_HANDLE if in_Buffer is not a valid buffer handle.
+///
+/// @return COI_OUT_OF_RANGE if in_Length is zero, or if in_Offset + in_Length
+/// is greater than the size of the original buffer.
+///
+/// @return COI_OUT_OF_MEMORY if allocating the buffer fails.
+///
+/// @return COI_INVALID_POINTER if the out_pSubBuffer pointer is NULL.
+///
+/// @return COI_NOT_SUPPORTED if the in_Buffer is of any type other than
+/// COI_BUFFER_OPENCL
+///
+COIACCESSAPI
+COIRESULT
+COIBufferCreateSubBuffer(
+ COIBUFFER in_Buffer,
+ uint64_t in_Length,
+ uint64_t in_Offset,
+ COIBUFFER* out_pSubBuffer);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* _COIBUFFER_SOURCE_H */
+
+/*! @} */
diff --git a/liboffloadmic/include/coi/source/COIEngine_source.h b/liboffloadmic/include/coi/source/COIEngine_source.h
new file mode 100644
index 00000000000..19a63e43409
--- /dev/null
+++ b/liboffloadmic/include/coi/source/COIEngine_source.h
@@ -0,0 +1,247 @@
+/*
+ * Copyright 2010-2013 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 2.1.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ *
+ * Disclaimer: The codes contained in these modules may be specific
+ * to the Intel Software Development Platform codenamed Knights Ferry,
+ * and the Intel product codenamed Knights Corner, and are not backward
+ * compatible with other Intel products. Additionally, Intel will NOT
+ * support the codes or instruction set in future products.
+ *
+ * Intel offers no warranty of any kind regarding the code. This code is
+ * licensed on an "AS IS" basis and Intel is not obligated to provide
+ * any support, assistance, installation, training, or other services
+ * of any kind. Intel is also not obligated to provide any updates,
+ * enhancements or extensions. Intel specifically disclaims any warranty
+ * of merchantability, non-infringement, fitness for any particular
+ * purpose, and any other warranty.
+ *
+ * Further, Intel disclaims all liability of any kind, including but
+ * not limited to liability for infringement of any proprietary rights,
+ * relating to the use of the code, even if Intel is notified of the
+ * possibility of such liability. Except as expressly stated in an Intel
+ * license agreement provided with this code and agreed upon with Intel,
+ * no license, express or implied, by estoppel or otherwise, to any
+ * intellectual property rights is granted herein.
+ */
+
+#ifndef _COIENGINE_SOURCE_H
+#define _COIENGINE_SOURCE_H
+
+/** @ingroup COIEngine
+ * @addtogroup COIEngineSource
+@{
+
+* @file source\COIEngine_source.h
+*/
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+#include <wchar.h>
+#include "../common/COITypes_common.h"
+#include "../common/COIResult_common.h"
+#include "../common/COIEngine_common.h"
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define COI_MAX_DRIVER_VERSION_STR_LEN 255
+
+#define COI_MAX_HW_THREADS 1024
+
+///////////////////////////////////////////////////////////////////////////////
+/// This enum defines miscellaneous information returned from the
+/// COIGetEngineInfo() function.
+///
+typedef enum
+{
+ COI_ENG_ECC_DISABLED = 0, //ECC is not enabled on this engine
+ COI_ENG_ECC_ENABLED = 0x00000001, //ECC is enabled on this engine
+ COI_ENG_ECC_UNKNOWN = 0x00000002 //ECC is mode is unknown
+} coi_eng_misc;
+
+
+///////////////////////////////////////////////////////////////////////////////
+/// This structure returns information about an Intel(r) Xeon Phi(tm)
+/// coprocessor.
+/// A pointer to this structure is passed into the COIGetEngineInfo() function,
+/// which fills in the data before returning to the caller.
+///
+typedef struct COI_ENGINE_INFO
+{
+ /// The version string identifying the driver.
+ coi_wchar_t DriverVersion[COI_MAX_DRIVER_VERSION_STR_LEN];
+
+ /// The ISA supported by the engine.
+ COI_ISA_TYPE ISA;
+
+ /// The number of cores on the engine.
+ uint32_t NumCores;
+
+ /// Miscellaneous fields
+ coi_eng_misc MiscFlags;
+
+ /// The number of hardware threads on the engine.
+ uint32_t NumThreads;
+
+ /// The maximum frequency (in MHz) of the cores on the engine.
+ uint32_t CoreMaxFrequency;
+
+ /// The load percentage for each of the hardware threads on the engine.
+ uint32_t Load[COI_MAX_HW_THREADS];
+
+ /// The amount of physical memory managed by the OS.
+ uint64_t PhysicalMemory;
+
+ /// The amount of free physical memory in the OS.
+ uint64_t PhysicalMemoryFree;
+
+ /// The amount of swap memory managed by the OS.
+ uint64_t SwapMemory;
+
+ /// The amount of free swap memory in the OS.
+ uint64_t SwapMemoryFree;
+
+ /// The pci config vendor id
+ uint16_t VendorId;
+
+ /// The pci config device id
+ uint16_t DeviceId;
+
+ /// The pci config subsystem id
+ uint16_t SubSystemId;
+
+ /// The stepping of the board, A0, A1, C0, D0 etc.
+ uint16_t BoardStepping;
+
+ /// The SKU of the stepping, EB, ED, etc.
+ uint16_t BoardSKU;
+} COI_ENGINE_INFO;
+
+///////////////////////////////////////////////////////////////////////////////
+///
+/// Returns information related to a specified engine. Note that if Intel® Coprocessor Offload Infrastructure (Intel® COI) is
+/// unable to query a value it will be returned as zero but the call will
+/// still succeed.
+///
+///
+/// @param in_EngineHandle
+/// [in] The COIENGINE structure as provided from COIEngineGetHandle()
+/// which to query for device level information.
+///
+/// @param in_EngineInfoSize
+/// [in] The size of the structure that out_pEngineInfo points to.
+/// Used for version safety of the function call.
+///
+/// @param out_pEngineInfo
+/// [out] The address of a user allocated COI_ENGINE_INFO structure.
+/// Upon success, the contents of the structure will be updated
+/// to contain information related to the specified engine.
+///
+///
+/// @return COI_SUCCESS if the function completed without error.
+///
+/// @return COI_INVALID_HANDLE if the in_EngineHandle handle is not valid.
+///
+/// @return COI_SIZE_MISMATCH if in_EngineInfoSize does not match any current
+/// or previous COI_ENGINE_INFO structure sizes.
+///
+/// @return COI_INVALID_POINTER if the out_pEngineInfo pointer is NULL.
+///
+COIACCESSAPI
+COIRESULT
+COIEngineGetInfo(
+ COIENGINE in_EngineHandle,
+ uint32_t in_EngineInfoSize,
+ COI_ENGINE_INFO* out_pEngineInfo);
+
+
+///////////////////////////////////////////////////////////////////////////////
+///
+/// Returns the number of engines in the system that match the provided ISA.
+///
+/// Note that while it is possible to enumerate different types of Intel(r)
+/// Xeon Phi(tm) coprocessors on a single host this is not currently
+/// supported. Intel® Coprocessor Offload Infrastructure (Intel® COI) makes an assumption that all Intel(r) Xeon Phi(tm)
+/// coprocessors found in the system are the same architecture as the first
+/// coprocessor device.
+///
+/// Also, note that this function returns the number of engines that Intel® Coprocessor Offload Infrastructure (Intel® COI)
+/// is able to detect. Not all of them may be online.
+///
+/// @param in_ISA
+/// [in] Specifies the ISA type of the engine requested.
+///
+/// @param out_pNumEngines
+/// [out] The number of engines available. This can be used to index
+/// into the engines using COIEngineGetHandle().
+///
+/// @return COI_SUCCESS if the function completed without error.
+///
+/// @return COI_DOES_NOT_EXIST if the in_ISA parameter is not valid.
+///
+/// @return COI_INVALID_POINTER if the out_pNumEngines parameter is NULL.
+///
+COIACCESSAPI
+COIRESULT
+COIEngineGetCount(
+ COI_ISA_TYPE in_ISA,
+ uint32_t* out_pNumEngines);
+
+
+///////////////////////////////////////////////////////////////////////////////
+///
+/// Returns the handle of a user specified engine.
+///
+/// @param in_ISA
+/// [in] Specifies the ISA type of the engine requested.
+///
+/// @param in_EngineIndex
+/// [in] A unsigned integer which specifies the zero-based position of
+/// the engine in a collection of engines. The makeup of this
+/// collection is defined by the in_ISA parameter.
+///
+/// @param out_pEngineHandle
+/// [out] The address of an COIENGINE handle.
+///
+/// @return COI_SUCCESS if the function completed without error.
+///
+/// @return COI_DOES_NOT_EXIST if the in_ISA parameter is not valid.
+///
+/// @return COI_OUT_OF_RANGE if in_EngineIndex is greater than or equal to
+/// the number of engines that match the in_ISA parameter.
+///
+/// @return COI_INVALID_POINTER if the out_pEngineHandle parameter is NULL.
+///
+/// @return COI_VERSION_MISMATCH if the version of Intel® Coprocessor Offload Infrastructure (Intel® COI) on the host is not
+/// compatible with the version on the device.
+///
+/// @return COI_NOT_INITIALIZED if the engine requested exists but is offline.
+///
+COIACCESSAPI
+COIRESULT
+COIEngineGetHandle(
+ COI_ISA_TYPE in_ISA,
+ uint32_t in_EngineIndex,
+ COIENGINE* out_pEngineHandle);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* _COIENGINE_SOURCE_H */
+
+/*! @} */
diff --git a/liboffloadmic/include/coi/source/COIEvent_source.h b/liboffloadmic/include/coi/source/COIEvent_source.h
new file mode 100644
index 00000000000..99fa00d6a27
--- /dev/null
+++ b/liboffloadmic/include/coi/source/COIEvent_source.h
@@ -0,0 +1,192 @@
+/*
+ * Copyright 2010-2013 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 2.1.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ *
+ * Disclaimer: The codes contained in these modules may be specific
+ * to the Intel Software Development Platform codenamed Knights Ferry,
+ * and the Intel product codenamed Knights Corner, and are not backward
+ * compatible with other Intel products. Additionally, Intel will NOT
+ * support the codes or instruction set in future products.
+ *
+ * Intel offers no warranty of any kind regarding the code. This code is
+ * licensed on an "AS IS" basis and Intel is not obligated to provide
+ * any support, assistance, installation, training, or other services
+ * of any kind. Intel is also not obligated to provide any updates,
+ * enhancements or extensions. Intel specifically disclaims any warranty
+ * of merchantability, non-infringement, fitness for any particular
+ * purpose, and any other warranty.
+ *
+ * Further, Intel disclaims all liability of any kind, including but
+ * not limited to liability for infringement of any proprietary rights,
+ * relating to the use of the code, even if Intel is notified of the
+ * possibility of such liability. Except as expressly stated in an Intel
+ * license agreement provided with this code and agreed upon with Intel,
+ * no license, express or implied, by estoppel or otherwise, to any
+ * intellectual property rights is granted herein.
+ */
+
+#ifndef _COIEVENT_SOURCE_H
+#define _COIEVENT_SOURCE_H
+
+/** @ingroup COIEvent
+ * @addtogroup COIEventSource
+@{
+* @file source/COIEvent_source.h
+*/
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+#include "../common/COITypes_common.h"
+#include "../common/COIResult_common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+///////////////////////////////////////////////////////////////////////////////
+///
+/// Special case event values which can be passed in to APIs to specify
+/// how the API should behave. In COIBuffer APIs passing in NULL for the
+/// completion event is the equivalent of passing COI_EVENT_SYNC. For
+/// COIPipelineRunFunction passing in NULL is the equivalent of
+/// COI_EVENT_ASYNC.
+/// Note that passing COI_EVENT_ASYNC can be used when the caller wishes the
+/// operation to be performed asynchronously but does not care when the
+/// operation completes. This can be useful for opertions that by definition
+/// must complete in order (DMAs, run functions on a single pipeline). If
+/// the caller does care when the operation completes then they should pass
+/// in a valid completion event which they can later wait on.
+///
+#define COI_EVENT_ASYNC ((COIEVENT*)1)
+#define COI_EVENT_SYNC ((COIEVENT*)2)
+
+///////////////////////////////////////////////////////////////////////////////
+///
+/// Wait for an arbitrary number of COIEVENTs to be signaled as completed,
+/// eg when the run function or asynchronous map call associated with an event
+/// has finished execution.
+/// If the user sets in_WaitForAll = True and not all of the events are
+/// signaled when the timeout period is reached then COI_TIME_OUT_REACHED will
+/// be returned.
+/// If the user sets in_WaitForAll = False then if at least one event is
+/// signaled when the timeout is reached then COI_SUCCESS is returned.
+///
+/// @param in_NumEvents
+/// [in] The number of events to wait for.
+///
+/// @param in_pEvents
+/// [in] The array of COIEVENT handles to wait for.
+///
+/// @param in_Timeout
+/// [in] The time in milliseconds to wait for the event. 0 polls
+/// and returns immediately, -1 blocks indefinitely.
+///
+/// @param in_WaitForAll
+/// [in] Boolean value specifying behavior. If true, wait for all
+/// events to be signaled, or for timeout, whichever happens first.
+/// If false, return when any event is signaled, or at timeout.
+///
+/// @param out_pNumSignaled
+/// [out] The number of events that were signaled. If in_NumEvents
+/// is 1 or in_WaitForAll = True, this parameter is optional.
+///
+/// @param out_pSignaledIndices
+/// [out] Pointer to an array of indicies into the original event
+/// array. Those denoted have been signaled. The user must provide an
+/// array that is no smaller than the in_Events array. If in_NumEvents
+/// is 1 or in_WaitForAll = True, this parameter is optional.
+///
+/// @return COI_SUCCESS once an event has been signaled completed.
+///
+/// @return COI_TIME_OUT_REACHED if the events are still in use when the
+/// timeout is reached or timeout is zero (a poll).
+///
+/// @return COI_OUT_OF_RANGE if a negative value other than -1 is passed in to
+/// the in_Timeout parameter.
+///
+/// @return COI_OUT_OF_RANGE if in_NumEvents is 0.
+///
+/// @return COI_INVALID_POINTER if in_pEvents is NULL.
+///
+/// @return COI_ARGUMENT_MISMATCH if in_NumEvents > 1 and if in_WaitForAll
+/// is not true and out_pSignaled or out_pSignaledIndicies are NULL.
+///
+/// @return COI_ARGUMENT_MISMATCH if out_pNumSignaled is not NULL
+/// and out_pSignaledIndices is NULL (or vice versa).
+///
+/// @return COI_EVENT_CANCELED if while waiting on a user event, it gets
+/// unregistered this returns COI_EVENT_CANCELED
+///
+/// @return COI_PROCESS_DIED if the remote process died. See COIProcessDestroy
+/// for more details.
+///
+COIACCESSAPI
+COIRESULT
+COIEventWait(
+ uint16_t in_NumEvents,
+ const COIEVENT* in_pEvents,
+ int32_t in_TimeoutMilliseconds,
+ uint8_t in_WaitForAll,
+ uint32_t* out_pNumSignaled,
+ uint32_t* out_pSignaledIndices);
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+///
+/// Register a User COIEVENT so that it can be fired. Registered event is
+/// a one shot User event; in other words once signaled it cannot be used
+/// again for signaling. You have to unregister and register again to enable
+/// signaling. An event will be reset if it is re-registered without
+/// unregistering, resulting in loss of all outstanding signals.
+///
+/// @param out_pEvent
+/// [out] Pointer to COIEVENT handle being Registered
+///
+/// @return COI_SUCCESS an event is successfully registered
+///
+/// @return COI_INVALID_POINTER if out_pEvent is NULL
+///
+COIACCESSAPI
+COIRESULT
+COIEventRegisterUserEvent(
+ COIEVENT* out_pEvent);
+
+
+///////////////////////////////////////////////////////////////////////////////
+///
+/// Unregister a User COIEVENT. Unregistering a unsignaled event is similar
+/// to firing an event. Except Calling COIEventWait on an event that is
+/// being unregistered returns COI_EVENT_CANCELED
+///
+/// @param in_Event
+/// [in] Event Handle to be unregistered.
+///
+/// @return COI_INVALID_HANDLE if in_Event is not a UserEvent
+///
+/// @return COI_SUCCESS an event is successfully registered
+///
+COIACCESSAPI
+COIRESULT
+COIEventUnregisterUserEvent(
+ COIEVENT in_Event);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* _COIEVENT_SOURCE_H */
+
+/*! @} */
diff --git a/liboffloadmic/include/coi/source/COIPipeline_source.h b/liboffloadmic/include/coi/source/COIPipeline_source.h
new file mode 100644
index 00000000000..d210a1f5025
--- /dev/null
+++ b/liboffloadmic/include/coi/source/COIPipeline_source.h
@@ -0,0 +1,426 @@
+/*
+ * Copyright 2010-2013 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 2.1.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ *
+ * Disclaimer: The codes contained in these modules may be specific
+ * to the Intel Software Development Platform codenamed Knights Ferry,
+ * and the Intel product codenamed Knights Corner, and are not backward
+ * compatible with other Intel products. Additionally, Intel will NOT
+ * support the codes or instruction set in future products.
+ *
+ * Intel offers no warranty of any kind regarding the code. This code is
+ * licensed on an "AS IS" basis and Intel is not obligated to provide
+ * any support, assistance, installation, training, or other services
+ * of any kind. Intel is also not obligated to provide any updates,
+ * enhancements or extensions. Intel specifically disclaims any warranty
+ * of merchantability, non-infringement, fitness for any particular
+ * purpose, and any other warranty.
+ *
+ * Further, Intel disclaims all liability of any kind, including but
+ * not limited to liability for infringement of any proprietary rights,
+ * relating to the use of the code, even if Intel is notified of the
+ * possibility of such liability. Except as expressly stated in an Intel
+ * license agreement provided with this code and agreed upon with Intel,
+ * no license, express or implied, by estoppel or otherwise, to any
+ * intellectual property rights is granted herein.
+ */
+
+#ifndef _COIPIPELINE_SOURCE_H
+#define _COIPIPELINE_SOURCE_H
+
+/** @ingroup COIPipeline
+ * @addtogroup COIPipelineSource
+@{
+* @file source/COIPipeline_source.h
+*/
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+#include "../common/COITypes_common.h"
+#include "../common/COIResult_common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
+
+
+//////////////////////////////////////////////////////////////////////////////
+/// These flags specify how a buffer will be used within a run function. They
+/// allow Intel® Coprocessor Offload Infrastructure (Intel® COI) to make optimizations in how it moves data around the system.
+/// These flags can affect the correctness of an application, so they must be
+/// set properly. For example, if a buffer is used in a run function with the
+/// COI_SINK_READ flag and then mapped on the source, Intel® Coprocessor Offload Infrastructure (Intel® COI) may use a previously
+/// cached version of the buffer instead of retrieving data from the sink.
+typedef enum COI_ACCESS_FLAGS
+{
+ /// Specifies that the run function will only read the associated buffer.
+ COI_SINK_READ = 1,
+
+ /// Specifies that the run function will write to the associated buffer.
+ COI_SINK_WRITE,
+
+ /// Specifies that the run function will overwrite the entire associated
+ /// buffer and therefore the buffer will not be synchronized with the
+ /// source before execution.
+ COI_SINK_WRITE_ENTIRE
+} COI_ACCESS_FLAGS;
+
+#define COI_PIPELINE_MAX_PIPELINES 512
+#define COI_PIPELINE_MAX_IN_BUFFERS 16384
+#define COI_PIPELINE_MAX_IN_MISC_DATA_LEN 32768
+
+
+///////////////////////////////////////////////////////////////////////////////
+///
+/// Create a pipeline assoiated with a remote process. This pipeline can
+/// then be used to execute remote functions and to share data using
+/// COIBuffers.
+///
+/// @param in_Process
+/// [in] A handle to an already existing process that the pipeline
+/// will be associated with.
+///
+/// @param in_Mask
+/// [in] An optional mask of the set of hardware threads on which the
+/// sink pipeline command processing thread could run.
+///
+/// @param in_StackSize
+/// [in] An optional value that will be used when the pipeline
+/// processing thread is created on the sink. If the user passes in
+/// 0 the OS default stack size will be used. Otherwise the value
+/// must be PTHREAD_STACK_MIN (16384) bytes or larger and must be
+/// a multiple of a page (4096 bytes).
+///
+/// @param out_pPipeline
+/// [out] Handle returned to uniquely identify the pipeline that was
+/// created for use in later API calls.
+///
+///
+/// @return COI_SUCCESS if the pipeline was successfully created.
+///
+/// @return COI_INVALID_HANDLE if the in_Process handle passed in was invalid.
+///
+/// @return COI_INVALID_POINTER if the out_pPipeline pointer was NULL.
+///
+/// @return COI_RESOURCE_EXHAUSTED if no more COIPipelines can be created. The
+/// maximum number of pipelines allowed is COI_PIPELINE_MAX_PIPELINES.
+/// It is recommended in most cases to not exceed the number of CPU's
+/// that are reported on the offload device, performance will suffer.
+///
+///
+/// @return COI_OUT_OF_RANGE if the in_StackSize > 0 &&
+/// in_StackSize < PTHREAD_STACK_MIN or if in_StackSize is not a
+/// multiple of a page (4096 bytes).
+///
+/// @return COI_OUT_OF_RANGE if the in_Mask is set to all zeroes. If no mask
+/// is desired then the in_Mask should be passed as NULL, otherwise
+/// at least one thread must be set.
+///
+/// @return COI_TIME_OUT_REACHED if establishing the communication channel with
+/// the remote pipeline timed out.
+///
+/// @return COI_RETRY if the pipeline cannot be created due to the number of
+/// source-to-sink connections in use. A subsequent call to
+/// COIPipelineCreate may succeed if resources are freed up.
+///
+/// @return COI_PROCESS_DIED if in_Process died.
+///
+COIACCESSAPI
+COIRESULT
+COIPipelineCreate(
+ COIPROCESS in_Process,
+ COI_CPU_MASK in_Mask,
+ uint32_t in_StackSize,
+ COIPIPELINE* out_pPipeline);
+
+///////////////////////////////////////////////////////////////////////////////
+///
+/// Destroys the inidicated pipeline, releasing its resources.
+///
+/// @param in_Pipeline
+/// [in] Pipeline to destroy.
+///
+///
+/// @return COI_SUCCESS if the pipeline was destroyed
+///
+COIACCESSAPI
+COIRESULT
+COIPipelineDestroy(
+ COIPIPELINE in_Pipeline);
+
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// Enqueues a function in the remote process binary to be executed. The
+/// function execution is asynchronous in regards to the Source and all
+/// run functions enqueued on a pipeline are executed in-order. The run
+/// function will only execute when all of the required buffers are present
+/// in the Sink's memory.
+///
+/// Potential Hazards while using Runfunctions:
+///
+/// 1. Proper care has to be taken while setting the input dependencies for
+/// RunFunctions. Setting it incorrectly can lead to cyclic dependencies
+/// and can cause the respective pipeline (as a result Intel® Coprocessor Offload Infrastructure (Intel® COI) Runtime) to
+/// stall.
+/// 2. RunFunctions can also segfault if enough memory space is not available
+/// on the sink for the buffers passed in. Pinned buffers and buffers that
+/// are AddRef'd need to be accounted for available memory space. In other
+/// words, this memory is not available for use until it is freed up.
+/// 3. Unexpected segmentation faults or erroneous behaviour can occur if
+/// handles or data passed in to Runfunction gets destroyed before the
+/// RunFunction finishes.
+/// For example, if a variable passed in as Misc data or the buffer gets
+/// destroyed before the Intel® Coprocessor Offload Infrastructure (Intel® COI) runtime receives the completion notification
+/// of the Runfunction, it can cause unexpected behaviour. So it is always
+/// recommended to wait for RunFunction completion event before any related
+/// destroy event occurs.
+///
+/// Intel® Coprocessor Offload Infrastructure (Intel® COI) Runtime expects users to handle such scenarios. COIPipelineRunFunction
+/// returns COI_SUCCESS for above cases because it was queued up successfully.
+/// Also if you try to destroy a pipeline with a stalled function then the
+/// destroy call will hang. COIPipelineDestroy waits until all the functions
+/// enqueued are finished executing.
+///
+/// @param in_Pipeline
+/// [in] Handle to a previously created pipeline that this run
+/// function should be enqueued to.
+///
+/// @param in_Function
+/// [in] Previously returned handle from a call to
+/// COIPipelineGetFunctionHandle() that represents a function in the
+/// application running on the Sink process.
+///
+/// @param in_NumBuffers
+/// [in] The number of buffers that are being passed to the run
+/// function. This number must match the number of buffers in the
+/// in_pBuffers and in_pBufferAccessFlags arrays. Must be less than
+/// COI_PIPELINE_MAX_IN_BUFFERS.
+///
+/// @param in_pBuffers
+/// [in] An array of COIBUFFER handles that the function is expected
+/// to use during its execution. Each buffer when it arrives at the
+/// Sink process will be at least 4k page aligned, thus, using a very
+/// large number of small buffers is memory inefficient and should be
+/// avoided.
+///
+/// @param in_pBufferAccessFlags
+/// [in] An array of flag values which correspond to the buffers
+/// passed in the in_pBuffers parameter. These flags are used to
+/// track dependencies between different run functions being
+/// executed from different pipelines.
+///
+/// @param in_NumDependencies
+/// [in] The number of dependencies specified in the in_pDependencies
+/// array. This may be 0 if the caller does not want the run function
+/// to wait for any dependencies.
+///
+/// @param in_pDependencies
+/// [in] An optional array of COIEVENT objects that this run
+/// function will wait for before executing. This allows the user to
+/// create dependencies between run functions in different pipelines.
+/// The user may pass in NULL if they do not wish to wait for any
+/// dependencies to complete.
+///
+/// @param in_pMiscData
+/// [in] Pointer to user defined data, typically used to pass
+/// parameters to Sink side functions. Should only be used for small
+/// amounts data since the data will be placed directly in the
+/// Driver's command buffer. COIBuffers should be used to pass large
+/// amounts of data.
+///
+/// @param in_MiscDataLen
+/// [in] Size of the in_pMiscData in bytes. Must be less than
+/// COI_PIPELINE_MAX_IN_MISC_DATA_LEN, and should usually be much
+/// smaller, see documentation for the parameter in_pMiscData.
+///
+/// @param out_pAsyncReturnValue
+/// [out] Pointer to user-allocated memory where the return value from
+/// the run function will be placed. This memory should not be read
+/// until out_pCompletion has been signalled.
+///
+/// @param in_AsyncReturnValueLen
+/// [in] Size of the out_pAsyncReturnValue in bytes.
+///
+/// @param out_pCompletion
+/// [out] An optional pointer to a COIEVENT object
+/// that will be signaled when this run function has completed
+/// execution. The user may pass in NULL if they do not wish to signal
+/// any COIEVENTs when this run function completes.
+///
+/// @return COI_SUCCESS if the function was successfully placed in a
+/// pipeline for future execution. Note that the actual
+/// execution of the function will occur in the future.
+///
+/// @return COI_OUT_OF_RANGE if in_NumBuffers is greater than
+/// COI_PIPELINE_MAX_IN_BUFFERS or if in_MiscDataLen is greater than
+/// COI_PIPELINE_MAX_IN_MISC_DATA_LEN.
+///
+/// @return COI_INVALID_HANDLE if the pipeline handle passed in was invalid.
+///
+/// @return COI_INVALID_HANDLE if the function handle passed in was invalid.
+///
+/// @return COI_INVALID_HANDLE if any of the buffers passed in are invalid.
+///
+/// @return COI_ARGUMENT_MISMATCH if in_NumDependencies is non-zero while
+/// in_pDependencies was passed in as NULL.
+///
+/// @return COI_ARGUMENT_MISMATCH if in_pDependencies is non-NULL but
+/// in_NumDependencies is zero.
+///
+/// @return COI_ARGUMENT_MISMATCH if in_MiscDataLen is non-zero while
+/// in_pMiscData was passed in as NULL.
+///
+/// @return COI_ARGUMENT_MISMATCH if in_pMiscData is non-NULL but
+/// in_MiscDataLen is zero.
+///
+/// @return COI_ARGUMENT_MISMATCH if in_NumBuffers is non-zero and in_pBuffers
+/// or in_pBufferAccessFlags are NULL.
+///
+/// @return COI_ARGUMENT_MISMATCH if in_pBuffers is non-NULL but
+/// in_NumBuffers is zero.
+///
+/// @return COI_ARGUMENT_MISMATCH if in_pBufferAccessFlags is non-NULL but
+/// in_NumBuffers is zero.
+///
+/// @return COI_ARGUMENT_MISMATCH if in_ReturnValueLen is non-zero while
+/// in_pReturnValue was passed in as NULL.
+///
+/// @return COI_ARGUMENT_MISMATCH if in_pReturnValue is non-NULL but
+/// in_ReturnValueLen is zero.
+///
+/// @return COI_ARGUMENT_MISMATCH if a COI_BUFFER_STREAMING_TO_SOURCE buffer
+/// is not passed with COI_SINK_WRITE_ENTIRE access flag.
+///
+/// @return COI_RESOURCE_EXHAUSTED if could not create a version for TO_SOURCE
+/// streaming buffer. It can fail if enough memory is not available to
+/// register. This call will succeed eventually when the registered
+/// memory becomes available.
+///
+/// @return COI_RETRY if any input buffers, which are not pinned buffers,
+/// are still mapped when passed to the run function.
+///
+/// @return COI_MISSING_DEPENDENCY if buffer was not created on the process
+/// associated with the pipeline that was passed in.
+///
+/// @return COI_OUT_OF_RANGE if any of the access flags in
+/// in_pBufferAccessFlags is not a valid COI_ACCESS_FLAGS.
+///
+COIACCESSAPI
+COIRESULT
+COIPipelineRunFunction(
+ COIPIPELINE in_Pipeline,
+ COIFUNCTION in_Function,
+ uint32_t in_NumBuffers,
+ const COIBUFFER* in_pBuffers,
+ const COI_ACCESS_FLAGS* in_pBufferAccessFlags,
+ uint32_t in_NumDependencies,
+ const COIEVENT* in_pDependencies,
+ const void* in_pMiscData,
+ uint16_t in_MiscDataLen,
+ void* out_pAsyncReturnValue,
+ uint16_t in_AsyncReturnValueLen,
+ COIEVENT* out_pCompletion);
+
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// Retrieve the engine that the pipeline is associated with.
+///
+/// @param in_Pipeline
+/// [in] Pipeline to query.
+///
+/// @param out_pEngine
+/// [out] The handle of the Engine.
+///
+/// @return COI_SUCCESS if the engine was retrieved.
+///
+/// @return COI_INVALID_HANDLE if the pipeline handle passed in was invalid.
+///
+/// @return COI_INVALID_POINTER if the out_pEngine parameter is NULL.
+///
+/// @return COI_PROCESS_DIED if the process associated with this engine died.
+///
+COIACCESSAPI
+COIRESULT
+COIPipelineGetEngine(
+ COIPIPELINE in_Pipeline,
+ COIENGINE* out_pEngine);
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// Add a particular core:thread pair to a COI_CPU_MASK.
+///
+/// @param in_Process
+/// [in] A handle to an already existing process that the pipeline
+/// will be associated with.
+///
+/// @param in_CoreID
+/// [in] Core to affinitize to; must be less than the number of cores
+/// on the device.
+///
+/// @param in_ThreadID
+/// [in] Thread on the core to affinitize to (0 - 3).
+///
+/// @param out_pMask
+/// [out] Pointer to the mask to set.
+///
+/// @warning Unless it is explicitly done, the contents of the mask may not
+/// be zero when creating or declaring a COI_CPU_MASK variable.
+///
+/// @return COI_SUCCESS if the mask was set.
+///
+/// @return COI_OUT_OF_RANGE if the in_CoreID or in_ThreadID is out of range.
+///
+/// @return COI_INVALID_POINTER if out_pMask is invalid.
+///
+/// @return COI_INVALID_HANDLE if in_Process is invalid.
+///
+COIACCESSAPI
+COIRESULT
+COIPipelineSetCPUMask(
+ COIPROCESS in_Process,
+ uint32_t in_CoreID,
+ uint8_t in_ThreadID,
+ COI_CPU_MASK* out_pMask);
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// Clears a given mask. Note that the memory contents of COI_CPU_MASK are not
+/// guaranteed to be zero when declaring a COI_CPU_MASK variable. Thus, prior
+/// to setting a specific affinity to in_Mask it is important to call this
+/// function first.
+///
+/// @param in_Mask
+/// [in] Pointer to the mask to clear.
+///
+/// @return COI_SUCCESS if the mask was cleared.
+///
+/// @return COI_INVALID_POINTER if in_Mask is invalid.
+///
+COIACCESSAPI
+COIRESULT
+COIPipelineClearCPUMask(
+ COI_CPU_MASK* in_Mask);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* _COIPIPELINE_SOURCE_H */
+
+/*! @} */
diff --git a/liboffloadmic/include/coi/source/COIProcess_source.h b/liboffloadmic/include/coi/source/COIProcess_source.h
new file mode 100644
index 00000000000..b60e5522515
--- /dev/null
+++ b/liboffloadmic/include/coi/source/COIProcess_source.h
@@ -0,0 +1,971 @@
+/*
+ * Copyright 2010-2013 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 2.1.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ *
+ * Disclaimer: The codes contained in these modules may be specific
+ * to the Intel Software Development Platform codenamed Knights Ferry,
+ * and the Intel product codenamed Knights Corner, and are not backward
+ * compatible with other Intel products. Additionally, Intel will NOT
+ * support the codes or instruction set in future products.
+ *
+ * Intel offers no warranty of any kind regarding the code. This code is
+ * licensed on an "AS IS" basis and Intel is not obligated to provide
+ * any support, assistance, installation, training, or other services
+ * of any kind. Intel is also not obligated to provide any updates,
+ * enhancements or extensions. Intel specifically disclaims any warranty
+ * of merchantability, non-infringement, fitness for any particular
+ * purpose, and any other warranty.
+ *
+ * Further, Intel disclaims all liability of any kind, including but
+ * not limited to liability for infringement of any proprietary rights,
+ * relating to the use of the code, even if Intel is notified of the
+ * possibility of such liability. Except as expressly stated in an Intel
+ * license agreement provided with this code and agreed upon with Intel,
+ * no license, express or implied, by estoppel or otherwise, to any
+ * intellectual property rights is granted herein.
+ */
+
+#ifndef _COIPROCESS_SOURCE_H
+#define _COIPROCESS_SOURCE_H
+
+/** @ingroup COIProcess
+ * @addtogroup COIProcessSource
+@{
+* @file source/COIProcess_source.h
+*/
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+#include "../common/COITypes_common.h"
+#include "../common/COIResult_common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
+
+///////////////////////////////////////////////////////////////////////////////
+/// This is a special COIPROCESS handle that can be used to indicate that
+/// the source process should be used for an operation.
+///
+#define COI_PROCESS_SOURCE ((COIPROCESS)-1)
+
+#define COI_MAX_FILE_NAME_LENGTH 256
+
+///////////////////////////////////////////////////////////////////////////////
+///
+/// Create a remote process on the Sink and start executing its main()
+/// function.
+///
+/// For more details about creating a process see COIProcessCreateFromMemory.
+///
+/// @param in_Engine
+/// [in] A handle retrieved via a call to COIEngineGetHandle() that
+/// indicates which device to create the process on. This is
+/// necessary because there can be more than one device
+/// within the system.
+///
+/// @param in_pBinaryName
+/// [in] Pointer to a null-terminated string that contains the
+/// path to the program binary to be instantiated as a process on
+/// the sink device. The file name will be accessed via
+/// fopen and fread, as such, the passed in binary name must
+/// be locatable via these commands. Also, the file name (without
+/// directory information) will be used automatically by the system
+/// to create the argv[0] of the new process.
+///
+/// @param in_Argc
+/// [in] The number of arguments being passed in to the process in the
+/// in_ppArgv parameter.
+///
+/// @param in_ppArgv
+/// [in] An array of strings that represent the arguments being passed
+/// in. The system will auto-generate argv[0] using in_pBinaryName and
+/// thus that parameter cannot be passed in using in_ppArgv. Instead,
+/// in_ppArgv contains the rest of the parameters being passed in.
+///
+/// @param in_DupEnv
+/// [in] A boolean that indicates whether the process that is being
+/// created should inherit the environment of the caller.
+///
+/// @param in_ppAdditionalEnv
+/// [in] An array of strings that represent additional environment
+/// variables. This parameter must terminate the array with a NULL
+/// string. For convenience it is also allowed to be NULL if there are
+/// no additional environment variables that need adding. Note that
+/// any environment variables specified here will be in addition to
+/// but override those that were inherited via in_DupEnv.
+///
+/// @param in_ProxyActive
+/// [in] A boolean that specifies whether the process that is to be
+/// created wants I/O proxy support. If this flag is enabled, then
+/// stdout and stderr are forwarded back to the calling process's
+/// output and error streams.
+///
+/// @param in_Reserved
+/// Reserved for future use, best set at NULL.
+///
+/// @param in_InitialBufferSpace
+/// [in] The initial memory (in bytes) that will be pre-allocated at
+/// process creation for use by buffers associated with this remote
+/// process. In addition to allocating, Intel® Coprocessor Offload
+/// Infrastructure (Intel® COI) will also fault in the
+/// memory during process creation. If the total size of the buffers
+/// in use by this process exceed this initial size, memory on the
+/// sink may continue to be allocated on demand, as needed, subject
+/// to the system constraints on the sink.
+///
+///@param in_LibrarySearchPath
+/// [in] a path to locate dynamic libraries dependencies for the sink
+/// application. If not NULL, this path will override the environment
+/// variable SINK_LD_LIBRARY_PATH. If NULL it will use
+/// SINK_LD_LIBRARY_PATH to locate dependencies.
+///
+/// @param out_pProcess
+/// [out] Handle returned to uniquely identify the process that was
+/// created for use in later API calls.
+///
+/// @return COI_SUCCESS if the remote process was successfully created.
+///
+/// @return COI_INVALID_POINTER if in_pBinaryName was NULL.
+///
+/// @return COI_INVALID_FILE if in_pBinaryName is not a "regular file" as
+/// determined by stat or if its size is 0.
+///
+/// @return COI_DOES_NOT_EXIST if in_pBinaryName cannot be found.
+///
+/// @return See COIProcessCreateFromMemory for additional errors.
+///
+COIACCESSAPI
+COIRESULT
+COIProcessCreateFromFile(
+ COIENGINE in_Engine,
+ const char* in_pBinaryName,
+ int in_Argc,
+ const char** in_ppArgv,
+ uint8_t in_DupEnv,
+ const char** in_ppAdditionalEnv,
+ uint8_t in_ProxyActive,
+ const char* in_Reserved,
+ uint64_t in_InitialBufferSpace,
+ const char* in_LibrarySearchPath,
+ COIPROCESS* out_pProcess);
+
+///////////////////////////////////////////////////////////////////////////////
+///
+/// Create a remote process on the Sink and start executing its main()
+/// function. This will also automatically load any dependent shared objects
+/// on to the device. Once the process is created, remote calls can be
+/// initiated by using the RunFunction mechanism found in the COIPipeline APIs.
+///
+/// If instead of creating a process you only wish to check for dynamic
+/// library dependencies set the environment variable
+/// SINK_LD_TRACE_LOADED_OBJECTS to be non empty before making this call.
+///
+/// If there are dynamic link libraries on the source file system that need to
+/// be preloaded when the process is created on the device, callers of this
+/// API can set the environment variable SINK_LD_PRELOAD to a colon separated
+/// list of libraries that need to be copied to the sink and preloaded as part
+/// of process creation.
+///
+/// For more information on how dependencies are loaded, see
+/// COIProcessLoadLibraryFromMemory.
+///
+/// @param in_Engine
+/// [in] A handle retrieved via a call to COIEngineGetHandle() that
+/// indicates which device to create the process on. This is
+/// necessary because there can be more than one device
+/// within the system.
+///
+/// @param in_pBinaryName
+/// [in] Pointer to a null-terminated string that contains the name to
+/// give the process that will be created. Note that the final name
+/// will strip out any directory information from in_pBinaryName and
+/// use the file information to generate an argv[0] for the new
+/// process.
+///
+/// @param in_pBinaryBuffer
+/// [in] Pointer to a buffer whose contents represent the sink-side
+/// process that we want to create.
+///
+/// @param in_BinaryBufferLength
+/// [in] Number of bytes in in_pBinaryBuffer.
+///
+/// @param in_Argc
+/// [in] The number of arguments being passed in to the process in the
+/// in_ppArgv parameter.
+///
+/// @param in_ppArgv
+/// [in] An array of strings that represent the arguments being passed
+/// in. The system will auto-generate argv[0] using in_pBinaryName and
+/// thus that parameter cannot be passed in using in_ppArgv. Instead,
+/// in_ppArgv contains the rest of the parameters being passed in.
+///
+/// @param in_DupEnv
+/// [in] A boolean that indicates whether the process that is being
+/// created should inherit the environment of the caller.
+///
+/// @param in_ppAdditionalEnv
+/// [in] An array of strings that represent additional environment
+/// variables. This parameter must terminate the array with a NULL
+/// string. For convenience it is also allowed to be NULL if there are
+/// no additional environment variables that need adding. Note that
+/// any environment variables specified here will be in addition to
+/// but override those that were inherited via in_DupEnv.
+///
+/// @param in_ProxyActive
+/// [in] A boolean that specifies whether the process that is to be
+/// created wants I/O proxy support.
+///
+/// @param in_Reserved
+/// Reserved for future use, best set to NULL.
+///
+/// @param in_InitialBufferSpace
+/// [in] The initial memory (in bytes) that will be pre-allocated at
+/// process creation for use by buffers associated with this remote
+/// process. In addition to allocating, Intel® Coprocessor
+/// Offload Infrastructure (Intel® COI) will also fault in the
+/// memory during process creation. If the total size of the buffers
+/// in use by this process exceed this initial size, memory on the
+/// sink may continue to be allocated on demand, as needed, subject
+/// to the system constraints on the sink.
+///
+/// @param in_LibrarySearchPath
+/// [in] A path to locate dynamic libraries dependencies for the sink
+/// application. If not NULL, this path will override the environment
+/// variable SINK_LD_LIBRARY_PATH. If NULL it will use
+/// SINK_LD_LIBRARY_PATH to locate dependencies.
+///
+/// @param in_FileOfOrigin
+/// [in] If not NULL, this parameter indicates the file from which the
+/// in_pBinaryBuffer was obtained. This parameter is optional.
+///
+/// @param in_FileOfOriginOffset
+/// [in] If in_FileOfOrigin is not NULL, this parameter indicates the
+/// offset within that file where in_pBinaryBuffer begins.
+///
+/// @param out_pProcess
+/// [out] Handle returned to uniquely identify the process that was
+/// created for use in later API calls.
+///
+/// @return COI_SUCCESS if the remote process was successfully created.
+///
+/// @return COI_INVALID_HANDLE if the in_Engine handle passed in was invalid.
+///
+/// @return COI_INVALID_POINTER if out_pProcess was NULL.
+///
+/// @return COI_INVALID_POINTER if in_pBinaryName or in_pBinaryBuffer was NULL.
+///
+/// @return COI_MISSING_DEPENDENCY if a dependent library is missing from
+/// either SINK_LD_LIBRARY_PATH or the in_LibrarySearchPath parameter.
+///
+/// @return COI_BINARY_AND_HARDWARE_MISMATCH if in_pBinaryName or any of its
+/// recursive dependencies were built for a target machine that does
+/// not match the engine specified.
+///
+/// @return COI_RESOURCE_EXHAUSTED if no more COIProcesses can be created,
+/// possibly, but not necessarily because in_InitialBufferSpace is too
+/// large.
+///
+/// @return COI_ARGUMENT_MISMATCH if in_Argc is 0 and in_ppArgv is not NULL.
+///
+/// @return COI_ARGUMENT_MISMATCH if in_Argc is greater than 0 and in_ppArgv is
+/// NULL.
+///
+/// @return COI_OUT_OF_RANGE if in_Argc is less than 0.
+///
+/// @return COI_OUT_OF_RANGE if the length of in_pBinaryName is greater than or
+/// equal to COI_MAX_FILE_NAME_LENGTH.
+///
+/// @return COI_OUT_OF_RANGE if in_BinaryBufferLength is 0.
+///
+/// @return COI_TIME_OUT_REACHED if establishing the communication channel with
+/// the remote process timed out.
+///
+/// @return COI_DOES_NOT_EXIST if in_FileOfOrigin is not NULL and does not
+/// exist.
+///
+/// @return COI_ARGUMENT_MISMATCH if in_FileOfOrigin is NULL and
+/// in_FileOfOriginOffset is not 0.
+///
+/// @return COI_INVALID_FILE if in_FileOfOrigin is not a "regular file" as
+/// determined by stat or if its size is 0.
+///
+/// @return COI_OUT_OF_RANGE if in_FileOfOrigin exists but its size is
+/// less than in_FileOfOriginOffset + in_BinaryBufferLength.
+///
+/// @return COI_NOT_INITIALIZED if the environment variable
+/// SINK_LD_TRACE_LOADED_OBJECTS is set to a non empty string and there
+/// are no errors locating the shared library dependencies.
+///
+/// @return COI_PROCESS_DIED if at some point during the loading of the remote
+/// process the remote process terminated abnormally.
+///
+/// @return COI_VERSION_MISMATCH if the version of Intel® Coprocessor
+/// Offload Infrastructure (Intel® COI) on the host is not
+/// compatible with the version on the device.
+///
+COIACCESSAPI
+COIRESULT
+COIProcessCreateFromMemory(
+ COIENGINE in_Engine,
+ const char* in_pBinaryName,
+ const void* in_pBinaryBuffer,
+ uint64_t in_BinaryBufferLength,
+ int in_Argc,
+ const char** in_ppArgv,
+ uint8_t in_DupEnv,
+ const char** in_ppAdditionalEnv,
+ uint8_t in_ProxyActive,
+ const char* in_Reserved,
+ uint64_t in_InitialBufferSpace,
+ const char* in_LibrarySearchPath,
+ const char* in_FileOfOrigin,
+ uint64_t in_FileOfOriginOffset,
+ COIPROCESS* out_pProcess);
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// Destroys the indicated process, releasing its resources. Note, this
+/// will destroy any outstanding pipelines created in this process as well.
+///
+/// @param in_Process
+/// [in] Process to destroy.
+///
+/// @param in_WaitForMainTimeout
+/// [in] The number of milliseconds to wait for the main() function
+/// to return in the sink process before timing out. -1 means to wait
+/// indefinitely.
+///
+/// @param in_ForceDestroy
+/// [in] If this flag is set to true, then the sink process will be
+/// forcibly terminated after the timeout has been reached. A timeout
+/// value of 0 will kill the process immediately, while a timeout of
+/// -1 is invalid. If the flag is set to false then a message will
+/// be sent to the sink process requesting a clean shutdown. A value
+/// of false along with a timeout of 0 does not send a shutdown
+/// message, instead simply polls the process to see if it is alive.
+/// In most cases this flag should be set to false. If a sink process
+/// is not responding then it may be necessary to set this flag to
+/// true.
+///
+/// @param out_pProcessReturn
+/// [out] The value returned from the main() function executing in
+/// the sink process. This is an optional parameter. If the caller
+/// is not interested in the return value from the remote process
+/// they may pass in NULL for this parameter. The output value of
+/// this pointer is only meaningful if COI_SUCCESS is returned.
+///
+/// @param out_pTerminationCode
+/// [out] This parameter specifies the termination code. This will
+/// be 0 if the remote process exited cleanly. If the remote process
+/// exited abnormally this will contain the termination code given
+/// by the operating system of the remote process. This is an optional
+/// parameter and the caller may pass in NULL if they are not
+/// interested in the termination code. The output value of this
+/// pointer is only meaningful if COI_SUCCESS is returned.
+///
+/// @return COI_SUCCESS if the process was destroyed.
+///
+/// @return COI_INVALID_HANDLE if the process handle passed in was invalid.
+///
+/// @return COI_OUT_OF_RANGE for any negative in_WaitForMainTimeout value
+/// except -1.
+///
+/// @return COI_ARGUMENT_MISMATCH if in_WaitForMainTimeout is -1 and
+/// in_ForceDestroy is true.
+///
+/// @return COI_TIME_OUT_REACHED if the sink process is still running after
+/// waiting in_WaitForMainTimeout milliseconds and in_ForceDestroy
+/// is false. This is true even if in_WaitForMainTimeout was 0.
+/// In this case, out_pProcessReturn and out_pTerminationCode
+/// are undefined.
+///
+COIACCESSAPI
+COIRESULT
+COIProcessDestroy(
+ COIPROCESS in_Process,
+ int32_t in_WaitForMainTimeout,
+ uint8_t in_ForceDestroy,
+ int8_t* out_pProcessReturn,
+ uint32_t* out_pTerminationCode);
+
+
+#define COI_MAX_FUNCTION_NAME_LENGTH 256
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// Given a loaded native process, gets an array of function handles that can
+/// be used to schedule run functions on a pipeline associated with that
+/// process. See the documentation for COIPipelineRunFunction() for
+/// additional information. All functions that are to be retrieved in this
+/// fashion must have the define COINATIVEPROCESSEXPORT preceeding their type
+/// specification. For functions that are written in C++, either the entries
+/// in in_pFunctionNameArray in must be pre-mangled, or the functions must be
+/// declared as extern "C". It is also necessary to link the binary containing
+/// the exported functions with the -rdynamic linker flag.
+/// It is possible for this call to successfully find function handles for
+/// some of the names passed in but not all of them. If this occurs
+/// COI_DOES_NOT_EXIST will return and any handles not found will be returned
+/// as NULL.
+///
+/// @param in_Process
+/// [in] Process handle previously returned via COIProcessCreate().
+///
+/// @param in_NumFunctions
+/// [in] Number of function names passed in to the in_pFunctionNames
+/// array.
+///
+/// @param in_ppFunctionNameArray
+/// [in] Pointer to an array of null-terminated strings that match
+/// the name of functions present in the code of the binary
+/// previously loaded via COIProcessCreate(). Note that if a C++
+/// function is used, then the string passed in must already be
+/// properly name-mangled, or extern "C" must be used for where
+/// the function is declared.
+///
+/// @param out_pFunctionHandleArray
+/// [in out] Pointer to a location created by the caller large
+/// enough to hold an array of COIFUNCTION sized elements that has
+/// in_numFunctions entries in the array.
+///
+/// @return COI_SUCCESS if all function names indicated were found.
+///
+/// @return COI_INVALID_HANDLE if the in_Process handle passed in was invalid.
+///
+/// @return COI_OUT_OF_RANGE if in_NumFunctions is zero.
+///
+/// @return COI_INVALID_POINTER if the in_ppFunctionNameArray or
+/// out_pFunctionHandleArray pointers was NULL.
+///
+/// @return COI_DOES_NOT_EXIST if one or more function names were not
+/// found. To determine the function names that were not found,
+/// check which elements in the out_pFunctionHandleArray
+/// are set to NULL.
+///
+/// @return COI_OUT_OF_RANGE if any of the null-terminated strings passed in
+/// via in_ppFunctionNameArray were more than
+/// COI_MAX_FUNCTION_NAME_LENGTH characters in length including
+/// the null.
+///
+/// @warning This operation can take several milliseconds so it is recommended
+/// that it only be be done at load time.
+///
+COIACCESSAPI
+COIRESULT
+COIProcessGetFunctionHandles(
+ COIPROCESS in_Process,
+ uint32_t in_NumFunctions,
+ const char** in_ppFunctionNameArray,
+ COIFUNCTION* out_pFunctionHandleArray);
+
+#if COI_LIBRARY_VERSION >= 2
+/// @name COIProcessLoadLibrary* flags, named after the corresponding
+/// RTLD flags that are passed into dlopen().
+/// Please consult a Linux manual for more information about these flags.
+//@{
+#define COI_LOADLIBRARY_LOCAL 0x00000
+#define COI_LOADLIBRARY_GLOBAL 0x00100
+
+#define COI_LOADLIBRARY_LAZY 0x00001
+#define COI_LOADLIBRARY_NOW 0x00002
+#define COI_LOADLIBRARY_NOLOAD 0x00004
+#define COI_LOADLIBRARY_DEEPBIND 0x00008
+#define COI_LOADLIBRARY_NODELETE 0x01000
+
+/// Flags to replicate the behavior of the original version of
+/// COIProcessLoadLibrary* APIs.
+#define COI_LOADLIBRARY_V1_FLAGS (COI_LOADLIBRARY_GLOBAL|COI_LOADLIBRARY_NOW)
+
+//@}
+
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// Loads a shared library into the specified remote process, akin to using
+/// dlopen() on a local process in Linux or LoadLibrary() in Windows.
+/// Dependencies for this library that are not listed with absolute paths
+/// are searched for first in current working directory, then in the
+/// colon-delimited paths in the environment variable SINK_LD_LIBRARY_PATH,
+/// and finally on the sink in the standard search paths as defined by the
+/// sink's operating system / dynamic loader.
+///
+/// @param in_Process
+/// [in] Process to load the library into.
+///
+/// @param in_pLibraryBuffer
+/// [in] The memory buffer containing the shared library to load.
+///
+/// @param in_LibraryBufferLength
+/// [in] The number of bytes in the memory buffer in_pLibraryBuffer.
+///
+/// @param in_pLibraryName
+/// [in] Name for the shared library. This optional parameter can
+/// be specified in case the dynamic library doesn't have an
+/// SO_NAME field. If specified, it will take precedence over
+/// the SO_NAME if it exists. If it is not specified then
+/// the library must have a valid SO_NAME field.
+///
+///@param in_LibrarySearchPath
+/// [in] A path to locate dynamic libraries dependencies for the
+/// library being loaded. If not NULL, this path will override the
+/// environment variable SINK_LD_LIBRARY_PATH. If NULL it will use
+/// SINK_LD_LIBRARY_PATH to locate dependencies.
+///
+///@param in_LibrarySearchPath
+/// [in] A path to locate dynamic libraries dependencies for the sink
+/// application. If not NULL, this path will override the environment
+/// variable SINK_LD_LIBRARY_PATH. If NULL it will use
+/// SINK_LD_LIBRARY_PATH to locate dependencies.
+///
+/// @param in_FileOfOrigin
+/// [in] If not NULL, this parameter indicates the file from which the
+/// in_pBinaryBuffer was obtained. This parameter is optional.
+///
+/// @param in_FileOfOriginOffset
+/// [in] If in_FileOfOrigin is not NULL, this parameter indicates the
+/// offset within that file where in_pBinaryBuffer begins.
+///
+#if COI_LIBRARY_VERSION >= 2
+/// @param in_Flags
+/// [in] Bitmask of the flags that will be passed in as the dlopen()
+/// "flag" parameter on the sink.
+///
+#endif
+///
+/// @param out_pLibrary
+/// [out] If COI_SUCCESS or COI_ALREADY_EXISTS is returned, the handle
+/// that uniquely identifies the loaded library.
+///
+/// @return COI_SUCCESS if the library was successfully loaded.
+///
+/// @return COI_INVALID_HANDLE if the process handle passed in was invalid.
+///
+/// @return COI_OUT_OF_RANGE if in_LibraryBufferLength is 0.
+///
+/// @return COI_INVALID_FILE if in_pLibraryBuffer does not represent a valid
+/// shared library file.
+///
+/// @return COI_MISSING_DEPENDENCY if a dependent library is missing from
+/// either SINK_LD_LIBRARY_PATH or the in_LibrarySearchPath parameter.
+///
+/// @return COI_ARGUMENT_MISMATCH if the shared library is missing an SONAME
+/// and in_pLibraryName is NULL.
+///
+/// @return COI_ARGUMENT_MISMATCH if in_pLibraryName is the same as that of
+/// any of the dependencies (recursive) of the library being loaded.
+///
+/// @return COI_ALREADY_EXISTS if there is an existing COILIBRARY handle
+/// that identifies this library, and this COILIBRARY hasn't been
+/// unloaded yet.
+///
+/// @return COI_BINARY_AND_HARDWARE_MISMATCH if the target machine of the
+/// binary or any of its recursive dependencies does not match the
+/// engine associated with in_Process.
+///
+/// @return COI_UNDEFINED_SYMBOL if we are unable to load the library due to
+/// an undefined symbol.
+///
+/// @return COI_PROCESS_DIED if loading the library on the device caused
+/// the remote process to terminate.
+///
+/// @return COI_DOES_NOT_EXIST if in_FileOfOrigin is not NULL and does not
+/// exist.
+///
+/// @return COI_ARGUMENT_MISMATCH if in_FileOfOrigin is NULL and
+/// in_FileOfOriginOffset is not 0.
+///
+/// @return COI_INVALID_FILE if in_FileOfOrigin is not a "regular file" as
+/// determined by stat or if its size is 0.
+///
+/// @return COI_OUT_OF_RANGE if in_FileOfOrigin exists but its size is
+/// less than in_FileOfOriginOffset + in_BinaryBufferLength.
+///
+/// @return COI_INVALID_POINTER if out_pLibrary or in_pLibraryBuffer are NULL.
+///
+#if COI_LIBRARY_VERSION >= 2
+COIACCESSAPI
+COIRESULT
+COIProcessLoadLibraryFromMemory(
+ COIPROCESS in_Process,
+ const void* in_pLibraryBuffer,
+ uint64_t in_LibraryBufferLength,
+ const char* in_pLibraryName,
+ const char* in_LibrarySearchPath,
+ const char* in_FileOfOrigin,
+ uint64_t in_FileOfOriginOffset,
+ uint32_t in_Flags,
+ COILIBRARY* out_pLibrary);
+__asm__(".symver COIProcessLoadLibraryFromMemory,"
+ "COIProcessLoadLibraryFromMemory@COI_2.0");
+#else
+
+COIRESULT
+COIProcessLoadLibraryFromMemory(
+COIPROCESS in_Process,
+ const void* in_pLibraryBuffer,
+ uint64_t in_LibraryBufferLength,
+ const char* in_pLibraryName,
+ const char* in_LibrarySearchPath,
+ const char* in_FileOfOrigin,
+ uint64_t in_FileOfOriginOffset,
+ COILIBRARY* out_pLibrary);
+__asm__(".symver COIProcessLoadLibraryFromMemory,"
+ "COIProcessLoadLibraryFromMemory@COI_1.0");
+#endif
+
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// Loads a shared library into the specified remote process, akin to using
+/// dlopen() on a local process in Linux or LoadLibrary() in Windows.
+///
+/// For more details, see COIProcessLoadLibraryFromMemory.
+///
+/// @param in_Process
+/// [in] Process to load the library into.
+///
+/// @param in_pFileName
+/// [in] The name of the shared library file on the source's file
+/// system that is being loaded. If the file name is not an absolute
+/// path, the file is searched for in the same manner as dependencies.
+///
+/// @param in_pLibraryName
+/// [in] Name for the shared library. This optional parameter can
+/// be specified in case the dynamic library doesn't have an
+/// SO_NAME field. If specified, it will take precedence over
+/// the SO_NAME if it exists. If it is not specified then
+/// the library must have a valid SO_NAME field.
+///
+///@param in_LibrarySearchPath
+/// [in] a path to locate dynamic libraries dependencies for the
+/// library being loaded. If not NULL, this path will override the
+/// environment variable SINK_LD_LIBRARY_PATH. If NULL it will use
+/// SINK_LD_LIBRARY_PATH to locate dependencies.
+///
+#if COI_LIBRARY_VERSION >= 2
+/// @param in_Flags
+/// [in] Bitmask of the flags that will be passed in as the dlopen()
+/// "flag" parameter on the sink.
+///
+#endif
+///
+/// @param out_pLibrary
+/// [out] If COI_SUCCESS or COI_ALREADY_EXISTS is returned, the handle
+/// that uniquely identifies the loaded library.
+///
+/// @return COI_SUCCESS if the library was successfully loaded.
+///
+/// @return COI_INVALID_POINTER if in_pFileName is NULL.
+///
+/// @return COI_DOES_NOT_EXIST if in_pFileName cannot be found.
+///
+/// @return COI_INVALID_FILE if the file is not a valid shared library.
+///
+/// @return See COIProcessLoadLibraryFromMemory for additional errors.
+///
+#if COI_LIBRARY_VERSION >= 2
+
+COIACCESSAPI
+COIRESULT
+COIProcessLoadLibraryFromFile(
+ COIPROCESS in_Process,
+ const char* in_pFileName,
+ const char* in_pLibraryName,
+ const char* in_LibrarySearchPath,
+ uint32_t in_Flags,
+ COILIBRARY* out_pLibrary);
+__asm__(".symver COIProcessLoadLibraryFromFile,"
+ "COIProcessLoadLibraryFromFile@COI_2.0");
+#else
+
+COIRESULT
+COIProcessLoadLibraryFromFile(
+ COIPROCESS in_Process,
+ const char* in_pFileName,
+ const char* in_pLibraryName,
+ const char* in_LibrarySearchPath,
+ COILIBRARY* out_pLibrary);
+__asm__(".symver COIProcessLoadLibraryFromFile,"
+ "COIProcessLoadLibraryFromFile@COI_1.0");
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// Unloads a a previously loaded shared library from the specified
+/// remote process.
+///
+/// @param in_Process
+/// [in] Process that we are unloading a library from.
+///
+/// @param in_Library
+/// [in] Library that we want to unload.
+///
+/// @return COI_SUCCESS if the library was successfully loaded.
+///
+/// @return COI_INVALID_HANDLE if the process or library handle were invalid.
+///
+COIACCESSAPI
+COIRESULT
+COIProcessUnloadLibrary(
+ COIPROCESS in_Process,
+ COILIBRARY in_Library);
+
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// Registers shared libraries that are already in the host process's memory
+/// to be used during the shared library dependency resolution steps that take
+/// place during subsequent calls to COIProcessCreate* and
+/// COIProcessLoadLibrary*. If listed as a dependency, the registered library
+/// will be used to satisfy the dependency, even if there is another library
+/// on disk that also satisfies that dependency.
+///
+/// Addresses registered must remain valid during subsequent calls to
+/// COIProcessCreate* and COIProcessLoadLibrary*.
+///
+/// If the Sink is Linux, the shared libraries must have a library name
+/// (DT_SONAME field). On most compilers this means built with -soname.
+///
+/// If successful, this API registers all the libraries. Otherwise none
+/// are registered.
+///
+/// @param in_NumLibraries
+/// [in] The number of libraries that are being registered.
+///
+/// @param in_ppLibraryArray
+/// [in] An array of pointers that point to the starting addresses
+/// of the libraries.
+///
+/// @param in_pLibrarySizeArray
+/// [in] An array of pointers that point to the number of bytes in
+/// each of the libraries.
+///
+/// @param in_ppFileOfOriginArray
+/// [in] An array of strings indicating the file from which the
+/// library was obtained. This parameter is optional. Elements
+/// in the array may be set to NULL.
+///
+/// @param in_pFileOfOriginOffSetArray
+/// [in] If the corresponding entry in in_ppFileOfOriginArray is not
+/// NULL, this parameter indicates the offsets within those files
+/// where the corresponding libraries begin.
+///
+/// @return COI_SUCCESS if the libraries were registered successfully.
+///
+/// @return COI_OUT_OF_RANGE if in_NumLibraries is 0.
+///
+/// @return COI_INVALID_POINTER if in_ppLibraryArray or in_pLibrarySizeArray
+/// are NULL.
+///
+/// @return COI_INVALID_POINTER if any of the pointers in in_ppLibraryArray
+/// are NULL.
+///
+/// @return COI_OUT_OF_RANGE if any of the values in in_pLibrarySizeArray is 0.
+///
+/// @return COI_ARGUMENT_MISMATCH if either one of in_ppFileOfOriginArray
+/// and in_pFileOfOriginOffSetArray is NULL and the other is not.
+///
+/// @return COI_OUT_OF_RANGE if one of the addresses being registered does not
+/// represent a valid library.
+///
+COIACCESSAPI
+COIRESULT
+COIProcessRegisterLibraries(
+ uint32_t in_NumLibraries,
+ const void** in_ppLibraryArray,
+ const uint64_t* in_pLibrarySizeArray,
+ const char** in_ppFileOfOriginArray,
+ const uint64_t* in_pFileOfOriginOffSetArray);
+
+
+//////////////////////////////////////////////////////////////////////////////
+/// The user can choose to have notifications for these internal events
+/// so that they can build their own profiling and performance layer on
+/// top of Intel® Coprocessor Offload Infrastructure (Intel® COI) .
+///
+typedef enum COI_NOTIFICATIONS
+{
+ /// This event occurs when all explicit and implicit dependencies are
+ /// satisified and Intel® Coprocessor Offload Infrastructure
+ /// (Intel® COI) schedules the run function to begin execution.
+ RUN_FUNCTION_READY = 0,
+
+ /// This event occurs just before the run function actually starts
+ /// executing. There may be some latency between the ready and start
+ /// events if other run functions are already queued and ready to run.
+ RUN_FUNCTION_START,
+
+ /// This event occurs when the run function finishes. This is when the
+ /// completion event for that run function would be signaled.
+ RUN_FUNCTION_COMPLETE,
+
+ /// This event occurs when all explicit and implicit dependencies are
+ /// met for the pending buffer operation. Assuming buffer needs to be
+ /// moved, copied, read, etc... Will not be invoked if no actual memory
+ /// is moved, copied, read, etc. This means that COIBufferUnmap will
+ /// never result in a callback as it simply updates the status of the
+ /// buffer but doesn't initiate any data movement. COIBufferMap,
+ /// COIBufferSetState, COIBufferWrite, COIBufferRead and COIBufferCopy
+ /// do initiate data movement and therefore will invoke the callback.
+ BUFFER_OPERATION_READY,
+
+ /// This event occurs when the buffer operation is completed.
+ BUFFER_OPERATION_COMPLETE,
+
+ /// This event occurs when a user event is signaled from the remotely
+ /// a sink process. Local (source triggered) events do not trigger this.
+ USER_EVENT_SIGNALED
+} COI_NOTIFICATIONS;
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// A callback that will be invoked to notify the user of an internal
+/// Intel® Coprocessor Offload Infrastructure (Intel® COI)
+/// event. Note that the callback is registered per process so any of the
+/// above notifications that happen on the registered process will receive
+/// the callback.
+/// As with any callback mechanism it is up to the user to make sure that
+/// there are no possible deadlocks due to reentrancy (ie the callback being
+/// invoked in the same context that triggered the notification) and also
+/// that the callback does not slow down overall processing. If the user
+/// performs too much work within the callback it could delay further
+/// Intel® Coprocessor Offload Infrastructure (Intel® COI)
+/// processing.
+/// Intel® Coprocessor Offload Infrastructure (Intel® COI)
+/// promises to invoke the callback for an internal event prior to
+/// signaling the corresponding COIEvent. For example, if a user is waiting
+/// for a COIEvent associated with a run function completing they will
+/// receive the callback before the COIEvent is marked as signaled.
+///
+///
+/// @param in_Type
+/// [in] The type of internal event that has occurred.
+///
+/// @param in_Process
+/// [in] The process associated with the operation.
+///
+/// @param in_Event
+/// [in] The completion event that is associated with the
+/// operation that is being notified.
+///
+/// @param in_UserData
+/// [in] Opaque data that was provided when the callback was
+/// registered. Intel® Coprocessor Offload Infrastructure (Intel® COI) simply passes this back to the user so that
+/// they can interpret it as they choose.
+///
+typedef void (*COI_NOTIFICATION_CALLBACK)(
+ COI_NOTIFICATIONS in_Type,
+ COIPROCESS in_Process,
+ COIEVENT in_Event,
+ const void* in_UserData);
+
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// Register a callback to be invoked to notify that an internal
+/// Intel® Coprocessor Offload Infrastructure (Intel® COI) event
+/// has occured on the process that is associated with the callback.
+/// Note that it is legal to have more than one callback registered with
+/// a given process but those must all be unique callback pointers.
+/// Note that setting a UserData value with COINotificationCallbackSetContext
+/// will override a value set when registering the callback.
+///
+/// @param in_Process
+/// [in] Process that the callback is associated with. The callback
+/// will only be invoked to notify an event for this specific process.
+///
+/// @param in_Callback
+/// [in] Pointer to a user function used to signal a notification.
+///
+/// @param in_UserData
+/// [in] Opaque data to pass to the callback when it is invoked.
+///
+/// @return COI_SUCCESS if the callback was registered successfully.
+///
+/// @return COI_INVALID_HANDLE if the in_Process parameter does not identify
+/// a valid process.
+///
+/// @return COI_INVALID_POINTER if the in_Callback parameter is NULL.
+///
+/// @return COI_ALREADY_EXISTS if the user attempts to reregister the same
+/// callback for a process.
+///
+COIACCESSAPI
+COIRESULT COIRegisterNotificationCallback(
+ COIPROCESS in_Process,
+ COI_NOTIFICATION_CALLBACK in_Callback,
+ const void* in_UserData);
+
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// Unregisters a callback, notifications will no longer be signaled.
+///
+/// @param in_Process
+/// [in] Process that we are unregistering.
+///
+/// @param in_Callback
+/// [in] The specific callback to unregister.
+///
+/// @return COI_SUCCESS if the callback was unregistered.
+///
+/// @return COI_INVALID_HANDLE if the in_Process parameter does not identify
+/// a valid process.
+///
+/// @return COI_INVALID_POINTER if the in_Callback parameter is NULL.
+///
+/// @return COI_DOES_NOT_EXIST if in_Callback was not previously registered
+/// for in_Process.
+///
+COIACCESSAPI
+COIRESULT COIUnregisterNotificationCallback(
+ COIPROCESS in_Process,
+ COI_NOTIFICATION_CALLBACK in_Callback);
+
+
+//////////////////////////////////////////////////////////////////////////////
+///
+/// Set the user data that will be returned in the notification callback.
+/// This data is sticky and per thread so must be set prior to the
+/// Intel® Coprocessor Offload Infrastructure (Intel® COI) //
+/// operation being invoked. If you wish to set the context to be returned
+/// for a specific instance of a user event notification then the context
+/// must be set using this API prior to registering that user event with
+/// COIEventRegisterUserEvent.
+/// The value may be set prior to each Intel® Coprocessor Offload
+/// Infrastructure (Intel® COI) operation being called to
+/// effectively have a unique UserData per callback.
+/// Setting this value overrides any value that was set when the
+/// callback was registered and will also override any future registrations
+/// that occur.
+///
+/// @param in_UserData
+/// [in] Opaque data to pass to the callback when it is invoked.
+/// Note that this data is set per thread.
+///
+COIACCESSAPI
+void COINotificationCallbackSetContext(
+ const void* in_UserData);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* _COIPROCESS_SOURCE_H */
+
+/*! @} */
diff --git a/liboffloadmic/include/myo/myo.h b/liboffloadmic/include/myo/myo.h
new file mode 100644
index 00000000000..c6e5f56ede2
--- /dev/null
+++ b/liboffloadmic/include/myo/myo.h
@@ -0,0 +1,619 @@
+/*
+ * Copyright 2010-2013 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 2.1.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ *
+ * Disclaimer: The codes contained in these modules may be specific
+ * to the Intel Software Development Platform codenamed Knights Ferry,
+ * and the Intel product codenamed Knights Corner, and are not backward
+ * compatible with other Intel products. Additionally, Intel will NOT
+ * support the codes or instruction set in future products.
+ *
+ * Intel offers no warranty of any kind regarding the code. This code is
+ * licensed on an "AS IS" basis and Intel is not obligated to provide
+ * any support, assistance, installation, training, or other services
+ * of any kind. Intel is also not obligated to provide any updates,
+ * enhancements or extensions. Intel specifically disclaims any warranty
+ * of merchantability, non-infringement, fitness for any particular
+ * purpose, and any other warranty.
+ *
+ * Further, Intel disclaims all liability of any kind, including but
+ * not limited to liability for infringement of any proprietary rights,
+ * relating to the use of the code, even if Intel is notified of the
+ * possibility of such liability. Except as expressly stated in an Intel
+ * license agreement provided with this code and agreed upon with Intel,
+ * no license, express or implied, by estoppel or otherwise, to any
+ * intellectual property rights is granted herein.
+ */
+/**
+ * Description:
+ * External APIs of MYO runtime (MYO stands for Mine, Yours and Ours).
+ **/
+
+#ifndef _MYO_H_
+#define _MYO_H_
+
+#include "myotypes.h"
+#include "myoimpl.h"
+
+/** @ingroup MYO
+ * @addtogroup MYO_API
+@{
+* @file myo.h
+*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/****************************************************************************
+ Arena-based APIs
+ ***************************************************************************/
+
+/*
+ * Arena is a set of memory pages with the same ownership type. The ownership
+ * type of all the memory pages inside the same arena can only be changed as
+ * a whole. For "OURS", it is also the minimal unit of sync operations to
+ * implement "release consistency".
+ */
+
+/** @fn extern MyoError myoArenaCreate(MyoOwnershipType in_Type,
+ * int in_Property, MyoArena *out_pArena)
+ * @brief Create an arena with specified ownership type and property.
+ *
+ * @param in_Type Specified ownership type (MYO_ARENA_OURS or
+ * MYO_ARENA_MINE).
+ * @param in_Property Specified properties of the arena. Set it
+ * to 0 to use default properties.
+ *
+ * MYO_RELEASE_CONSISTENCY or MYO_STRONG_RELEASE_CONSISTENCY
+ * or MYO_STRONG_CONSISTENCY:
+ *
+ * Consistency modes for "OURS" arenas. For MYO_RELEASE_CONSISTENCY,
+ * there are 2 functions, "Acquire" and "Release", which are
+ * used for memory ordering. "Release" makes all local stores
+ * prior to the release globally visible; "Acquire" syncs up the
+ * local memory with all stores that have been made globally
+ * visible. However, there is no definite answer as to whether
+ * local stores can be globally visible before reaching a release
+ * point, nor whether the newest globally visible stores can be
+ * updated to local before reaching an acquire point. By using
+ * MYO_STRONG_RELEASE_CONSISTENCY, the answer to these questions
+ * is "no". A sequential consistency model is maintained to the
+ * arena when using MYO_STRONG_CONSISTENCY.
+ * MYO_RELEASE_CONSISTENCY is the default property.
+ *
+ * MYO_UPDATE_ON_DEMAND or MYO_UPDATE_ON_ACQUIRE:
+ *
+ * Only apply to "OURS" arenas with "Release Consistency".
+ * MYO_UPDATE_ON_ACQUIRE means that the shared pages of this
+ * arena will be updated on acquire point; MYO_UPDATE_ON_DEMAND
+ * means that the shared pages will not be updated until they
+ * are accessed. MYO_UPDATE_ON_DEMAND is the default property.
+ *
+ * MYO_RECORD_DIRTY or MYO_NOT_RECORD_DIRTY:
+ *
+ * This property controls whether to record dirty pages.
+ * There will be runtime overhead when recording dirty pages,
+ * as it can reduce the communication data. It is a trade-off
+ * for performance. Also when MYO_NOT_RECORD_DIRTY is set for
+ * "OURS" arena, the runtime cannot guarantee the correctness
+ * when the host and card modify the same shared page between
+ * the same sync segment. MYO_RECORD_DIRTY is the default
+ * property.
+ *
+ * MYO_ONE_VERSION or MYO_MULTI_VERSION:
+ *
+ * Only apply to "OURS" arenas with "Release Consistency". When
+ * MYO_MULTI_VERSION is set, this arena can only be "release" on
+ * HOST side and "acquire" on CARD side. Releasing the arena on
+ * HOST will create a new versioned data and put it into a FIFO;
+ * acquiring the arena on CARD will get the versioned data
+ * from the FIFO one by one. MYO_ONE_VERSION is the default
+ * property.
+ *
+ * MYO_CONSISTENCY or MYO_NO_CONSISTENCY:
+ *
+ * Only apply to "OURS" arenas with "Release Consistency". When
+ * MYO_NO_CONSISTENCY is set, the consistency of the arena will
+ * not be maintained. That is, it is a no-op operation when
+ * calling acquire/release for such arenas. MYO_CONSISTENCY is
+ * the default property.
+ *
+ * MYO_HOST_TO_DEVICE and MYO_DEVICE_TO_HOST:
+ *
+ * When it is certain that there is only one communication
+ * direction for this arena, it can be created with only
+ * MYO_HOST_TO_DEVICE or MYO_DEVICE_TO_HOST so the runtime
+ * can perform optimizations. The default property is
+ * MYO_HOST_TO_DEVICE | MYO_DEVICE_TO_HOST.
+ *
+ * @param out_pArena Used to store the handle of the created arena.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+CILK_SHARED MyoError myoArenaCreate(MyoOwnershipType in_Type, int in_Property, MyoArena *out_pArena);
+
+/** @fn extern MyoError myoArenaDestroy(MyoArena in_Arena)
+ * @brief Destroy an arena. As a result, the arena can not be
+ * referred any more.
+ *
+ * @param in_Arena Arena handle returned by previous call to
+ * myoArenaCreate.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+CILK_SHARED MyoError myoArenaDestroy(MyoArena in_Arena);
+
+/** @fn extern void *myoArenaMalloc(MyoArena in_Arena, size_t in_Size)
+ * @brief Allocates size bytes from the specified arena, and returns
+ * the start address of the allocated memory. The memory is not
+ * cleared.
+ *
+ * @param in_Arena Arena handle returned by previous call to
+ * myoArenaCreate.
+ * @param in_Size Size (bytes) of the required memory space.
+ * @return
+ * The start address of the allocated memory space.
+ * NULL: Failed.
+ **/
+MYOACCESSAPI
+void *myoArenaMalloc(MyoArena in_Arena, size_t in_Size);
+
+/** @fn extern void myoArenaFree(MyoArena in_Arena, void *in_pPtr)
+ * @brief Frees the memory space allocated by myoArenaMalloc to the
+ * specified arena.
+ *
+ * @param in_Arena Arena handle returned by previous call to
+ * myoArenaCreate.
+ * @param in_pPtr The start address of the specified memory
+ * space, which must be retured by myoArenaMalloc.
+ * @return
+ **/
+MYOACCESSAPI
+void myoArenaFree(MyoArena in_Arena, void *in_pPtr);
+
+/** @fn extern void *myoArenaAlignedMalloc(MyoArena in_Arena,
+ * size_t in_Size, size_t in_Alignment)
+ * @brief Allocates size bytes from the specified arena. The
+ * start address of the allocated memory will be a multiple of the
+ * alignment, which must be a power of two.
+ *
+ * @param in_Arena Arena handle returned by previous call to
+ * myoArenaCreate.
+ * @param in_Size Size (bytes) of the required memory space.
+ * @param in_Alignment The alignment value (must be a power
+ * of two).
+ * @return
+ * The start address of the allocated memory space.
+ * NULL: Failed.
+ **/
+MYOACCESSAPI
+void *myoArenaAlignedMalloc(MyoArena in_Arena, size_t in_Size, size_t in_Alignment);
+
+/** @fn extern void myoArenaAlignedFree(MyoArena in_Arena, void *in_pPtr)
+ * @brief Frees the memory space allocated by myoArenaAlignedMalloc
+ * to the specified arena.
+ *
+ * @param in_Arena Arena handle returned by previous call to
+ * myoArenaCreate.
+ * @param in_pPtr The start address of the specified memory space,
+ * which must be returned by myoArenaAlignedMalloc.
+ * @return
+ **/
+MYOACCESSAPI
+void myoArenaAlignedFree(MyoArena in_Arena, void *in_pPtr);
+
+/** @fn extern MyoError myoArenaAcquire(MyoArena in_Arena)
+ * @brief myoArenaAcquire is the sync point for "OURS" arena with
+ * "Release Consistency". myoArenaAcquire is used to obtain all
+ * stores of "OURS" arena that have been made globally visible prior
+ * to this point.
+ *
+ * @param in_Arena Arena handle returned by previous call to
+ * myoArenaCreate.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+CILK_SHARED MyoError myoArenaAcquire(MyoArena in_Arena);
+
+/** @fn extern MyoError myoArenaRelease(MyoArena in_Arena)
+ * @brief myoArenaRelease is the sync point for "OURS" arena with
+ * "Release Consistency". myoArenaRelease is used to flush all prior
+ * stores of "OURS" arena to be globally visible.
+ *
+ * @param in_Arena Arena handle returned by previous call to
+ * myoArenaCreate.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+CILK_SHARED MyoError myoArenaRelease(MyoArena in_Arena);
+
+/** @fn extern MyoError myoArenaAcquireOwnership(MyoArena in_Arena)
+ * @brief Changes the ownership type of the arena to MYO_ARENA_MINE.
+ *
+ * @param in_Arena Arena handle returned by previous call to
+ * myoArenaCreate.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+MyoError myoArenaAcquireOwnership(MyoArena in_Arena);
+
+/** @fn extern MyoError myoArenaReleaseOwnership(MyoArena in_Arena)
+ * @brief Change the ownership type of the arena to MYO_ARENA_OURS.
+ *
+ * @param in_Arena Arena handle returned by previous call to
+ * myoArenaCreate.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+MyoError myoArenaReleaseOwnership(MyoArena in_Arena);
+
+/** @fn extern MyoError myoArenaGetHandle(void *in_pPtr,
+ * MyoArena *out_pArena)
+ * @brief Gets the arena handle of the arena that contains the memory
+ * space pointed to by "in_pPtr". This API can be used when it is
+ * not clear which arena handle should be used for other arena
+ * related APIs.
+ *
+ * @param in_pPtr The start address of a chunk of memory space.
+ * @param out_pArena Handle of the arena.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+CILK_SHARED MyoError myoArenaGetHandle(void *in_pPtr, MyoArena *out_pArena);
+
+/********************************************************************************
+ APIs for the default arena
+ *******************************************************************************/
+
+/**
+ * There will be a default arena inside MYO runtime, which will be used when
+ * there is no specified arena.
+ **/
+
+/** @fn extern void* myoSharedMalloc(size_t in_Size)
+ * @brief Allocates size bytes from the default arena, and returns the
+ * start address of the allocated memory. The memory is not cleared.
+ *
+ @param in_Size Size (bytes) of the required memory space.
+ * @return
+ * The start address of the allocated memory space.
+ * NULL: Failed.
+ **/
+MYOACCESSAPI
+void* myoSharedMalloc(size_t in_Size);
+
+/** @fn extern void myoSharedFree(void *in_pPtr)
+ * @brief Frees the memory space allocated by myoArenaMalloc to the
+ * default arena.
+ *
+ * @param in_pPtr The start address of the specified memory space,
+ * which must be retured by myoSharedMalloc.
+ * @return
+ **/
+MYOACCESSAPI
+void myoSharedFree(void *in_pPtr);
+
+/** @fn extern void* myoSharedAlignedMalloc(size_t in_Size,
+ * size_t in_Alignment)
+ * @brief Allocates size bytes from the default arena. The start
+ * address of the allocated memory will be a multiple of alignment,
+ * which must be a power of two.
+ *
+ * @param in_Size Size (bytes) of the required memory space.
+ * @param in_Alignment The alignment value, which must be an power of two.
+ * @return
+ * The start address of the allocated memory space.
+ * NULL: Failed.
+ **/
+MYOACCESSAPI
+void* myoSharedAlignedMalloc(size_t in_Size, size_t in_Alignment);
+
+/** @fn extern void myoSharedAlignedFree(void *in_pPtr)
+ * @brief Frees the memory space allocated by myoArenaAlignedMalloc
+ * to the default arena.
+ *
+ * @param in_pPtr The start address of the specified memory space,
+ * which must be returned by myoArenaAlignedMalloc.
+ * @return
+ **/
+MYOACCESSAPI
+void myoSharedAlignedFree(void *in_pPtr);
+
+/** @fn extern MyoError myoAcquire()
+ * @brief myoAcquire is the sync point for the default arena with
+ * "Release Consistency". myoAcquire is used to obtain all stores of
+ * the default arena that have been made globally visible prior to
+ * this point.
+ *
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+MyoError myoAcquire();
+
+/** @fn extern MyoError myoRelease()
+ * @brief myoRelease is the sync point for the default arena with
+ * "Release Consistency". myoRelease is used to flush all prior stores
+ * of the default arena to be globally visible.
+ *
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+MyoError myoRelease();
+
+/** @fn extern MyoError myoAcquireOwnership()
+ * @brief Changes the ownership type of the default arena to
+ * MYO_ARENA_MINE.
+ *
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+MyoError myoAcquireOwnership();
+
+/** @fn extern MyoError myoReleaseOwnership()
+ * @brief Change the ownership type of the default arena to
+ * MYO_ARENA_OURS.
+ *
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+MyoError myoReleaseOwnership();
+
+/*****************************************************************************
+ APIs for global sync operations.
+ *****************************************************************************/
+
+/** @fn extern MyoError myoMutexCreate(MyoMutex *out_pMutex)
+ * @brief Create a mutex and return the mutex handle.
+ *
+ * @param out_pMutex Used to store the handle of the created mutex.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+MyoError myoMutexCreate(MyoMutex *out_pMutex);
+
+/** @fn extern MyoError myoMutexLock(MyoMutex in_Mutex)
+ * @brief Lock the mutex. If the mutex is already locked by other peers,
+ * the call blocks until the mutex becomes available. Currently,
+ * attempting to re-acquire the mutex will cause a deadlock.
+ *
+ * @param in_Mutex the mutex handle returned by myoMutexCreate.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+MyoError myoMutexLock(MyoMutex in_Mutex);
+
+/** @fn extern MyoError myoMutexUnlock(MyoMutex in_Mutex)
+ * @brief Release the locked mutex.
+ * Currently, attempting to release an unlocked mutex will cause
+ * undefined results.
+ *
+ * @param in_Mutex the mutex handle returned by myoMutexCreate.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+MyoError myoMutexUnlock(MyoMutex in_Mutex);
+
+/** @fn extern MyoError myoMutexTryLock(MyoMutex in_Mutex)
+ * @brief Try to lock the mutex. myoMutexTryLock is equivalent to
+ * myoMutexLock, except that myoMutexLock will return immediately if
+ * the mutex is already locked.
+ *
+ * @param in_Mutex the mutex handle returned by myoMutexCreate.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+MyoError myoMutexTryLock(MyoMutex in_Mutex);
+
+/** @fn extern MyoError myoMutexDestroy(MyoMutex in_Mutex)
+ * @brief Destroy the mutex.
+ *
+ * @param in_Mutex the mutex handle returned by myoMutexCreate.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+MyoError myoMutexDestroy(MyoMutex in_Mutex);
+
+/** @fn extern MyoError myoSemCreate(int in_Value, MyoSem *out_pSem)
+ * @brief Create a semaphore and return the semaphore handle.
+ *
+ * @param in_Value the initial value for the semaphore.
+ * @param out_pSem Used to store the handle of the created semaphore.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+MyoError myoSemCreate(int in_Value, MyoSem *out_pSem);
+
+/** @fn extern MyoError myoSemWait(MyoSem in_Sem)
+ * @brief Decrements (locks) the semaphore. If the semaphore value is
+ * greater than zero, then the decrement proceeds and the function
+ * returns immediately, or else the call blocks until the semaphore
+ * value rises above zero.
+ *
+ * @param in_Sem the semaphore handle returned by myoSemCreate.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+MyoError myoSemWait(MyoSem in_Sem);
+
+/** @fn extern MyoError myoSemPost(MyoSem in_Sem)
+ * @brief Increments (unlocks) the semaphore. If the semaphore value
+ * becomes greater than zero, one blocked myoSemWait call will be
+ * notified to return.
+ *
+ * @param in_Sem the semaphore handle returned by myoSemCreate.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+MyoError myoSemPost(MyoSem in_Sem);
+
+/** @fn extern MyoError myoSemTryWait(MyoSem in_Sem)
+ * @brief Try to lock semaphore. myoSemTryWait is the same as
+ * myoSemAcquire, except that if the decrement cannot be immediately
+ * performed, then the call returns instead of blocking.
+ *
+ * @param in_Sem the semaphore handle returned by myoSemCreate.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+MyoError myoSemTryWait(MyoSem in_Sem);
+
+/** @fn extern MyoError myoSemDestroy(MyoSem in_Sem)
+ * @brief Destroy the semaphore.
+ *
+ * @param in_Sem the semaphore handle returned by myoSemCreate.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+MyoError myoSemDestroy(MyoSem in_Sem);
+
+/** @fn extern MyoError myoBarrierCreate(int in_Count, MyoBarrier *out_pBarrier)
+ * @brief Create a barrier and return the barrier handle.
+ *
+ * @param in_Count the number of threads that must call
+ * myoBarrierWait before any of them successfully return.
+ * @param out_pBarrier Used to store the handle of the created
+ * barrier.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+MyoError myoBarrierCreate(int in_Count, MyoBarrier *out_pBarrier);
+
+/** @fn extern MyoError myoBarrierWait(MyoBarrier in_Barrier)
+ * @brief The caller will block until the required number of threads
+ * have called myoBarrierWait with the same barrier handle.
+ *
+ * @param in_Barrier the barrier handle returned by myoBarrierCreate.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+MyoError myoBarrierWait(MyoBarrier in_Barrier);
+
+/** @fn extern MyoError myoBarrierDestroy(MyoBarrier in_Barrier)
+ * @brief Destroy the barrier.
+ *
+ * @param in_Barrier the barrier handle returned by myoBarrierCreate.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+MyoError myoBarrierDestroy(MyoBarrier in_Barrier);
+
+/*****************************************************************************
+ MISC APIs.
+ *****************************************************************************/
+
+/**
+ * @cond INCLUDE_MYO_INTERNAL_DOCUMENTATION
+ **/
+
+MYOACCESSAPI
+int myoMyId();
+/* int myoNumNodes() returns the number of peers, minus one, to
+ equal the number of cards in the system. */
+MYOACCESSAPI
+int myoNumNodes();
+
+MYOACCESSAPI
+unsigned long long myoTicks();
+MYOACCESSAPI
+unsigned long long myoWallTime();
+MYOACCESSAPI
+void myoStatOn();
+MYOACCESSAPI
+void myoStatOff();
+
+/** @fn extern MyoError myoGetMemUsage(uint64 *out_memUsedMB)
+ * @brief Retrieves the amount of shared memory currently used.
+ * myoGetMemUsage() fills in out_memUsedMB when the pointer is not NULL.
+ *
+ * @param out_memUsedBytes, pointer to the current size shared memory used.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+MyoError myoGetMemUsage(unsigned int *out_memUsedMB);
+
+/** @fn extern MyoError myoHTimeOn(int in_On)
+ * @brief Toggle MYO HTime report feature on/off.
+ *
+ * @param in_On: 1 turn on MYO HTime report
+ * 0 turn off MYO HTime report
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+extern MyoError myoHTimeOn(int in_On);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+ /**
+ * @endcond
+ **/
+
+/*! @} */
diff --git a/liboffloadmic/include/myo/myoimpl.h b/liboffloadmic/include/myo/myoimpl.h
new file mode 100644
index 00000000000..d998ef3feb6
--- /dev/null
+++ b/liboffloadmic/include/myo/myoimpl.h
@@ -0,0 +1,538 @@
+/*
+ * Copyright 2010-2013 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 2.1.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ *
+ * Disclaimer: The codes contained in these modules may be specific
+ * to the Intel Software Development Platform codenamed Knights Ferry,
+ * and the Intel product codenamed Knights Corner, and are not backward
+ * compatible with other Intel products. Additionally, Intel will NOT
+ * support the codes or instruction set in future products.
+ *
+ * Intel offers no warranty of any kind regarding the code. This code is
+ * licensed on an "AS IS" basis and Intel is not obligated to provide
+ * any support, assistance, installation, training, or other services
+ * of any kind. Intel is also not obligated to provide any updates,
+ * enhancements or extensions. Intel specifically disclaims any warranty
+ * of merchantability, non-infringement, fitness for any particular
+ * purpose, and any other warranty.
+ *
+ * Further, Intel disclaims all liability of any kind, including but
+ * not limited to liability for infringement of any proprietary rights,
+ * relating to the use of the code, even if Intel is notified of the
+ * possibility of such liability. Except as expressly stated in an Intel
+ * license agreement provided with this code and agreed upon with Intel,
+ * no license, express or implied, by estoppel or otherwise, to any
+ * intellectual property rights is granted herein.
+ */
+/**
+ Description:
+ Define APIs of MYO for compiler or pre-processor to transfer original programs.
+ */
+
+#ifndef _MYO_IMPL_H_
+#define _MYO_IMPL_H_
+
+/** @ingroup MYO
+ * @addtogroup MYOIMPL_API
+@{
+* @file myoimpl.h
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#define EXTERN_C extern "C"
+#else
+#define EXTERN_C /* nothing */
+#endif
+
+# define MYOACCESSAPI /* nothing */
+
+#ifdef DEFINE_ARENA_API_CILK_SHARED
+#define CILK_SHARED _Cilk_shared
+#else
+#define CILK_SHARED /* nothing */
+#endif
+
+/* **************************************************************************** *\
+ APIs to enable functions being remotely called
+\* **************************************************************************** */
+
+typedef void *(*MyoiRemoteFuncType)(void *);
+
+/** @fn extern MyoError myoiRemoteFuncRegister(MyoiRemoteFuncType in_pFuncAddr,
+ * const char *in_pFuncName)
+ * @brief Register a function so that it can be remotely called. This should be
+ * done in myoiUserInit or before calling myoiLibInit. After myoiLibInit,
+ * there will be a table on all peers, which contains the information for
+ * all remotely callable functions.
+ *
+ * @param in_pWrapFuncAddr address of the wrapper function.
+ * @param in_pFuncName name of the function.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+
+MYOACCESSAPI
+MyoError myoiRemoteFuncRegister(MyoiRemoteFuncType in_pFuncAddr,
+ const char *in_pFuncName);
+/** @fn extern MyoError myoiRemoteFuncLookupByName(char *in_pFuncName,
+ * MyoiRemoteFuncType *out_pWrapFuncAddr)
+ * @brief Get the address of the wrapper function by looking up the table
+ * by name. This API can be used when assigning a function pointer to
+ * remotely callable functions.
+ *
+ * @param in_pFuncName name of the function.
+ * @param out_pWrapFuncAddr address of the wrapper function.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI MyoError myoiRemoteFuncLookupByName(char *in_pFuncName,
+ MyoiRemoteFuncType *out_pWrapFuncAddr);
+
+/** @fn extern MyoError myoiRemoteFuncLookupByAddr(MyoiRemoteFuncType
+ * in_pWrapFuncAddr,char **out_pFuncName)
+ * @brief Get the name of a remote function by looking up the table by
+ * the address. This API can be used when calling a remotely callable
+ * function by a function pointer.
+ *
+ * @param in_pWrapFuncAddr address of the function.
+ * @param out_pFuncName name of the function.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI MyoError myoiRemoteFuncLookupByAddr(MyoiRemoteFuncType in_pWrapFuncAddr,
+ char **out_pFuncName);
+
+//! Host Side Shared Function Pointer Entry Struct
+typedef struct {
+ //! Function Name
+ const char *funcName;
+ //! Function Address
+ void *funcAddr;
+ //! Local Thunk Address
+ void *localThunkAddr;
+} MyoiHostSharedFptrEntry;
+
+//! Target Side Shared Function Pointer Entry Struct
+typedef struct {
+ //! Function Name
+ const char *funcName;
+ //! Function Address
+ void *funcAddr;
+ //! Wrap Function Address
+ void *wrapFuncAddr;
+ //! Locak Thunk Address
+ void *localThunkAddr;
+} MyoiTargetSharedFptrEntry;
+
+/**
+ * @cond INCLUDE_MYO_INTERNAL_DOCUMENTATION
+ * @fn extern MyoError myoiHostFptrTableRegister(void *in_pAddrOfFptrTable,
+ * int in_NumEntry, int in_Ordered)
+ * @brief Register shared functions on host side. A 16 byte thunk will be
+ * allocated for each function entry in non-coherent shared memory. The
+ * thunk will contain a jump instruction to the local version of the
+ * shared function, which is provided by the second item of the function
+ * entry. Also, the address of the thunk will be stored to the 3rd item
+ * of the function entry for Compiler usage.
+ *
+ * @param in_pAddrOfFptrTable start address of the shared function
+ * table, assuming it follows the format of MyoiHostSharedFptrEntry.
+ * @param in_NumEntry number of entry in the table.
+ * @param in_Ordered whether the table is ordered by function name.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+MyoError myoiHostFptrTableRegister(
+ void *in_pAddrOfFptrTable, int in_NumEntry, int in_Ordered);
+
+/** @fn extern MyoError myoiTargetFptrTableRegister(void *in_pAddrOfFptrTable,
+ * int in_NumEntry, int in_Ordered)
+ * @brief Register shared functions on target side. This function is the
+ * same as myoiHostFptrTableRegister, except it does not need to allocate
+ * thunks from non-coherent shared memory for each function entry, but
+ * instead looks up this information from a table retrieved from the
+ * Host side.
+ *
+ * @param in_pAddrOfFptrTable start address of the shared function
+ * table, assuming it follows the format of MyoiTargetSharedFptrEntry.
+ * @param in_NumEntry number of entry in the table.
+ * @param in_Ordered whether the table is ordered by function name.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+extern MyoError myoiTargetFptrTableRegister(
+ void *in_pAddrOfFptrTable, int in_NumEntry, int in_Ordered);
+/**
+ * @endcond
+ **/
+
+/* *************************************************************************** *\
+ APIs for remote function calls
+\* *************************************************************************** */
+
+typedef void * MyoiRFuncCallHandle;
+
+/** @fn extern MyoiRFuncCallHandle myoiRemoteCall(char *in_pFuncName,
+ * void *in_pArgs, int in_deviceNum)
+ * @brief Call a remote callable function. If there are multiple arguments
+ * for the function, pack them to a shared buffer beforehand and take the
+ * address of the shared buffer as this function. After receiving the call
+ * requests from other peers, the arguments should be unpacked from the
+ * shared buffer before calling the target function. The shared buffer
+ * can also be used to store the return value of the function.
+ *
+ * @param in_pFuncName name of the function.
+ * @param in_pArgs address of the shared buffer.
+ * @return
+ * Handle used to check the result.
+ **/
+MYOACCESSAPI
+MyoiRFuncCallHandle myoiRemoteCall(const char *in_pFuncName, void *in_pArgs, int in_deviceNum);
+
+/**
+ * @cond INCLUDE_MYO_INTERNAL_DOCUMENTATION
+ * @fn extern MyoError myoiRemoteThunkCall(void *in_funcThunkAddr, void *in_pArgs, int in_deviceNum)
+ * @brief Call a remote callable function. If there are multiple arguments for
+ * the function, pack them to a shared buffer beforehand and take the address
+ * of the shared buffer as this function. After receiving the call requests
+ * from other peers, the arguments should be unpacked from the shared buffer
+ * before calling the target function. The shared buffer can also be used to
+ * store the return value of the function.
+ *
+ * @param in_funcThunkAddr pointer to function thunk in the non-coherent
+ * shared memory.
+ * @param in_pArgs address of the shared buffer.
+ * @PARAM in_deviceNum: device ID (0-N-1) for the MIC device to run
+ * function call. -1 request causes MYO to schedule an available device.
+ * For RPC from device to host, in_deviceNum should always be -1.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+MyoError myoiRemoteThunkCall(void *in_funcThunkAddr, void *in_pArgs, int in_deviceNum);
+/**
+ * @endcond
+ **/
+
+/** @fn extern MyoError myoiCheckResult(MyoiRFuncCallHandle in_Handle)
+ * @brief Check whether the remote call is done.
+ *
+ * @param in_Handle handle of the remote call.
+ * @return
+ * MYO_SUCCESS (done); or
+ * an error number to indicate the error.
+ **/
+extern MyoError myoiCheckResult(MyoiRFuncCallHandle in_Handle);
+
+/** @fn extern MyoError myoiGetResult(MyoiRFuncCallHandle in_Handle)
+ * @brief Wait till the remote call is done.
+ *
+ * @param in_Handle handle of the remote call.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+MyoError myoiGetResult(MyoiRFuncCallHandle in_Handle);
+
+/* **************************************************************************** *\
+ APIs related with shared variables.
+\* **************************************************************************** */
+
+/*
+ * It is Compiler's responsibility to make sure all shared variables
+ * located in shared memory space and have the same address in all sides.
+ * However, it is hard for Compiler to do this. So we propose a solution
+ * which is changing the definition of all shared variables and accessing
+ * them indirectly, and making sure all shared variables pointing
+ * to the same shared space on all sides. For example,
+ *
+ * "shared int a;" is changed to "shared int *a";
+ * Also all the accesses to "a" is change to "*a".
+ *
+ * We suppose the shared memory for each shared variable is allocated on
+ * host side by Compiler. For the upper example, Compiler can call:
+ *
+ * a = (shared int *) myoSharedMalloc(sizeof(shared int));
+ *
+ * Now the issue is how to make "a" on other sides also pointing to the
+ * same shared memory on other sides. We provide two methods to do this.
+ * They can be used in a hybrid way.
+ */
+
+/*
+ * The first method is calling myoiVarRegister for each shared variable
+ * on all sides in myoiUserInit. On host side, we will get a table containing
+ * a table containing the shared address and name of each shared variable.
+ * After calling myoiUserInit, we will propagate the table to other sides.
+ * On card side, after getting the table from host, myoiUserInit is called.
+ * When calling myoiVarRegister in myoiUserInit, we will make local pointer
+ * of each shared variable pointing to the same shared memory with the local
+ * pointer on host side of the same shared variable pointing to.
+ */
+
+/*
+ * The second method suppose that Compiler already have a table on all sides.
+ * On host side, the table contains the name and the shared address of each
+ * shared variable. On card side, the table contains the name of each shared
+ * variable and the address of the local pointer which will pointing to shared
+ * memory space.
+ *
+ * On host side, Compiler generates a call to myoiHostVarTablePropagate
+ * after initializing MYO runtime and making the host side table ready.
+ * On card side, Compiler uses myoiMicVarTableRegister to tell
+ * the runtime where the card side table is.
+ *
+ * Since there may be multiple libraries on card side for the same application,
+ * myoiHostVarTablePropagate and myoiMicVarTableRegister can be called multiple
+ * times and called simultaneously.
+ *
+ * Inside runtime, the local pointer of the same shared variable on all sides
+ * will be make sure pointing to the same shared space by using the information
+ * of the Compiler provided tables.
+ */
+
+/*
+ * Comipler knows the following two structures to make sure the var table
+ * has the following format.
+ */
+
+/*
+ * This is structure of the Shared var table entry. This table contains
+ * the shared address and name of each shared variable
+ */
+
+/** @fn extern MyoError myoiVarRegister(void *in_pAddrOfLocalPtrToShared, char *in_pSVarName)
+ * @brief Register shared variables. Call it on all sides in myoiUserInit.
+ * On host side, make sure calling it after allocating shared memory for
+ * the shared variables by calling myoSharedMalloc.
+ *
+ * @param in_pAddrOfLocalPtrToShared the address assigned by the compiler
+ * for the shared variable, which is the address of a local pointer,
+ * pointing to shared memory space.
+ * @param in_pSVarName name of shared variable.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+MyoError myoiVarRegister(
+ void *in_pAddrOfLocalPtrToShared, const char *in_pSVarName);
+
+/*
+ * Compiler knows the following two structures to make sure the var table
+ * has the following format.
+ */
+
+/**
+ * This is structure of the Shared var table entry. This table contains
+ * the shared address and name of each shared variable
+ **/
+typedef struct {
+ //! Variable Name
+ const char *varName;
+ //! Shared Address
+ void *sharedAddr;
+} MyoiSharedVarEntry;
+
+//! Structure of the var table entry on host
+typedef struct {
+ //! Variable Name
+ const char *varName;
+ //! Variable Size
+ int size;
+ //! Local pointer to Shared var
+ void *ptrToLocalPtrToShared;
+} MyoiHostSharedVarEntry;
+
+//! Structure of the var table entry on card
+typedef struct {
+ //! Variable Name
+ const char *varName;
+ //! Local pointer to Shared var
+ void *ptrToLocalPtrToShared;
+} MyoiMicSharedVarEntry;
+
+/** @fn extern MyoError myoiHostVarTablePropagate(void *in_pAddrOfSVarTable, int in_NumEntry)
+ * @brief Send the host side var table to the card side. Card side will also
+ * have a copy of the host side var table after this propagation, although it
+ * is in an internal format different than the original host side var table,
+ * due to implementation convenience.
+ *
+ * @param in_pAddrOfSVarTable start address of the host side var table,
+ * assuming it follows the format of MyoiSharedVarEntry.
+ * @param in_NumEntry number of entry in the table.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI MyoError myoiHostVarTablePropagate(
+ void *in_pAddrOfSVarTable, int in_NumEntry);
+
+/**
+ * @cond INCLUDE_MYO_INTERNAL_DOCUMENTATION
+ * @fn extern MyoError myoiMicVarTableRegister(void *in_pAddrOfSVarTable, int in_NumEntry)
+ * @brief Tell the runtime where the card side table is.
+ *
+ * @param in_pAddrOfSVarTable start address of the card side var
+ * table, assuming it follows the format of MyoiMicSharedVarEntry.
+ * @param in_NumEntry number of entry in the table.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+extern MyoError myoiMicVarTableRegister(
+ void *in_pAddrOfSVarTable, int in_NumEntry);
+/**
+ * @endcond
+ **/
+
+/** @fn MyoError myoiHostSharedMallocTableRegister(void *in_pAddrOfSVarTable, int in_NumEntry, int in_Ordered)
+ * @brief Allocate shared memory for all shared variables in the table.
+ * Also update local address of the shared variable with new shared address.
+ *
+ * @param in_pAddrOfSVarTable start address of the shared variable table,
+ * assuming it follows the format of MyoiHostSharedVarEntry.
+ * @param in_NumEntry number of entry in the table.
+ * @param in_Ordered whether the table ordered by name.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+MyoError myoiHostSharedMallocTableRegister(
+ void *in_pAddrOfSVarTable, int in_NumEntry, int in_Ordered);
+
+/** @fn extern MyoError myoiTargetSharedMallocTableRegister(void *in_pAddrOfSVarTable, int in_NumEntry, int in_Ordered)
+ * @brief Register the shared variables on the target side.
+ *
+ * @param in_pAddrOfSVarTable start address of the shared varaible table,
+ * assuming it follows the format of MyoiMicSharedVarEntry.
+ * @param in_NumEntry number of entry in the table.
+ * @param in_Ordered whether the table ordered by name.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+extern MyoError myoiTargetSharedMallocTableRegister(
+ void *in_pAddrOfSVarTable, int in_NumEntry, int in_Ordered);
+
+/** @fn MyoError myoiLibInit(void * in_args, void (*userInitFunc))
+ * @brief Init entry of the MYO library responsible for initializing
+ * the runtime.
+ *
+ * @param in_args mechanism to pass arguments to the Initialization
+ * routine. The default value of NULL would mean the host is blocked
+ * on the completion of myoiLibInit() on all nodes. A subset of the
+ * installed cards can be intialized by passing an array of
+ * MyoiUserParams. For example, in a system with two cards, to run a
+ * MYO application only on the second card, intialize the array as
+ * follows:
+ * @code
+ * MyoiUserParams UserParas[64];
+ * UserParas[0].type = MYOI_USERPARAMS_DEVID;
+ * UserParas[0].nodeid = 2;
+ * UserParas[1].type = MYOI_USERPARAMS_LAST_MSG;
+ * if(MYO_SUCCESS != myoiLibInit(&UserParas, (void*)&myoiUserInit)) {
+ * printf("Failed to initialize MYO runtime\n");
+ * return -1;
+ * }
+ * @endcode
+ * This intialization is required only in the client/host side
+ * of the application. The server/card side executable should be
+ * executed only on the second card in this case.
+ *
+ * @param userInitFunc Shared variables and remote funtions are
+ * registered in this routine, which is called by the runtime during
+ * library initialization.
+ * @return
+ * MYO_SUCCESS;
+ * MYO_ERROR;
+ **/
+MYOACCESSAPI
+MyoError myoiLibInit(void * in_args, void *userInitFunc /*userInitFunc must be: MyoError (*userInitFunc)(void) */);
+
+/** @fn void myoiLibFini()
+ * @brief Finalize the MYO library, all resources held by the runtime are
+ * released by this routine.
+ *
+ * @return
+ **/
+MYOACCESSAPI
+void myoiLibFini();
+
+/* *************************************************************************** *\
+ APIs to set shared memory space consistent/non-consistent.
+\* *************************************************************************** */
+
+/** @fn extern MyoError myoiSetMemNonConsistent(void *in_pAddr, size_t in_Size)
+ * @brief Set part of the shared memory space to be non-consistent, which
+ * means that the consistency of this part of shared memory space does not
+ * need to be maintained between HOST and cards.
+ *
+ * @param in_pAddr The start address of the specified shared memory space;
+ * @param in_Size The size of the specified shared memory space;
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+MyoError myoiSetMemNonConsistent(void *in_pAddr, size_t in_Size);
+
+/** @fn extern MyoError myoiSetMemConsistent(void *in_pAddr, size_t in_Size)
+ * @brief Set part of the shared memory space to be consistent, which
+ * means that the consistency of this part of shared memory space needs
+ * to be maintained between HOST and cards.
+ *
+ * @param in_pAddr The start address of the specified shared
+ * memory space.
+ * @param in_size The size of the specified shared memory space.
+ * @return
+ * MYO_SUCCESS; or
+ * an error number to indicate the error.
+ **/
+MYOACCESSAPI
+MyoError myoiSetMemConsistent(void *in_pAddr, size_t in_Size);
+
+/* A collection of external data symbols */
+EXTERN_C MYOACCESSAPI unsigned int myoiMyId; /* MYO_MYID if on accelerators */
+EXTERN_C MYOACCESSAPI volatile int myoiInitFlag;
+
+
+ //! Structure of the array element that is passed to myoiLibInit() to initialize a subset of the available cards.
+typedef struct{
+ //!type = MYOI_USERPARAMS_DEVID for each element in the array except the last element ; type = MYOI_USERPARAMS_LAST_MSG for the last element in the array.
+ int type;
+ //!nodeid refers to the card index.
+ int nodeid;
+}MyoiUserParams;
+
+#define MYOI_USERPARAMS_DEVID 1
+#define MYOI_USERPARAMS_LAST_MSG -1
+
+#ifdef __cplusplus
+}
+#endif
+#endif // _MYO_IMPL_H_
+/*! @} */
diff --git a/liboffloadmic/include/myo/myotypes.h b/liboffloadmic/include/myo/myotypes.h
new file mode 100644
index 00000000000..81464d1666f
--- /dev/null
+++ b/liboffloadmic/include/myo/myotypes.h
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2010-2013 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 2.1.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ *
+ * Disclaimer: The codes contained in these modules may be specific
+ * to the Intel Software Development Platform codenamed Knights Ferry,
+ * and the Intel product codenamed Knights Corner, and are not backward
+ * compatible with other Intel products. Additionally, Intel will NOT
+ * support the codes or instruction set in future products.
+ *
+ * Intel offers no warranty of any kind regarding the code. This code is
+ * licensed on an "AS IS" basis and Intel is not obligated to provide
+ * any support, assistance, installation, training, or other services
+ * of any kind. Intel is also not obligated to provide any updates,
+ * enhancements or extensions. Intel specifically disclaims any warranty
+ * of merchantability, non-infringement, fitness for any particular
+ * purpose, and any other warranty.
+ *
+ * Further, Intel disclaims all liability of any kind, including but
+ * not limited to liability for infringement of any proprietary rights,
+ * relating to the use of the code, even if Intel is notified of the
+ * possibility of such liability. Except as expressly stated in an Intel
+ * license agreement provided with this code and agreed upon with Intel,
+ * no license, express or implied, by estoppel or otherwise, to any
+ * intellectual property rights is granted herein.
+ */
+/**
+ Description: Define the types used by APIs of MYO programming.
+ */
+
+#ifndef _MYO_TYPES_H_
+#define _MYO_TYPES_H_
+
+#include <string.h> /* For size_t */
+
+/** @ingroup MYO
+ * @addtogroup MYOTYPES
+@{
+* @file myotypes.h
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*! MYO Status
+ */
+typedef enum {
+ MYO_SUCCESS = 0, /*!< Success */
+ MYO_ERROR, /*!< Error */
+
+ MYO_INVALID_ENV, /*!< Invalid Env */
+ MYO_INVALID_ARGUMENT, /*!< Invalid Argument */
+
+ MYO_NOT_INITIALIZED, /*!< Not Initialized */
+ MYO_ALREADY_FINALIZED,/*!< Already Finalized */
+
+ MYO_BUF_ERROR, /*!< Buffer Error */
+ MYO_OUT_OF_RANGE, /*!< Out of Range */
+ MYO_OUT_OF_MEMORY, /*!< Out of Memory */
+
+ MYO_ALREADY_EXISTS, /*!< Already Exists */
+
+ MYO_EOF, /*!< EOF */
+} MyoError;
+
+
+/*! Arena Ownership */
+typedef enum {
+ MYO_ARENA_MINE = 1, /*!< Arena MINE Ownership */
+ MYO_ARENA_OURS, /*!< Arena OURS Ownership */
+} MyoOwnershipType;
+
+/*************************************************************
+ * define the property of MYO Arena
+ ***********************************************************/
+#define MYO_CONSISTENCY_MODE 0x3
+#define MYO_RELEASE_CONSISTENCY 0x1
+#define MYO_STRONG_RELEASE_CONSISTENCY 0x2
+#define MYO_STRONG_CONSISTENCY 0x3
+#define MYO_UPDATE_ON_DEMAND 0x8
+#define MYO_UPDATE_ON_ACQUIRE 0x10
+#define MYO_RECORD_DIRTY 0x20
+#define MYO_NOT_RECORD_DIRTY 0x40
+#define MYO_ONE_VERSION 0x80
+#define MYO_MULTI_VERSIONS 0x100
+#define MYO_CONSISTENCY 0x200
+#define MYO_NO_CONSISTENCY 0x400
+#define MYO_HOST_TO_DEVICE 0x800
+#define MYO_DEVICE_TO_HOST 0x1000
+#define MYO_HYBRID_UPDATE 0x2000
+typedef unsigned int MyoArena;
+
+typedef void * MyoMutex;
+typedef void * MyoSem;
+typedef void * MyoBarrier;
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif // _MYO_TYPES_H_
+/*! @} */
diff --git a/liboffloadmic/liboffloadmic_host.spec.in b/liboffloadmic/liboffloadmic_host.spec.in
new file mode 100644
index 00000000000..3fd12e4d7d6
--- /dev/null
+++ b/liboffloadmic/liboffloadmic_host.spec.in
@@ -0,0 +1,3 @@
+# This spec file is read by gcc when linking. It is used to specify the
+# standard libraries we need in order to link with liboffloadmic_host.
+*link_offloadmic_host: @link_offloadmic_host@
diff --git a/liboffloadmic/liboffloadmic_target.spec.in b/liboffloadmic/liboffloadmic_target.spec.in
new file mode 100644
index 00000000000..d679686684a
--- /dev/null
+++ b/liboffloadmic/liboffloadmic_target.spec.in
@@ -0,0 +1,3 @@
+# This spec file is read by gcc when linking. It is used to specify the
+# standard libraries we need in order to link with liboffloadmic_target.
+*link_offloadmic_target: @link_offloadmic_target@
diff --git a/liboffloadmic/plugin/Makefile.am b/liboffloadmic/plugin/Makefile.am
new file mode 100644
index 00000000000..0baf70de935
--- /dev/null
+++ b/liboffloadmic/plugin/Makefile.am
@@ -0,0 +1,123 @@
+# Plugin for offload execution on Intel MIC devices.
+#
+# Copyright (C) 2014 Free Software Foundation, Inc.
+#
+# Contributed by Ilya Verbin <ilya.verbin@intel.com> and
+# Andrey Turetskiy <andrey.turetskiy@intel.com>.
+#
+# This file is part of the GNU OpenMP Library (libgomp).
+#
+# Libgomp 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.
+#
+# Libgomp 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.
+#
+# Under Section 7 of GPL version 3, you are granted additional
+# permissions described in the GCC Runtime Library Exception, version
+# 3.1, as published by the Free Software Foundation.
+#
+# You should have received a copy of the GNU General Public License and
+# a copy of the GCC Runtime Library Exception along with this program;
+# see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+# <http://www.gnu.org/licenses/>.
+
+
+AUTOMAKE_OPTIONS = foreign
+ACLOCAL_AMFLAGS = -I ../.. -I ../../config
+
+# Directories
+build_dir = $(top_builddir)
+source_dir = $(top_srcdir)
+coi_inc_dir = $(top_srcdir)/../include/coi
+myo_inc_dir = $(top_srcdir)/../include/myo
+libgomp_src_dir = $(top_srcdir)/../../libgomp
+libgomp_dir = $(build_dir)/../../libgomp
+liboffload_src_dir = $(top_srcdir)/../runtime
+liboffload_dir = $(top_builddir)/..
+
+# May be used by toolexeclibdir.
+gcc_version := $(shell cat $(top_srcdir)/../../gcc/BASE-VER)
+libsubincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)$(MULTISUBDIR)/include
+# Search for main_target_image.h in these directories
+target_prefix_dir = $(libdir)/gcc/$(accel_target)/$(gcc_version)$(MULTISUBDIR)
+target_build_dir = $(accel_search_dir)/$(accel_target)$(MULTISUBDIR)/liboffloadmic/plugin
+target_install_dir = $(accel_search_dir)/lib/gcc/$(accel_target)/$(gcc_version)$(MULTISUBDIR)
+
+if PLUGIN_HOST
+ toolexeclib_LTLIBRARIES = libgomp-plugin-intelmic.la
+ libgomp_plugin_intelmic_la_SOURCES = libgomp-plugin-intelmic.cpp
+ libgomp_plugin_intelmic_la_CPPFLAGS = $(CPPFLAGS) -DLINUX -DCOI_LIBRARY_VERSION=2 -DMYO_SUPPORT -DOFFLOAD_DEBUG=1 -DSEP_SUPPORT -DTIMING_SUPPORT -DHOST_LIBRARY=1 -I$(coi_inc_dir) -I$(myo_inc_dir) -I$(liboffload_src_dir) -I$(libgomp_src_dir) -I$(libgomp_dir) -I$(target_prefix_dir)/include -I$(target_build_dir) -I$(target_install_dir)/include
+ libgomp_plugin_intelmic_la_LDFLAGS = -L$(liboffload_dir)/.libs -loffloadmic_host -version-info 1:0:0
+else # PLUGIN_TARGET
+ plugin_includedir = $(libsubincludedir)
+ plugin_include_HEADERS = main_target_image.h
+ AM_CPPFLAGS = $(CPPFLAGS) -DLINUX -DCOI_LIBRARY_VERSION=2 -DMYO_SUPPORT -DOFFLOAD_DEBUG=1 -DSEP_SUPPORT -DTIMING_SUPPORT -DHOST_LIBRARY=0 -I$(coi_inc_dir) -I$(myo_inc_dir) -I$(liboffload_src_dir) -I$(libgomp_dir)
+ AM_CXXFLAGS = $(CXXFLAGS)
+ AM_LDFLAGS = -L$(liboffload_dir)/.libs -L$(libgomp_dir)/.libs -loffloadmic_target -lcoi_device -lmyo-service -lgomp -rdynamic
+endif
+
+main_target_image.h: offload_target_main
+ @echo -n "const int image_size = " > $@
+ @stat -c '%s' $< >> $@
+ @echo ";" >> $@
+ @echo "struct MainTargetImage {" >> $@
+ @echo " int64_t size;" >> $@
+ @echo " char name[sizeof \"offload_target_main\"];" >> $@
+ @echo " char data[image_size];" >> $@
+ @echo "};" >> $@
+ @echo "extern \"C\" const MainTargetImage main_target_image = {" >> $@
+ @echo " image_size, \"offload_target_main\"," >> $@
+ @cat $< | xxd -include >> $@
+ @echo "};" >> $@
+
+offload_target_main: $(liboffload_dir)/ofldbegin.o offload_target_main.o $(liboffload_dir)/ofldend.o
+ $(CXX) $(AM_LDFLAGS) $^ -o $@
+
+offload_target_main.o: offload_target_main.cpp
+ $(CXX) $(AM_CXXFLAGS) $(AM_CPPFLAGS) -c $< -o $@
+
+# Work around what appears to be a GNU make bug handling MAKEFLAGS
+# values defined in terms of make variables, as is the case for CC and
+# friends when we are called from the top level Makefile.
+AM_MAKEFLAGS = \
+ "AR_FLAGS=$(AR_FLAGS)" \
+ "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
+ "CFLAGS=$(CFLAGS)" \
+ "CXXFLAGS=$(CXXFLAGS)" \
+ "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
+ "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
+ "INSTALL=$(INSTALL)" \
+ "INSTALL_DATA=$(INSTALL_DATA)" \
+ "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
+ "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
+ "JC1FLAGS=$(JC1FLAGS)" \
+ "LDFLAGS=$(LDFLAGS)" \
+ "LIBCFLAGS=$(LIBCFLAGS)" \
+ "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
+ "MAKE=$(MAKE)" \
+ "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
+ "PICFLAG=$(PICFLAG)" \
+ "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
+ "SHELL=$(SHELL)" \
+ "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
+ "exec_prefix=$(exec_prefix)" \
+ "infodir=$(infodir)" \
+ "libdir=$(libdir)" \
+ "prefix=$(prefix)" \
+ "includedir=$(includedir)" \
+ "AR=$(AR)" \
+ "AS=$(AS)" \
+ "LD=$(LD)" \
+ "LIBCFLAGS=$(LIBCFLAGS)" \
+ "NM=$(NM)" \
+ "PICFLAG=$(PICFLAG)" \
+ "RANLIB=$(RANLIB)" \
+ "DESTDIR=$(DESTDIR)"
+
+MAKEOVERRIDES =
+
diff --git a/liboffloadmic/plugin/Makefile.in b/liboffloadmic/plugin/Makefile.in
new file mode 100644
index 00000000000..5ba750a3277
--- /dev/null
+++ b/liboffloadmic/plugin/Makefile.in
@@ -0,0 +1,697 @@
+# Makefile.in generated by automake 1.11.1 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@
+
+# Plugin for offload execution on Intel MIC devices.
+#
+# Copyright (C) 2014 Free Software Foundation, Inc.
+#
+# Contributed by Ilya Verbin <ilya.verbin@intel.com> and
+# Andrey Turetskiy <andrey.turetskiy@intel.com>.
+#
+# This file is part of the GNU OpenMP Library (libgomp).
+#
+# Libgomp 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.
+#
+# Libgomp 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.
+#
+# Under Section 7 of GPL version 3, you are granted additional
+# permissions described in the GCC Runtime Library Exception, version
+# 3.1, as published by the Free Software Foundation.
+#
+# You should have received a copy of the GNU General Public License and
+# a copy of the GCC Runtime Library Exception along with this program;
+# see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+# <http://www.gnu.org/licenses/>.
+
+
+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@
+target_triplet = @target@
+subdir = .
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+ $(top_srcdir)/configure $(am__configure_deps) \
+ $(srcdir)/../../mkinstalldirs $(srcdir)/../../depcomp \
+ $(am__plugin_include_HEADERS_DIST)
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
+ $(top_srcdir)/../../config/lead-dot.m4 \
+ $(top_srcdir)/../../config/multi.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)$(toolexeclibdir)" \
+ "$(DESTDIR)$(plugin_includedir)"
+LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
+libgomp_plugin_intelmic_la_LIBADD =
+@PLUGIN_HOST_TRUE@am_libgomp_plugin_intelmic_la_OBJECTS = libgomp_plugin_intelmic_la-libgomp-plugin-intelmic.lo
+libgomp_plugin_intelmic_la_OBJECTS = \
+ $(am_libgomp_plugin_intelmic_la_OBJECTS)
+libgomp_plugin_intelmic_la_LINK = $(LIBTOOL) --tag=CXX \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
+ $(AM_CXXFLAGS) $(CXXFLAGS) \
+ $(libgomp_plugin_intelmic_la_LDFLAGS) $(LDFLAGS) -o $@
+@PLUGIN_HOST_TRUE@am_libgomp_plugin_intelmic_la_rpath = -rpath \
+@PLUGIN_HOST_TRUE@ $(toolexeclibdir)
+DEFAULT_INCLUDES = -I.@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/../../depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libgomp_plugin_intelmic_la_SOURCES)
+MULTISRCTOP =
+MULTIBUILDTOP =
+MULTIDIRS =
+MULTISUBDIR =
+MULTIDO = true
+MULTICLEAN = true
+am__plugin_include_HEADERS_DIST = main_target_image.h
+HEADERS = $(plugin_include_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+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@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+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_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+accel_search_dir = @accel_search_dir@
+accel_target = @accel_target@
+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_os = @build_os@
+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_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+toolexecdir = @toolexecdir@
+toolexeclibdir = @toolexeclibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = foreign
+ACLOCAL_AMFLAGS = -I ../.. -I ../../config
+
+# Directories
+build_dir = $(top_builddir)
+source_dir = $(top_srcdir)
+coi_inc_dir = $(top_srcdir)/../include/coi
+myo_inc_dir = $(top_srcdir)/../include/myo
+libgomp_src_dir = $(top_srcdir)/../../libgomp
+libgomp_dir = $(build_dir)/../../libgomp
+liboffload_src_dir = $(top_srcdir)/../runtime
+liboffload_dir = $(top_builddir)/..
+
+# May be used by toolexeclibdir.
+gcc_version := $(shell cat $(top_srcdir)/../../gcc/BASE-VER)
+libsubincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)$(MULTISUBDIR)/include
+# Search for main_target_image.h in these directories
+target_prefix_dir = $(libdir)/gcc/$(accel_target)/$(gcc_version)$(MULTISUBDIR)
+target_build_dir = $(accel_search_dir)/$(accel_target)$(MULTISUBDIR)/liboffloadmic/plugin
+target_install_dir = $(accel_search_dir)/lib/gcc/$(accel_target)/$(gcc_version)$(MULTISUBDIR)
+@PLUGIN_HOST_TRUE@toolexeclib_LTLIBRARIES = libgomp-plugin-intelmic.la
+@PLUGIN_HOST_TRUE@libgomp_plugin_intelmic_la_SOURCES = libgomp-plugin-intelmic.cpp
+@PLUGIN_HOST_TRUE@libgomp_plugin_intelmic_la_CPPFLAGS = $(CPPFLAGS) -DLINUX -DCOI_LIBRARY_VERSION=2 -DMYO_SUPPORT -DOFFLOAD_DEBUG=1 -DSEP_SUPPORT -DTIMING_SUPPORT -DHOST_LIBRARY=1 -I$(coi_inc_dir) -I$(myo_inc_dir) -I$(liboffload_src_dir) -I$(libgomp_src_dir) -I$(libgomp_dir) -I$(target_prefix_dir)/include -I$(target_build_dir) -I$(target_install_dir)/include
+@PLUGIN_HOST_TRUE@libgomp_plugin_intelmic_la_LDFLAGS = -L$(liboffload_dir)/.libs -loffloadmic_host -version-info 1:0:0
+@PLUGIN_HOST_FALSE@plugin_includedir = $(libsubincludedir)
+@PLUGIN_HOST_FALSE@plugin_include_HEADERS = main_target_image.h
+@PLUGIN_HOST_FALSE@AM_CPPFLAGS = $(CPPFLAGS) -DLINUX -DCOI_LIBRARY_VERSION=2 -DMYO_SUPPORT -DOFFLOAD_DEBUG=1 -DSEP_SUPPORT -DTIMING_SUPPORT -DHOST_LIBRARY=0 -I$(coi_inc_dir) -I$(myo_inc_dir) -I$(liboffload_src_dir) -I$(libgomp_dir)
+@PLUGIN_HOST_FALSE@AM_CXXFLAGS = $(CXXFLAGS)
+@PLUGIN_HOST_FALSE@AM_LDFLAGS = -L$(liboffload_dir)/.libs -L$(libgomp_dir)/.libs -loffloadmic_target -lcoi_device -lmyo-service -lgomp -rdynamic
+
+# Work around what appears to be a GNU make bug handling MAKEFLAGS
+# values defined in terms of make variables, as is the case for CC and
+# friends when we are called from the top level Makefile.
+AM_MAKEFLAGS = \
+ "AR_FLAGS=$(AR_FLAGS)" \
+ "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
+ "CFLAGS=$(CFLAGS)" \
+ "CXXFLAGS=$(CXXFLAGS)" \
+ "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
+ "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
+ "INSTALL=$(INSTALL)" \
+ "INSTALL_DATA=$(INSTALL_DATA)" \
+ "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
+ "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
+ "JC1FLAGS=$(JC1FLAGS)" \
+ "LDFLAGS=$(LDFLAGS)" \
+ "LIBCFLAGS=$(LIBCFLAGS)" \
+ "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
+ "MAKE=$(MAKE)" \
+ "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
+ "PICFLAG=$(PICFLAG)" \
+ "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
+ "SHELL=$(SHELL)" \
+ "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
+ "exec_prefix=$(exec_prefix)" \
+ "infodir=$(infodir)" \
+ "libdir=$(libdir)" \
+ "prefix=$(prefix)" \
+ "includedir=$(includedir)" \
+ "AR=$(AR)" \
+ "AS=$(AS)" \
+ "LD=$(LD)" \
+ "LIBCFLAGS=$(LIBCFLAGS)" \
+ "NM=$(NM)" \
+ "PICFLAG=$(PICFLAG)" \
+ "RANLIB=$(RANLIB)" \
+ "DESTDIR=$(DESTDIR)"
+
+MAKEOVERRIDES =
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .lo .o .obj
+am--refresh:
+ @:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ $(am__cd) $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+$(am__aclocal_m4_deps):
+install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(toolexeclibdir)" || $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)"
+ @list='$(toolexeclib_LTLIBRARIES)'; test -n "$(toolexeclibdir)" || 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)$(toolexeclibdir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(toolexeclibdir)"; \
+ }
+
+uninstall-toolexeclibLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(toolexeclib_LTLIBRARIES)'; test -n "$(toolexeclibdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(toolexeclibdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(toolexeclibdir)/$$f"; \
+ done
+
+clean-toolexeclibLTLIBRARIES:
+ -test -z "$(toolexeclib_LTLIBRARIES)" || rm -f $(toolexeclib_LTLIBRARIES)
+ @list='$(toolexeclib_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
+libgomp-plugin-intelmic.la: $(libgomp_plugin_intelmic_la_OBJECTS) $(libgomp_plugin_intelmic_la_DEPENDENCIES)
+ $(libgomp_plugin_intelmic_la_LINK) $(am_libgomp_plugin_intelmic_la_rpath) $(libgomp_plugin_intelmic_la_OBJECTS) $(libgomp_plugin_intelmic_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgomp_plugin_intelmic_la-libgomp-plugin-intelmic.Plo@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+libgomp_plugin_intelmic_la-libgomp-plugin-intelmic.lo: libgomp-plugin-intelmic.cpp
+@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgomp_plugin_intelmic_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgomp_plugin_intelmic_la-libgomp-plugin-intelmic.lo -MD -MP -MF $(DEPDIR)/libgomp_plugin_intelmic_la-libgomp-plugin-intelmic.Tpo -c -o libgomp_plugin_intelmic_la-libgomp-plugin-intelmic.lo `test -f 'libgomp-plugin-intelmic.cpp' || echo '$(srcdir)/'`libgomp-plugin-intelmic.cpp
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libgomp_plugin_intelmic_la-libgomp-plugin-intelmic.Tpo $(DEPDIR)/libgomp_plugin_intelmic_la-libgomp-plugin-intelmic.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='libgomp-plugin-intelmic.cpp' object='libgomp_plugin_intelmic_la-libgomp-plugin-intelmic.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgomp_plugin_intelmic_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgomp_plugin_intelmic_la-libgomp-plugin-intelmic.lo `test -f 'libgomp-plugin-intelmic.cpp' || echo '$(srcdir)/'`libgomp-plugin-intelmic.cpp
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool config.lt
+
+# GNU Make needs to see an explicit $(MAKE) variable in the command it
+# runs to enable its job server during parallel builds. Hence the
+# comments below.
+all-multi:
+ $(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do # $(MAKE)
+install-multi:
+ $(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do # $(MAKE)
+
+mostlyclean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=mostlyclean multi-clean # $(MAKE)
+clean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=clean multi-clean # $(MAKE)
+distclean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean # $(MAKE)
+maintainer-clean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean # $(MAKE)
+install-plugin_includeHEADERS: $(plugin_include_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(plugin_includedir)" || $(MKDIR_P) "$(DESTDIR)$(plugin_includedir)"
+ @list='$(plugin_include_HEADERS)'; test -n "$(plugin_includedir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(plugin_includedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(plugin_includedir)" || exit $$?; \
+ done
+
+uninstall-plugin_includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(plugin_include_HEADERS)'; test -n "$(plugin_includedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(plugin_includedir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(plugin_includedir)" && rm -f $$files
+
+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
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) all-multi $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(plugin_includedir)"; 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-multi
+
+clean-am: clean-generic clean-libtool clean-toolexeclibLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am distclean-multi
+ -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-plugin_includeHEADERS
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-multi install-toolexeclibLTLIBRARIES
+
+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 maintainer-clean-multi
+ -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-multi
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-plugin_includeHEADERS \
+ uninstall-toolexeclibLTLIBRARIES
+
+.MAKE: all-multi clean-multi distclean-multi install-am install-multi \
+ install-strip maintainer-clean-multi mostlyclean-multi
+
+.PHONY: CTAGS GTAGS all all-am all-multi am--refresh check check-am \
+ clean clean-generic clean-libtool clean-multi \
+ clean-toolexeclibLTLIBRARIES ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-multi \
+ distclean-tags 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-man \
+ install-multi install-pdf install-pdf-am \
+ install-plugin_includeHEADERS install-ps install-ps-am \
+ install-strip install-toolexeclibLTLIBRARIES installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic maintainer-clean-multi mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ mostlyclean-multi pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-plugin_includeHEADERS \
+ uninstall-toolexeclibLTLIBRARIES
+
+
+main_target_image.h: offload_target_main
+ @echo -n "const int image_size = " > $@
+ @stat -c '%s' $< >> $@
+ @echo ";" >> $@
+ @echo "struct MainTargetImage {" >> $@
+ @echo " int64_t size;" >> $@
+ @echo " char name[sizeof \"offload_target_main\"];" >> $@
+ @echo " char data[image_size];" >> $@
+ @echo "};" >> $@
+ @echo "extern \"C\" const MainTargetImage main_target_image = {" >> $@
+ @echo " image_size, \"offload_target_main\"," >> $@
+ @cat $< | xxd -include >> $@
+ @echo "};" >> $@
+
+offload_target_main: $(liboffload_dir)/ofldbegin.o offload_target_main.o $(liboffload_dir)/ofldend.o
+ $(CXX) $(AM_LDFLAGS) $^ -o $@
+
+offload_target_main.o: offload_target_main.cpp
+ $(CXX) $(AM_CXXFLAGS) $(AM_CPPFLAGS) -c $< -o $@
+
+# 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/liboffloadmic/plugin/aclocal.m4 b/liboffloadmic/plugin/aclocal.m4
new file mode 100644
index 00000000000..bcb1f333665
--- /dev/null
+++ b/liboffloadmic/plugin/aclocal.m4
@@ -0,0 +1,979 @@
+# generated automatically by aclocal 1.11.1 -*- 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.1], [],
+ [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.1])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)])
+
+# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
+# From Jim Meyering
+
+# Copyright (C) 1996, 1998, 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_MAINTAINER_MODE([DEFAULT-MODE])
+# ----------------------------------
+# Control maintainer-specific portions of Makefiles.
+# Default is to disable them, unless `enable' is passed literally.
+# For symmetry, `disable' may be passed as well. Anyway, the user
+# can override the default with the --enable/--disable switch.
+AC_DEFUN([AM_MAINTAINER_MODE],
+[m4_case(m4_default([$1], [disable]),
+ [enable], [m4_define([am_maintainer_other], [disable])],
+ [disable], [m4_define([am_maintainer_other], [enable])],
+ [m4_define([am_maintainer_other], [enable])
+ m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
+AC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
+ dnl maintainer-mode's default is 'disable' unless 'enable' is passed
+ AC_ARG_ENABLE([maintainer-mode],
+[ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer],
+ [USE_MAINTAINER_MODE=$enableval],
+ [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
+ AC_MSG_RESULT([$USE_MAINTAINER_MODE])
+ AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
+ MAINT=$MAINTAINER_MODE_TRUE
+ AC_SUBST([MAINT])dnl
+]
+)
+
+AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
+
+# 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 <conftest.tar])
+ grep GrepMe conftest.dir/file >/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/depstand.m4])
+m4_include([../../config/lead-dot.m4])
+m4_include([../../config/multi.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/liboffloadmic/plugin/configure b/liboffloadmic/plugin/configure
new file mode 100644
index 00000000000..60189c4d228
--- /dev/null
+++ b/liboffloadmic/plugin/configure
@@ -0,0 +1,16656 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.64 for Intel MIC Offload Plugin 1.0.
+#
+# 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 -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
+ ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+ ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+ PATH=/empty FPATH=/empty; export PATH FPATH
+ test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\
+ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || 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'"
+
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+
+exec 7<&0 </dev/null 6>&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='Intel MIC Offload Plugin'
+PACKAGE_TARNAME='libgomp-plugin-intelmic'
+PACKAGE_VERSION='1.0'
+PACKAGE_STRING='Intel MIC Offload Plugin 1.0'
+PACKAGE_BUGREPORT=''
+PACKAGE_URL=''
+
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='am__EXEEXT_FALSE
+am__EXEEXT_TRUE
+LTLIBOBJS
+LIBOBJS
+toolexeclibdir
+toolexecdir
+CXXCPP
+CPP
+OTOOL64
+OTOOL
+LIPO
+NMEDIT
+DSYMUTIL
+RANLIB
+AR
+OBJDUMP
+LN_S
+NM
+ac_ct_DUMPBIN
+DUMPBIN
+LD
+FGREP
+EGREP
+GREP
+SED
+LIBTOOL
+accel_target
+accel_search_dir
+PLUGIN_HOST_FALSE
+PLUGIN_HOST_TRUE
+multi_basedir
+am__fastdepCXX_FALSE
+am__fastdepCXX_TRUE
+CXXDEPMODE
+ac_ct_CXX
+CXXFLAGS
+CXX
+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
+MAINT
+MAINTAINER_MODE_FALSE
+MAINTAINER_MODE_TRUE
+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_os
+target_vendor
+target_cpu
+target
+host_os
+host_vendor
+host_cpu
+host
+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
+enable_maintainer_mode
+enable_dependency_tracking
+enable_multilib
+enable_version_specific_runtime_libs
+enable_shared
+enable_static
+with_pic
+enable_fast_install
+with_gnu_ld
+enable_libtool_lock
+'
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CXX
+CXXFLAGS
+CCC
+CPP
+CXXCPP'
+
+
+# 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 Intel MIC Offload Plugin 1.0 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/libgomp-plugin-intelmic]
+ --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]
+ --target=TARGET configure for building compilers for TARGET [HOST]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of Intel MIC Offload Plugin 1.0:";;
+ 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]
+ --enable-maintainer-mode enable make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer
+ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors
+ --enable-multilib build many library versions (default)
+ --enable-version-specific-runtime-libs
+ Specify that runtime libraries should be installed
+ in a compiler-specific directory
+ --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)
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --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<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ LIBS libraries to pass to the linker, e.g. -l<library>
+ CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
+ CXX C++ compiler command
+ CXXFLAGS C++ compiler flags
+ CPP C preprocessor
+ CXXCPP 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
+Intel MIC Offload Plugin configure 1.0
+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_cxx_try_compile LINENO
+# ----------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_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_cxx_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_cxx_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 <limits.h> declares $2.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $2 (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#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
+
+# ac_fn_cxx_try_cpp LINENO
+# ------------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_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_cxx_preproc_warn_flag$ac_cxx_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_cxx_try_cpp
+
+# ac_fn_cxx_try_link LINENO
+# -------------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_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_cxx_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_cxx_try_link
+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 Intel MIC Offload Plugin $as_me 1.0, 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"/../..; 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\"/../.." "$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
+
+
+{ $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 target system type" >&5
+$as_echo_n "checking target system type... " >&6; }
+if test "${ac_cv_target+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "x$target_alias" = x; then
+ ac_cv_target=$ac_cv_host
+else
+ ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
+ as_fn_error "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5
+$as_echo "$ac_cv_target" >&6; }
+case $ac_cv_target in
+*-*-*) ;;
+*) as_fn_error "invalid value of canonical target" "$LINENO" 5;;
+esac
+target=$ac_cv_target
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_target
+shift
+target_cpu=$1
+target_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+target_os=$*
+IFS=$ac_save_IFS
+case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac
+
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+test -n "$target_alias" &&
+ test "$program_prefix$program_suffix$program_transform_name" = \
+ NONENONEs,x,x, &&
+ program_prefix=${target_alias}-
+
+target_alias=${target_alias-$host_alias}
+
+
+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='libgomp-plugin-intelmic'
+ VERSION='1.0'
+
+
+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 -'
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
+$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
+ # Check whether --enable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then :
+ enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
+else
+ USE_MAINTAINER_MODE=no
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5
+$as_echo "$USE_MAINTAINER_MODE" >&6; }
+ if test $USE_MAINTAINER_MODE = yes; then
+ MAINTAINER_MODE_TRUE=
+ MAINTAINER_MODE_FALSE='#'
+else
+ MAINTAINER_MODE_TRUE='#'
+ MAINTAINER_MODE_FALSE=
+fi
+
+ MAINT=$MAINTAINER_MODE_TRUE
+
+
+
+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 <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* 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
+
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -z "$CXX"; then
+ if test -n "$CCC"; then
+ CXX=$CCC
+ else
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+ 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_CXX+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CXX"; then
+ ac_cv_prog_CXX="$CXX" # 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_CXX="$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
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
+$as_echo "$CXX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CXX" && break
+ done
+fi
+if test -z "$CXX"; then
+ ac_ct_CXX=$CXX
+ for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+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_CXX+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CXX"; then
+ ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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_CXX="$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_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
+$as_echo "$ac_ct_CXX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CXX" && break
+done
+
+ if test "x$ac_ct_CXX" = x; then
+ CXX="g++"
+ 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
+ CXX=$ac_ct_CXX
+ fi
+fi
+
+ fi
+fi
+# 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
+
+{ $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_cxx_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_cxx_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_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
+$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GXX=yes
+else
+ GXX=
+fi
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
+$as_echo_n "checking whether $CXX accepts -g... " >&6; }
+if test "${ac_cv_prog_cxx_g+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+ ac_cxx_werror_flag=yes
+ ac_cv_prog_cxx_g=no
+ CXXFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_cv_prog_cxx_g=yes
+else
+ CXXFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+else
+ ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+ CXXFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_cv_prog_cxx_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_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
+$as_echo "$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+ CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+ if test "$GXX" = yes; then
+ CXXFLAGS="-g -O2"
+ else
+ CXXFLAGS="-g"
+ fi
+else
+ if test "$GXX" = yes; then
+ CXXFLAGS="-O2"
+ else
+ CXXFLAGS=
+ fi
+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
+
+depcc="$CXX" 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_CXX_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_CXX_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_CXX_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CXX_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; }
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
+
+ if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+ am__fastdepCXX_TRUE=
+ am__fastdepCXX_FALSE='#'
+else
+ am__fastdepCXX_TRUE='#'
+ am__fastdepCXX_FALSE=
+fi
+
+
+ac_config_files="$ac_config_files Makefile"
+
+# Default to --enable-multilib
+# Check whether --enable-multilib was given.
+if test "${enable_multilib+set}" = set; then :
+ enableval=$enable_multilib; case "$enableval" in
+ yes) multilib=yes ;;
+ no) multilib=no ;;
+ *) as_fn_error "bad value $enableval for multilib option" "$LINENO" 5 ;;
+ esac
+else
+ multilib=yes
+fi
+
+
+# We may get other options which we leave undocumented:
+# --with-target-subdir, --with-multisrctop, --with-multisubdir
+# See config-ml.in if you want the gory details.
+
+if test "$srcdir" = "."; then
+ if test "$with_target_subdir" != "."; then
+ multi_basedir="$srcdir/$with_multisrctop../../.."
+ else
+ multi_basedir="$srcdir/$with_multisrctop../.."
+ fi
+else
+ multi_basedir="$srcdir/../.."
+fi
+
+
+# Even if the default multilib is not a cross compilation,
+# it may be that some of the other multilibs are.
+if test $cross_compiling = no && test $multilib = yes \
+ && test "x${with_multisubdir}" != x ; then
+ cross_compiling=maybe
+fi
+
+ac_config_commands="$ac_config_commands default-1"
+
+
+if test "${multilib}" = "yes"; then
+ multilib_arg="--enable-multilib"
+else
+ multilib_arg=
+fi
+
+# Make sure liboffloadmic is enabled
+case "$enable_liboffloadmic" in
+ host | target)
+ ;;
+ *)
+ as_fn_error "Liboffloadmic is disabled" "$LINENO" 5 ;;
+esac
+ if test x"$enable_liboffloadmic" = xhost; then
+ PLUGIN_HOST_TRUE=
+ PLUGIN_HOST_FALSE='#'
+else
+ PLUGIN_HOST_TRUE='#'
+ PLUGIN_HOST_FALSE=
+fi
+
+
+# Get accel target and path to build or install tree of accel compiler
+accel_search_dir=
+accel_target=
+if test x"$enable_liboffloadmic" = xhost; then
+ for accel in `echo $enable_offload_targets | sed -e 's#,# #g'`; do
+ accel_name=`echo $accel | sed 's/=.*//'`
+ accel_dir=`echo $accel | grep '=' | sed 's/.*=//'`
+ case "$accel_name" in
+ *-intelmic-* | *-intelmicemul-*)
+ accel_target=$accel_name
+ accel_search_dir=$accel_dir
+ ;;
+ esac
+ done
+ if test x"$accel_target" = x; then
+ as_fn_error "--enable-offload-targets does not contain intelmic target" "$LINENO" 5
+ fi
+fi
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --enable-version-specific-runtime-libs" >&5
+$as_echo_n "checking for --enable-version-specific-runtime-libs... " >&6; }
+# Check whether --enable-version-specific-runtime-libs was given.
+if test "${enable_version_specific_runtime_libs+set}" = set; then :
+ enableval=$enable_version_specific_runtime_libs; case "$enableval" in
+ yes) enable_version_specific_runtime_libs=yes ;;
+ no) enable_version_specific_runtime_libs=no ;;
+ *) as_fn_error "Unknown argument to enable/disable version-specific libs" "$LINENO" 5;;
+ esac
+else
+ enable_version_specific_runtime_libs=no
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_version_specific_runtime_libs" >&5
+$as_echo "$enable_version_specific_runtime_libs" >&6; }
+
+
+# Calculate toolexeclibdir.
+# Also toolexecdir, though it's only used in toolexeclibdir.
+case ${enable_version_specific_runtime_libs} in
+ yes)
+ # Need the gcc compiler version to know where to install libraries
+ # and header files if --enable-version-specific-runtime-libs option
+ # is selected.
+ toolexecdir='$(libdir)/gcc/$(target_alias)'
+ toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
+ ;;
+ no)
+ if test -n "$with_cross_host" &&
+ test x"$with_cross_host" != x"no"; then
+ # Install a library built with a cross compiler in tooldir, not libdir.
+ toolexecdir='$(exec_prefix)/$(target_alias)'
+ toolexeclibdir='$(toolexecdir)/lib'
+ else
+ toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
+ toolexeclibdir='$(libdir)'
+ fi
+ multi_os_directory=`$CC -print-multi-os-directory`
+ case $multi_os_directory in
+ .) ;; # Avoid trailing /.
+ *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
+ esac
+ ;;
+esac
+
+enable_dlopen=yes
+
+
+
+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.7a'
+macro_revision='1.3134'
+
+
+
+
+
+
+
+
+
+
+
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+# Backslashify 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'
+
+ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
+$as_echo_n "checking how to print strings... " >&6; }
+# Test print first, because it will be a builtin if present.
+if test "X`print -r -- -n 2>/dev/null`" = X-n && \
+ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='printf %s\n'
+else
+ # Use this function as a fallback that always works.
+ func_fallback_echo ()
+ {
+ eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+ }
+ ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+ $ECHO ""
+}
+
+case "$ECHO" in
+ printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
+$as_echo "printf" >&6; } ;;
+ print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
+$as_echo "print -r" >&6; } ;;
+ *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
+$as_echo "cat" >&6; } ;;
+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 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&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 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&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 "$DUMPBIN"; then :
+ # Let the user override the test.
+ else
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in dumpbin "link -dump"
+ 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 "link -dump"
+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
+
+ case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+ *COFF*)
+ DUMPBIN="$DUMPBIN -symbols"
+ ;;
+ *)
+ DUMPBIN=:
+ ;;
+ esac
+ 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:$LINENO: $ac_compile\"" >&5)
+ (eval "$ac_compile" 2>conftest.err)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:$LINENO: 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;
+ ;;
+
+ mint*)
+ # On MiNT this can take a long time and run out of memory.
+ 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"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
+ = "X$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.
+ # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+ if ( test "$lt_cv_nm_interface" = "BSD nm" && 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
+ ;;
+
+haiku*)
+ 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])(-bit)?( [LM]SB)? 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
+
+case $host_os in
+ darwin*)
+ lock_old_archive_extraction=yes ;;
+ *)
+ lock_old_archive_extraction=no ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 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 '$LINENO' "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*|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*)
+ case `/usr/bin/file conftest.o` in
+ *x86-64*)
+ LD="${LD-ld} -m elf32_x86_64"
+ ;;
+ *)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ esac
+ ;;
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ 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"
+ ;;
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ 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; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
+$as_echo_n "checking for -force_load linker flag... " >&6; }
+if test "${lt_cv_ld_force_load+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_force_load=no
+ cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
+ $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
+ echo "$AR cru libconftest.a conftest.o" >&5
+ $AR cru libconftest.a conftest.o 2>&5
+ cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
+ $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+ _lt_result=$?
+ if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then
+ lt_cv_ld_force_load=yes
+ else
+ cat conftest.err >&5
+ fi
+ rm -f conftest.err libconftest.a conftest conftest.c
+ rm -rf conftest.dSYM
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
+$as_echo "$lt_cv_ld_force_load" >&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" != ":" && test "$lt_cv_ld_force_load" = "no"; 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 <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> 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 <limits.h>
+#else
+# include <assert.h>
+#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 <ac_nonexistent.h>
+_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 <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> 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 <limits.h>
+#else
+# include <assert.h>
+#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 <ac_nonexistent.h>
+_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 <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+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 <string.h>
+
+_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 <stdlib.h>
+
+_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 <ctype.h>
+#include <stdlib.h>
+#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_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
+
+# 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 "$cc_temp" | $SED "s%.*/%%; 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
+ case $cc_basename in
+ nvcc*)
+ lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
+ *)
+ lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;;
+ esac
+
+ { $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:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+
+ 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'
+ ;;
+
+ haiku*)
+ # PIC is the default for Haiku.
+ # The "-static" flag exists, but is broken.
+ lt_prog_compiler_static=
+ ;;
+
+ 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
+
+ case $cc_basename in
+ nvcc*) # Cuda Compiler Driver 2.2
+ lt_prog_compiler_wl='-Xlinker '
+ lt_prog_compiler_pic='-Xcompiler -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* | pgfortran*)
+ # 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* | bgxl* | bgf* | mpixl*)
+ # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-qpic'
+ lt_prog_compiler_static='-qstaticlink'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ F* | *Sun*Fortran*)
+ # 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=''
+ ;;
+ *Sun\ C*)
+ # Sun C 5.9
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl='-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:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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 "$_lt_linker_boilerplate" | $SED '/^$/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:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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
+
+ # On some targets, GNU ld is compatible enough with the native linker
+ # that we're better off using the native interface for both.
+ lt_use_gnu_ld_interface=no
+ if test "$with_gnu_ld" = yes; then
+ case $host_os in
+ aix*)
+ # The AIX port of GNU ld has always aspired to compatibility
+ # with the native linker. However, as the warning in the GNU ld
+ # block says, versions before 2.19.5* couldn't really create working
+ # shared libraries, regardless of the interface used.
+ case `$LD -v 2>&1` in
+ *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+ *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;;
+ *\ \(GNU\ Binutils\)\ [3-9]*) ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ fi
+
+ if test "$lt_use_gnu_ld_interface" = 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
+ *GNU\ gold*) supports_anon_versioning=yes ;;
+ *\ [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.19, 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 install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_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 <jrb3@best.com> 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'
+ export_dynamic_flag_spec='${wl}--export-all-symbols'
+ 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
+ ;;
+
+ haiku*)
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ link_all_deplibs=yes
+ ;;
+
+ 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; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95* | pgfortran*)
+ # 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; func_echo_all \"$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]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+ tmp_sharedflag='-qmkshrobj'
+ tmp_addflag= ;;
+ nvcc*) # Cuda Compiler Driver 2.2
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ compiler_needs_object=yes
+ ;;
+ 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; func_echo_all \"$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* | bgf* | bgxlf* | mpixlf*)
+ # 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
+ # Also, AIX nm treats weak defined symbols like other global
+ # defined symbols, whereas GNU nm marks them as "W".
+ 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") || (\$ 2 == "W")) && (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 func_echo_all "${wl}${allow_undefined_flag}"; 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'
+ if test "$with_gnu_ld" = yes; then
+ # We only use this code for GNU lds that support --whole-archive.
+ whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ else
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec='$convenience'
+ fi
+ 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 `func_echo_all "$deplibs" | $SED '\''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
+ if test "$lt_cv_ld_force_load" = "yes"; then
+ whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+ else
+ whole_archive_flag_spec=''
+ fi
+ 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=func_echo_all
+ 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
+ ;;
+
+ # 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 && test "$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 && test "$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'
+ ;;
+ *)
+
+ # Older versions of the 11.00 compiler do not understand -b yet
+ # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
+$as_echo_n "checking if $CC understands -b... " >&6; }
+if test "${lt_cv_prog_compiler__b+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler__b=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -b"
+ 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 "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler__b=yes
+ fi
+ else
+ lt_cv_prog_compiler__b=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
+$as_echo "$lt_cv_prog_compiler__b" >&6; }
+
+if test x"$lt_cv_prog_compiler__b" = xyes; then
+ archive_cmds='$CC -b ${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
+
+ ;;
+ 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" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${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" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${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" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -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" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${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" && func_echo_all "-set_version $verstring"` -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" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${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" && func_echo_all "-set_version $verstring"` -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 "-set_version $verstring"` -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
+ case $host_os in
+ mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;;
+ *) lt_sed_strip_eq="s,=/,/,g" ;;
+ esac
+ lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+ case $lt_search_path_spec in
+ *\;*)
+ # 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 's/;/ /g'`
+ ;;
+ *)
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+ ;;
+ esac
+ # 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; }
+}'`
+ # AWK program above erroneously prepends '/' to C:/dos/paths
+ # for these hosts.
+ case $host_os in
+ mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+ $SED 's,/\([A-Za-z]:\),\1,g'` ;;
+ esac
+ sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+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<name>.so
+ # instead of lib<name>.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=`func_echo_all "$lib" | $SED '\''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="$sys_lib_search_path_spec /usr/lib/w32api"
+ ;;
+ mingw* | cegcc*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ 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
+ ;;
+
+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[23].*) 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
+ ;;
+
+haiku*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ dynamic_linker="$host_os runtime_loader"
+ 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=LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib'
+ 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'
+ # or fails outright, so override atomically:
+ install_override_mode=555
+ ;;
+
+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;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 10810 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#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
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+ correspondingly for the symbols needed. */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+void fnord () __attribute__((visibility("default")));
+#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;
+ else puts (dlerror ());
+ }
+ /* 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 10916 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#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
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+ correspondingly for the symbols needed. */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+void fnord () __attribute__((visibility("default")));
+#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;
+ else puts (dlerror ());
+ }
+ /* 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"
+
+ if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+ (test "X$CXX" != "Xg++"))) ; then
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_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; }
+if test -z "$CXXCPP"; then
+ if test "${ac_cv_prog_CXXCPP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ # Double quotes because CXXCPP needs to be expanded
+ for CXXCPP in "$CXX -E" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> 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 <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_cxx_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 <ac_nonexistent.h>
+_ACEOF
+if ac_fn_cxx_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_CXXCPP=$CXXCPP
+
+fi
+ CXXCPP=$ac_cv_prog_CXXCPP
+else
+ ac_cv_prog_CXXCPP=$CXXCPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5
+$as_echo "$CXXCPP" >&6; }
+ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> 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 <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_cxx_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 <ac_nonexistent.h>
+_ACEOF
+if ac_fn_cxx_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 \"$CXXCPP\" 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
+
+else
+ _lt_caught_CXX_error=yes
+fi
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+archive_cmds_need_lc_CXX=no
+allow_undefined_flag_CXX=
+always_export_symbols_CXX=no
+archive_expsym_cmds_CXX=
+compiler_needs_object_CXX=no
+export_dynamic_flag_spec_CXX=
+hardcode_direct_CXX=no
+hardcode_direct_absolute_CXX=no
+hardcode_libdir_flag_spec_CXX=
+hardcode_libdir_flag_spec_ld_CXX=
+hardcode_libdir_separator_CXX=
+hardcode_minus_L_CXX=no
+hardcode_shlibpath_var_CXX=unsupported
+hardcode_automatic_CXX=no
+inherit_rpath_CXX=no
+module_cmds_CXX=
+module_expsym_cmds_CXX=
+link_all_deplibs_CXX=unknown
+old_archive_cmds_CXX=$old_archive_cmds
+reload_flag_CXX=$reload_flag
+reload_cmds_CXX=$reload_cmds
+no_undefined_flag_CXX=
+whole_archive_flag_spec_CXX=
+enable_shared_with_static_runtimes_CXX=no
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+objext_CXX=$objext
+
+# No sense in running all these tests if we already determined that
+# the CXX compiler isn't working. Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_caught_CXX_error" != yes; then
+ # 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(int, char *[]) { return(0); }'
+
+ # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+
+
+
+
+
+# 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 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*
+
+
+ # Allow CC to be a program name with arguments.
+ lt_save_CC=$CC
+ lt_save_LD=$LD
+ lt_save_GCC=$GCC
+ GCC=$GXX
+ lt_save_with_gnu_ld=$with_gnu_ld
+ lt_save_path_LD=$lt_cv_path_LD
+ if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+ lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+ else
+ $as_unset lt_cv_prog_gnu_ld
+ fi
+ if test -n "${lt_cv_path_LDCXX+set}"; then
+ lt_cv_path_LD=$lt_cv_path_LDCXX
+ else
+ $as_unset lt_cv_path_LD
+ fi
+ test -z "${LDCXX+set}" || LD=$LDCXX
+ CC=${CXX-"c++"}
+ compiler=$CC
+ compiler_CXX=$CC
+ for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+
+
+ if test -n "$compiler"; then
+ # We don't want -fno-exception when compiling C++ code, so set the
+ # no_builtin_flag separately
+ if test "$GXX" = yes; then
+ lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin'
+ else
+ lt_prog_compiler_no_builtin_flag_CXX=
+ fi
+
+ if test "$GXX" = yes; then
+ # Set up default GNU C++ configuration
+
+
+
+# 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 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&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 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+
+
+
+
+ # Check if GNU C++ uses GNU ld as the underlying linker, since the
+ # archiving commands below assume that GNU ld is being used.
+ if test "$with_gnu_ld" = yes; then
+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+ # investigate it a little bit more. (MM)
+ wlarc='${wl}'
+
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if eval "`$CC -print-prog-name=ld` --help 2>&1" |
+ $GREP 'no-whole-archive' > /dev/null; then
+ whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec_CXX=
+ fi
+ else
+ with_gnu_ld=no
+ wlarc=
+
+ # A generic and very simple default shared library creation
+ # command for GNU C++ for the case where it uses the native
+ # linker, instead of GNU ld. If possible, this setting should
+ # overridden to take advantage of the native linker features on
+ # the platform it is being used on.
+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ fi
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+ else
+ GXX=no
+ with_gnu_ld=no
+ wlarc=
+ fi
+
+ # PORTME: fill in a description of your system's C++ link characteristics
+ { $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; }
+ ld_shlibs_CXX=yes
+ case $host_os in
+ aix3*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ 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
+ 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
+ case $ld_flag in
+ *-brtl*)
+ aix_use_runtimelinking=yes
+ break
+ ;;
+ esac
+ 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_CXX=''
+ hardcode_direct_CXX=yes
+ hardcode_direct_absolute_CXX=yes
+ hardcode_libdir_separator_CXX=':'
+ link_all_deplibs_CXX=yes
+ file_list_spec_CXX='${wl}-f,'
+
+ if test "$GXX" = 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_CXX=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_CXX=yes
+ hardcode_libdir_flag_spec_CXX='-L$libdir'
+ hardcode_libdir_separator_CXX=
+ 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_CXX='${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_CXX=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_CXX='-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_cxx_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_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+ archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag_CXX="-z nodefs"
+ archive_expsym_cmds_CXX="\$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_cxx_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_CXX='${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_CXX=' ${wl}-bernotok'
+ allow_undefined_flag_CXX=' ${wl}-berok'
+ if test "$with_gnu_ld" = yes; then
+ # We only use this code for GNU lds that support --whole-archive.
+ whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ else
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec_CXX='$convenience'
+ fi
+ archive_cmds_need_lc_CXX=yes
+ # This is similar to how AIX traditionally builds its shared
+ # libraries.
+ archive_expsym_cmds_CXX="\$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
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag_CXX=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs_CXX=no
+ fi
+ ;;
+
+ chorus*)
+ case $cc_basename in
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
+ # as there is no search path for DLLs.
+ hardcode_libdir_flag_spec_CXX='-L$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-all-symbols'
+ allow_undefined_flag_CXX=unsupported
+ always_export_symbols_CXX=no
+ enable_shared_with_static_runtimes_CXX=yes
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $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_CXX='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 -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ ld_shlibs_CXX=no
+ fi
+ ;;
+ darwin* | rhapsody*)
+
+
+ archive_cmds_need_lc_CXX=no
+ hardcode_direct_CXX=no
+ hardcode_automatic_CXX=yes
+ hardcode_shlibpath_var_CXX=unsupported
+ if test "$lt_cv_ld_force_load" = "yes"; then
+ whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+ else
+ whole_archive_flag_spec_CXX=''
+ fi
+ link_all_deplibs_CXX=yes
+ allow_undefined_flag_CXX="$_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=func_echo_all
+ archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="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_CXX="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}"
+ if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+ archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+ fi
+
+ else
+ ld_shlibs_CXX=no
+ fi
+
+ ;;
+
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ ;;
+
+ freebsd2.*)
+ # C++ shared libraries reported to be fairly broken before
+ # switch to ELF
+ ld_shlibs_CXX=no
+ ;;
+
+ freebsd-elf*)
+ archive_cmds_need_lc_CXX=no
+ ;;
+
+ freebsd* | dragonfly*)
+ # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+ # conventions
+ ld_shlibs_CXX=yes
+ ;;
+
+ gnu*)
+ ;;
+
+ haiku*)
+ archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ link_all_deplibs_CXX=yes
+ ;;
+
+ hpux9*)
+ hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator_CXX=:
+ export_dynamic_flag_spec_CXX='${wl}-E'
+ hardcode_direct_CXX=yes
+ hardcode_minus_L_CXX=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+
+ case $cc_basename in
+ CC*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ aCC*)
+ archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ fi
+ ;;
+ esac
+ ;;
+
+ hpux10*|hpux11*)
+ if test $with_gnu_ld = no; then
+ hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator_CXX=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ ;;
+ *)
+ export_dynamic_flag_spec_CXX='${wl}-E'
+ ;;
+ esac
+ fi
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_direct_CXX=no
+ hardcode_shlibpath_var_CXX=no
+ ;;
+ *)
+ hardcode_direct_CXX=yes
+ hardcode_direct_absolute_CXX=yes
+ hardcode_minus_L_CXX=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+ ;;
+ esac
+
+ case $cc_basename in
+ CC*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ aCC*)
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test $with_gnu_ld = no; then
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ fi
+ else
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ fi
+ ;;
+ esac
+ ;;
+
+ interix[3-9]*)
+ hardcode_direct_CXX=no
+ hardcode_shlibpath_var_CXX=no
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec_CXX='${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_CXX='$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_CXX='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'
+ ;;
+ irix5* | irix6*)
+ case $cc_basename in
+ CC*)
+ # SGI C++
+ archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+
+ # Archives containing C++ object files must be created using
+ # "CC -ar", where "CC" is the IRIX C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test "$with_gnu_ld" = no; then
+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
+ fi
+ fi
+ link_all_deplibs_CXX=yes
+ ;;
+ esac
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_CXX=:
+ inherit_rpath_CXX=yes
+ ;;
+
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+ archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+ # Archives containing C++ object files must be created using
+ # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+ old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+ ;;
+ icpc* | ecpc* )
+ # Intel C++
+ with_gnu_ld=yes
+ # version 8.0 and above of icpc choke on multiply defined symbols
+ # if we add $predep_objects and $postdep_objects, however 7.1 and
+ # earlier do not add the objects themselves.
+ case `$CC -V 2>&1` in
+ *"Version 7."*)
+ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ *) # Version 8.0 or newer
+ tmp_idyn=
+ case $host_cpu in
+ ia64*) tmp_idyn=' -i_dynamic';;
+ esac
+ archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ esac
+ archive_cmds_need_lc_CXX=no
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+ whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ ;;
+ pgCC* | pgcpp*)
+ # Portland Group C++ compiler
+ case `$CC -V` in
+ *pgCC\ [1-5].* | *pgcpp\ [1-5].*)
+ prelink_cmds_CXX='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+ compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
+ old_archive_cmds_CXX='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
+ $RANLIB $oldlib'
+ archive_cmds_CXX='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ archive_expsym_cmds_CXX='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ ;;
+ *) # Version 6 and above use weak symbols
+ archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ ;;
+ esac
+
+ hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+ whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ ;;
+ cxx*)
+ # Compaq C++
+ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+ hardcode_libdir_separator_CXX=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
+ ;;
+ xl* | mpixl* | bgxl*)
+ # IBM XL 8.0 on PPC, with GNU ld
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+ archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ if test "x$supports_anon_versioning" = xyes; then
+ archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+ no_undefined_flag_CXX=' -zdefs'
+ archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+ hardcode_libdir_flag_spec_CXX='-R$libdir'
+ whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ compiler_needs_object_CXX=yes
+
+ # Not sure whether something based on
+ # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+ # would be better.
+ output_verbose_link_cmd='func_echo_all'
+
+ # Archives containing C++ object files must be created using
+ # "CC -xar", where "CC" is the Sun C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ lynxos*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+
+ m88k*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+ wlarc=
+ hardcode_libdir_flag_spec_CXX='-R$libdir'
+ hardcode_direct_CXX=yes
+ hardcode_shlibpath_var_CXX=no
+ fi
+ # Workaround some broken pre-1.5 toolchains
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+ ;;
+
+ *nto* | *qnx*)
+ ld_shlibs_CXX=yes
+ ;;
+
+ openbsd2*)
+ # C++ shared libraries are fairly broken
+ ld_shlibs_CXX=no
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ hardcode_direct_CXX=yes
+ hardcode_shlibpath_var_CXX=no
+ hardcode_direct_absolute_CXX=yes
+ archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+ export_dynamic_flag_spec_CXX='${wl}-E'
+ whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ fi
+ output_verbose_link_cmd=func_echo_all
+ else
+ ld_shlibs_CXX=no
+ fi
+ ;;
+
+ osf3* | osf4* | osf5*)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ hardcode_libdir_separator_CXX=:
+
+ # Archives containing C++ object files must be created using
+ # the KAI C++ compiler.
+ case $host in
+ osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;;
+ *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;;
+ esac
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ cxx*)
+ case $host in
+ osf3*)
+ allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+ ;;
+ *)
+ allow_undefined_flag_CXX=' -expect_unresolved \*'
+ archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+ echo "-hidden">> $lib.exp~
+ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
+ $RM $lib.exp'
+ hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+ ;;
+ esac
+
+ hardcode_libdir_separator_CXX=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+ ;;
+ *)
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+ case $host in
+ osf3*)
+ archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ ;;
+ *)
+ archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ ;;
+ esac
+
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_CXX=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+ else
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ fi
+ ;;
+ esac
+ ;;
+
+ psos*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ lcc*)
+ # Lucid
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ ;;
+
+ solaris*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ archive_cmds_need_lc_CXX=yes
+ no_undefined_flag_CXX=' -zdefs'
+ archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+ hardcode_libdir_flag_spec_CXX='-R$libdir'
+ hardcode_shlibpath_var_CXX=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'.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract'
+ ;;
+ esac
+ link_all_deplibs_CXX=yes
+
+ output_verbose_link_cmd='func_echo_all'
+
+ # Archives containing C++ object files must be created using
+ # "CC -xar", where "CC" is the Sun C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+ # The C++ compiler must be used to create the archive.
+ old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+ ;;
+ *)
+ # GNU C++ compiler with Solaris linker
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ no_undefined_flag_CXX=' ${wl}-z ${wl}defs'
+ if $CC --version | $GREP -v '^2\.7' > /dev/null; then
+ archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+ else
+ # g++ 2.7 appears to require `-G' NOT `-shared' on this
+ # platform.
+ archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+ fi
+
+ hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir'
+ case $host_os in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *)
+ whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+ no_undefined_flag_CXX='${wl}-z,text'
+ archive_cmds_need_lc_CXX=no
+ hardcode_shlibpath_var_CXX=no
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+
+ 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_CXX='${wl}-z,text'
+ allow_undefined_flag_CXX='${wl}-z,nodefs'
+ archive_cmds_need_lc_CXX=no
+ hardcode_shlibpath_var_CXX=no
+ hardcode_libdir_flag_spec_CXX='${wl}-R,$libdir'
+ hardcode_libdir_separator_CXX=':'
+ link_all_deplibs_CXX=yes
+ export_dynamic_flag_spec_CXX='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~
+ '"$old_archive_cmds_CXX"
+ reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~
+ '"$reload_cmds_CXX"
+ ;;
+ *)
+ archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ ;;
+
+ vxworks*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5
+$as_echo "$ld_shlibs_CXX" >&6; }
+ test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+ GCC_CXX="$GXX"
+ LD_CXX="$LD"
+
+ ## 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...
+ # Dependencies to place before and after the object being linked:
+predep_objects_CXX=
+postdep_objects_CXX=
+predeps_CXX=
+postdeps_CXX=
+compiler_lib_search_path_CXX=
+
+cat > conftest.$ac_ext <<_LT_EOF
+class Foo
+{
+public:
+ Foo (void) { a = 0; }
+private:
+ int a;
+};
+_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
+ # Parse the compiler output and extract the necessary
+ # objects, libraries and library flags.
+
+ # Sentinel used to keep track of whether or not we are before
+ # the conftest object file.
+ pre_test_object_deps_done=no
+
+ for p in `eval "$output_verbose_link_cmd"`; do
+ case $p in
+
+ -L* | -R* | -l*)
+ # Some compilers place space between "-{L,R}" and the path.
+ # Remove the space.
+ if test $p = "-L" ||
+ test $p = "-R"; then
+ prev=$p
+ continue
+ else
+ prev=
+ fi
+
+ if test "$pre_test_object_deps_done" = no; then
+ case $p in
+ -L* | -R*)
+ # Internal compiler library paths should come after those
+ # provided the user. The postdeps already come after the
+ # user supplied libs so there is no need to process them.
+ if test -z "$compiler_lib_search_path_CXX"; then
+ compiler_lib_search_path_CXX="${prev}${p}"
+ else
+ compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}"
+ fi
+ ;;
+ # The "-l" case would never come before the object being
+ # linked, so don't bother handling this case.
+ esac
+ else
+ if test -z "$postdeps_CXX"; then
+ postdeps_CXX="${prev}${p}"
+ else
+ postdeps_CXX="${postdeps_CXX} ${prev}${p}"
+ fi
+ fi
+ ;;
+
+ *.$objext)
+ # This assumes that the test object file only shows up
+ # once in the compiler output.
+ if test "$p" = "conftest.$objext"; then
+ pre_test_object_deps_done=yes
+ continue
+ fi
+
+ if test "$pre_test_object_deps_done" = no; then
+ if test -z "$predep_objects_CXX"; then
+ predep_objects_CXX="$p"
+ else
+ predep_objects_CXX="$predep_objects_CXX $p"
+ fi
+ else
+ if test -z "$postdep_objects_CXX"; then
+ postdep_objects_CXX="$p"
+ else
+ postdep_objects_CXX="$postdep_objects_CXX $p"
+ fi
+ fi
+ ;;
+
+ *) ;; # Ignore the rest.
+
+ esac
+ done
+
+ # Clean up.
+ rm -f a.out a.exe
+else
+ echo "libtool.m4: error: problem compiling CXX test program"
+fi
+
+$RM -f confest.$objext
+
+# PORTME: override above test on systems where it is broken
+case $host_os in
+interix[3-9]*)
+ # Interix 3.5 installs completely hosed .la files for C++, so rather than
+ # hack all around it, let's just trust "g++" to DTRT.
+ predep_objects_CXX=
+ postdep_objects_CXX=
+ postdeps_CXX=
+ ;;
+
+linux*)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+
+ # The more standards-conforming stlport4 library is
+ # incompatible with the Cstd library. Avoid specifying
+ # it if it's in CXXFLAGS. Ignore libCrun as
+ # -library=stlport4 depends on it.
+ case " $CXX $CXXFLAGS " in
+ *" -library=stlport4 "*)
+ solaris_use_stlport4=yes
+ ;;
+ esac
+
+ if test "$solaris_use_stlport4" != yes; then
+ postdeps_CXX='-library=Cstd -library=Crun'
+ fi
+ ;;
+ esac
+ ;;
+
+solaris*)
+ case $cc_basename in
+ CC*)
+ # The more standards-conforming stlport4 library is
+ # incompatible with the Cstd library. Avoid specifying
+ # it if it's in CXXFLAGS. Ignore libCrun as
+ # -library=stlport4 depends on it.
+ case " $CXX $CXXFLAGS " in
+ *" -library=stlport4 "*)
+ solaris_use_stlport4=yes
+ ;;
+ esac
+
+ # Adding this requires a known-good setup of shared libraries for
+ # Sun compiler versions before 5.6, else PIC objects from an old
+ # archive will be linked into the output, leading to subtle bugs.
+ if test "$solaris_use_stlport4" != yes; then
+ postdeps_CXX='-library=Cstd -library=Crun'
+ fi
+ ;;
+ esac
+ ;;
+esac
+
+
+case " $postdeps_CXX " in
+*" -lc "*) archive_cmds_need_lc_CXX=no ;;
+esac
+ compiler_lib_search_dirs_CXX=
+if test -n "${compiler_lib_search_path_CXX}"; then
+ compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ lt_prog_compiler_wl_CXX=
+lt_prog_compiler_pic_CXX=
+lt_prog_compiler_static_CXX=
+
+{ $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; }
+
+ # C++ specific cases for pic, static, wl, etc.
+ if test "$GXX" = yes; then
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_static_CXX='-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_CXX='-Bstatic'
+ fi
+ lt_prog_compiler_pic_CXX='-fPIC'
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ lt_prog_compiler_pic_CXX='-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_CXX='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ esac
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+ mingw* | cygwin* | os2* | pw32* | 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_CXX='-DDLL_EXPORT'
+ ;;
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ lt_prog_compiler_pic_CXX='-fno-common'
+ ;;
+ *djgpp*)
+ # DJGPP does not support shared libraries at all
+ lt_prog_compiler_pic_CXX=
+ ;;
+ haiku*)
+ # PIC is the default for Haiku.
+ # The "-static" flag exists, but is broken.
+ lt_prog_compiler_static_CXX=
+ ;;
+ interix[3-9]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ lt_prog_compiler_pic_CXX=-Kconform_pic
+ fi
+ ;;
+ 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*)
+ ;;
+ *)
+ lt_prog_compiler_pic_CXX='-fPIC'
+ ;;
+ esac
+ ;;
+ *qnx* | *nto*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic_CXX='-fPIC -shared'
+ ;;
+ *)
+ lt_prog_compiler_pic_CXX='-fPIC'
+ ;;
+ esac
+ else
+ case $host_os in
+ aix[4-9]*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static_CXX='-Bstatic'
+ else
+ lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+ chorus*)
+ case $cc_basename in
+ cxch68*)
+ # Green Hills C++ Compiler
+ # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+ ;;
+ esac
+ ;;
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ lt_prog_compiler_pic_CXX='-KPIC'
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ lt_prog_compiler_pic_CXX='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ freebsd* | dragonfly*)
+ # FreeBSD uses GNU C++
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ case $cc_basename in
+ CC*)
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+ if test "$host_cpu" != ia64; then
+ lt_prog_compiler_pic_CXX='+Z'
+ fi
+ ;;
+ aCC*)
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic_CXX='+Z'
+ ;;
+ esac
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ interix*)
+ # This is c89, which is MS Visual C++ (no shared libs)
+ # Anyone wants to do a port?
+ ;;
+ irix5* | irix6* | nonstopux*)
+ case $cc_basename in
+ CC*)
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_static_CXX='-non_shared'
+ # CC pic flag -KPIC is the default.
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ case $cc_basename in
+ KCC*)
+ # KAI C++ Compiler
+ lt_prog_compiler_wl_CXX='--backend -Wl,'
+ lt_prog_compiler_pic_CXX='-fPIC'
+ ;;
+ ecpc* )
+ # old Intel C++ for x86_64 which still supported -KPIC.
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_pic_CXX='-KPIC'
+ lt_prog_compiler_static_CXX='-static'
+ ;;
+ icpc* )
+ # Intel C++, used to be incompatible with GCC.
+ # ICC 10 doesn't accept -KPIC any more.
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_pic_CXX='-fPIC'
+ lt_prog_compiler_static_CXX='-static'
+ ;;
+ pgCC* | pgcpp*)
+ # Portland Group C++ compiler
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_pic_CXX='-fpic'
+ lt_prog_compiler_static_CXX='-Bstatic'
+ ;;
+ cxx*)
+ # Compaq C++
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ lt_prog_compiler_pic_CXX=
+ lt_prog_compiler_static_CXX='-non_shared'
+ ;;
+ xlc* | xlC* | bgxl[cC]* | mpixl[cC]*)
+ # IBM XL 8.0, 9.0 on PPC and BlueGene
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_pic_CXX='-qpic'
+ lt_prog_compiler_static_CXX='-qstaticlink'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+ lt_prog_compiler_pic_CXX='-KPIC'
+ lt_prog_compiler_static_CXX='-Bstatic'
+ lt_prog_compiler_wl_CXX='-Qoption ld '
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ lynxos*)
+ ;;
+ m88k*)
+ ;;
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ lt_prog_compiler_pic_CXX='-W c,exportall'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ netbsd*)
+ ;;
+ *qnx* | *nto*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic_CXX='-fPIC -shared'
+ ;;
+ osf3* | osf4* | osf5*)
+ case $cc_basename in
+ KCC*)
+ lt_prog_compiler_wl_CXX='--backend -Wl,'
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ lt_prog_compiler_pic_CXX='-pic'
+ ;;
+ cxx*)
+ # Digital/Compaq C++
+ lt_prog_compiler_wl_CXX='-Wl,'
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ lt_prog_compiler_pic_CXX=
+ lt_prog_compiler_static_CXX='-non_shared'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ psos*)
+ ;;
+ solaris*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ lt_prog_compiler_pic_CXX='-KPIC'
+ lt_prog_compiler_static_CXX='-Bstatic'
+ lt_prog_compiler_wl_CXX='-Qoption ld '
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ lt_prog_compiler_pic_CXX='-PIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ lt_prog_compiler_pic_CXX='-pic'
+ lt_prog_compiler_static_CXX='-Bstatic'
+ ;;
+ lcc*)
+ # Lucid
+ lt_prog_compiler_pic_CXX='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ case $cc_basename in
+ CC*)
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_pic_CXX='-KPIC'
+ lt_prog_compiler_static_CXX='-Bstatic'
+ ;;
+ esac
+ ;;
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ lt_prog_compiler_pic_CXX='-KPIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ vxworks*)
+ ;;
+ *)
+ lt_prog_compiler_can_build_shared_CXX=no
+ ;;
+ esac
+ fi
+
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ lt_prog_compiler_pic_CXX=
+ ;;
+ *)
+ lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC"
+ ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic_CXX" >&5
+$as_echo "$lt_prog_compiler_pic_CXX" >&6; }
+
+
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_CXX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; }
+if test "${lt_cv_prog_compiler_pic_works_CXX+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_pic_works_CXX=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$lt_prog_compiler_pic_CXX -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:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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_CXX=yes
+ fi
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then
+ case $lt_prog_compiler_pic_CXX in
+ "" | " "*) ;;
+ *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;;
+ esac
+else
+ lt_prog_compiler_pic_CXX=
+ lt_prog_compiler_can_build_shared_CXX=no
+fi
+
+fi
+
+
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\"
+{ $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_CXX+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_static_works_CXX=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 "$_lt_linker_boilerplate" | $SED '/^$/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_CXX=yes
+ fi
+ else
+ lt_cv_prog_compiler_static_works_CXX=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then
+ :
+else
+ lt_prog_compiler_static_CXX=
+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_CXX+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_c_o_CXX=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:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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_CXX=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_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&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_CXX+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_c_o_CXX=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:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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_CXX=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_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; }
+
+
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_CXX" = 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; }
+
+ export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ case $host_os in
+ aix[4-9]*)
+ # 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
+ # Also, AIX nm treats weak defined symbols like other global defined
+ # symbols, whereas GNU nm marks them as "W".
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+ export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ else
+ export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ fi
+ ;;
+ pw32*)
+ export_symbols_cmds_CXX="$ltdll_cmds"
+ ;;
+ cygwin* | mingw* | cegcc*)
+ export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;/^.*[ ]__nm__/s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
+ ;;
+ *)
+ export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ ;;
+ esac
+ exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5
+$as_echo "$ld_shlibs_CXX" >&6; }
+test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+with_gnu_ld_CXX=$with_gnu_ld
+
+
+
+
+
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_CXX" in
+x|xyes)
+ # Assume -lc should be added
+ archive_cmds_need_lc_CXX=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $archive_cmds_CXX 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_CXX+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_CXX
+ pic_flag=$lt_prog_compiler_pic_CXX
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$allow_undefined_flag_CXX
+ allow_undefined_flag_CXX=
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+ (eval $archive_cmds_CXX 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_CXX=no
+ else
+ lt_cv_archive_cmds_need_lc_CXX=yes
+ fi
+ allow_undefined_flag_CXX=$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_CXX" >&5
+$as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; }
+ archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
+
+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<name>.so
+ # instead of lib<name>.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=`func_echo_all "$lib" | $SED '\''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}'
+
+ ;;
+ mingw* | cegcc*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ 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_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
+ ;;
+
+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[23].*) 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
+ ;;
+
+haiku*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ dynamic_linker="$host_os runtime_loader"
+ 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=LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib'
+ 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'
+ # or fails outright, so override atomically:
+ install_override_mode=555
+ ;;
+
+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_CXX\"; \
+ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_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;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_CXX=
+if test -n "$hardcode_libdir_flag_spec_CXX" ||
+ test -n "$runpath_var_CXX" ||
+ test "X$hardcode_automatic_CXX" = "Xyes" ; then
+
+ # We can hardcode non-existent directories.
+ if test "$hardcode_direct_CXX" != 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, CXX)" != no &&
+ test "$hardcode_minus_L_CXX" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action_CXX=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action_CXX=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action_CXX=unsupported
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5
+$as_echo "$hardcode_action_CXX" >&6; }
+
+if test "$hardcode_action_CXX" = relink ||
+ test "$inherit_rpath_CXX" = 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
+
+
+
+
+
+
+
+ fi # test -n "$compiler"
+
+ CC=$lt_save_CC
+ LDCXX=$LD
+ LD=$lt_save_LD
+ GCC=$lt_save_GCC
+ with_gnu_ld=$lt_save_with_gnu_ld
+ lt_cv_path_LDCXX=$lt_cv_path_LD
+ lt_cv_path_LD=$lt_save_path_LD
+ lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+ lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+fi # test "$_lt_caught_CXX_error" != yes
+
+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_config_commands="$ac_config_commands libtool"
+
+
+
+
+# Only expand once:
+
+
+# Forbid libtool to hardcode RPATH, because we want to be able to specify
+# library search directory using LD_LIBRARY_PATH
+hardcode_into_libs=no
+
+
+
+# Must be last
+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 "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
+ as_fn_error "conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+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
+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+ as_fn_error "conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${PLUGIN_HOST_TRUE}" && test -z "${PLUGIN_HOST_FALSE}"; then
+ as_fn_error "conditional \"PLUGIN_HOST\" 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 Intel MIC Offload Plugin $as_me 1.0, 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="\\
+Intel MIC Offload Plugin config.status 1.0
+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"
+
+srcdir="$srcdir"
+host="$host"
+target="$target"
+with_multisubdir="$with_multisubdir"
+with_multisrctop="$with_multisrctop"
+with_target_subdir="$with_target_subdir"
+ac_configure_args="${multilib_arg} ${ac_configure_args}"
+multi_basedir="$multi_basedir"
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+CC="$CC"
+CXX="$CXX"
+GFORTRAN="$GFORTRAN"
+GCJ="$GCJ"
+
+
+# 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 "$macro_version" | $SED "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
+enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
+enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
+SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
+ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
+host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
+host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
+host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
+build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`'
+build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`'
+build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`'
+SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`'
+Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`'
+GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`'
+EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`'
+FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`'
+LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`'
+NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`'
+LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`'
+exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
+AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
+STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`'
+lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`'
+CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`'
+compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`'
+GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
+objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
+need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
+DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
+NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
+LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
+OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`'
+OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`'
+libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
+fix_srcfile_path='`$ECHO "$fix_srcfile_path" | $SED "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
+need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`'
+version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`'
+install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`'
+striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`'
+predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`'
+postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`'
+predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`'
+postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`'
+LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`'
+reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`'
+reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`'
+GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld_CXX='`$ECHO "$hardcode_libdir_flag_spec_ld_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`'
+inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`'
+fix_srcfile_path_CXX='`$ECHO "$fix_srcfile_path_CXX" | $SED "$delay_single_quote_subst"`'
+always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`'
+include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`'
+prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`'
+predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`'
+postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`'
+predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`'
+postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`'
+
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+ eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+
+# Quote evaled strings.
+for var in SHELL \
+ECHO \
+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 \
+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 \
+install_override_mode \
+finish_eval \
+old_striplib \
+striplib \
+compiler_lib_search_dirs \
+predep_objects \
+postdep_objects \
+predeps \
+postdeps \
+compiler_lib_search_path \
+LD_CXX \
+reload_flag_CXX \
+compiler_CXX \
+lt_prog_compiler_no_builtin_flag_CXX \
+lt_prog_compiler_wl_CXX \
+lt_prog_compiler_pic_CXX \
+lt_prog_compiler_static_CXX \
+lt_cv_prog_compiler_c_o_CXX \
+export_dynamic_flag_spec_CXX \
+whole_archive_flag_spec_CXX \
+compiler_needs_object_CXX \
+with_gnu_ld_CXX \
+allow_undefined_flag_CXX \
+no_undefined_flag_CXX \
+hardcode_libdir_flag_spec_CXX \
+hardcode_libdir_flag_spec_ld_CXX \
+hardcode_libdir_separator_CXX \
+fix_srcfile_path_CXX \
+exclude_expsyms_CXX \
+include_expsyms_CXX \
+file_list_spec_CXX \
+compiler_lib_search_dirs_CXX \
+predep_objects_CXX \
+postdep_objects_CXX \
+predeps_CXX \
+postdeps_CXX \
+compiler_lib_search_path_CXX; do
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$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 \
+reload_cmds_CXX \
+old_archive_cmds_CXX \
+old_archive_from_new_cmds_CXX \
+old_archive_from_expsyms_cmds_CXX \
+archive_cmds_CXX \
+archive_expsym_cmds_CXX \
+module_cmds_CXX \
+module_expsym_cmds_CXX \
+export_symbols_cmds_CXX \
+prelink_cmds_CXX; do
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+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" ;;
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
+ "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
+
+ *) 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 2>/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
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$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
+}
+ ;;
+ "default-1":C)
+# Only add multilib support code if we just rebuilt the top-level
+# Makefile.
+case " $CONFIG_FILES " in
+ *" Makefile "*)
+ ac_file=Makefile . ${multi_basedir}/config-ml.in
+ ;;
+esac ;;
+ "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, 2009 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="CXX "
+
+# ### 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
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that protects backslashes.
+ECHO=$lt_ECHO
+
+# 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
+
+# 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
+
+# Whether to use a lock for old archive extraction.
+lock_old_archive_extraction=$lock_old_archive_extraction
+
+# 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
+
+# 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
+
+# Permission mode override for installation of shared libraries.
+install_override_mode=$lt_install_override_mode
+
+# 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
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# 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
+
+# The directories searched by this compiler when creating a shared library.
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs
+
+# Dependencies to place before and after the objects being linked to
+# create a shared library.
+predep_objects=$lt_predep_objects
+postdep_objects=$lt_postdep_objects
+predeps=$lt_predeps
+postdeps=$lt_postdeps
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path
+
+# ### 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 "${1}" | $SED "$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 "${1}" | $SED "$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 "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+ *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; 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 "${1}" | $SED "$my_sed_long_opt"`
+ func_opt_split_arg=`$ECHO "${1}" | $SED "$my_sed_long_arg"`
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+ func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+ func_xform_result=`$ECHO "${1}" | $SED '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"
+
+
+ cat <<_LT_EOF >> "$ofile"
+
+# ### BEGIN LIBTOOL TAG CONFIG: CXX
+
+# The linker used to build libraries.
+LD=$lt_LD_CXX
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag_CXX
+reload_cmds=$lt_reload_cmds_CXX
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds_CXX
+
+# A language specific compiler.
+CC=$lt_compiler_CXX
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC_CXX
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_CXX
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_CXX
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_CXX
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_CXX
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object_CXX
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds_CXX
+archive_expsym_cmds=$lt_archive_expsym_cmds_CXX
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds_CXX
+module_expsym_cmds=$lt_module_expsym_cmds_CXX
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld_CXX
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_CXX
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_CXX
+
+# 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_CXX
+
+# 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_CXX
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct_CXX
+
+# 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_CXX
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L_CXX
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX
+
+# 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_CXX
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath_CXX
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_CXX
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path_CXX
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols_CXX
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_CXX
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_CXX
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_CXX
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds_CXX
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec_CXX
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_CXX
+
+# The directories searched by this compiler when creating a shared library.
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX
+
+# Dependencies to place before and after the objects being linked to
+# create a shared library.
+predep_objects=$lt_predep_objects_CXX
+postdep_objects=$lt_postdep_objects_CXX
+predeps=$lt_predeps_CXX
+postdeps=$lt_postdeps_CXX
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
+
+# ### END LIBTOOL TAG CONFIG: CXX
+_LT_EOF
+
+ ;;
+
+ 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
+
diff --git a/liboffloadmic/plugin/configure.ac b/liboffloadmic/plugin/configure.ac
new file mode 100644
index 00000000000..283faad542c
--- /dev/null
+++ b/liboffloadmic/plugin/configure.ac
@@ -0,0 +1,135 @@
+# Plugin for offload execution on Intel MIC devices.
+#
+# Copyright (C) 2014 Free Software Foundation, Inc.
+#
+# Contributed by Andrey Turetskiy <andrey.turetskiy@intel.com>.
+#
+# This file is part of the GNU OpenMP Library (libgomp).
+#
+# Libgomp 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.
+#
+# Libgomp 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.
+#
+# Under Section 7 of GPL version 3, you are granted additional
+# permissions described in the GCC Runtime Library Exception, version
+# 3.1, as published by the Free Software Foundation.
+#
+# You should have received a copy of the GNU General Public License and
+# a copy of the GCC Runtime Library Exception along with this program;
+# see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+# <http://www.gnu.org/licenses/>.
+
+# Process this file with autoconf to produce a configure script, like so:
+# aclocal -I ../.. -I ../../config && autoconf && automake
+
+AC_PREREQ([2.64])
+AC_INIT([Intel MIC Offload Plugin], [1.0], ,[libgomp-plugin-intelmic])
+
+AC_CONFIG_AUX_DIR(../..)
+
+AC_CANONICAL_SYSTEM
+target_alias=${target_alias-$host_alias}
+AC_SUBST(target_alias)
+
+AM_INIT_AUTOMAKE([1.9.0 foreign no-dist])
+
+AM_MAINTAINER_MODE
+
+AC_PROG_CC
+AC_PROG_CXX
+AC_CONFIG_FILES([Makefile])
+AM_ENABLE_MULTILIB(, ../..)
+
+if test "${multilib}" = "yes"; then
+ multilib_arg="--enable-multilib"
+else
+ multilib_arg=
+fi
+
+# Make sure liboffloadmic is enabled
+case "$enable_liboffloadmic" in
+ host | target)
+ ;;
+ *)
+ AC_MSG_ERROR([Liboffloadmic is disabled]) ;;
+esac
+AM_CONDITIONAL(PLUGIN_HOST, [test x"$enable_liboffloadmic" = xhost])
+
+# Get accel target and path to build or install tree of accel compiler
+accel_search_dir=
+accel_target=
+if test x"$enable_liboffloadmic" = xhost; then
+ for accel in `echo $enable_offload_targets | sed -e 's#,# #g'`; do
+ accel_name=`echo $accel | sed 's/=.*//'`
+ accel_dir=`echo $accel | grep '=' | sed 's/.*=//'`
+ case "$accel_name" in
+ *-intelmic-* | *-intelmicemul-*)
+ accel_target=$accel_name
+ accel_search_dir=$accel_dir
+ ;;
+ esac
+ done
+ if test x"$accel_target" = x; then
+ AC_MSG_ERROR([--enable-offload-targets does not contain intelmic target])
+ fi
+fi
+AC_SUBST(accel_search_dir)
+AC_SUBST(accel_target)
+
+AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
+AC_ARG_ENABLE([version-specific-runtime-libs],
+ AC_HELP_STRING([--enable-version-specific-runtime-libs],
+ [Specify that runtime libraries should be installed in a compiler-specific directory]),
+ [case "$enableval" in
+ yes) enable_version_specific_runtime_libs=yes ;;
+ no) enable_version_specific_runtime_libs=no ;;
+ *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
+ esac],
+ [enable_version_specific_runtime_libs=no])
+AC_MSG_RESULT($enable_version_specific_runtime_libs)
+
+
+# Calculate toolexeclibdir.
+# Also toolexecdir, though it's only used in toolexeclibdir.
+case ${enable_version_specific_runtime_libs} in
+ yes)
+ # Need the gcc compiler version to know where to install libraries
+ # and header files if --enable-version-specific-runtime-libs option
+ # is selected.
+ toolexecdir='$(libdir)/gcc/$(target_alias)'
+ toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
+ ;;
+ no)
+ if test -n "$with_cross_host" &&
+ test x"$with_cross_host" != x"no"; then
+ # Install a library built with a cross compiler in tooldir, not libdir.
+ toolexecdir='$(exec_prefix)/$(target_alias)'
+ toolexeclibdir='$(toolexecdir)/lib'
+ else
+ toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
+ toolexeclibdir='$(libdir)'
+ fi
+ multi_os_directory=`$CC -print-multi-os-directory`
+ case $multi_os_directory in
+ .) ;; # Avoid trailing /.
+ *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
+ esac
+ ;;
+esac
+
+AC_LIBTOOL_DLOPEN
+AM_PROG_LIBTOOL
+# Forbid libtool to hardcode RPATH, because we want to be able to specify
+# library search directory using LD_LIBRARY_PATH
+hardcode_into_libs=no
+AC_SUBST(toolexecdir)
+AC_SUBST(toolexeclibdir)
+
+# Must be last
+AC_OUTPUT
diff --git a/liboffloadmic/plugin/libgomp-plugin-intelmic.cpp b/liboffloadmic/plugin/libgomp-plugin-intelmic.cpp
new file mode 100644
index 00000000000..28ddbc39db6
--- /dev/null
+++ b/liboffloadmic/plugin/libgomp-plugin-intelmic.cpp
@@ -0,0 +1,447 @@
+/* Plugin for offload execution on Intel MIC devices.
+
+ Copyright (C) 2014 Free Software Foundation, Inc.
+
+ Contributed by Ilya Verbin <ilya.verbin@intel.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp 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.
+
+ Libgomp 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.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* Host side part of a libgomp plugin. */
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <utility>
+#include <vector>
+#include <libgomp_target.h>
+#include "compiler_if_host.h"
+#include "main_target_image.h"
+
+#define LD_LIBRARY_PATH_ENV "LD_LIBRARY_PATH"
+#define MIC_LD_LIBRARY_PATH_ENV "MIC_LD_LIBRARY_PATH"
+
+#ifdef DEBUG
+#define TRACE(...) \
+{ \
+fprintf (stderr, "HOST:\t%s:%s ", __FILE__, __FUNCTION__); \
+fprintf (stderr, __VA_ARGS__); \
+fprintf (stderr, "\n"); \
+}
+#else
+#define TRACE { }
+#endif
+
+
+static VarDesc vd_host2tgt = {
+ { 1, 1 }, /* dst, src */
+ { 1, 0 }, /* in, out */
+ 1, /* alloc_if */
+ 1, /* free_if */
+ 4, /* align */
+ 0, /* mic_offset */
+ { 0, 0, 0, 0, 0, 0, 0, 0 }, /* is_static, is_static_dstn, has_length,
+ is_stack_buf, sink_addr, alloc_disp,
+ is_noncont_src, is_noncont_dst */
+ 0, /* offset */
+ 0, /* size */
+ 1, /* count */
+ 0, /* alloc */
+ 0, /* into */
+ 0 /* ptr */
+};
+
+static VarDesc vd_tgt2host = {
+ { 1, 1 }, /* dst, src */
+ { 0, 1 }, /* in, out */
+ 1, /* alloc_if */
+ 1, /* free_if */
+ 4, /* align */
+ 0, /* mic_offset */
+ { 0, 0, 0, 0, 0, 0, 0, 0 }, /* is_static, is_static_dstn, has_length,
+ is_stack_buf, sink_addr, alloc_disp,
+ is_noncont_src, is_noncont_dst */
+ 0, /* offset */
+ 0, /* size */
+ 1, /* count */
+ 0, /* alloc */
+ 0, /* into */
+ 0 /* ptr */
+};
+
+
+/* Total number of shared libraries with offloading to Intel MIC. */
+static int num_libraries;
+
+/* Pointers to the descriptors, containing pointers to host-side tables and to
+ target images. */
+static std::vector< std::pair<void *, void *> > lib_descrs;
+
+/* Thread-safe registration of the main image. */
+static pthread_once_t main_image_is_registered = PTHREAD_ONCE_INIT;
+
+
+/* Add path specified in LD_LIBRARY_PATH to MIC_LD_LIBRARY_PATH, which is
+ required by liboffloadmic. */
+__attribute__((constructor))
+static void
+set_mic_lib_path (void)
+{
+ const char *ld_lib_path = getenv (LD_LIBRARY_PATH_ENV);
+ const char *mic_lib_path = getenv (MIC_LD_LIBRARY_PATH_ENV);
+
+ if (!ld_lib_path)
+ return;
+
+ if (!mic_lib_path)
+ setenv (MIC_LD_LIBRARY_PATH_ENV, ld_lib_path, 1);
+ else
+ {
+ size_t len = strlen (mic_lib_path) + strlen (ld_lib_path) + 2;
+ bool use_alloca = len <= 2048;
+ char *mic_lib_path_new = (char *) (use_alloca ? alloca (len)
+ : malloc (len));
+ if (!mic_lib_path_new)
+ {
+ fprintf (stderr, "%s: Can't allocate memory\n", __FILE__);
+ exit (1);
+ }
+
+ sprintf (mic_lib_path_new, "%s:%s", mic_lib_path, ld_lib_path);
+ setenv (MIC_LD_LIBRARY_PATH_ENV, mic_lib_path_new, 1);
+
+ if (!use_alloca)
+ free (mic_lib_path_new);
+ }
+}
+
+extern "C" enum offload_target_type
+GOMP_OFFLOAD_get_type (void)
+{
+ enum offload_target_type res = OFFLOAD_TARGET_TYPE_INTEL_MIC;
+ TRACE ("(): return %d", res);
+ return res;
+}
+
+extern "C" int
+GOMP_OFFLOAD_get_num_devices (void)
+{
+ int res = _Offload_number_of_devices ();
+ TRACE ("(): return %d", res);
+ return res;
+}
+
+/* This should be called from every shared library with offloading. */
+extern "C" void
+GOMP_OFFLOAD_register_image (void *host_table, void *target_image)
+{
+ TRACE ("(host_table = %p, target_image = %p)", host_table, target_image);
+ lib_descrs.push_back (std::make_pair (host_table, target_image));
+ num_libraries++;
+}
+
+static void
+offload (const char *file, uint64_t line, int device, const char *name,
+ int num_vars, VarDesc *vars, VarDesc2 *vars2)
+{
+ OFFLOAD ofld = __offload_target_acquire1 (&device, file, line);
+ if (ofld)
+ __offload_offload1 (ofld, name, 0, num_vars, vars, vars2, 0, NULL, NULL);
+ else
+ {
+ fprintf (stderr, "%s:%d: Offload target acquire failed\n", file, line);
+ exit (1);
+ }
+}
+
+static void
+register_main_image ()
+{
+ __offload_register_image (&main_target_image);
+}
+
+/* Load offload_target_main on target. */
+extern "C" void
+GOMP_OFFLOAD_init_device (int device)
+{
+ TRACE ("");
+ pthread_once (&main_image_is_registered, register_main_image);
+ offload (__FILE__, __LINE__, device, "__offload_target_init_proc", 0,
+ NULL, NULL);
+}
+
+static void
+get_target_table (int device, int &num_funcs, int &num_vars, void **&table)
+{
+ VarDesc vd1[2] = { vd_tgt2host, vd_tgt2host };
+ vd1[0].ptr = &num_funcs;
+ vd1[0].size = sizeof (num_funcs);
+ vd1[1].ptr = &num_vars;
+ vd1[1].size = sizeof (num_vars);
+ VarDesc2 vd1g[2] = { { "num_funcs", 0 }, { "num_vars", 0 } };
+
+ offload (__FILE__, __LINE__, device, "__offload_target_table_p1", 2,
+ vd1, vd1g);
+
+ int table_size = num_funcs + 2 * num_vars;
+ if (table_size > 0)
+ {
+ table = new void * [table_size];
+
+ VarDesc vd2;
+ vd2 = vd_tgt2host;
+ vd2.ptr = table;
+ vd2.size = table_size * sizeof (void *);
+ VarDesc2 vd2g = { "table", 0 };
+
+ offload (__FILE__, __LINE__, device, "__offload_target_table_p2", 1,
+ &vd2, &vd2g);
+ }
+}
+
+static void
+load_lib_and_get_table (int device, int lib_num, mapping_table *&table,
+ int &table_size)
+{
+ struct TargetImage {
+ int64_t size;
+ /* 10 characters is enough for max int value. */
+ char name[sizeof ("lib0000000000.so")];
+ char data[];
+ } __attribute__ ((packed));
+
+ void ***host_table_descr = (void ***) lib_descrs[lib_num].first;
+ void **host_func_start = host_table_descr[0];
+ void **host_func_end = host_table_descr[1];
+ void **host_var_start = host_table_descr[2];
+ void **host_var_end = host_table_descr[3];
+
+ void **target_image_descr = (void **) lib_descrs[lib_num].second;
+ void *image_start = target_image_descr[0];
+ void *image_end = target_image_descr[1];
+
+ TRACE ("() host_table_descr { %p, %p, %p, %p }", host_func_start,
+ host_func_end, host_var_start, host_var_end);
+ TRACE ("() target_image_descr { %p, %p }", image_start, image_end);
+
+ int64_t image_size = (uintptr_t) image_end - (uintptr_t) image_start;
+ TargetImage *image
+ = (TargetImage *) malloc (sizeof (int64_t) + sizeof ("lib0000000000.so")
+ + image_size);
+ if (!image)
+ {
+ fprintf (stderr, "%s: Can't allocate memory\n", __FILE__);
+ exit (1);
+ }
+
+ image->size = image_size;
+ sprintf (image->name, "lib%010d.so", lib_num);
+ memcpy (image->data, image_start, image->size);
+
+ TRACE ("() __offload_register_image %s { %p, %d }",
+ image->name, image_start, image->size);
+ __offload_register_image (image);
+
+ int tgt_num_funcs = 0;
+ int tgt_num_vars = 0;
+ void **tgt_table = NULL;
+ get_target_table (device, tgt_num_funcs, tgt_num_vars, tgt_table);
+ free (image);
+
+ /* The func table contains only addresses, the var table contains addresses
+ and corresponding sizes. */
+ int host_num_funcs = host_func_end - host_func_start;
+ int host_num_vars = (host_var_end - host_var_start) / 2;
+ TRACE ("() host_num_funcs = %d, tgt_num_funcs = %d",
+ host_num_funcs, tgt_num_funcs);
+ TRACE ("() host_num_vars = %d, tgt_num_vars = %d",
+ host_num_vars, tgt_num_vars);
+ if (host_num_funcs != tgt_num_funcs)
+ {
+ fprintf (stderr, "%s: Can't map target functions\n", __FILE__);
+ exit (1);
+ }
+ if (host_num_vars != tgt_num_vars)
+ {
+ fprintf (stderr, "%s: Can't map target variables\n", __FILE__);
+ exit (1);
+ }
+
+ table = (mapping_table *) realloc (table, (table_size + host_num_funcs
+ + host_num_vars)
+ * sizeof (mapping_table));
+ if (table == NULL)
+ {
+ fprintf (stderr, "%s: Can't allocate memory\n", __FILE__);
+ exit (1);
+ }
+
+ for (int i = 0; i < host_num_funcs; i++)
+ {
+ mapping_table t;
+ t.host_start = (uintptr_t) host_func_start[i];
+ t.host_end = t.host_start + 1;
+ t.tgt_start = (uintptr_t) tgt_table[i];
+ t.tgt_end = t.tgt_start + 1;
+
+ TRACE ("() lib %d, func %d:\t0x%llx -- 0x%llx",
+ lib_num, i, t.host_start, t.tgt_start);
+
+ table[table_size++] = t;
+ }
+
+ for (int i = 0; i < host_num_vars * 2; i += 2)
+ {
+ mapping_table t;
+ t.host_start = (uintptr_t) host_var_start[i];
+ t.host_end = t.host_start + (uintptr_t) host_var_start[i+1];
+ t.tgt_start = (uintptr_t) tgt_table[tgt_num_funcs+i];
+ t.tgt_end = t.tgt_start + (uintptr_t) tgt_table[tgt_num_funcs+i+1];
+
+ TRACE ("() lib %d, var %d:\t0x%llx (%d) -- 0x%llx (%d)", lib_num, i/2,
+ t.host_start, t.host_end - t.host_start,
+ t.tgt_start, t.tgt_end - t.tgt_start);
+
+ table[table_size++] = t;
+ }
+
+ delete [] tgt_table;
+}
+
+extern "C" int
+GOMP_OFFLOAD_get_table (int device, void *result)
+{
+ TRACE ("(num_libraries = %d)", num_libraries);
+
+ mapping_table *table = NULL;
+ int table_size = 0;
+
+ for (int i = 0; i < num_libraries; i++)
+ load_lib_and_get_table (device, i, table, table_size);
+
+ *(void **) result = table;
+ return table_size;
+}
+
+extern "C" void *
+GOMP_OFFLOAD_alloc (int device, size_t size)
+{
+ TRACE ("(size = %d)", size);
+
+ void *tgt_ptr;
+ VarDesc vd1[2] = { vd_host2tgt, vd_tgt2host };
+ vd1[0].ptr = &size;
+ vd1[0].size = sizeof (size);
+ vd1[1].ptr = &tgt_ptr;
+ vd1[1].size = sizeof (void *);
+ VarDesc2 vd1g[2] = { { "size", 0 }, { "tgt_ptr", 0 } };
+
+ offload (__FILE__, __LINE__, device, "__offload_target_alloc", 2, vd1, vd1g);
+
+ return tgt_ptr;
+}
+
+extern "C" void
+GOMP_OFFLOAD_free (int device, void *tgt_ptr)
+{
+ TRACE ("(tgt_ptr = %p)", tgt_ptr);
+
+ VarDesc vd1 = vd_host2tgt;
+ vd1.ptr = &tgt_ptr;
+ vd1.size = sizeof (void *);
+ VarDesc2 vd1g = { "tgt_ptr", 0 };
+
+ offload (__FILE__, __LINE__, device, "__offload_target_free", 1, &vd1, &vd1g);
+}
+
+extern "C" void *
+GOMP_OFFLOAD_host2dev (int device, void *tgt_ptr, const void *host_ptr,
+ size_t size)
+{
+ TRACE ("(tgt_ptr = %p, host_ptr = %p, size = %d)", tgt_ptr, host_ptr, size);
+ if (!size)
+ return tgt_ptr;
+
+ VarDesc vd1[2] = { vd_host2tgt, vd_host2tgt };
+ vd1[0].ptr = &tgt_ptr;
+ vd1[0].size = sizeof (void *);
+ vd1[1].ptr = &size;
+ vd1[1].size = sizeof (size);
+ VarDesc2 vd1g[2] = { { "tgt_ptr", 0 }, { "size", 0 } };
+
+ offload (__FILE__, __LINE__, device, "__offload_target_host2tgt_p1", 2,
+ vd1, vd1g);
+
+ VarDesc vd2 = vd_host2tgt;
+ vd2.ptr = (void *) host_ptr;
+ vd2.size = size;
+ VarDesc2 vd2g = { "var", 0 };
+
+ offload (__FILE__, __LINE__, device, "__offload_target_host2tgt_p2", 1,
+ &vd2, &vd2g);
+
+ return tgt_ptr;
+}
+
+extern "C" void *
+GOMP_OFFLOAD_dev2host (int device, void *host_ptr, const void *tgt_ptr,
+ size_t size)
+{
+ TRACE ("(host_ptr = %p, tgt_ptr = %p, size = %d)", host_ptr, tgt_ptr, size);
+ if (!size)
+ return host_ptr;
+
+ VarDesc vd1[2] = { vd_host2tgt, vd_host2tgt };
+ vd1[0].ptr = &tgt_ptr;
+ vd1[0].size = sizeof (void *);
+ vd1[1].ptr = &size;
+ vd1[1].size = sizeof (size);
+ VarDesc2 vd1g[2] = { { "tgt_ptr", 0 }, { "size", 0 } };
+
+ offload (__FILE__, __LINE__, device, "__offload_target_tgt2host_p1", 2,
+ vd1, vd1g);
+
+ VarDesc vd2 = vd_tgt2host;
+ vd2.ptr = (void *) host_ptr;
+ vd2.size = size;
+ VarDesc2 vd2g = { "var", 0 };
+
+ offload (__FILE__, __LINE__, device, "__offload_target_tgt2host_p2", 1,
+ &vd2, &vd2g);
+
+ return host_ptr;
+}
+
+extern "C" void
+GOMP_OFFLOAD_run (int device, void *tgt_fn, void *tgt_vars)
+{
+ TRACE ("(tgt_fn = %p, tgt_vars = %p)", tgt_fn, tgt_vars);
+
+ VarDesc vd1[2] = { vd_host2tgt, vd_host2tgt };
+ vd1[0].ptr = &tgt_fn;
+ vd1[0].size = sizeof (void *);
+ vd1[1].ptr = &tgt_vars;
+ vd1[1].size = sizeof (void *);
+ VarDesc2 vd1g[2] = { { "tgt_fn", 0 }, { "tgt_vars", 0 } };
+
+ offload (__FILE__, __LINE__, device, "__offload_target_run", 2, vd1, vd1g);
+}
diff --git a/liboffloadmic/plugin/offload_target_main.cpp b/liboffloadmic/plugin/offload_target_main.cpp
new file mode 100644
index 00000000000..4a2778e9c57
--- /dev/null
+++ b/liboffloadmic/plugin/offload_target_main.cpp
@@ -0,0 +1,366 @@
+/* Plugin for offload execution on Intel MIC devices.
+
+ Copyright (C) 2014 Free Software Foundation, Inc.
+
+ Contributed by Ilya Verbin <ilya.verbin@intel.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp 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.
+
+ Libgomp 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.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* Target side part of a libgomp plugin. */
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "compiler_if_target.h"
+
+
+#ifdef DEBUG
+#define TRACE(...) \
+{ \
+fprintf (stderr, "TARGET:\t%s:%s ", __FILE__, __FUNCTION__); \
+fprintf (stderr, __VA_ARGS__); \
+fprintf (stderr, "\n"); \
+}
+#else
+#define TRACE { }
+#endif
+
+
+static VarDesc vd_host2tgt = {
+ { 1, 1 }, /* dst, src */
+ { 1, 0 }, /* in, out */
+ 1, /* alloc_if */
+ 1, /* free_if */
+ 4, /* align */
+ 0, /* mic_offset */
+ { 0, 0, 0, 0, 0, 0, 0, 0 }, /* is_static, is_static_dstn, has_length,
+ is_stack_buf, sink_addr, alloc_disp,
+ is_noncont_src, is_noncont_dst */
+ 0, /* offset */
+ 0, /* size */
+ 1, /* count */
+ 0, /* alloc */
+ 0, /* into */
+ 0 /* ptr */
+};
+
+static VarDesc vd_tgt2host = {
+ { 1, 1 }, /* dst, src */
+ { 0, 1 }, /* in, out */
+ 1, /* alloc_if */
+ 1, /* free_if */
+ 4, /* align */
+ 0, /* mic_offset */
+ { 0, 0, 0, 0, 0, 0, 0, 0 }, /* is_static, is_static_dstn, has_length,
+ is_stack_buf, sink_addr, alloc_disp,
+ is_noncont_src, is_noncont_dst */
+ 0, /* offset */
+ 0, /* size */
+ 1, /* count */
+ 0, /* alloc */
+ 0, /* into */
+ 0 /* ptr */
+};
+
+/* Pointer to the descriptor of the last loaded shared library. */
+static void *last_loaded_library = NULL;
+
+/* Pointer and size of the variable, used in __offload_target_host2tgt_p[12]
+ and __offload_target_tgt2host_p[12]. */
+static void *last_var_ptr = NULL;
+static int last_var_size = 0;
+
+
+/* Override the corresponding functions from libgomp. */
+extern "C" int
+omp_is_initial_device (void) __GOMP_NOTHROW
+{
+ return 0;
+}
+
+extern "C" int32_t
+omp_is_initial_device_ (void)
+{
+ return omp_is_initial_device ();
+}
+
+
+/* Dummy function needed for the initialization of target process during the
+ first call to __offload_offload1. */
+static void
+__offload_target_init_proc (OFFLOAD ofldt)
+{
+ TRACE ("");
+}
+
+/* Collect addresses of the offload functions and of the global variables from
+ the library descriptor and send them to host.
+ Part 1: Send num_funcs and num_vars to host. */
+static void
+__offload_target_table_p1 (OFFLOAD ofldt)
+{
+ void ***lib_descr = (void ***) last_loaded_library;
+
+ if (lib_descr == NULL)
+ {
+ TRACE ("");
+ fprintf (stderr, "Error! No shared libraries loaded on target.\n");
+ return;
+ }
+
+ void **func_table_begin = lib_descr[0];
+ void **func_table_end = lib_descr[1];
+ void **var_table_begin = lib_descr[2];
+ void **var_table_end = lib_descr[3];
+
+ /* The func table contains only addresses, the var table contains addresses
+ and corresponding sizes. */
+ int num_funcs = func_table_end - func_table_begin;
+ int num_vars = (var_table_end - var_table_begin) / 2;
+ TRACE ("(num_funcs = %d, num_vars = %d)", num_funcs, num_vars);
+
+ VarDesc vd1[2] = { vd_tgt2host, vd_tgt2host };
+ vd1[0].ptr = &num_funcs;
+ vd1[0].size = sizeof (num_funcs);
+ vd1[1].ptr = &num_vars;
+ vd1[1].size = sizeof (num_vars);
+ VarDesc2 vd2[2] = { { "num_funcs", 0 }, { "num_vars", 0 } };
+
+ __offload_target_enter (ofldt, 2, vd1, vd2);
+ __offload_target_leave (ofldt);
+}
+
+/* Part 2: Send the table with addresses to host. */
+static void
+__offload_target_table_p2 (OFFLOAD ofldt)
+{
+ void ***lib_descr = (void ***) last_loaded_library;
+ void **func_table_begin = lib_descr[0];
+ void **func_table_end = lib_descr[1];
+ void **var_table_begin = lib_descr[2];
+ void **var_table_end = lib_descr[3];
+
+ int num_funcs = func_table_end - func_table_begin;
+ int num_vars = (var_table_end - var_table_begin) / 2;
+ int table_size = (num_funcs + 2 * num_vars) * sizeof (void *);
+ void **table = (void **) malloc (table_size);
+ TRACE ("(table_size = %d)", table_size);
+
+ VarDesc vd1;
+ vd1 = vd_tgt2host;
+ vd1.ptr = table;
+ vd1.size = table_size;
+ VarDesc2 vd2 = { "table", 0 };
+
+ __offload_target_enter (ofldt, 1, &vd1, &vd2);
+
+ void **p;
+ int i = 0;
+ for (p = func_table_begin; p < func_table_end; p++, i++)
+ table[i] = *p;
+
+ for (p = var_table_begin; p < var_table_end; p++, i++)
+ table[i] = *p;
+
+ __offload_target_leave (ofldt);
+ free (table);
+}
+
+/* Allocate size bytes and send a pointer to the allocated memory to host. */
+static void
+__offload_target_alloc (OFFLOAD ofldt)
+{
+ size_t size = 0;
+ void *ptr = NULL;
+
+ VarDesc vd1[2] = { vd_host2tgt, vd_tgt2host };
+ vd1[0].ptr = &size;
+ vd1[0].size = sizeof (size);
+ vd1[1].ptr = &ptr;
+ vd1[1].size = sizeof (void *);
+ VarDesc2 vd2[2] = { { "size", 0 }, { "ptr", 0 } };
+
+ __offload_target_enter (ofldt, 2, vd1, vd2);
+ ptr = malloc (size);
+ TRACE ("(size = %d): ptr = %p", size, ptr);
+ __offload_target_leave (ofldt);
+}
+
+/* Free the memory space pointed to by ptr. */
+static void
+__offload_target_free (OFFLOAD ofldt)
+{
+ void *ptr = 0;
+
+ VarDesc vd1 = vd_host2tgt;
+ vd1.ptr = &ptr;
+ vd1.size = sizeof (void *);
+ VarDesc2 vd2 = { "ptr", 0 };
+
+ __offload_target_enter (ofldt, 1, &vd1, &vd2);
+ TRACE ("(ptr = %p)", ptr);
+ free (ptr);
+ __offload_target_leave (ofldt);
+}
+
+/* Receive var_size bytes from host and store to var_ptr.
+ Part 1: Receive var_ptr and var_size from host. */
+static void
+__offload_target_host2tgt_p1 (OFFLOAD ofldt)
+{
+ void *var_ptr = NULL;
+ size_t var_size = 0;
+
+ VarDesc vd1[2] = { vd_host2tgt, vd_host2tgt };
+ vd1[0].ptr = &var_ptr;
+ vd1[0].size = sizeof (void *);
+ vd1[1].ptr = &var_size;
+ vd1[1].size = sizeof (var_size);
+ VarDesc2 vd2[2] = { { "var_ptr", 0 }, { "var_size", 0 } };
+
+ __offload_target_enter (ofldt, 2, vd1, vd2);
+ TRACE ("(var_ptr = %p, var_size = %d)", var_ptr, var_size);
+ last_var_ptr = var_ptr;
+ last_var_size = var_size;
+ __offload_target_leave (ofldt);
+}
+
+/* Part 2: Receive the data from host. */
+static void
+__offload_target_host2tgt_p2 (OFFLOAD ofldt)
+{
+ TRACE ("(last_var_ptr = %p, last_var_size = %d)",
+ last_var_ptr, last_var_size);
+
+ VarDesc vd1 = vd_host2tgt;
+ vd1.ptr = last_var_ptr;
+ vd1.size = last_var_size;
+ VarDesc2 vd2 = { "var", 0 };
+
+ __offload_target_enter (ofldt, 1, &vd1, &vd2);
+ __offload_target_leave (ofldt);
+}
+
+/* Send var_size bytes from var_ptr to host.
+ Part 1: Receive var_ptr and var_size from host. */
+static void
+__offload_target_tgt2host_p1 (OFFLOAD ofldt)
+{
+ void *var_ptr = NULL;
+ size_t var_size = 0;
+
+ VarDesc vd1[2] = { vd_host2tgt, vd_host2tgt };
+ vd1[0].ptr = &var_ptr;
+ vd1[0].size = sizeof (void *);
+ vd1[1].ptr = &var_size;
+ vd1[1].size = sizeof (var_size);
+ VarDesc2 vd2[2] = { { "var_ptr", 0 }, { "var_size", 0 } };
+
+ __offload_target_enter (ofldt, 2, vd1, vd2);
+ TRACE ("(var_ptr = %p, var_size = %d)", var_ptr, var_size);
+ last_var_ptr = var_ptr;
+ last_var_size = var_size;
+ __offload_target_leave (ofldt);
+}
+
+/* Part 2: Send the data to host. */
+static void
+__offload_target_tgt2host_p2 (OFFLOAD ofldt)
+{
+ TRACE ("(last_var_ptr = %p, last_var_size = %d)",
+ last_var_ptr, last_var_size);
+
+ VarDesc vd1 = vd_tgt2host;
+ vd1.ptr = last_var_ptr;
+ vd1.size = last_var_size;
+ VarDesc2 vd2 = { "var", 0 };
+
+ __offload_target_enter (ofldt, 1, &vd1, &vd2);
+ __offload_target_leave (ofldt);
+}
+
+/* Call offload function by the address fn_ptr and pass vars_ptr to it. */
+static void
+__offload_target_run (OFFLOAD ofldt)
+{
+ void *fn_ptr;
+ void *vars_ptr;
+
+ VarDesc vd1[2] = { vd_host2tgt, vd_host2tgt };
+ vd1[0].ptr = &fn_ptr;
+ vd1[0].size = sizeof (void *);
+ vd1[1].ptr = &vars_ptr;
+ vd1[1].size = sizeof (void *);
+ VarDesc2 vd2[2] = { { "fn_ptr", 0 }, { "vars_ptr", 0 } };
+
+ __offload_target_enter (ofldt, 2, vd1, vd2);
+ TRACE ("(fn_ptr = %p, vars_ptr = %p)", fn_ptr, vars_ptr);
+ void (*fn)(void *) = (void (*)(void *)) fn_ptr;
+ fn (vars_ptr);
+ __offload_target_leave (ofldt);
+}
+
+
+/* This should be called from every library with offloading. */
+extern "C" void
+target_register_lib (const void *target_table)
+{
+ TRACE ("(target_table = %p { %p, %p, %p, %p })", target_table,
+ ((void **) target_table)[0], ((void **) target_table)[1],
+ ((void **) target_table)[2], ((void **) target_table)[3]);
+
+ last_loaded_library = (void *) target_table;
+}
+
+/* Use __offload_target_main from liboffload. */
+int
+main (int argc, char **argv)
+{
+ __offload_target_main ();
+ return 0;
+}
+
+
+/* Register offload_target_main's functions in the liboffload. */
+
+struct Entry {
+ const char *name;
+ void *func;
+};
+
+#define REGISTER(f) \
+extern "C" const Entry __offload_target_##f##_$entry \
+__attribute__ ((section(".OffloadEntryTable."))) = { \
+ "__offload_target_"#f, \
+ (void *) __offload_target_##f \
+}
+REGISTER (init_proc);
+REGISTER (table_p1);
+REGISTER (table_p2);
+REGISTER (alloc);
+REGISTER (free);
+REGISTER (host2tgt_p1);
+REGISTER (host2tgt_p2);
+REGISTER (tgt2host_p1);
+REGISTER (tgt2host_p2);
+REGISTER (run);
+#undef REGISTER
diff --git a/liboffloadmic/runtime/cean_util.cpp b/liboffloadmic/runtime/cean_util.cpp
new file mode 100644
index 00000000000..3258d7f3ade
--- /dev/null
+++ b/liboffloadmic/runtime/cean_util.cpp
@@ -0,0 +1,366 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "cean_util.h"
+#include "offload_common.h"
+
+// 1. allocate element of CeanReadRanges type
+// 2. initialized it for reading consequently contiguous ranges
+// described by "ap" argument
+CeanReadRanges * init_read_ranges_arr_desc(const arr_desc *ap)
+{
+ CeanReadRanges * res;
+
+ // find the max contiguous range
+ int64_t rank = ap->rank - 1;
+ int64_t length = ap->dim[rank].size;
+ for (; rank >= 0; rank--) {
+ if (ap->dim[rank].stride == 1) {
+ length *= (ap->dim[rank].upper - ap->dim[rank].lower + 1);
+ if (rank > 0 && length != ap->dim[rank - 1].size) {
+ break;
+ }
+ }
+ else {
+ break;
+ }
+ }
+
+ res =(CeanReadRanges *)malloc(sizeof(CeanReadRanges) +
+ (ap->rank - rank) * sizeof(CeanReadDim));
+ if (res == NULL)
+ LIBOFFLOAD_ERROR(c_malloc);
+ res->current_number = 0;
+ res->range_size = length;
+ res->last_noncont_ind = rank;
+
+ // calculate number of contiguous ranges inside noncontiguous dimensions
+ int count = 1;
+ bool prev_is_cont = true;
+ int64_t offset = 0;
+
+ for (; rank >= 0; rank--) {
+ res->Dim[rank].count = count;
+ res->Dim[rank].size = ap->dim[rank].stride * ap->dim[rank].size;
+ count *= (prev_is_cont && ap->dim[rank].stride == 1? 1 :
+ (ap->dim[rank].upper - ap->dim[rank].lower +
+ ap->dim[rank].stride) / ap->dim[rank].stride);
+ prev_is_cont = false;
+ offset +=(ap->dim[rank].lower - ap->dim[rank].lindex) *
+ ap->dim[rank].size;
+ }
+ res->range_max_number = count;
+ res -> ptr = (void*)ap->base;
+ res -> init_offset = offset;
+ return res;
+}
+
+// check if ranges described by 1 argument could be transfered into ranges
+// described by 2-nd one
+bool cean_ranges_match(
+ CeanReadRanges * read_rng1,
+ CeanReadRanges * read_rng2
+)
+{
+ return ( read_rng1 == NULL || read_rng2 == NULL ||
+ (read_rng1->range_size % read_rng2->range_size == 0 ||
+ read_rng2->range_size % read_rng1->range_size == 0));
+}
+
+// Set next offset and length and returns true for next range.
+// Returns false if the ranges are over.
+bool get_next_range(
+ CeanReadRanges * read_rng,
+ int64_t *offset
+)
+{
+ if (++read_rng->current_number > read_rng->range_max_number) {
+ read_rng->current_number = 0;
+ return false;
+ }
+ int rank = 0;
+ int num = read_rng->current_number - 1;
+ int64_t cur_offset = 0;
+ int num_loc;
+ for (; rank <= read_rng->last_noncont_ind; rank++) {
+ num_loc = num / read_rng->Dim[rank].count;
+ cur_offset += num_loc * read_rng->Dim[rank].size;
+ num = num % read_rng->Dim[rank].count;
+ }
+ *offset = cur_offset + read_rng->init_offset;
+ return true;
+}
+
+bool is_arr_desc_contiguous(const arr_desc *ap)
+{
+ int64_t rank = ap->rank - 1;
+ int64_t length = ap->dim[rank].size;
+ for (; rank >= 0; rank--) {
+ if (ap->dim[rank].stride > 1 &&
+ ap->dim[rank].upper - ap->dim[rank].lower != 0) {
+ return false;
+ }
+ else if (length != ap->dim[rank].size) {
+ for (; rank >= 0; rank--) {
+ if (ap->dim[rank].upper - ap->dim[rank].lower != 0) {
+ return false;
+ }
+ }
+ return true;
+ }
+ length *= (ap->dim[rank].upper - ap->dim[rank].lower + 1);
+ }
+ return true;
+}
+
+int64_t cean_get_transf_size(CeanReadRanges * read_rng)
+{
+ return(read_rng->range_max_number * read_rng->range_size);
+}
+
+static uint64_t last_left, last_right;
+typedef void (*fpp)(const char *spaces, uint64_t low, uint64_t high, int esize);
+
+static void generate_one_range(
+ const char *spaces,
+ uint64_t lrange,
+ uint64_t rrange,
+ fpp fp,
+ int esize
+)
+{
+ OFFLOAD_TRACE(3,
+ "%s generate_one_range(lrange=%p, rrange=%p, esize=%d)\n",
+ spaces, (void*)lrange, (void*)rrange, esize);
+ if (last_left == -1) {
+ // First range
+ last_left = lrange;
+ }
+ else {
+ if (lrange == last_right+1) {
+ // Extend previous range, don't print
+ }
+ else {
+ (*fp)(spaces, last_left, last_right, esize);
+ last_left = lrange;
+ }
+ }
+ last_right = rrange;
+}
+
+static void generate_mem_ranges_one_rank(
+ const char *spaces,
+ uint64_t base,
+ uint64_t rank,
+ const struct dim_desc *ddp,
+ fpp fp,
+ int esize
+)
+{
+ uint64_t lindex = ddp->lindex;
+ uint64_t lower = ddp->lower;
+ uint64_t upper = ddp->upper;
+ uint64_t stride = ddp->stride;
+ uint64_t size = ddp->size;
+ OFFLOAD_TRACE(3,
+ "%s "
+ "generate_mem_ranges_one_rank(base=%p, rank=%lld, lindex=%lld, "
+ "lower=%lld, upper=%lld, stride=%lld, size=%lld, esize=%d)\n",
+ spaces, (void*)base, rank, lindex, lower, upper, stride, size, esize);
+ if (rank == 1) {
+ uint64_t lrange, rrange;
+ if (stride == 1) {
+ lrange = base + (lower-lindex)*size;
+ rrange = lrange + (upper-lower+1)*size - 1;
+ generate_one_range(spaces, lrange, rrange, fp, esize);
+ }
+ else {
+ for (int i=lower-lindex; i<=upper-lindex; i+=stride) {
+ lrange = base + i*size;
+ rrange = lrange + size - 1;
+ generate_one_range(spaces, lrange, rrange, fp, esize);
+ }
+ }
+ }
+ else {
+ for (int i=lower-lindex; i<=upper-lindex; i+=stride) {
+ generate_mem_ranges_one_rank(
+ spaces, base+i*size, rank-1, ddp+1, fp, esize);
+
+ }
+ }
+}
+
+static void generate_mem_ranges(
+ const char *spaces,
+ const arr_desc *adp,
+ bool deref,
+ fpp fp
+)
+{
+ uint64_t esize;
+
+ OFFLOAD_TRACE(3,
+ "%s "
+ "generate_mem_ranges(adp=%p, deref=%d, fp)\n",
+ spaces, adp, deref);
+ last_left = -1;
+ last_right = -2;
+
+ // Element size is derived from last dimension
+ esize = adp->dim[adp->rank-1].size;
+
+ generate_mem_ranges_one_rank(
+ // For c_cean_var the base addr is the address of the data
+ // For c_cean_var_ptr the base addr is dereferenced to get to the data
+ spaces, deref ? *((uint64_t*)(adp->base)) : adp->base,
+ adp->rank, &adp->dim[0], fp, esize);
+ (*fp)(spaces, last_left, last_right, esize);
+}
+
+// returns offset and length of the data to be transferred
+void __arr_data_offset_and_length(
+ const arr_desc *adp,
+ int64_t &offset,
+ int64_t &length
+)
+{
+ int64_t rank = adp->rank - 1;
+ int64_t size = adp->dim[rank].size;
+ int64_t r_off = 0; // offset from right boundary
+
+ // find the rightmost dimension which takes just part of its
+ // range. We define it if the size of left rank is not equal
+ // the range's length between upper and lower boungaries
+ while (rank > 0) {
+ size *= (adp->dim[rank].upper - adp->dim[rank].lower + 1);
+ if (size != adp->dim[rank - 1].size) {
+ break;
+ }
+ rank--;
+ }
+
+ offset = (adp->dim[rank].lower - adp->dim[rank].lindex) *
+ adp->dim[rank].size;
+
+ // find gaps both from the left - offset and from the right - r_off
+ for (rank--; rank >= 0; rank--) {
+ offset += (adp->dim[rank].lower - adp->dim[rank].lindex) *
+ adp->dim[rank].size;
+ r_off += adp->dim[rank].size -
+ (adp->dim[rank + 1].upper - adp->dim[rank + 1].lindex + 1) *
+ adp->dim[rank + 1].size;
+ }
+ length = (adp->dim[0].upper - adp->dim[0].lindex + 1) *
+ adp->dim[0].size - offset - r_off;
+}
+
+#if OFFLOAD_DEBUG > 0
+
+void print_range(
+ const char *spaces,
+ uint64_t low,
+ uint64_t high,
+ int esize
+)
+{
+ char buffer[1024];
+ char number[32];
+
+ OFFLOAD_TRACE(3, "%s print_range(low=%p, high=%p, esize=%d)\n",
+ spaces, (void*)low, (void*)high, esize);
+
+ if (console_enabled < 4) {
+ return;
+ }
+ OFFLOAD_TRACE(4, "%s values:\n", spaces);
+ int count = 0;
+ buffer[0] = '\0';
+ while (low <= high)
+ {
+ switch (esize)
+ {
+ case 1:
+ sprintf(number, "%d ", *((char *)low));
+ low += 1;
+ break;
+ case 2:
+ sprintf(number, "%d ", *((short *)low));
+ low += 2;
+ break;
+ case 4:
+ sprintf(number, "%d ", *((int *)low));
+ low += 4;
+ break;
+ default:
+ sprintf(number, "0x%016x ", *((uint64_t *)low));
+ low += 8;
+ break;
+ }
+ strcat(buffer, number);
+ count++;
+ if (count == 10) {
+ OFFLOAD_TRACE(4, "%s %s\n", spaces, buffer);
+ count = 0;
+ buffer[0] = '\0';
+ }
+ }
+ if (count != 0) {
+ OFFLOAD_TRACE(4, "%s %s\n", spaces, buffer);
+ }
+}
+
+void __arr_desc_dump(
+ const char *spaces,
+ const char *name,
+ const arr_desc *adp,
+ bool deref
+)
+{
+ OFFLOAD_TRACE(2, "%s%s CEAN expression %p\n", spaces, name, adp);
+
+ if (adp != 0) {
+ OFFLOAD_TRACE(2, "%s base=%llx, rank=%lld\n",
+ spaces, adp->base, adp->rank);
+
+ for (int i = 0; i < adp->rank; i++) {
+ OFFLOAD_TRACE(2,
+ "%s dimension %d: size=%lld, lindex=%lld, "
+ "lower=%lld, upper=%lld, stride=%lld\n",
+ spaces, i, adp->dim[i].size, adp->dim[i].lindex,
+ adp->dim[i].lower, adp->dim[i].upper,
+ adp->dim[i].stride);
+ }
+ // For c_cean_var the base addr is the address of the data
+ // For c_cean_var_ptr the base addr is dereferenced to get to the data
+ generate_mem_ranges(spaces, adp, deref, &print_range);
+ }
+}
+#endif // OFFLOAD_DEBUG
diff --git a/liboffloadmic/runtime/cean_util.h b/liboffloadmic/runtime/cean_util.h
new file mode 100644
index 00000000000..83140479269
--- /dev/null
+++ b/liboffloadmic/runtime/cean_util.h
@@ -0,0 +1,116 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#ifndef CEAN_UTIL_H_INCLUDED
+#define CEAN_UTIL_H_INCLUDED
+
+#include <stdint.h>
+
+// CEAN expression representation
+struct dim_desc {
+ int64_t size; // Length of data type
+ int64_t lindex; // Lower index
+ int64_t lower; // Lower section bound
+ int64_t upper; // Upper section bound
+ int64_t stride; // Stride
+};
+
+struct arr_desc {
+ int64_t base; // Base address
+ int64_t rank; // Rank of array
+ dim_desc dim[1];
+};
+
+struct CeanReadDim {
+ int64_t count; // The number of elements in this dimension
+ int64_t size; // The number of bytes between successive
+ // elements in this dimension.
+};
+
+struct CeanReadRanges {
+ void * ptr;
+ int64_t current_number; // the number of ranges read
+ int64_t range_max_number; // number of contiguous ranges
+ int64_t range_size; // size of max contiguous range
+ int last_noncont_ind; // size of Dim array
+ int64_t init_offset; // offset of 1-st element from array left bound
+ CeanReadDim Dim[1];
+};
+
+// array descriptor length
+#define __arr_desc_length(rank) \
+ (sizeof(int64_t) + sizeof(dim_desc) * (rank))
+
+// returns offset and length of the data to be transferred
+void __arr_data_offset_and_length(const arr_desc *adp,
+ int64_t &offset,
+ int64_t &length);
+
+// define if data array described by argument is contiguous one
+bool is_arr_desc_contiguous(const arr_desc *ap);
+
+// allocate element of CeanReadRanges type initialized
+// to read consequently contiguous ranges described by "ap" argument
+CeanReadRanges * init_read_ranges_arr_desc(const arr_desc *ap);
+
+// check if ranges described by 1 argument could be transfered into ranges
+// described by 2-nd one
+bool cean_ranges_match(
+ CeanReadRanges * read_rng1,
+ CeanReadRanges * read_rng2
+);
+
+// first argument - returned value by call to init_read_ranges_arr_desc.
+// returns true if offset and length of next range is set successfuly.
+// returns false if the ranges is over.
+bool get_next_range(
+ CeanReadRanges * read_rng,
+ int64_t *offset
+);
+
+// returns number of transfered bytes
+int64_t cean_get_transf_size(CeanReadRanges * read_rng);
+
+#if OFFLOAD_DEBUG > 0
+// prints array descriptor contents to stderr
+void __arr_desc_dump(
+ const char *spaces,
+ const char *name,
+ const arr_desc *adp,
+ bool dereference);
+#else
+#define __arr_desc_dump(
+ spaces,
+ name,
+ adp,
+ dereference)
+#endif // OFFLOAD_DEBUG
+
+#endif // CEAN_UTIL_H_INCLUDED
diff --git a/liboffloadmic/runtime/coi/coi_client.cpp b/liboffloadmic/runtime/coi/coi_client.cpp
new file mode 100644
index 00000000000..0fb2c398855
--- /dev/null
+++ b/liboffloadmic/runtime/coi/coi_client.cpp
@@ -0,0 +1,370 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+// The COI host interface
+
+#include "coi_client.h"
+#include "../offload_common.h"
+
+namespace COI {
+
+#define COI_VERSION1 "COI_1.0"
+#define COI_VERSION2 "COI_2.0"
+
+bool is_available;
+static void* lib_handle;
+
+// pointers to functions from COI library
+COIRESULT (*EngineGetCount)(COI_ISA_TYPE, uint32_t*);
+COIRESULT (*EngineGetHandle)(COI_ISA_TYPE, uint32_t, COIENGINE*);
+
+COIRESULT (*ProcessCreateFromMemory)(COIENGINE, const char*, const void*,
+ uint64_t, int, const char**, uint8_t,
+ const char**, uint8_t, const char*,
+ uint64_t, const char*, const char*,
+ uint64_t, COIPROCESS*);
+COIRESULT (*ProcessDestroy)(COIPROCESS, int32_t, uint8_t, int8_t*, uint32_t*);
+COIRESULT (*ProcessGetFunctionHandles)(COIPROCESS, uint32_t, const char**,
+ COIFUNCTION*);
+COIRESULT (*ProcessLoadLibraryFromMemory)(COIPROCESS, const void*, uint64_t,
+ const char*, const char*,
+ const char*, uint64_t, uint32_t,
+ COILIBRARY*);
+COIRESULT (*ProcessRegisterLibraries)(uint32_t, const void**, const uint64_t*,
+ const char**, const uint64_t*);
+
+COIRESULT (*PipelineCreate)(COIPROCESS, COI_CPU_MASK, uint32_t, COIPIPELINE*);
+COIRESULT (*PipelineDestroy)(COIPIPELINE);
+COIRESULT (*PipelineRunFunction)(COIPIPELINE, COIFUNCTION, uint32_t,
+ const COIBUFFER*, const COI_ACCESS_FLAGS*,
+ uint32_t, const COIEVENT*, const void*,
+ uint16_t, void*, uint16_t, COIEVENT*);
+
+COIRESULT (*BufferCreate)(uint64_t, COI_BUFFER_TYPE, uint32_t, const void*,
+ uint32_t, const COIPROCESS*, COIBUFFER*);
+COIRESULT (*BufferCreateFromMemory)(uint64_t, COI_BUFFER_TYPE, uint32_t,
+ void*, uint32_t, const COIPROCESS*,
+ COIBUFFER*);
+COIRESULT (*BufferDestroy)(COIBUFFER);
+COIRESULT (*BufferMap)(COIBUFFER, uint64_t, uint64_t, COI_MAP_TYPE, uint32_t,
+ const COIEVENT*, COIEVENT*, COIMAPINSTANCE*, void**);
+COIRESULT (*BufferUnmap)(COIMAPINSTANCE, uint32_t, const COIEVENT*, COIEVENT*);
+COIRESULT (*BufferWrite)(COIBUFFER, uint64_t, const void*, uint64_t,
+ COI_COPY_TYPE, uint32_t, const COIEVENT*, COIEVENT*);
+COIRESULT (*BufferRead)(COIBUFFER, uint64_t, void*, uint64_t, COI_COPY_TYPE,
+ uint32_t, const COIEVENT*, COIEVENT*);
+COIRESULT (*BufferCopy)(COIBUFFER, COIBUFFER, uint64_t, uint64_t, uint64_t,
+ COI_COPY_TYPE, uint32_t, const COIEVENT*, COIEVENT*);
+COIRESULT (*BufferGetSinkAddress)(COIBUFFER, uint64_t*);
+COIRESULT (*BufferSetState)(COIBUFFER, COIPROCESS, COI_BUFFER_STATE,
+ COI_BUFFER_MOVE_FLAG, uint32_t,
+ const COIEVENT*, COIEVENT*);
+
+COIRESULT (*EventWait)(uint16_t, const COIEVENT*, int32_t, uint8_t, uint32_t*,
+ uint32_t*);
+
+uint64_t (*PerfGetCycleFrequency)(void);
+
+bool init(void)
+{
+#ifndef TARGET_WINNT
+ const char *lib_name = "libcoi_host.so.0";
+#else // TARGET_WINNT
+ const char *lib_name = "coi_host.dll";
+#endif // TARGET_WINNT
+
+ OFFLOAD_DEBUG_TRACE(2, "Loading COI library %s ...\n", lib_name);
+ lib_handle = DL_open(lib_name);
+ if (lib_handle == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to load the library\n");
+ return false;
+ }
+
+ EngineGetCount =
+ (COIRESULT (*)(COI_ISA_TYPE, uint32_t*))
+ DL_sym(lib_handle, "COIEngineGetCount", COI_VERSION1);
+ if (EngineGetCount == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in COI library\n",
+ "COIEngineGetCount");
+ fini();
+ return false;
+ }
+
+ EngineGetHandle =
+ (COIRESULT (*)(COI_ISA_TYPE, uint32_t, COIENGINE*))
+ DL_sym(lib_handle, "COIEngineGetHandle", COI_VERSION1);
+ if (EngineGetHandle == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in COI library\n",
+ "COIEngineGetHandle");
+ fini();
+ return false;
+ }
+
+ ProcessCreateFromMemory =
+ (COIRESULT (*)(COIENGINE, const char*, const void*, uint64_t, int,
+ const char**, uint8_t, const char**, uint8_t,
+ const char*, uint64_t, const char*, const char*,
+ uint64_t, COIPROCESS*))
+ DL_sym(lib_handle, "COIProcessCreateFromMemory", COI_VERSION1);
+ if (ProcessCreateFromMemory == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in COI library\n",
+ "COIProcessCreateFromMemory");
+ fini();
+ return false;
+ }
+
+ ProcessDestroy =
+ (COIRESULT (*)(COIPROCESS, int32_t, uint8_t, int8_t*,
+ uint32_t*))
+ DL_sym(lib_handle, "COIProcessDestroy", COI_VERSION1);
+ if (ProcessDestroy == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in COI library\n",
+ "COIProcessDestroy");
+ fini();
+ return false;
+ }
+
+ ProcessGetFunctionHandles =
+ (COIRESULT (*)(COIPROCESS, uint32_t, const char**, COIFUNCTION*))
+ DL_sym(lib_handle, "COIProcessGetFunctionHandles", COI_VERSION1);
+ if (ProcessGetFunctionHandles == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in COI library\n",
+ "COIProcessGetFunctionHandles");
+ fini();
+ return false;
+ }
+
+ ProcessLoadLibraryFromMemory =
+ (COIRESULT (*)(COIPROCESS, const void*, uint64_t, const char*,
+ const char*, const char*, uint64_t, uint32_t,
+ COILIBRARY*))
+ DL_sym(lib_handle, "COIProcessLoadLibraryFromMemory", COI_VERSION2);
+ if (ProcessLoadLibraryFromMemory == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in COI library\n",
+ "COIProcessLoadLibraryFromMemory");
+ fini();
+ return false;
+ }
+
+ ProcessRegisterLibraries =
+ (COIRESULT (*)(uint32_t, const void**, const uint64_t*, const char**,
+ const uint64_t*))
+ DL_sym(lib_handle, "COIProcessRegisterLibraries", COI_VERSION1);
+ if (ProcessRegisterLibraries == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in COI library\n",
+ "COIProcessRegisterLibraries");
+ fini();
+ return false;
+ }
+
+ PipelineCreate =
+ (COIRESULT (*)(COIPROCESS, COI_CPU_MASK, uint32_t, COIPIPELINE*))
+ DL_sym(lib_handle, "COIPipelineCreate", COI_VERSION1);
+ if (PipelineCreate == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in COI library\n",
+ "COIPipelineCreate");
+ fini();
+ return false;
+ }
+
+ PipelineDestroy =
+ (COIRESULT (*)(COIPIPELINE))
+ DL_sym(lib_handle, "COIPipelineDestroy", COI_VERSION1);
+ if (PipelineDestroy == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in COI library\n",
+ "COIPipelineDestroy");
+ fini();
+ return false;
+ }
+
+ PipelineRunFunction =
+ (COIRESULT (*)(COIPIPELINE, COIFUNCTION, uint32_t, const COIBUFFER*,
+ const COI_ACCESS_FLAGS*, uint32_t, const COIEVENT*,
+ const void*, uint16_t, void*, uint16_t, COIEVENT*))
+ DL_sym(lib_handle, "COIPipelineRunFunction", COI_VERSION1);
+ if (PipelineRunFunction == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in COI library\n",
+ "COIPipelineRunFunction");
+ fini();
+ return false;
+ }
+
+ BufferCreate =
+ (COIRESULT (*)(uint64_t, COI_BUFFER_TYPE, uint32_t, const void*,
+ uint32_t, const COIPROCESS*, COIBUFFER*))
+ DL_sym(lib_handle, "COIBufferCreate", COI_VERSION1);
+ if (BufferCreate == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in COI library\n",
+ "COIBufferCreate");
+ fini();
+ return false;
+ }
+
+ BufferCreateFromMemory =
+ (COIRESULT (*)(uint64_t, COI_BUFFER_TYPE, uint32_t, void*,
+ uint32_t, const COIPROCESS*, COIBUFFER*))
+ DL_sym(lib_handle, "COIBufferCreateFromMemory", COI_VERSION1);
+ if (BufferCreateFromMemory == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in COI library\n",
+ "COIBufferCreateFromMemory");
+ fini();
+ return false;
+ }
+
+ BufferDestroy =
+ (COIRESULT (*)(COIBUFFER))
+ DL_sym(lib_handle, "COIBufferDestroy", COI_VERSION1);
+ if (BufferDestroy == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in COI library\n",
+ "COIBufferDestroy");
+ fini();
+ return false;
+ }
+
+ BufferMap =
+ (COIRESULT (*)(COIBUFFER, uint64_t, uint64_t, COI_MAP_TYPE, uint32_t,
+ const COIEVENT*, COIEVENT*, COIMAPINSTANCE*,
+ void**))
+ DL_sym(lib_handle, "COIBufferMap", COI_VERSION1);
+ if (BufferMap == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in COI library\n",
+ "COIBufferMap");
+ fini();
+ return false;
+ }
+
+ BufferUnmap =
+ (COIRESULT (*)(COIMAPINSTANCE, uint32_t, const COIEVENT*,
+ COIEVENT*))
+ DL_sym(lib_handle, "COIBufferUnmap", COI_VERSION1);
+ if (BufferUnmap == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in COI library\n",
+ "COIBufferUnmap");
+ fini();
+ return false;
+ }
+
+ BufferWrite =
+ (COIRESULT (*)(COIBUFFER, uint64_t, const void*, uint64_t,
+ COI_COPY_TYPE, uint32_t, const COIEVENT*,
+ COIEVENT*))
+ DL_sym(lib_handle, "COIBufferWrite", COI_VERSION1);
+ if (BufferWrite == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in COI library\n",
+ "COIBufferWrite");
+ fini();
+ return false;
+ }
+
+ BufferRead =
+ (COIRESULT (*)(COIBUFFER, uint64_t, void*, uint64_t,
+ COI_COPY_TYPE, uint32_t,
+ const COIEVENT*, COIEVENT*))
+ DL_sym(lib_handle, "COIBufferRead", COI_VERSION1);
+ if (BufferRead == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in COI library\n",
+ "COIBufferRead");
+ fini();
+ return false;
+ }
+
+ BufferCopy =
+ (COIRESULT (*)(COIBUFFER, COIBUFFER, uint64_t, uint64_t, uint64_t,
+ COI_COPY_TYPE, uint32_t, const COIEVENT*,
+ COIEVENT*))
+ DL_sym(lib_handle, "COIBufferCopy", COI_VERSION1);
+ if (BufferCopy == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in COI library\n",
+ "COIBufferCopy");
+ fini();
+ return false;
+ }
+
+ BufferGetSinkAddress =
+ (COIRESULT (*)(COIBUFFER, uint64_t*))
+ DL_sym(lib_handle, "COIBufferGetSinkAddress", COI_VERSION1);
+ if (BufferGetSinkAddress == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in COI library\n",
+ "COIBufferGetSinkAddress");
+ fini();
+ return false;
+ }
+
+ BufferSetState =
+ (COIRESULT(*)(COIBUFFER, COIPROCESS, COI_BUFFER_STATE,
+ COI_BUFFER_MOVE_FLAG, uint32_t, const COIEVENT*,
+ COIEVENT*))
+ DL_sym(lib_handle, "COIBufferSetState", COI_VERSION1);
+ if (BufferSetState == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in COI library\n",
+ "COIBufferSetState");
+ fini();
+ return false;
+ }
+
+ EventWait =
+ (COIRESULT (*)(uint16_t, const COIEVENT*, int32_t, uint8_t,
+ uint32_t*, uint32_t*))
+ DL_sym(lib_handle, "COIEventWait", COI_VERSION1);
+ if (EventWait == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in COI library\n",
+ "COIEventWait");
+ fini();
+ return false;
+ }
+
+ PerfGetCycleFrequency =
+ (uint64_t (*)(void))
+ DL_sym(lib_handle, "COIPerfGetCycleFrequency", COI_VERSION1);
+ if (PerfGetCycleFrequency == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in COI library\n",
+ "COIPerfGetCycleFrequency");
+ fini();
+ return false;
+ }
+
+ is_available = true;
+
+ return true;
+}
+
+void fini(void)
+{
+ is_available = false;
+
+ if (lib_handle != 0) {
+#ifndef TARGET_WINNT
+ DL_close(lib_handle);
+#endif // TARGET_WINNT
+ lib_handle = 0;
+ }
+}
+
+} // namespace COI
diff --git a/liboffloadmic/runtime/coi/coi_client.h b/liboffloadmic/runtime/coi/coi_client.h
new file mode 100644
index 00000000000..54b83a9d965
--- /dev/null
+++ b/liboffloadmic/runtime/coi/coi_client.h
@@ -0,0 +1,138 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+// The interface betwen offload library and the COI API on the host
+
+#ifndef COI_CLIENT_H_INCLUDED
+#define COI_CLIENT_H_INCLUDED
+
+#include <common/COIPerf_common.h>
+#include <source/COIEngine_source.h>
+#include <source/COIProcess_source.h>
+#include <source/COIPipeline_source.h>
+#include <source/COIBuffer_source.h>
+#include <source/COIEvent_source.h>
+
+#include <string.h>
+
+#include "../liboffload_error_codes.h"
+#include "../offload_util.h"
+
+#define MIC_ENGINES_MAX 128
+
+#if MIC_ENGINES_MAX < COI_MAX_ISA_MIC_DEVICES
+#error MIC_ENGINES_MAX need to be increased
+#endif
+
+// COI library interface
+namespace COI {
+
+extern bool init(void);
+extern void fini(void);
+
+extern bool is_available;
+
+// pointers to functions from COI library
+extern COIRESULT (*EngineGetCount)(COI_ISA_TYPE, uint32_t*);
+extern COIRESULT (*EngineGetHandle)(COI_ISA_TYPE, uint32_t, COIENGINE*);
+
+extern COIRESULT (*ProcessCreateFromMemory)(COIENGINE, const char*,
+ const void*, uint64_t, int,
+ const char**, uint8_t,
+ const char**, uint8_t,
+ const char*, uint64_t,
+ const char*,
+ const char*, uint64_t,
+ COIPROCESS*);
+extern COIRESULT (*ProcessDestroy)(COIPROCESS, int32_t, uint8_t,
+ int8_t*, uint32_t*);
+extern COIRESULT (*ProcessGetFunctionHandles)(COIPROCESS, uint32_t,
+ const char**,
+ COIFUNCTION*);
+extern COIRESULT (*ProcessLoadLibraryFromMemory)(COIPROCESS,
+ const void*,
+ uint64_t,
+ const char*,
+ const char*,
+ const char*,
+ uint64_t,
+ uint32_t,
+ COILIBRARY*);
+extern COIRESULT (*ProcessRegisterLibraries)(uint32_t,
+ const void**,
+ const uint64_t*,
+ const char**,
+ const uint64_t*);
+
+extern COIRESULT (*PipelineCreate)(COIPROCESS, COI_CPU_MASK, uint32_t,
+ COIPIPELINE*);
+extern COIRESULT (*PipelineDestroy)(COIPIPELINE);
+extern COIRESULT (*PipelineRunFunction)(COIPIPELINE, COIFUNCTION,
+ uint32_t, const COIBUFFER*,
+ const COI_ACCESS_FLAGS*,
+ uint32_t, const COIEVENT*,
+ const void*, uint16_t, void*,
+ uint16_t, COIEVENT*);
+
+extern COIRESULT (*BufferCreate)(uint64_t, COI_BUFFER_TYPE, uint32_t,
+ const void*, uint32_t,
+ const COIPROCESS*, COIBUFFER*);
+extern COIRESULT (*BufferCreateFromMemory)(uint64_t, COI_BUFFER_TYPE,
+ uint32_t, void*,
+ uint32_t, const COIPROCESS*,
+ COIBUFFER*);
+extern COIRESULT (*BufferDestroy)(COIBUFFER);
+extern COIRESULT (*BufferMap)(COIBUFFER, uint64_t, uint64_t,
+ COI_MAP_TYPE, uint32_t, const COIEVENT*,
+ COIEVENT*, COIMAPINSTANCE*, void**);
+extern COIRESULT (*BufferUnmap)(COIMAPINSTANCE, uint32_t,
+ const COIEVENT*, COIEVENT*);
+extern COIRESULT (*BufferWrite)(COIBUFFER, uint64_t, const void*,
+ uint64_t, COI_COPY_TYPE, uint32_t,
+ const COIEVENT*, COIEVENT*);
+extern COIRESULT (*BufferRead)(COIBUFFER, uint64_t, void*, uint64_t,
+ COI_COPY_TYPE, uint32_t,
+ const COIEVENT*, COIEVENT*);
+extern COIRESULT (*BufferCopy)(COIBUFFER, COIBUFFER, uint64_t, uint64_t,
+ uint64_t, COI_COPY_TYPE, uint32_t,
+ const COIEVENT*, COIEVENT*);
+extern COIRESULT (*BufferGetSinkAddress)(COIBUFFER, uint64_t*);
+extern COIRESULT (*BufferSetState)(COIBUFFER, COIPROCESS, COI_BUFFER_STATE,
+ COI_BUFFER_MOVE_FLAG, uint32_t,
+ const COIEVENT*, COIEVENT*);
+
+extern COIRESULT (*EventWait)(uint16_t, const COIEVENT*, int32_t,
+ uint8_t, uint32_t*, uint32_t*);
+
+extern uint64_t (*PerfGetCycleFrequency)(void);
+
+} // namespace COI
+
+#endif // COI_CLIENT_H_INCLUDED
diff --git a/liboffloadmic/runtime/coi/coi_server.cpp b/liboffloadmic/runtime/coi/coi_server.cpp
new file mode 100644
index 00000000000..7eebf5a306e
--- /dev/null
+++ b/liboffloadmic/runtime/coi/coi_server.cpp
@@ -0,0 +1,150 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+// The COI interface on the target
+
+#include "coi_server.h"
+
+#include "../offload_target.h"
+#include "../offload_timer.h"
+#ifdef MYO_SUPPORT
+#include "../offload_myo_target.h" // for __offload_myoLibInit/Fini
+#endif // MYO_SUPPORT
+
+COINATIVELIBEXPORT
+void server_compute(
+ uint32_t buffer_count,
+ void** buffers,
+ uint64_t* buffers_len,
+ void* misc_data,
+ uint16_t misc_data_len,
+ void* return_data,
+ uint16_t return_data_len
+)
+{
+ OffloadDescriptor::offload(buffer_count, buffers,
+ misc_data, misc_data_len,
+ return_data, return_data_len);
+}
+
+COINATIVELIBEXPORT
+void server_init(
+ uint32_t buffer_count,
+ void** buffers,
+ uint64_t* buffers_len,
+ void* misc_data,
+ uint16_t misc_data_len,
+ void* return_data,
+ uint16_t return_data_len
+)
+{
+ struct init_data {
+ int device_index;
+ int devices_total;
+ int console_level;
+ int offload_report_level;
+ } *data = (struct init_data*) misc_data;
+
+ // set device index and number of total devices
+ mic_index = data->device_index;
+ mic_engines_total = data->devices_total;
+
+ // initialize trace level
+ console_enabled = data->console_level;
+ offload_report_level = data->offload_report_level;
+
+ // return back the process id
+ *((pid_t*) return_data) = getpid();
+}
+
+COINATIVELIBEXPORT
+void server_var_table_size(
+ uint32_t buffer_count,
+ void** buffers,
+ uint64_t* buffers_len,
+ void* misc_data,
+ uint16_t misc_data_len,
+ void* return_data,
+ uint16_t return_data_len
+)
+{
+ struct Params {
+ int64_t nelems;
+ int64_t length;
+ } *params;
+
+ params = static_cast<Params*>(return_data);
+ params->length = __offload_vars.table_size(params->nelems);
+}
+
+COINATIVELIBEXPORT
+void server_var_table_copy(
+ uint32_t buffer_count,
+ void** buffers,
+ uint64_t* buffers_len,
+ void* misc_data,
+ uint16_t misc_data_len,
+ void* return_data,
+ uint16_t return_data_len
+)
+{
+ __offload_vars.table_copy(buffers[0], *static_cast<int64_t*>(misc_data));
+}
+
+#ifdef MYO_SUPPORT
+// temporary workaround for blocking behavior of myoiLibInit/Fini calls
+COINATIVELIBEXPORT
+void server_myoinit(
+ uint32_t buffer_count,
+ void** buffers,
+ uint64_t* buffers_len,
+ void* misc_data,
+ uint16_t misc_data_len,
+ void* return_data,
+ uint16_t return_data_len
+)
+{
+ __offload_myoLibInit();
+}
+
+COINATIVELIBEXPORT
+void server_myofini(
+ uint32_t buffer_count,
+ void** buffers,
+ uint64_t* buffers_len,
+ void* misc_data,
+ uint16_t misc_data_len,
+ void* return_data,
+ uint16_t return_data_len
+)
+{
+ __offload_myoLibFini();
+}
+#endif // MYO_SUPPORT
diff --git a/liboffloadmic/runtime/coi/coi_server.h b/liboffloadmic/runtime/coi/coi_server.h
new file mode 100644
index 00000000000..14376108e9d
--- /dev/null
+++ b/liboffloadmic/runtime/coi/coi_server.h
@@ -0,0 +1,94 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+//The interface betwen offload library and the COI API on the target.
+
+#ifndef COI_SERVER_H_INCLUDED
+#define COI_SERVER_H_INCLUDED
+
+#include <common/COIEngine_common.h>
+#include <common/COIPerf_common.h>
+#include <sink/COIProcess_sink.h>
+#include <sink/COIPipeline_sink.h>
+#include <sink/COIBuffer_sink.h>
+#include <list>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include "../liboffload_error_codes.h"
+
+// wrappers for COI API
+#define PipelineStartExecutingRunFunctions() \
+ { \
+ COIRESULT res = COIPipelineStartExecutingRunFunctions(); \
+ if (res != COI_SUCCESS) { \
+ LIBOFFLOAD_ERROR(c_pipeline_start_run_funcs, mic_index, res); \
+ exit(1); \
+ } \
+ }
+
+#define ProcessWaitForShutdown() \
+ { \
+ COIRESULT res = COIProcessWaitForShutdown(); \
+ if (res != COI_SUCCESS) { \
+ LIBOFFLOAD_ERROR(c_process_wait_shutdown, mic_index, res); \
+ exit(1); \
+ } \
+ }
+
+#define BufferAddRef(buf) \
+ { \
+ COIRESULT res = COIBufferAddRef(buf); \
+ if (res != COI_SUCCESS) { \
+ LIBOFFLOAD_ERROR(c_buf_add_ref, mic_index, res); \
+ exit(1); \
+ } \
+ }
+
+#define BufferReleaseRef(buf) \
+ { \
+ COIRESULT res = COIBufferReleaseRef(buf); \
+ if (res != COI_SUCCESS) { \
+ LIBOFFLOAD_ERROR(c_buf_release_ref, mic_index, res); \
+ exit(1); \
+ } \
+ }
+
+#define EngineGetIndex(index) \
+ { \
+ COI_ISA_TYPE isa_type; \
+ COIRESULT res = COIEngineGetIndex(&isa_type, index); \
+ if (res != COI_SUCCESS) { \
+ LIBOFFLOAD_ERROR(c_get_engine_index, mic_index, res); \
+ exit(1); \
+ } \
+ }
+
+#endif // COI_SERVER_H_INCLUDED
diff --git a/liboffloadmic/runtime/compiler_if_host.cpp b/liboffloadmic/runtime/compiler_if_host.cpp
new file mode 100644
index 00000000000..c4e2a15633f
--- /dev/null
+++ b/liboffloadmic/runtime/compiler_if_host.cpp
@@ -0,0 +1,343 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "compiler_if_host.h"
+
+#include <malloc.h>
+#ifndef TARGET_WINNT
+#include <alloca.h>
+#endif // TARGET_WINNT
+
+// Global counter on host.
+// This variable is used if P2OPT_offload_do_data_persistence == 2.
+// The variable used to identify offload constructs contained in one procedure.
+// Increment of OFFLOAD_CALL_COUNT is inserted at entries of HOST routines with
+// offload constructs.
+static int offload_call_count = 0;
+
+extern "C" OFFLOAD OFFLOAD_TARGET_ACQUIRE(
+ TARGET_TYPE target_type,
+ int target_number,
+ int is_optional,
+ _Offload_status* status,
+ const char* file,
+ uint64_t line
+)
+{
+ bool retval;
+ OFFLOAD ofld;
+
+ // initialize status
+ if (status != 0) {
+ status->result = OFFLOAD_UNAVAILABLE;
+ status->device_number = -1;
+ status->data_sent = 0;
+ status->data_received = 0;
+ }
+
+ // make sure libray is initialized
+ retval = __offload_init_library();
+
+ // OFFLOAD_TIMER_INIT must follow call to __offload_init_library
+ OffloadHostTimerData * timer_data = OFFLOAD_TIMER_INIT(file, line);
+
+ OFFLOAD_TIMER_START(timer_data, c_offload_host_total_offload);
+
+ OFFLOAD_TIMER_START(timer_data, c_offload_host_initialize);
+
+ // initalize all devices is init_type is on_offload_all
+ if (retval && __offload_init_type == c_init_on_offload_all) {
+ for (int i = 0; i < mic_engines_total; i++) {
+ mic_engines[i].init();
+ }
+ }
+ OFFLOAD_TIMER_STOP(timer_data, c_offload_host_initialize);
+
+ OFFLOAD_TIMER_START(timer_data, c_offload_host_target_acquire);
+
+ if (target_type == TARGET_HOST) {
+ // Host always available
+ retval = true;
+ }
+ else if (target_type == TARGET_MIC) {
+ if (target_number >= -1) {
+ if (retval) {
+ if (target_number >= 0) {
+ // User provided the device number
+ target_number = target_number % mic_engines_total;
+ }
+ else {
+ // use device 0
+ target_number = 0;
+ }
+
+ // reserve device in ORSL
+ if (is_optional) {
+ if (!ORSL::try_reserve(target_number)) {
+ target_number = -1;
+ }
+ }
+ else {
+ if (!ORSL::reserve(target_number)) {
+ target_number = -1;
+ }
+ }
+
+ // initialize device
+ if (target_number >= 0 &&
+ __offload_init_type == c_init_on_offload) {
+ OFFLOAD_TIMER_START(timer_data, c_offload_host_initialize);
+ mic_engines[target_number].init();
+ OFFLOAD_TIMER_STOP(timer_data, c_offload_host_initialize);
+ }
+ }
+ else {
+ // fallback to CPU
+ target_number = -1;
+ }
+
+ if (target_number < 0 || !retval) {
+ if (!is_optional && status == 0) {
+ LIBOFFLOAD_ERROR(c_device_is_not_available);
+ exit(1);
+ }
+
+ retval = false;
+ }
+ }
+ else {
+ LIBOFFLOAD_ERROR(c_invalid_device_number);
+ exit(1);
+ }
+ }
+
+ if (retval) {
+ ofld = new OffloadDescriptor(target_number, status,
+ !is_optional, false, timer_data);
+ OFFLOAD_TIMER_HOST_MIC_NUM(timer_data, target_number);
+ Offload_Report_Prolog(timer_data);
+ OFFLOAD_DEBUG_TRACE_1(2, timer_data->offload_number, c_offload_start,
+ "Starting offload: target_type = %d, "
+ "number = %d, is_optional = %d\n",
+ target_type, target_number, is_optional);
+
+ OFFLOAD_TIMER_STOP(timer_data, c_offload_host_target_acquire);
+ }
+ else {
+ ofld = NULL;
+
+ OFFLOAD_TIMER_STOP(timer_data, c_offload_host_target_acquire);
+ OFFLOAD_TIMER_STOP(timer_data, c_offload_host_total_offload);
+ offload_report_free_data(timer_data);
+ }
+
+ return ofld;
+}
+
+extern "C" OFFLOAD OFFLOAD_TARGET_ACQUIRE1(
+ const int* device_num,
+ const char* file,
+ uint64_t line
+)
+{
+ int target_number;
+
+ // make sure libray is initialized and at least one device is available
+ if (!__offload_init_library()) {
+ LIBOFFLOAD_ERROR(c_device_is_not_available);
+ exit(1);
+ }
+
+ // OFFLOAD_TIMER_INIT must follow call to __offload_init_library
+
+ OffloadHostTimerData * timer_data = OFFLOAD_TIMER_INIT(file, line);
+
+ OFFLOAD_TIMER_START(timer_data, c_offload_host_total_offload);
+
+ OFFLOAD_TIMER_START(timer_data, c_offload_host_initialize);
+
+ if (__offload_init_type == c_init_on_offload_all) {
+ for (int i = 0; i < mic_engines_total; i++) {
+ mic_engines[i].init();
+ }
+ }
+
+ OFFLOAD_TIMER_STOP(timer_data, c_offload_host_initialize);
+
+ OFFLOAD_TIMER_START(timer_data, c_offload_host_target_acquire);
+
+ // use default device number if it is not provided
+ if (device_num != 0) {
+ target_number = *device_num;
+ }
+ else {
+ target_number = __omp_device_num;
+ }
+
+ // device number should be a non-negative integer value
+ if (target_number < 0) {
+ LIBOFFLOAD_ERROR(c_omp_invalid_device_num);
+ exit(1);
+ }
+
+ // should we do this for OpenMP?
+ target_number %= mic_engines_total;
+
+ // reserve device in ORSL
+ if (!ORSL::reserve(target_number)) {
+ LIBOFFLOAD_ERROR(c_device_is_not_available);
+ exit(1);
+ }
+
+ // initialize device(s)
+ OFFLOAD_TIMER_START(timer_data, c_offload_host_initialize);
+
+ if (__offload_init_type == c_init_on_offload) {
+ mic_engines[target_number].init();
+ }
+
+ OFFLOAD_TIMER_STOP(timer_data, c_offload_host_initialize);
+
+ OFFLOAD ofld =
+ new OffloadDescriptor(target_number, 0, true, true, timer_data);
+
+ OFFLOAD_TIMER_HOST_MIC_NUM(timer_data, target_number);
+
+ Offload_Report_Prolog(timer_data);
+
+ OFFLOAD_DEBUG_TRACE_1(2, timer_data->offload_number, c_offload_start,
+ "Starting OpenMP offload, device = %d\n",
+ target_number);
+
+ OFFLOAD_TIMER_STOP(timer_data, c_offload_host_target_acquire);
+
+ return ofld;
+}
+
+int offload_offload_wrap(
+ OFFLOAD ofld,
+ const char *name,
+ int is_empty,
+ int num_vars,
+ VarDesc *vars,
+ VarDesc2 *vars2,
+ int num_waits,
+ const void **waits,
+ const void **signal,
+ int entry_id,
+ const void *stack_addr
+)
+{
+ bool ret = ofld->offload(name, is_empty, vars, vars2, num_vars,
+ waits, num_waits, signal, entry_id, stack_addr);
+ if (!ret || signal == 0) {
+ delete ofld;
+ }
+ return ret;
+}
+
+extern "C" int OFFLOAD_OFFLOAD1(
+ OFFLOAD ofld,
+ const char *name,
+ int is_empty,
+ int num_vars,
+ VarDesc *vars,
+ VarDesc2 *vars2,
+ int num_waits,
+ const void **waits,
+ const void **signal
+)
+{
+ return offload_offload_wrap(ofld, name, is_empty,
+ num_vars, vars, vars2,
+ num_waits, waits,
+ signal, NULL, NULL);
+}
+
+extern "C" int OFFLOAD_OFFLOAD2(
+ OFFLOAD ofld,
+ const char *name,
+ int is_empty,
+ int num_vars,
+ VarDesc *vars,
+ VarDesc2 *vars2,
+ int num_waits,
+ const void** waits,
+ const void** signal,
+ int entry_id,
+ const void *stack_addr
+)
+{
+ return offload_offload_wrap(ofld, name, is_empty,
+ num_vars, vars, vars2,
+ num_waits, waits,
+ signal, entry_id, stack_addr);
+}
+
+extern "C" int OFFLOAD_OFFLOAD(
+ OFFLOAD ofld,
+ const char *name,
+ int is_empty,
+ int num_vars,
+ VarDesc *vars,
+ VarDesc2 *vars2,
+ int num_waits,
+ const void **waits,
+ const void *signal,
+ int entry_id,
+ const void *stack_addr
+)
+{
+ // signal is passed by reference now
+ const void **signal_new = (signal != 0) ? &signal : 0;
+ const void **waits_new = 0;
+ int num_waits_new = 0;
+
+ // remove NULL values from the list of signals to wait for
+ if (num_waits > 0) {
+ waits_new = (const void**) alloca(sizeof(void*) * num_waits);
+ for (int i = 0; i < num_waits; i++) {
+ if (waits[i] != 0) {
+ waits_new[num_waits_new++] = waits[i];
+ }
+ }
+ }
+
+ return OFFLOAD_OFFLOAD1(ofld, name, is_empty,
+ num_vars, vars, vars2,
+ num_waits_new, waits_new,
+ signal_new);
+}
+
+extern "C" int OFFLOAD_CALL_COUNT()
+{
+ offload_call_count++;
+ return offload_call_count;
+}
diff --git a/liboffloadmic/runtime/compiler_if_host.h b/liboffloadmic/runtime/compiler_if_host.h
new file mode 100644
index 00000000000..1a7135088f6
--- /dev/null
+++ b/liboffloadmic/runtime/compiler_if_host.h
@@ -0,0 +1,153 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+/*! \file
+ \brief The interface between compiler-generated host code and runtime library
+*/
+
+#ifndef COMPILER_IF_HOST_H_INCLUDED
+#define COMPILER_IF_HOST_H_INCLUDED
+
+#include "offload_host.h"
+
+#define OFFLOAD_TARGET_ACQUIRE OFFLOAD_PREFIX(target_acquire)
+#define OFFLOAD_TARGET_ACQUIRE1 OFFLOAD_PREFIX(target_acquire1)
+#define OFFLOAD_OFFLOAD OFFLOAD_PREFIX(offload)
+#define OFFLOAD_OFFLOAD1 OFFLOAD_PREFIX(offload1)
+#define OFFLOAD_OFFLOAD2 OFFLOAD_PREFIX(offload2)
+#define OFFLOAD_CALL_COUNT OFFLOAD_PREFIX(offload_call_count)
+
+
+/*! \fn OFFLOAD_TARGET_ACQUIRE
+ \brief Attempt to acquire the target.
+ \param target_type The type of target.
+ \param target_number The device number.
+ \param is_optional Whether CPU fall-back is allowed.
+ \param status Address of variable to hold offload status.
+ \param file Filename in which this offload occurred.
+ \param line Line number in the file where this offload occurred.
+*/
+extern "C" OFFLOAD OFFLOAD_TARGET_ACQUIRE(
+ TARGET_TYPE target_type,
+ int target_number,
+ int is_optional,
+ _Offload_status* status,
+ const char* file,
+ uint64_t line
+);
+
+/*! \fn OFFLOAD_TARGET_ACQUIRE1
+ \brief Acquire the target for offload (OpenMP).
+ \param device_number Device number or null if not specified.
+ \param file Filename in which this offload occurred
+ \param line Line number in the file where this offload occurred.
+*/
+extern "C" OFFLOAD OFFLOAD_TARGET_ACQUIRE1(
+ const int* device_number,
+ const char* file,
+ uint64_t line
+);
+
+/*! \fn OFFLOAD_OFFLOAD1
+ \brief Run function on target using interface for old data persistence.
+ \param o Offload descriptor created by OFFLOAD_TARGET_ACQUIRE.
+ \param name Name of offload entry point.
+ \param is_empty If no code to execute (e.g. offload_transfer)
+ \param num_vars Number of variable descriptors.
+ \param vars Pointer to VarDesc array.
+ \param vars2 Pointer to VarDesc2 array.
+ \param num_waits Number of "wait" values.
+ \param waits Pointer to array of wait values.
+ \param signal Pointer to signal value or NULL.
+*/
+extern "C" int OFFLOAD_OFFLOAD1(
+ OFFLOAD o,
+ const char *name,
+ int is_empty,
+ int num_vars,
+ VarDesc *vars,
+ VarDesc2 *vars2,
+ int num_waits,
+ const void** waits,
+ const void** signal
+);
+
+/*! \fn OFFLOAD_OFFLOAD2
+ \brief Run function on target using interface for new data persistence.
+ \param o Offload descriptor created by OFFLOAD_TARGET_ACQUIRE.
+ \param name Name of offload entry point.
+ \param is_empty If no code to execute (e.g. offload_transfer)
+ \param num_vars Number of variable descriptors.
+ \param vars Pointer to VarDesc array.
+ \param vars2 Pointer to VarDesc2 array.
+ \param num_waits Number of "wait" values.
+ \param waits Pointer to array of wait values.
+ \param signal Pointer to signal value or NULL.
+ \param entry_id A signature for the function doing the offload.
+ \param stack_addr The stack frame address of the function doing offload.
+*/
+extern "C" int OFFLOAD_OFFLOAD2(
+ OFFLOAD o,
+ const char *name,
+ int is_empty,
+ int num_vars,
+ VarDesc *vars,
+ VarDesc2 *vars2,
+ int num_waits,
+ const void** waits,
+ const void** signal,
+ int entry_id,
+ const void *stack_addr
+);
+
+// Run function on target (obsolete).
+// @param o OFFLOAD object
+// @param name function name
+extern "C" int OFFLOAD_OFFLOAD(
+ OFFLOAD o,
+ const char *name,
+ int is_empty,
+ int num_vars,
+ VarDesc *vars,
+ VarDesc2 *vars2,
+ int num_waits,
+ const void** waits,
+ const void* signal,
+ int entry_id = 0,
+ const void *stack_addr = NULL
+);
+
+// Global counter on host.
+// This variable is used if P2OPT_offload_do_data_persistence == 2.
+// The variable used to identify offload constructs contained in one procedure.
+// Call to OFFLOAD_CALL_COUNT() is inserted at HOST on entry of the routine.
+extern "C" int OFFLOAD_CALL_COUNT();
+
+#endif // COMPILER_IF_HOST_H_INCLUDED
diff --git a/liboffloadmic/runtime/compiler_if_target.cpp b/liboffloadmic/runtime/compiler_if_target.cpp
new file mode 100644
index 00000000000..839ef14ed63
--- /dev/null
+++ b/liboffloadmic/runtime/compiler_if_target.cpp
@@ -0,0 +1,64 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "compiler_if_target.h"
+
+extern "C" void OFFLOAD_TARGET_ENTER(
+ OFFLOAD ofld,
+ int vars_total,
+ VarDesc *vars,
+ VarDesc2 *vars2
+)
+{
+ OFFLOAD_DEBUG_TRACE(3, "%s(%p, %d, %p, %p)\n", __func__, ofld,
+ vars_total, vars, vars2);
+ ofld->merge_var_descs(vars, vars2, vars_total);
+ ofld->scatter_copyin_data();
+}
+
+extern "C" void OFFLOAD_TARGET_LEAVE(
+ OFFLOAD ofld
+)
+{
+ OFFLOAD_DEBUG_TRACE(3, "%s(%p)\n", __func__, ofld);
+ ofld->gather_copyout_data();
+}
+
+extern "C" void OFFLOAD_TARGET_MAIN(void)
+{
+ // initialize target part
+ __offload_target_init();
+
+ // pass control to COI
+ PipelineStartExecutingRunFunctions();
+ ProcessWaitForShutdown();
+
+ OFFLOAD_DEBUG_TRACE(2, "Exiting main...\n");
+}
diff --git a/liboffloadmic/runtime/compiler_if_target.h b/liboffloadmic/runtime/compiler_if_target.h
new file mode 100644
index 00000000000..c4de1260d34
--- /dev/null
+++ b/liboffloadmic/runtime/compiler_if_target.h
@@ -0,0 +1,70 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+/*! \file
+ \brief The interface between compiler-generated target code and runtime library
+*/
+
+#ifndef COMPILER_IF_TARGET_H_INCLUDED
+#define COMPILER_IF_TARGET_H_INCLUDED
+
+#include "offload_target.h"
+
+#define OFFLOAD_TARGET_ENTER OFFLOAD_PREFIX(target_enter)
+#define OFFLOAD_TARGET_LEAVE OFFLOAD_PREFIX(target_leave)
+#define OFFLOAD_TARGET_MAIN OFFLOAD_PREFIX(target_main)
+
+/*! \fn OFFLOAD_TARGET_ENTER
+ \brief Fill in variable addresses using VarDesc array.
+ \brief Then call back the runtime library to fetch data.
+ \param ofld Offload descriptor created by runtime.
+ \param var_desc_num Number of variable descriptors.
+ \param var_desc Pointer to VarDesc array.
+ \param var_desc2 Pointer to VarDesc2 array.
+*/
+extern "C" void OFFLOAD_TARGET_ENTER(
+ OFFLOAD ofld,
+ int var_desc_num,
+ VarDesc *var_desc,
+ VarDesc2 *var_desc2
+);
+
+/*! \fn OFFLOAD_TARGET_LEAVE
+ \brief Call back the runtime library to gather outputs using VarDesc array.
+ \param ofld Offload descriptor created by OFFLOAD_TARGET_ACQUIRE.
+*/
+extern "C" void OFFLOAD_TARGET_LEAVE(
+ OFFLOAD ofld
+);
+
+// Entry point for the target application.
+extern "C" void OFFLOAD_TARGET_MAIN(void);
+
+#endif // COMPILER_IF_TARGET_H_INCLUDED
diff --git a/liboffloadmic/runtime/dv_util.cpp b/liboffloadmic/runtime/dv_util.cpp
new file mode 100644
index 00000000000..63f50592e00
--- /dev/null
+++ b/liboffloadmic/runtime/dv_util.cpp
@@ -0,0 +1,153 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "offload_common.h"
+
+bool __dv_is_contiguous(const ArrDesc *dvp)
+{
+ if (dvp->Flags & ArrDescFlagsContiguous) {
+ return true;
+ }
+
+ if (dvp->Rank != 0) {
+ if (dvp->Dim[0].Mult != dvp->Len) {
+ return false;
+ }
+ for (int i = 1; i < dvp->Rank; i++) {
+ if (dvp->Dim[i].Mult !=
+ dvp->Dim[i-1].Extent * dvp->Dim[i-1].Mult) {
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+bool __dv_is_allocated(const ArrDesc *dvp)
+{
+ return (dvp->Flags & ArrDescFlagsDefined);
+}
+
+uint64_t __dv_data_length(const ArrDesc *dvp)
+{
+ uint64_t size;
+
+ if (dvp->Rank == 0) {
+ size = dvp->Len;
+ return size;
+ }
+
+ size = dvp->Len;
+ for (int i = 0; i < dvp->Rank; ++i) {
+ size += (dvp->Dim[i].Extent-1) * dvp->Dim[i].Mult;
+ }
+ return size;
+}
+
+uint64_t __dv_data_length(const ArrDesc *dvp, int64_t count)
+{
+ if (dvp->Rank == 0) {
+ return count;
+ }
+
+ return count * dvp->Dim[0].Mult;
+}
+
+// Create CeanReadRanges data for reading contiguous ranges of
+// noncontiguous array defined by the argument
+CeanReadRanges * init_read_ranges_dv(const ArrDesc *dvp)
+{
+ int64_t len;
+ int count;
+ int rank = dvp->Rank;
+ CeanReadRanges *res = NULL;
+
+ if (rank != 0) {
+ int i = 0;
+ len = dvp->Len;
+ if (dvp->Dim[0].Mult == len) {
+ for (i = 1; i < rank; i++) {
+ len *= dvp->Dim[i-1].Extent;
+ if (dvp->Dim[i].Mult != len) {
+ break;
+ }
+ }
+ }
+ res = (CeanReadRanges *)malloc(
+ sizeof(CeanReadRanges) + (rank - i) * sizeof(CeanReadDim));
+ if (res == NULL)
+ LIBOFFLOAD_ERROR(c_malloc);
+ res -> last_noncont_ind = rank - i - 1;
+ count = 1;
+ for (; i < rank; i++) {
+ res->Dim[rank - i - 1].count = count;
+ res->Dim[rank - i - 1].size = dvp->Dim[i].Mult;
+ count *= dvp->Dim[i].Extent;
+ }
+ res -> range_max_number = count;
+ res -> range_size = len;
+ res -> ptr = (void*)dvp->Base;
+ res -> current_number = 0;
+ res -> init_offset = 0;
+ }
+ return res;
+}
+
+#if OFFLOAD_DEBUG > 0
+void __dv_desc_dump(const char *name, const ArrDesc *dvp)
+{
+ OFFLOAD_TRACE(3, "%s DV %p\n", name, dvp);
+
+ if (dvp != 0) {
+ OFFLOAD_TRACE(3,
+ " dv->Base = 0x%lx\n"
+ " dv->Len = 0x%lx\n"
+ " dv->Offset = 0x%lx\n"
+ " dv->Flags = 0x%lx\n"
+ " dv->Rank = 0x%lx\n"
+ " dv->Resrvd = 0x%lx\n",
+ dvp->Base,
+ dvp->Len,
+ dvp->Offset,
+ dvp->Flags,
+ dvp->Rank,
+ dvp->Reserved);
+
+ for (int i = 0 ; i < dvp->Rank; i++) {
+ OFFLOAD_TRACE(3,
+ " (%d) Extent=%ld, Multiplier=%ld, LowerBound=%ld\n",
+ i,
+ dvp->Dim[i].Extent,
+ dvp->Dim[i].Mult,
+ dvp->Dim[i].LowerBound);
+ }
+ }
+}
+#endif // OFFLOAD_DEBUG > 0
diff --git a/liboffloadmic/runtime/dv_util.h b/liboffloadmic/runtime/dv_util.h
new file mode 100644
index 00000000000..d62cecc6aa1
--- /dev/null
+++ b/liboffloadmic/runtime/dv_util.h
@@ -0,0 +1,83 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#ifndef DV_UTIL_H_INCLUDED
+#define DV_UTIL_H_INCLUDED
+
+#include <stdint.h>
+
+// Dope vector declarations
+#define ArrDescMaxArrayRank 31
+
+// Dope vector flags
+#define ArrDescFlagsDefined 1
+#define ArrDescFlagsNodealloc 2
+#define ArrDescFlagsContiguous 4
+
+typedef int64_t dv_size;
+
+typedef struct DimDesc {
+ dv_size Extent; // Number of elements in this dimension
+ dv_size Mult; // Multiplier for this dimension.
+ // The number of bytes between successive
+ // elements in this dimension.
+ dv_size LowerBound; // LowerBound of this dimension
+} DimDesc ;
+
+typedef struct ArrDesc {
+ dv_size Base; // Base address
+ dv_size Len; // Length of data type, used only for
+ // character strings.
+ dv_size Offset;
+ dv_size Flags; // Flags
+ dv_size Rank; // Rank of pointer
+ dv_size Reserved; // reserved for openmp requests
+ DimDesc Dim[ArrDescMaxArrayRank];
+} ArrDesc ;
+
+typedef ArrDesc* pArrDesc;
+
+bool __dv_is_contiguous(const ArrDesc *dvp);
+
+bool __dv_is_allocated(const ArrDesc *dvp);
+
+uint64_t __dv_data_length(const ArrDesc *dvp);
+
+uint64_t __dv_data_length(const ArrDesc *dvp, int64_t nelems);
+
+CeanReadRanges * init_read_ranges_dv(const ArrDesc *dvp);
+
+#if OFFLOAD_DEBUG > 0
+void __dv_desc_dump(const char *name, const ArrDesc *dvp);
+#else // OFFLOAD_DEBUG
+#define __dv_desc_dump(name, dvp)
+#endif // OFFLOAD_DEBUG
+
+#endif // DV_UTIL_H_INCLUDED
diff --git a/liboffloadmic/runtime/emulator/coi_common.h b/liboffloadmic/runtime/emulator/coi_common.h
new file mode 100644
index 00000000000..482c8885437
--- /dev/null
+++ b/liboffloadmic/runtime/emulator/coi_common.h
@@ -0,0 +1,140 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef COI_COMMON_H_INCLUDED
+#define COI_COMMON_H_INCLUDED
+
+#include <common/COIMacros_common.h>
+#include <common/COIPerf_common.h>
+#include <source/COIEngine_source.h>
+#include <source/COIProcess_source.h>
+#include <source/COIPipeline_source.h>
+#include <source/COIBuffer_source.h>
+#include <source/COIEvent_source.h>
+
+#include <assert.h>
+#include <dirent.h>
+#include <dlfcn.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+
+/* Environment variable for path to 'target' files. */
+#define MIC_DIR_ENV "OFFLOAD_MIC_DIR"
+
+/* Environment variable for engine index. */
+#define MIC_INDEX_ENV "OFFLOAD_MIC_INDEX"
+
+/* Environment variable for target executable run command. */
+#define OFFLOAD_EMUL_RUN_ENV "OFFLOAD_EMUL_RUN"
+
+/* Environment variable for number ok KNC devices. */
+#define OFFLOAD_EMUL_KNC_NUM_ENV "OFFLOAD_EMUL_KNC_NUM"
+
+
+/* Path to engine directory. */
+#define ENGINE_PATH "/tmp/offload_XXXXXX"
+
+/* Relative path to directory with pipes. */
+#define PIPES_PATH "/pipes"
+
+/* Relative path to target-to-host pipe. */
+#define PIPE_HOST_PATH PIPES_PATH"/host"
+
+/* Relative path to host-to-target pipe. */
+#define PIPE_TARGET_PATH PIPES_PATH"/target"
+
+/* Non-numerical part of shared memory file name. */
+#define SHM_NAME "/offload_shm_"
+
+
+/* Use secure getenv if it's supported. */
+#ifdef HAVE_SECURE_GETENV
+ #define getenv(x) secure_getenv(x)
+#elif HAVE___SECURE_GETENV
+ #define getenv(x) __secure_getenv(x)
+#endif
+
+
+/* Wrapper for malloc. */
+#define MALLOC(type, ptr, size) \
+{ \
+ type p = (type) malloc (size); \
+ if (p == NULL) \
+ COIERROR ("Cannot allocate memory."); \
+ ptr = p; \
+}
+
+/* Wrapper for strdup. */
+#define STRDUP(ptr, str) \
+{ \
+ char *p = strdup (str); \
+ if (p == NULL) \
+ COIERROR ("Cannot allocate memory."); \
+ ptr = p; \
+}
+
+/* Wrapper for pipe reading. */
+#define READ(pipe, ptr, size) \
+{ \
+ int s = (int) size; \
+ if (read (pipe, ptr, s) != s) \
+ COIERROR ("Cannot read from pipe."); \
+}
+
+/* Wrapper for pipe writing. */
+#define WRITE(pipe, ptr, size) \
+{ \
+ int s = (int) size; \
+ if (write (pipe, ptr, s) != s) \
+ COIERROR ("Cannot write in pipe."); \
+}
+
+
+/* Command codes enum. */
+typedef enum
+{
+ CMD_BUFFER_COPY,
+ CMD_BUFFER_MAP,
+ CMD_BUFFER_UNMAP,
+ CMD_GET_FUNCTION_HANDLE,
+ CMD_OPEN_LIBRARY,
+ CMD_RUN_FUNCTION,
+ CMD_SHUTDOWN
+} cmd_t;
+
+#endif // COI_COMMON_H_INCLUDED
diff --git a/liboffloadmic/runtime/emulator/coi_device.cpp b/liboffloadmic/runtime/emulator/coi_device.cpp
new file mode 100644
index 00000000000..1a89a3f55df
--- /dev/null
+++ b/liboffloadmic/runtime/emulator/coi_device.cpp
@@ -0,0 +1,330 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "coi_device.h"
+
+#include "coi_version_asm.h"
+
+#define CYCLE_FREQUENCY 1000000000
+
+
+static uint32_t engine_index;
+
+
+extern "C"
+{
+
+COIRESULT
+SYMBOL_VERSION (COIBufferAddRef, 1) (void *ptr)
+{
+ COITRACE ("COIBufferAddRef");
+
+ /* Looks like we have nothing to do here. */
+
+ return COI_SUCCESS;
+}
+
+
+COIRESULT
+SYMBOL_VERSION (COIBufferReleaseRef, 1) (void *ptr)
+{
+ COITRACE ("COIBufferReleaseRef");
+
+ /* Looks like we have nothing to do here. */
+
+ return COI_SUCCESS;
+}
+
+
+COIRESULT
+SYMBOL_VERSION (COIEngineGetIndex, 1) (COI_ISA_TYPE *type,
+ uint32_t *index)
+{
+ COITRACE ("COIEngineGetIndex");
+
+ /* type is not used in liboffload. */
+ *index = engine_index;
+
+ return COI_SUCCESS;
+}
+
+
+COIRESULT
+SYMBOL_VERSION (COIPipelineStartExecutingRunFunctions, 1) ()
+{
+ COITRACE ("COIPipelineStartExecutingRunFunctions");
+
+ /* Looks like we have nothing to do here. */
+
+ return COI_SUCCESS;
+}
+
+
+COIRESULT
+SYMBOL_VERSION (COIProcessWaitForShutdown, 1) ()
+{
+ COITRACE ("COIProcessWaitForShutdown");
+
+ char *mic_dir = getenv (MIC_DIR_ENV);
+ char *mic_index = getenv (MIC_INDEX_ENV);
+ char *pipe_host_path, *pipe_target_path;
+ int pipe_host, pipe_target;
+ int cmd_len;
+ pid_t ppid = getppid ();
+ cmd_t cmd;
+
+ assert (mic_dir != NULL && mic_index != NULL);
+
+ /* Get engine index. */
+ engine_index = atoi (mic_index);
+
+ /* Open pipes. */
+ MALLOC (char *, pipe_host_path,
+ strlen (PIPE_HOST_PATH) + strlen (mic_dir) + 1);
+ MALLOC (char *, pipe_target_path,
+ strlen (PIPE_TARGET_PATH) + strlen (mic_dir) + 1);
+ sprintf (pipe_host_path, "%s"PIPE_HOST_PATH, mic_dir);
+ sprintf (pipe_target_path, "%s"PIPE_TARGET_PATH, mic_dir);
+ pipe_host = open (pipe_host_path, O_CLOEXEC | O_WRONLY);
+ if (pipe_host < 0)
+ COIERROR ("Cannot open target-to-host pipe.");
+ pipe_target = open (pipe_target_path, O_CLOEXEC | O_RDONLY);
+ if (pipe_target < 0)
+ COIERROR ("Cannot open host-to-target pipe.");
+
+ /* Clean up. */
+ free (pipe_host_path);
+ free (pipe_target_path);
+
+ /* Handler. */
+ while (1)
+ {
+ /* Read and execute command. */
+ cmd = CMD_SHUTDOWN;
+ cmd_len = read (pipe_target, &cmd, sizeof (cmd_t));
+ if (cmd_len != sizeof (cmd_t) && cmd_len != 0)
+ COIERROR ("Cannot read from pipe.");
+
+ switch (cmd)
+ {
+ case CMD_BUFFER_COPY:
+ {
+ uint64_t len;
+ void *dest, *source;
+
+ /* Receive data from host. */
+ READ (pipe_target, &dest, sizeof (void *));
+ READ (pipe_target, &source, sizeof (void *));
+ READ (pipe_target, &len, sizeof (uint64_t));
+
+ /* Copy. */
+ memcpy (dest, source, len);
+
+ /* Notify host about completion. */
+ WRITE (pipe_host, &cmd, sizeof (cmd_t));
+
+ break;
+ }
+ case CMD_BUFFER_MAP:
+ {
+ char *name;
+ int fd;
+ size_t len;
+ uint64_t buffer_len;
+ void *buffer;
+
+ /* Receive data from host. */
+ READ (pipe_target, &len, sizeof (size_t));
+ MALLOC (char *, name, len);
+ READ (pipe_target, name, len);
+ READ (pipe_target, &buffer_len, sizeof (uint64_t));
+
+ /* Open shared memory. */
+ fd = shm_open (name, O_CLOEXEC | O_RDWR, S_IRUSR | S_IWUSR);
+ if (fd < 0)
+ COIERROR ("Cannot open shared memory.");
+
+ /* Map shared memory. */
+ buffer = mmap (NULL, buffer_len, PROT_READ | PROT_WRITE,
+ MAP_SHARED, fd, 0);
+ if (buffer == NULL)
+ COIERROR ("Cannot map shared memory.");
+
+ /* Send data to host. */
+ WRITE (pipe_host, &fd, sizeof (int));
+ WRITE (pipe_host, &buffer, sizeof (void *));
+
+ /* Clean up. */
+ free (name);
+
+ break;
+ }
+ case CMD_BUFFER_UNMAP:
+ {
+ int fd;
+ uint64_t buffer_len;
+ void *buffer;
+
+ /* Receive data from host. */
+ READ (pipe_target, &fd, sizeof (int));
+ READ (pipe_target, &buffer, sizeof (void *));
+ READ (pipe_target, &buffer_len, sizeof (uint64_t));
+
+ /* Unmap buffer. */
+ if (munmap (buffer, buffer_len) < 0)
+ COIERROR ("Cannot unmap shared memory.");
+
+ /* Close shared memory. */
+ if (close (fd) < 0)
+ COIERROR ("Cannot close shared memory file.");
+
+ /* Notify host about completion. */
+ WRITE (pipe_host, &cmd, sizeof (cmd_t));
+
+ break;
+ }
+ case CMD_GET_FUNCTION_HANDLE:
+ {
+ char *name;
+ size_t len;
+ void *ptr;
+
+ /* Receive data from host. */
+ READ (pipe_target, &len, sizeof (size_t));
+ MALLOC (char *, name, len);
+ READ (pipe_target, name, len);
+
+ /* Find function. */
+ ptr = dlsym (RTLD_DEFAULT, name);
+ if (ptr == NULL)
+ COIERROR ("Cannot find symbol %s.", name);
+
+ /* Send data to host. */
+ WRITE (pipe_host, &ptr, sizeof (void *));
+
+ /* Clean up. */
+ free (name);
+
+ break;
+ }
+ case CMD_OPEN_LIBRARY:
+ {
+ char *lib_path;
+ size_t len;
+
+ /* Receive data from host. */
+ READ (pipe_target, &len, sizeof (size_t));
+ MALLOC (char *, lib_path, len);
+ READ (pipe_target, lib_path, len);
+
+ /* Open library. */
+ if (dlopen (lib_path, RTLD_LAZY | RTLD_GLOBAL) == 0)
+ COIERROR ("Cannot load %s: %s", lib_path, dlerror ());
+
+ /* Clean up. */
+ free (lib_path);
+
+ break;
+ }
+ case CMD_RUN_FUNCTION:
+ {
+ uint16_t misc_data_len, return_data_len;
+ uint32_t buffer_count, i;
+ uint64_t *buffers_len, size;
+ void *ptr;
+ void **buffers, *misc_data, *return_data;
+
+ void (*func) (uint32_t, void **, uint64_t *,
+ void *, uint16_t, void*, uint16_t);
+
+ /* Receive data from host. */
+ READ (pipe_target, &func, sizeof (void *));
+ READ (pipe_target, &buffer_count, sizeof (uint32_t));
+ MALLOC (void **, buffers, buffer_count * sizeof (void *));
+ MALLOC (uint64_t *, buffers_len, buffer_count * sizeof (uint64_t));
+
+ for (i = 0; i < buffer_count; i++)
+ {
+ READ (pipe_target, &(buffers_len[i]), sizeof (uint64_t));
+ READ (pipe_target, &(buffers[i]), sizeof (void *));
+ }
+ READ (pipe_target, &misc_data_len, sizeof (uint16_t));
+ if (misc_data_len > 0)
+ {
+ MALLOC (void *, misc_data, misc_data_len);
+ READ (pipe_target, misc_data, misc_data_len);
+ }
+ READ (pipe_target, &return_data_len, sizeof (uint16_t));
+ if (return_data_len > 0)
+ MALLOC (void *, return_data, return_data_len);
+
+ /* Run function. */
+ func (buffer_count, buffers, buffers_len, misc_data,
+ misc_data_len, return_data, return_data_len);
+
+ /* Send data to host if any or just send notification. */
+ WRITE (pipe_host, return_data_len > 0 ? return_data : &cmd,
+ return_data_len > 0 ? return_data_len : sizeof (cmd_t));
+
+ /* Clean up. */
+ free (buffers);
+ free (buffers_len);
+ if (misc_data_len > 0)
+ free (misc_data);
+ if (return_data_len > 0)
+ free (return_data);
+
+ break;
+ }
+ case CMD_SHUTDOWN:
+ if (close (pipe_host) < 0)
+ COIERROR ("Cannot close target-to-host pipe.");
+ if (close (pipe_target) < 0)
+ COIERROR ("Cannot close host-to-target pipe.");
+ return COI_SUCCESS;
+ default:
+ COIERROR ("Unrecognizable command from host.");
+ }
+ }
+
+ return COI_ERROR;
+}
+
+
+
+uint64_t
+SYMBOL_VERSION (COIPerfGetCycleFrequency, 1) ()
+{
+ COITRACE ("COIPerfGetCycleFrequency");
+
+ return (uint64_t) CYCLE_FREQUENCY;
+}
+
+} // extern "C"
+
diff --git a/liboffloadmic/runtime/emulator/coi_device.h b/liboffloadmic/runtime/emulator/coi_device.h
new file mode 100644
index 00000000000..779fdae69e7
--- /dev/null
+++ b/liboffloadmic/runtime/emulator/coi_device.h
@@ -0,0 +1,56 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef COI_DEVICE_H_INCLUDED
+#define COI_DEVICE_H_INCLUDED
+
+#include "coi_common.h"
+
+#define COIERROR(...) \
+{ \
+ fprintf (stderr, "COI ERROR - TARGET: "); \
+ fprintf (stderr, __VA_ARGS__); \
+ fprintf (stderr, "\n"); \
+ perror (NULL); \
+ return COI_ERROR; \
+}
+
+#ifdef DEBUG
+ #define COITRACE(...) \
+ { \
+ fprintf (stderr, "COI TRACE - TARGET: "); \
+ fprintf (stderr, __VA_ARGS__); \
+ fprintf (stderr, "\n"); \
+ }
+#else
+ #define COITRACE(...) {}
+#endif
+
+
+#endif // COI_DEVICE_H_INCLUDED
diff --git a/liboffloadmic/runtime/emulator/coi_host.cpp b/liboffloadmic/runtime/emulator/coi_host.cpp
new file mode 100644
index 00000000000..3425920a4a1
--- /dev/null
+++ b/liboffloadmic/runtime/emulator/coi_host.cpp
@@ -0,0 +1,1214 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "coi_host.h"
+
+#include "coi_version_asm.h"
+
+#define CYCLE_FREQUENCY 1000000000
+
+/* Environment variables. */
+extern char **environ;
+
+/* List of directories for removing on exit. */
+char **tmp_dirs;
+unsigned tmp_dirs_num = 0;
+
+/* Number of KNC engines. */
+long knc_engines_num;
+
+/* Mutex to sync parallel execution. */
+pthread_mutex_t mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+
+
+typedef enum
+{
+ BUFFER_NORMAL,
+ BUFFER_MEMORY
+} buffer_t;
+
+typedef struct
+{
+ COI_ISA_TYPE type;
+ uint32_t index;
+ char *dir;
+} Engine;
+
+typedef struct
+{
+ char *name;
+ void *ptr;
+} Function;
+
+typedef struct
+{
+ int pipe_host;
+ int pipe_target;
+} Pipeline;
+
+typedef struct
+{
+ pid_t pid;
+ Engine *engine;
+ Function **functions;
+ Pipeline *pipeline;
+} Process;
+
+typedef struct
+{
+ buffer_t type;
+ char *name;
+ int fd;
+ int fd_target;
+ uint64_t size;
+ void *data;
+ void *data_target;
+ Process *process;
+} Buffer;
+
+
+static COIRESULT
+read_long_env (const char *env_name, long *var, long var_default)
+{
+ char *str = getenv (env_name);
+ char *s;
+
+ if (!str || *str == '\0')
+ *var = var_default;
+ else
+ {
+ errno = 0;
+ *var = strtol (str, &s, 0);
+ if (errno != 0 || s == str || *s != '\0')
+ COIERROR ("Variable %s has invalid value.", env_name);
+ }
+
+ return COI_SUCCESS;
+}
+
+__attribute__((constructor))
+static void
+init ()
+{
+ if (read_long_env (OFFLOAD_EMUL_KNC_NUM_ENV, &knc_engines_num, 1)
+ == COI_ERROR)
+ exit (0);
+}
+
+
+/* Helper function for directory removing. */
+static COIRESULT remove_directory (char *path)
+{
+ char *file;
+ struct dirent *entry;
+ struct stat statfile;
+ DIR *dir = opendir (path);
+ if (dir == NULL)
+ COIERROR ("Cannot open directory %s.", dir);
+
+ while (entry = readdir (dir))
+ {
+ if (!strcmp (entry->d_name, ".") || !strcmp (entry->d_name, ".."))
+ continue;
+
+ MALLOC (char *, file, strlen (path) + strlen (entry->d_name) + 2);
+ sprintf (file, "%s/%s", path, entry->d_name);
+
+ if (stat (file, &statfile) < 0)
+ COIERROR ("Cannot retrieve information about file %s.", file);
+
+ if (S_ISDIR (statfile.st_mode))
+ {
+ if (remove_directory (file) == COI_ERROR)
+ return COI_ERROR;
+ }
+ else
+ {
+ if (unlink (file) < 0)
+ COIERROR ("Cannot unlink file %s.", file);
+ }
+
+ free (file);
+ }
+
+ if (closedir (dir) < 0)
+ COIERROR ("Cannot close directory %s.", path);
+ if (rmdir (path) < 0)
+ COIERROR ("Cannot remove directory %s.", path);
+
+ return COI_SUCCESS;
+}
+
+__attribute__((destructor))
+static void
+cleanup ()
+{
+ unsigned i;
+ for (i = 0; i < tmp_dirs_num; i++)
+ {
+ remove_directory (tmp_dirs[i]);
+ free (tmp_dirs[i]);
+ }
+ if (tmp_dirs)
+ free (tmp_dirs);
+}
+
+
+extern "C"
+{
+
+COIRESULT
+SYMBOL_VERSION (COIBufferCopy, 1) (COIBUFFER dest_buffer,
+ COIBUFFER source_buffer,
+ uint64_t dest_offset,
+ uint64_t source_offset,
+ uint64_t length,
+ COI_COPY_TYPE type,
+ uint32_t dependencies_num, // Ignored
+ const COIEVENT *dependencies, // Ignored
+ COIEVENT *completion) // Ignored
+{
+ COITRACE ("COIBufferCopy");
+
+ /* Convert input arguments. */
+ Buffer *dest = (Buffer *) dest_buffer;
+ Buffer *source = (Buffer *) source_buffer;
+
+ /* Features of liboffload. */
+ assert (type == COI_COPY_UNSPECIFIED);
+
+ /* Start critical section. */
+ if (pthread_mutex_lock (&mutex) != 0)
+ COIERROR ("Cannot lock mutex.");
+
+ /* Map buffers if needed. */
+ if (dest->data == 0 && dest->type == BUFFER_NORMAL)
+ if (COIBufferMap (dest_buffer, 0, dest->size, (COI_MAP_TYPE) 0,
+ 0, 0, 0, 0, 0) == COI_ERROR)
+ return COI_ERROR;
+ if (source->data == 0 && source->type == BUFFER_NORMAL)
+ if (COIBufferMap (source_buffer, 0, source->size, (COI_MAP_TYPE) 0,
+ 0, 0, 0, 0, 0) == COI_ERROR)
+ return COI_ERROR;
+
+ /* Copy data. */
+ if (source->data != 0 && dest->data != 0)
+ memcpy ((void *) ((uintptr_t) dest->data+dest_offset),
+ (void *) ((uintptr_t) source->data+source_offset), length);
+ else
+ {
+ assert (dest->process == source->process);
+
+ Buffer *buffer;
+ cmd_t cmd = CMD_BUFFER_COPY;
+ Pipeline *pipeline = dest->process->pipeline;
+
+ /* Create intermediary buffer. */
+ if (COIBufferCreate (length, COI_BUFFER_NORMAL, 0, 0, 1,
+ (COIPROCESS*) &dest->process,
+ (COIBUFFER *) &buffer) == COI_ERROR)
+ return COI_ERROR;
+
+ /* Copy from source to intermediary buffer. */
+ if (source->data == 0)
+ {
+ assert (source->data_target != 0);
+
+ /* Send data to target. */
+ WRITE (pipeline->pipe_target, &cmd, sizeof (cmd_t));
+ WRITE (pipeline->pipe_target, &(buffer->data_target), sizeof (void *));
+ WRITE (pipeline->pipe_target, &(source->data_target), sizeof (void *));
+ WRITE (pipeline->pipe_target, &(buffer->size), sizeof (uint64_t));
+
+ /* Receive data from target. */
+ READ (pipeline->pipe_host, &cmd, sizeof (cmd_t));
+ }
+ else
+ {
+ if (COIBufferCopy ((COIBUFFER) buffer, source_buffer, 0, source_offset,
+ length, type, 0, 0, 0) == COI_ERROR)
+ return COI_ERROR;
+ }
+
+ /* Copy from intermediary buffer to dest. */
+ if (dest->data == 0)
+ {
+ assert (dest->data_target != 0);
+
+ /* Send data to target. */
+ WRITE (pipeline->pipe_target, &cmd, sizeof (cmd_t));
+ WRITE (pipeline->pipe_target, &(dest->data_target), sizeof (void *));
+ WRITE (pipeline->pipe_target, &(buffer->data_target), sizeof (void *));
+ WRITE (pipeline->pipe_target, &(buffer->size), sizeof (uint64_t));
+
+ /* Receive data from target. */
+ READ (pipeline->pipe_host, &cmd, sizeof (cmd_t));
+ }
+ else
+ {
+ if (COIBufferCopy (dest_buffer, (COIBUFFER) buffer, dest_offset,
+ 0, length, type, 0, 0, 0) == COI_ERROR)
+ return COI_ERROR;
+ }
+
+ /* Unmap on target and destroy intermediary buffer. */
+ if (COIBufferDestroy ((COIBUFFER) buffer) == COI_ERROR)
+ return COI_ERROR;
+ }
+
+ /* Unmap buffers if needed. */
+ if (dest->type == BUFFER_NORMAL)
+ if (COIBufferUnmap ((COIMAPINSTANCE) dest, 0, 0, 0) == COI_ERROR)
+ return COI_ERROR;
+ if (source->type == BUFFER_NORMAL)
+ if (COIBufferUnmap ((COIMAPINSTANCE) source, 0, 0, 0) == COI_ERROR)
+ return COI_ERROR;
+
+ /* Finish critical section. */
+ if (pthread_mutex_unlock (&mutex) != 0)
+ COIERROR ("Cannot unlock mutex.");
+
+ return COI_SUCCESS;
+}
+
+
+COIRESULT
+SYMBOL_VERSION (COIBufferCreate, 1) (uint64_t size,
+ COI_BUFFER_TYPE type,
+ uint32_t flags,
+ const void *init_data,
+ uint32_t processes_num,
+ const COIPROCESS *processes,
+ COIBUFFER *buffer)
+{
+ COITRACE ("COIBufferCreate");
+
+ char *shm_name;
+ cmd_t cmd = CMD_BUFFER_MAP;
+ int shm_fd;
+ const int ullong_max_len = 20;
+ size_t len;
+ unsigned long long i;
+
+ Buffer *buf;
+ Pipeline *pipeline;
+
+ /* Features of liboffload. */
+ assert (type == COI_BUFFER_NORMAL);
+ assert ((flags & COI_SINK_MEMORY) == 0);
+ assert ((flags & COI_SAME_ADDRESS_SINKS) == 0);
+ assert ((flags & COI_SAME_ADDRESS_SINKS_AND_SOURCE) == 0);
+ assert (init_data == 0);
+ assert (processes_num == 1);
+
+ /* Create shared memory with an unique name. */
+ MALLOC (char *, shm_name, strlen (SHM_NAME) + ullong_max_len + 1);
+ for (i = 0; i >= 0; i++)
+ {
+ sprintf (shm_name, SHM_NAME"%lu", i);
+ shm_fd = shm_open (shm_name, O_CLOEXEC | O_CREAT | O_EXCL | O_RDWR,
+ S_IRUSR | S_IWUSR);
+ if (shm_fd > 0)
+ break;
+ }
+ if (ftruncate (shm_fd, size) < 0)
+ COIERROR ("Cannot truncate shared memory file.");
+
+ /* Create buffer. */
+ MALLOC (Buffer *, buf, sizeof (Buffer));
+ buf->data = 0;
+ buf->fd = shm_fd;
+ buf->process = (Process *) processes[0];
+ buf->size = size;
+ buf->type = BUFFER_NORMAL;
+ STRDUP (buf->name, shm_name);
+
+ /* Map buffer on target. */
+ len = strlen (buf->name) + 1;
+ pipeline = buf->process->pipeline;
+
+ /* Start critical section. */
+ if (pthread_mutex_lock (&mutex) != 0)
+ COIERROR ("Cannot lock mutex.");
+
+ /* Send data to target. */
+ WRITE (pipeline->pipe_target, &cmd, sizeof (cmd_t));
+ WRITE (pipeline->pipe_target, &len, sizeof (size_t));
+ WRITE (pipeline->pipe_target, buf->name, len);
+ WRITE (pipeline->pipe_target, &(buf->size), sizeof (uint64_t));
+
+ /* Receive data from target. */
+ READ (pipeline->pipe_host, &(buf->fd_target), sizeof (int));
+ READ (pipeline->pipe_host, &(buf->data_target), sizeof (void *));
+
+ /* Finish critical section. */
+ if (pthread_mutex_unlock (&mutex) != 0)
+ COIERROR ("Cannot unlock mutex.");
+
+ /* Prepare output arguments. */
+ *buffer = (COIBUFFER) buf;
+
+ /* Clean up. */
+ free (shm_name);
+
+ return COI_SUCCESS;
+}
+
+
+COIRESULT
+SYMBOL_VERSION (COIBufferCreateFromMemory, 1) (uint64_t size,
+ COI_BUFFER_TYPE type,
+ uint32_t flags,
+ void *memory,
+ uint32_t processes_num,
+ const COIPROCESS *processes,
+ COIBUFFER *buffer)
+{
+ COITRACE ("COIBufferCreateFromMemory");
+
+ Buffer *buf;
+
+ /* Features of liboffload. */
+ assert (type == COI_BUFFER_NORMAL);
+ assert ((flags & COI_SAME_ADDRESS_SINKS) == 0);
+ assert ((flags & COI_SAME_ADDRESS_SINKS_AND_SOURCE) == 0);
+ assert (processes_num == 1);
+
+ /* Create buffer. */
+ MALLOC (Buffer *, buf, sizeof (Buffer));
+ buf->data = (flags & COI_SINK_MEMORY) == 0 ? memory : 0;
+ buf->data_target = (flags & COI_SINK_MEMORY) != 0 ? memory : 0;
+ buf->process = (Process *) processes[0];
+ buf->size = size;
+ buf->type = BUFFER_MEMORY;
+
+ /* Prepare output argument. */
+ *buffer = (COIBUFFER) buf;
+
+ return COI_SUCCESS;
+}
+
+
+COIRESULT
+SYMBOL_VERSION (COIBufferDestroy, 1) (COIBUFFER buffer)
+{
+ COITRACE ("COIBufferDestroy");
+
+ cmd_t cmd = CMD_BUFFER_UNMAP;
+
+ /* Convert input arguments. */
+ Buffer *buf = (Buffer *) buffer;
+ Pipeline *pipeline = buf->process->pipeline;
+
+ /* Unmap buffer on host. */
+ if (buf->data != 0 && buf->type == BUFFER_NORMAL)
+ if (COIBufferUnmap ((COIMAPINSTANCE) buffer, 0, 0, 0) == COI_ERROR)
+ return COI_ERROR;
+
+ /* Unmap buffer on target. */
+ if (buf->data_target != 0)
+ {
+ /* Start critical section. */
+ if (pthread_mutex_lock (&mutex) != 0)
+ COIERROR ("Cannot lock mutex.");
+
+ /* Send data to target. */
+ WRITE (pipeline->pipe_target, &cmd, sizeof (cmd_t));
+ WRITE (pipeline->pipe_target, &(buf->fd_target), sizeof (int));
+ WRITE (pipeline->pipe_target, &(buf->data_target), sizeof (void *));
+ WRITE (pipeline->pipe_target, &(buf->size), sizeof (uint64_t));
+
+ /* Receive data from target. */
+ READ (pipeline->pipe_host, &cmd, sizeof (cmd_t));
+
+ /* Finish critical section. */
+ if (pthread_mutex_unlock (&mutex) != 0)
+ COIERROR ("Cannot unlock mutex.");
+ }
+
+ /* Unlink shared memory. */
+ if (buf->type == BUFFER_NORMAL)
+ {
+ if (close (buf->fd) < 0)
+ COIERROR ("Cannot close shared memory file.");
+ if (shm_unlink (buf->name) < 0)
+ COIERROR ("Cannot unlink shared memory.");
+ free (buf->name);
+ }
+
+ /* Clean up. */
+ free (buf);
+
+ return COI_SUCCESS;
+}
+
+
+COIRESULT
+SYMBOL_VERSION (COIBufferGetSinkAddress, 1) (COIBUFFER buffer,
+ uint64_t *data)
+{
+ COITRACE ("COIBufferGetSinkAddress");
+
+ /* Convert input arguments. */
+ Buffer *buf = (Buffer *) buffer;
+
+ /* Here should come BUFFER_NORMAL buffer. */
+ assert (buf->type == BUFFER_NORMAL);
+
+ /* Prepare output argument. */
+ *data = (uint64_t) buf->data_target;
+
+ return COI_SUCCESS;
+}
+
+
+COIRESULT
+SYMBOL_VERSION (COIBufferMap, 1) (COIBUFFER buffer,
+ uint64_t offset,
+ uint64_t length,
+ COI_MAP_TYPE type, // Ignored
+ uint32_t dependencies_num, // Ignored
+ const COIEVENT *dependencies, // Ignored
+ COIEVENT *completion, // Ignored
+ COIMAPINSTANCE *map_instance,
+ void **data)
+{
+ COITRACE ("COIBufferMap");
+
+ /* Features of liboffload. */
+ assert (offset == 0);
+
+ /* Convert input arguments. */
+ Buffer *buf = (Buffer *) buffer;
+
+ /* Only BUFFER_NORMAL buffers should come here. */
+ assert (buf->type == BUFFER_NORMAL);
+
+ /* Map shared memory. */
+ buf->data = mmap (NULL, buf->size, PROT_READ | PROT_WRITE,
+ MAP_SHARED, buf->fd, 0);
+ if (buf->data == NULL)
+ COIERROR ("Cannot map shared memory.");
+
+ /* Prepare output arguments. */
+ if (map_instance != 0)
+ *map_instance = (COIMAPINSTANCE) buf;
+ if (data != 0)
+ *data = buf->data;
+
+ return COI_SUCCESS;
+}
+
+
+COIRESULT
+SYMBOL_VERSION (COIBufferRead, 1) (COIBUFFER buffer,
+ uint64_t offset,
+ void *data,
+ uint64_t length,
+ COI_COPY_TYPE type,
+ uint32_t dependencies_num, // Ignored
+ const COIEVENT *dependencies, // Ignored
+ COIEVENT *completion) // Ignored
+{
+ COITRACE ("COIBufferRead");
+
+ /* Convert input arguments. */
+ Buffer *buf = (Buffer *) buffer;
+
+ /* Features of liboffload. */
+ assert (type == COI_COPY_UNSPECIFIED);
+
+ /* Start critical section. */
+ if (pthread_mutex_lock (&mutex) != 0)
+ COIERROR ("Cannot lock mutex.");
+
+ /* Map buffers if needed. */
+ if (buf->data == 0 && buf->type == BUFFER_NORMAL)
+ if (COIBufferMap (buffer, 0, buf->size, (COI_MAP_TYPE) 0,
+ 0, 0, 0, 0, 0) == COI_ERROR)
+ return COI_ERROR;
+
+ /* Copy data. */
+ memcpy (data, (void *) ((uintptr_t) buf->data+offset), length);
+
+ /* Unmap buffers if needed. */
+ if (buf->type == BUFFER_NORMAL)
+ if (COIBufferUnmap ((COIMAPINSTANCE) buf, 0, 0, 0) == COI_ERROR)
+ return COI_ERROR;
+
+ /* Finish critical section. */
+ if (pthread_mutex_unlock (&mutex) != 0)
+ COIERROR ("Cannot unlock mutex.");
+
+ return COI_SUCCESS;
+}
+
+
+COIRESULT
+SYMBOL_VERSION (COIBufferSetState, 1) (COIBUFFER buffer,
+ COIPROCESS process,
+ COI_BUFFER_STATE state,
+ COI_BUFFER_MOVE_FLAG flag,
+ uint32_t dependencies_num, // Ignored
+ const COIEVENT *dependencies, // Ignored
+ COIEVENT *completion) // Ignored
+{
+ COITRACE ("COIBufferSetState");
+
+ /* Features of liboffload. */
+ assert (flag == COI_BUFFER_NO_MOVE);
+
+ /* Looks like we have nothing to do here. */
+
+ return COI_SUCCESS;
+}
+
+
+COIRESULT
+SYMBOL_VERSION (COIBufferUnmap, 1) (COIMAPINSTANCE map_instance,
+ uint32_t dependencies_num, // Ignored
+ const COIEVENT *dependencies, // Ignored
+ COIEVENT *completion) // Ignored
+{
+ COITRACE ("COIBufferUnmap");
+
+ /* Convert input arguments. */
+ Buffer *buffer = (Buffer *) map_instance;
+
+ /* Only BUFFER_NORMAL buffers should come here. */
+ assert (buffer->type == BUFFER_NORMAL);
+
+ /* Unmap shared memory. */
+ if (munmap (buffer->data, buffer->size) < 0)
+ COIERROR ("Cannot unmap shared memory.");
+
+ buffer->data = 0;
+
+ return COI_SUCCESS;
+}
+
+
+COIRESULT
+SYMBOL_VERSION (COIBufferWrite, 1) (COIBUFFER buffer,
+ uint64_t offset,
+ const void *data,
+ uint64_t length,
+ COI_COPY_TYPE type,
+ uint32_t dependencies_num, // Ignored
+ const COIEVENT *dependencies, // Ignored
+ COIEVENT *completion) // Ignored
+{
+ COITRACE ("COIBufferWrite");
+
+ /* Convert input arguments. */
+ Buffer *buf = (Buffer *) buffer;
+
+ /* Features of liboffload. */
+ assert (type == COI_COPY_UNSPECIFIED);
+
+ /* Start critical section. */
+ if (pthread_mutex_lock (&mutex) != 0)
+ COIERROR ("Cannot lock mutex.");
+
+ /* Map buffers if needed. */
+ if (buf->data == 0 && buf->type == BUFFER_NORMAL)
+ if (COIBufferMap (buffer, 0, buf->size, (COI_MAP_TYPE) 0,
+ 0, 0, 0, 0, 0) == COI_ERROR)
+ return COI_ERROR;
+
+ /* Copy data. */
+ memcpy ((void *) ((uintptr_t) buf->data+offset), data, length);
+
+ /* Unmap buffers if needed. */
+ if (buf->type == BUFFER_NORMAL)
+ if (COIBufferUnmap ((COIMAPINSTANCE) buf, 0, 0, 0) == COI_ERROR)
+ return COI_ERROR;
+
+ /* Finish critical section. */
+ if (pthread_mutex_unlock (&mutex) != 0)
+ COIERROR ("Cannot unlock mutex.");
+
+ return COI_SUCCESS;
+}
+
+
+COIRESULT
+SYMBOL_VERSION (COIEngineGetCount, 1) (COI_ISA_TYPE isa,
+ uint32_t *count)
+{
+ COITRACE ("COIEngineGetCount");
+
+ /* Features of liboffload. */
+ assert (isa == COI_ISA_KNC);
+
+ /* Prepare output arguments. */
+ *count = knc_engines_num;
+
+ return COI_SUCCESS;
+}
+
+
+COIRESULT
+SYMBOL_VERSION (COIEngineGetHandle, 1) (COI_ISA_TYPE isa,
+ uint32_t index,
+ COIENGINE *handle)
+{
+ COITRACE ("COIEngineGetHandle");
+
+ Engine *engine;
+
+ /* Features of liboffload. */
+ assert (isa == COI_ISA_KNC);
+
+ /* Check engine index. */
+ if (index >= knc_engines_num)
+ COIERROR ("Wrong engine index.");
+
+ /* Create engine handle. */
+ MALLOC (Engine *, engine, sizeof (Engine));
+ engine->dir = NULL;
+ engine->index = index;
+ engine->type = isa;
+
+ /* Prepare output argument. */
+ *handle = (COIENGINE) engine;
+
+ return COI_SUCCESS;
+}
+
+
+COIRESULT
+SYMBOL_VERSION (COIEventWait, 1) (uint16_t events_num, // Ignored
+ const COIEVENT *events, // Ignored
+ int32_t timeout, // Ignored
+ uint8_t wait_all,
+ uint32_t *signaled_num,
+ uint32_t *signaled_indices)
+{
+ COITRACE ("COIEventWait");
+
+ /* Features of liboffload. */
+ assert (wait_all == 1);
+ assert (signaled_num == 0);
+ assert (signaled_indices == 0);
+
+ /* Looks like we have nothing to do here. */
+
+ return COI_SUCCESS;
+}
+
+
+COIRESULT
+SYMBOL_VERSION (COIPipelineCreate, 1) (COIPROCESS process,
+ COI_CPU_MASK mask,
+ uint32_t stack_size, // Ignored
+ COIPIPELINE *pipeline)
+{
+ COITRACE ("COIPipelineCreate");
+
+ /* Features of liboffload. */
+ assert (mask == 0);
+
+ /* Prepare output arguments. */
+ *pipeline = (COIPIPELINE) ((Process *) process)->pipeline;
+
+ return COI_SUCCESS;
+}
+
+
+COIRESULT
+SYMBOL_VERSION (COIPipelineDestroy, 1) (COIPIPELINE pipeline)
+{
+ COITRACE ("COIPipelineDestroy");
+
+ /* Do nothing here. Pipeline will be closed during COIProcessDestroy. */
+
+ return COI_SUCCESS;
+}
+
+
+COIRESULT
+SYMBOL_VERSION (COIPipelineRunFunction, 1) (COIPIPELINE pipeline,
+ COIFUNCTION function,
+ uint32_t buffers_num,
+ const COIBUFFER *buffers,
+ const COI_ACCESS_FLAGS *access_flags, // Ignored
+ uint32_t dependencies_num, // Ignored
+ const COIEVENT *dependencies, // Ignored
+ const void *misc_data,
+ uint16_t misc_data_len,
+ void *return_data,
+ uint16_t return_data_len,
+ COIEVENT *completion) // Ignored
+{
+ COITRACE ("COIPipelineRunFunction");
+
+ cmd_t cmd = CMD_RUN_FUNCTION;
+ int ret_len;
+ uint32_t i;
+ uint64_t size;
+ void *ptr;
+
+ /* Convert input arguments. */
+ Buffer **bufs = (Buffer **) buffers;
+ Function *func = (Function *) function;
+ Pipeline *pipe = (Pipeline *) pipeline;
+
+ /* Start critical section. */
+ if (pthread_mutex_lock (&mutex) != 0)
+ COIERROR ("Cannot lock mutex.");
+
+ /* Send data to target. */
+ WRITE (pipe->pipe_target, &cmd, sizeof (cmd_t));
+ WRITE (pipe->pipe_target, &(func->ptr), sizeof (void *));
+ WRITE (pipe->pipe_target, &buffers_num, sizeof (uint32_t));
+ for (i = 0; i < buffers_num; i++)
+ {
+ WRITE (pipe->pipe_target, &(bufs[i]->size), sizeof (uint64_t));
+ WRITE (pipe->pipe_target, &(bufs[i]->data_target), sizeof (void *));
+ }
+ WRITE (pipe->pipe_target, &misc_data_len, sizeof (uint16_t));
+ if (misc_data_len > 0)
+ WRITE (pipe->pipe_target, misc_data, misc_data_len);
+ WRITE (pipe->pipe_target, &return_data_len, sizeof (uint16_t));
+
+ /* Receive data from target. In emulator we don't need any asynchronous data
+ transfer, so we wait for target process whether it has any data or not. */
+ ret_len = read (pipe->pipe_host, return_data_len > 0 ? return_data : &cmd,
+ return_data_len > 0 ? return_data_len : sizeof (cmd_t));
+ if (ret_len == 0)
+ return COI_PROCESS_DIED;
+ else if (ret_len != (return_data_len > 0 ? return_data_len : sizeof (cmd_t)))
+ COIERROR ("Cannot read from pipe.");
+
+ /* Finish critical section. */
+ if (pthread_mutex_unlock (&mutex) != 0)
+ COIERROR ("Cannot unlock mutex.");
+
+ return COI_SUCCESS;
+}
+
+
+COIRESULT
+SYMBOL_VERSION (COIProcessCreateFromMemory, 1) (COIENGINE engine,
+ const char *bin_name,
+ const void *bin_buffer,
+ uint64_t bin_buffer_len,
+ int argc,
+ const char **argv,
+ uint8_t inherit_env,
+ const char **additional_env,
+ uint8_t proxy_active, // Ignored
+ const char *proxyfs_root, // Ignored
+ uint64_t buffer_space, // Ignored
+ const char *lib_search_path,
+ const char *file_of_origin, // Ignored
+ uint64_t file_of_origin_offset, // Ignored
+ COIPROCESS *process)
+{
+ COITRACE ("COIProcessCreateFromMemory");
+
+ const int run_max_args_num = 128;
+ char **envp;
+ char *run_argv[run_max_args_num];
+ char *emul_run = getenv (OFFLOAD_EMUL_RUN_ENV);
+ char *env_name, *tok;
+ char *pipe_host_path, *pipe_target_path, *pipes_path, *target_exe;
+ FILE *file;
+ int fd;
+ int i, j, env_i, env_num;
+ int pipe_host, pipe_target;
+ const int uint_max_len = 11;
+ pid_t pid;
+ Pipeline *pipeline;
+ Process *proc;
+
+ /* Features of liboffload. */
+ assert (argc == 0);
+ assert (argv == 0);
+
+ /* Convert input arguments. */
+ Engine *eng = (Engine *) engine;
+
+ /* Create temporary directory for engine files. */
+ assert (eng->dir == NULL);
+ STRDUP (eng->dir, ENGINE_PATH);
+ if (mkdtemp (eng->dir) == NULL)
+ COIERROR ("Cannot create temporary directory %s.", eng->dir);
+
+ /* Save path to engine directory for clean up on exit. */
+ tmp_dirs_num++;
+ tmp_dirs = (char **) realloc (tmp_dirs, tmp_dirs_num * sizeof (char *));
+ if (!tmp_dirs)
+ COIERROR ("Cannot allocate memory.");
+ STRDUP (tmp_dirs[tmp_dirs_num - 1], eng->dir);
+
+ /* Create target executable file. */
+ MALLOC (char *, target_exe, strlen (eng->dir) + strlen (bin_name) + 2);
+ sprintf (target_exe, "%s/%s", eng->dir, bin_name);
+ fd = open (target_exe, O_CLOEXEC | O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR);
+ if (fd < 0)
+ COIERROR ("Cannot create file %s.", target_exe);
+ file = fdopen (fd, "wb");
+ if (file == NULL)
+ COIERROR ("Cannot associate stream with file descriptor.");
+ if (fwrite (bin_buffer, 1, bin_buffer_len, file) != bin_buffer_len)
+ COIERROR ("Cannot write in file %s.", target_exe);
+ if (fclose (file) != 0)
+ COIERROR ("Cannot close file %s.", target_exe);
+
+ /* Fix file permissions. */
+ if (chmod (target_exe, S_IRWXU) < 0)
+ COIERROR ("Cannot change permissions for file %s.", target_exe);
+
+ /* Create directory for pipes to prevent names collision. */
+ MALLOC (char *, pipes_path, strlen (PIPES_PATH) + strlen (eng->dir) + 1);
+ sprintf (pipes_path, "%s"PIPES_PATH, eng->dir);
+ if (mkdir (pipes_path, S_IRWXU) < 0)
+ COIERROR ("Cannot create folder %s.", pipes_path);
+
+ /* Create pipes. */
+ MALLOC (char *, pipe_host_path,
+ strlen (PIPE_HOST_PATH) + strlen (eng->dir) + 1);
+ MALLOC (char *, pipe_target_path,
+ strlen (PIPE_TARGET_PATH) + strlen (eng->dir) + 1);
+ if (pipe_target_path == NULL)
+ COIERROR ("Cannot allocate memory.");
+ sprintf (pipe_host_path, "%s"PIPE_HOST_PATH, eng->dir);
+ sprintf (pipe_target_path, "%s"PIPE_TARGET_PATH, eng->dir);
+ if (mkfifo (pipe_host_path, S_IRUSR | S_IWUSR) < 0)
+ COIERROR ("Cannot create pipe %s.", pipe_host_path);
+ if (mkfifo (pipe_target_path, S_IRUSR | S_IWUSR) < 0)
+ COIERROR ("Cannot create pipe %s.", pipe_target_path);
+
+ /* Prepare argv. */
+ if (emul_run == NULL || strcmp (emul_run, "") == 0)
+ {
+ STRDUP (run_argv[0], target_exe);
+ run_argv[1] = (char *) NULL;
+ }
+ else
+ {
+ char *ptr, *tmp;
+ i = 0;
+ STRDUP (tmp, emul_run);
+ tok = strtok_r (tmp, " ", &ptr);
+ while (tok != NULL)
+ {
+ if (i >= run_max_args_num)
+ COIERROR ("Run command has too many arguments.");
+ STRDUP (run_argv[i++], tok);
+ tok = strtok_r (NULL, " ", &ptr);
+ }
+ STRDUP (run_argv[i], target_exe);
+ run_argv[i+1] = (char *) NULL;
+ free (tmp);
+ }
+
+ /* Prepare envp. */
+ /* FIXME: take into account additional_env. */
+ assert (additional_env == NULL);
+
+ env_num = 0;
+ if (inherit_env == true)
+ while (environ[env_num++]);
+ env_num += 4; // LD_LIBRARY_PATH, MIC_DIR, MIC_INDEX, NULL
+
+ MALLOC (char **, envp, env_num * sizeof (char *));
+
+ env_i = 0;
+ if (inherit_env == true)
+ for (i = 0; environ[i] != NULL; i++)
+ {
+ STRDUP (env_name, environ[i]);
+ for (j = 0; env_name[j] != '=' && env_name[j] != '\0'; j++);
+ env_name[j] = '\0';
+ if (strcmp (env_name, "LD_LIBRARY_PATH") != 0
+ && strcmp (env_name, MIC_DIR_ENV) != 0
+ && strcmp (env_name, MIC_INDEX_ENV) != 0)
+ STRDUP (envp[env_i++], environ[i]);
+ free (env_name);
+ }
+
+ MALLOC (char *, envp[env_i], strlen (MIC_DIR_ENV) + strlen (eng->dir) + 2);
+ sprintf (envp[env_i], "%s=%s", MIC_DIR_ENV, eng->dir);
+
+ MALLOC (char *, envp[env_i+1], strlen (MIC_INDEX_ENV) + uint_max_len + 1);
+ sprintf (envp[env_i+1], "%s=%u", MIC_INDEX_ENV, eng->index);
+
+ MALLOC (char *, envp[env_i+2],
+ strlen ("LD_LIBRARY_PATH=") + strlen (lib_search_path) + 1);
+ sprintf (envp[env_i+2], "LD_LIBRARY_PATH=%s", lib_search_path);
+
+ envp[env_i+3] = (char *) NULL;
+
+ /* Create target process. */
+ pid = vfork ();
+ if (pid < 0)
+ COIERROR ("Cannot create child process.");
+
+ if (pid == 0)
+ {
+ /* Run target executable. */
+ if (execvpe (run_argv[0], run_argv, envp) == -1)
+ COIERROR ("Cannot execute file %s.", target_exe);
+ }
+
+ /* Open pipes. */
+ pipe_host = open (pipe_host_path, O_CLOEXEC | O_RDONLY);
+ if (pipe_host < 0)
+ COIERROR ("Cannot open target-to-host pipe.");
+ pipe_target = open (pipe_target_path, O_CLOEXEC | O_WRONLY);
+ if (pipe_target < 0)
+ COIERROR ("Cannot open host-to-target pipe.");
+
+ /* Create pipeline handle. */
+ MALLOC (Pipeline *, pipeline, sizeof (Pipeline));
+ pipeline->pipe_host = pipe_host;
+ pipeline->pipe_target = pipe_target;
+
+ /* Create process handle. */
+ MALLOC (Process *, proc, sizeof (Process));
+ proc->pid = pid;
+ proc->engine = eng;
+ proc->functions = 0;
+ proc->pipeline = pipeline;
+
+ /* Prepare output arguments. */
+ *process = (COIPROCESS) proc;
+
+ /* Clean up. */
+ for (i = 0; run_argv[i] != NULL; i++)
+ free (run_argv[i]);
+ for (i = 0; envp[i] != NULL; i++)
+ free (envp[i]);
+ free (envp);
+ free (pipe_host_path);
+ free (pipe_target_path);
+ free (pipes_path);
+ free (target_exe);
+
+ return COI_SUCCESS;
+}
+
+
+COIRESULT
+SYMBOL_VERSION (COIProcessDestroy, 1) (COIPROCESS process,
+ int32_t wait_timeout, // Ignored
+ uint8_t force,
+ int8_t *proc_return,
+ uint32_t *reason)
+{
+ COITRACE ("COIProcessDestroy");
+
+ int i;
+
+ /* Convert input arguments. */
+ Process *proc = (Process *) process;
+
+ /* Close pipeline. */
+ if (close (proc->pipeline->pipe_host) < 0)
+ COIERROR ("Cannot close target-to-host pipe.");
+ if (close (proc->pipeline->pipe_target) < 0)
+ COIERROR ("Cannot close host-to-target pipe.");
+ free (proc->pipeline);
+
+ /* Shutdown target process by force. */
+ if (force)
+ kill (proc->pid, SIGTERM);
+
+ /* Clean up. */
+ for (i = 0; proc->functions[i] != 0; i++)
+ {
+ free (proc->functions[i]->name);
+ free (proc->functions[i]);
+ }
+ free (proc->engine->dir);
+ free (proc->engine);
+ free (proc->functions);
+ free (proc);
+
+ /* Prepare output arguments. */
+ *proc_return = 0;
+ *reason = 0;
+
+ return COI_SUCCESS;
+}
+
+
+COIRESULT
+SYMBOL_VERSION (COIProcessGetFunctionHandles, 1) (COIPROCESS process,
+ uint32_t functions_num,
+ const char **function_names,
+ COIFUNCTION *function_handles)
+{
+ COITRACE ("COIProcessGetFunctionHandles");
+
+ cmd_t cmd = CMD_GET_FUNCTION_HANDLE;
+ Function *function;
+ size_t len;
+ void *ptr;
+ uint32_t i;
+
+ /* Convert input arguments. */
+ Process *proc = (Process *) process;
+
+ /* This function should be called once for the process. */
+ assert (proc->functions == 0);
+
+ /* Create array of function pointers. Last element is 0, what shows
+ the end of the array. This array is used to free memory when process
+ is destroyed. */
+ proc->functions = (Function **) calloc (functions_num + 1,
+ sizeof (Function *));
+ if (proc->functions == NULL)
+ COIERROR ("Cannot allocate memory.");
+
+ /* Get handles for functions. */
+ for (i = 0; i < functions_num; i++)
+ {
+ MALLOC (Function *, function, sizeof (Function));
+
+ len = strlen (function_names[i]) + 1;
+
+ /* Start critical section. */
+ if (pthread_mutex_lock (&mutex) != 0)
+ COIERROR ("Cannot lock mutex.");
+
+ /* Send data to target. */
+ WRITE (proc->pipeline->pipe_target, &cmd, sizeof (cmd_t));
+ WRITE (proc->pipeline->pipe_target, &len, sizeof (size_t));
+ WRITE (proc->pipeline->pipe_target, function_names[i], len);
+
+ /* Receive data from target. */
+ READ (proc->pipeline->pipe_host, &ptr, sizeof (void *));
+
+ /* Finish critical section. */
+ if (pthread_mutex_unlock (&mutex) != 0)
+ COIERROR ("Cannot unlock mutex.");
+
+ /* Prepare output arguments. */
+ STRDUP (function->name, function_names[i]);
+ if (function->name == NULL)
+ COIERROR ("Cannot allocate memory.");
+ function->ptr = ptr;
+ function_handles[i] = (COIFUNCTION) function;
+
+ /* Save function pointer. */
+ proc->functions[i] = function;
+ }
+
+ return COI_SUCCESS;
+}
+
+
+COIRESULT
+SYMBOL_VERSION (COIProcessLoadLibraryFromMemory, 2) (COIPROCESS process,
+ const void *lib_buffer,
+ uint64_t lib_buffer_len,
+ const char *lib_name,
+ const char *lib_search_path,
+ const char *file_of_origin, // Ignored
+ uint64_t file_from_origin_offset, // Ignored
+ uint32_t flags, // Ignored
+ COILIBRARY *library) // Ignored
+{
+ COITRACE ("COIProcessLoadLibraryFromMemory");
+
+ char *lib_path;
+ cmd_t cmd = CMD_OPEN_LIBRARY;
+ int fd;
+ FILE *file;
+ size_t len;
+
+ /* Convert input arguments. */
+ Process *proc = (Process *) process;
+
+ /* Create target library file. */
+ MALLOC (char *, lib_path,
+ strlen (proc->engine->dir) + strlen (lib_name) + 2);
+ sprintf (lib_path, "%s/%s", proc->engine->dir, lib_name);
+ fd = open (lib_path, O_CLOEXEC | O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR);
+ if (fd < 0)
+ COIERROR ("Cannot create file %s.", lib_path);
+ file = fdopen (fd, "wb");
+ if (file == NULL)
+ COIERROR ("Cannot associate stream with file descriptor.");
+ if (fwrite (lib_buffer, 1, lib_buffer_len, file) != lib_buffer_len)
+ COIERROR ("Cannot write in file %s.", lib_path);
+ if (fclose (file) != 0)
+ COIERROR ("Cannot close file %s.", lib_path);
+
+ len = strlen (lib_path) + 1;
+
+ /* Start critical section. */
+ if (pthread_mutex_lock (&mutex) != 0)
+ COIERROR ("Cannot lock mutex.");
+
+ /* Make target open library. */
+ WRITE (proc->pipeline->pipe_target, &cmd, sizeof (cmd_t));
+ WRITE (proc->pipeline->pipe_target, &len, sizeof (size_t));
+ WRITE (proc->pipeline->pipe_target, lib_path, len);
+
+ /* Finish critical section. */
+ if (pthread_mutex_unlock (&mutex) != 0)
+ COIERROR ("Cannot unlock mutex.");
+
+ /* Clean up. */
+ free (lib_path);
+
+ return COI_SUCCESS;
+}
+
+
+COIRESULT
+SYMBOL_VERSION (COIProcessRegisterLibraries, 1) (uint32_t libraries_num,
+ const void **libraries,
+ const uint64_t *library_sizes,
+ const char **files_of_origin,
+ const uint64_t *file_of_origin_offsets)
+{
+ COITRACE ("COIProcessRegisterLibraries");
+
+ /* Looks like we have nothing to do here. */
+
+ return COI_SUCCESS;
+}
+
+
+uint64_t
+SYMBOL_VERSION (COIPerfGetCycleFrequency, 1) ()
+{
+ COITRACE ("COIPerfGetCycleFrequency");
+
+ return (uint64_t) CYCLE_FREQUENCY;
+}
+
+} // extern "C"
+
diff --git a/liboffloadmic/runtime/emulator/coi_host.h b/liboffloadmic/runtime/emulator/coi_host.h
new file mode 100644
index 00000000000..58ebd97ed7e
--- /dev/null
+++ b/liboffloadmic/runtime/emulator/coi_host.h
@@ -0,0 +1,55 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef COI_HOST_H_INCLUDED
+#define COI_HOST_H_INCLUDED
+
+#include "coi_common.h"
+
+#define COIERROR(...) \
+{ \
+ fprintf (stderr, "COI ERROR - HOST: "); \
+ fprintf (stderr, __VA_ARGS__); \
+ fprintf (stderr, "\n"); \
+ perror (NULL); \
+ return COI_ERROR; \
+}
+
+#ifdef DEBUG
+ #define COITRACE(...) \
+ { \
+ fprintf (stderr, "COI TRACE - HOST: "); \
+ fprintf (stderr, __VA_ARGS__); \
+ fprintf (stderr, "\n"); \
+ }
+#else
+ #define COITRACE(...) {}
+#endif
+
+#endif // COI_HOST_H_INCLUDED
diff --git a/liboffloadmic/runtime/emulator/coi_version_asm.h b/liboffloadmic/runtime/emulator/coi_version_asm.h
new file mode 100644
index 00000000000..672d062d72f
--- /dev/null
+++ b/liboffloadmic/runtime/emulator/coi_version_asm.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2010-2013 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 2.1.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ *
+ * Disclaimer: The codes contained in these modules may be specific
+ * to the Intel Software Development Platform codenamed Knights Ferry,
+ * and the Intel product codenamed Knights Corner, and are not backward
+ * compatible with other Intel products. Additionally, Intel will NOT
+ * support the codes or instruction set in future products.
+ *
+ * Intel offers no warranty of any kind regarding the code. This code is
+ * licensed on an "AS IS" basis and Intel is not obligated to provide
+ * any support, assistance, installation, training, or other services
+ * of any kind. Intel is also not obligated to provide any updates,
+ * enhancements or extensions. Intel specifically disclaims any warranty
+ * of merchantability, non-infringement, fitness for any particular
+ * purpose, and any other warranty.
+ *
+ * Further, Intel disclaims all liability of any kind, including but
+ * not limited to liability for infringement of any proprietary rights,
+ * relating to the use of the code, even if Intel is notified of the
+ * possibility of such liability. Except as expressly stated in an Intel
+ * license agreement provided with this code and agreed upon with Intel,
+ * no license, express or implied, by estoppel or otherwise, to any
+ * intellectual property rights is granted herein.
+ */
+
+__asm__ (".symver COIBufferAddRef1,COIBufferAddRef@@COI_1.0");
+__asm__ (".symver COIBufferCopy1,COIBufferCopy@@COI_1.0");
+__asm__ (".symver COIBufferCreate1,COIBufferCreate@@COI_1.0");
+__asm__ (".symver COIBufferCreateFromMemory1,COIBufferCreateFromMemory@@COI_1.0");
+__asm__ (".symver COIBufferDestroy1,COIBufferDestroy@@COI_1.0");
+__asm__ (".symver COIBufferGetSinkAddress1,COIBufferGetSinkAddress@@COI_1.0");
+__asm__ (".symver COIBufferMap1,COIBufferMap@@COI_1.0");
+__asm__ (".symver COIBufferRead1,COIBufferRead@@COI_1.0");
+__asm__ (".symver COIBufferReleaseRef1,COIBufferReleaseRef@@COI_1.0");
+__asm__ (".symver COIBufferSetState1,COIBufferSetState@@COI_1.0");
+__asm__ (".symver COIBufferUnmap1,COIBufferUnmap@@COI_1.0");
+__asm__ (".symver COIBufferWrite1,COIBufferWrite@@COI_1.0");
+__asm__ (".symver COIEngineGetCount1,COIEngineGetCount@@COI_1.0");
+__asm__ (".symver COIEngineGetHandle1,COIEngineGetHandle@@COI_1.0");
+__asm__ (".symver COIEngineGetIndex1,COIEngineGetIndex@@COI_1.0");
+__asm__ (".symver COIEventWait1,COIEventWait@@COI_1.0");
+__asm__ (".symver COIPerfGetCycleFrequency1,COIPerfGetCycleFrequency@@COI_1.0");
+__asm__ (".symver COIPipelineCreate1,COIPipelineCreate@@COI_1.0");
+__asm__ (".symver COIPipelineDestroy1,COIPipelineDestroy@@COI_1.0");
+__asm__ (".symver COIPipelineRunFunction1,COIPipelineRunFunction@@COI_1.0");
+__asm__ (".symver COIPipelineStartExecutingRunFunctions1,COIPipelineStartExecutingRunFunctions@@COI_1.0");
+__asm__ (".symver COIProcessCreateFromMemory1,COIProcessCreateFromMemory@@COI_1.0");
+__asm__ (".symver COIProcessDestroy1,COIProcessDestroy@@COI_1.0");
+__asm__ (".symver COIProcessGetFunctionHandles1,COIProcessGetFunctionHandles@@COI_1.0");
+__asm__ (".symver COIProcessLoadLibraryFromMemory2,COIProcessLoadLibraryFromMemory@COI_2.0");
+__asm__ (".symver COIProcessRegisterLibraries1,COIProcessRegisterLibraries@@COI_1.0");
+__asm__ (".symver COIProcessWaitForShutdown1,COIProcessWaitForShutdown@@COI_1.0");
+
diff --git a/liboffloadmic/runtime/emulator/coi_version_linker_script.map b/liboffloadmic/runtime/emulator/coi_version_linker_script.map
new file mode 100644
index 00000000000..496713fb4f7
--- /dev/null
+++ b/liboffloadmic/runtime/emulator/coi_version_linker_script.map
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2010-2013 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 2.1.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ *
+ * Disclaimer: The codes contained in these modules may be specific
+ * to the Intel Software Development Platform codenamed Knights Ferry,
+ * and the Intel product codenamed Knights Corner, and are not backward
+ * compatible with other Intel products. Additionally, Intel will NOT
+ * support the codes or instruction set in future products.
+ *
+ * Intel offers no warranty of any kind regarding the code. This code is
+ * licensed on an "AS IS" basis and Intel is not obligated to provide
+ * any support, assistance, installation, training, or other services
+ * of any kind. Intel is also not obligated to provide any updates,
+ * enhancements or extensions. Intel specifically disclaims any warranty
+ * of merchantability, non-infringement, fitness for any particular
+ * purpose, and any other warranty.
+ *
+ * Further, Intel disclaims all liability of any kind, including but
+ * not limited to liability for infringement of any proprietary rights,
+ * relating to the use of the code, even if Intel is notified of the
+ * possibility of such liability. Except as expressly stated in an Intel
+ * license agreement provided with this code and agreed upon with Intel,
+ * no license, express or implied, by estoppel or otherwise, to any
+ * intellectual property rights is granted herein.
+ */
+
+COI_1.0
+{
+ global:
+ COIBufferAddRef;
+ COIBufferCopy;
+ COIBufferCreate;
+ COIBufferCreateFromMemory;
+ COIBufferDestroy;
+ COIBufferGetSinkAddress;
+ COIBufferMap;
+ COIBufferRead;
+ COIBufferReleaseRef;
+ COIBufferSetState;
+ COIBufferUnmap;
+ COIBufferWrite;
+ COIEngineGetCount;
+ COIEngineGetHandle;
+ COIEngineGetIndex;
+ COIEventWait;
+ COIPerfGetCycleFrequency;
+ COIPipelineCreate;
+ COIPipelineDestroy;
+ COIPipelineRunFunction;
+ COIPipelineStartExecutingRunFunctions;
+ COIProcessCreateFromMemory;
+ COIProcessDestroy;
+ COIProcessGetFunctionHandles;
+ COIProcessLoadLibraryFromMemory;
+ COIProcessRegisterLibraries;
+ COIProcessWaitForShutdown;
+ local:
+ *;
+};
+
+COI_2.0
+{
+
+} COI_1.0;
+
diff --git a/liboffloadmic/runtime/emulator/myo_client.cpp b/liboffloadmic/runtime/emulator/myo_client.cpp
new file mode 100644
index 00000000000..bee59f0e113
--- /dev/null
+++ b/liboffloadmic/runtime/emulator/myo_client.cpp
@@ -0,0 +1,31 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* We don't need to implement any MYO client functions. */
+
diff --git a/liboffloadmic/runtime/emulator/myo_service.cpp b/liboffloadmic/runtime/emulator/myo_service.cpp
new file mode 100644
index 00000000000..e18abecd05c
--- /dev/null
+++ b/liboffloadmic/runtime/emulator/myo_service.cpp
@@ -0,0 +1,159 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "myo_service.h"
+
+#include "myo_version_asm.h"
+
+
+extern "C"
+{
+
+MYOACCESSAPI MyoError
+SYMBOL_VERSION (myoAcquire, 1) ()
+{
+ MYOTRACE ("myoAcquire");
+
+ assert (false);
+
+ return MYO_ERROR;
+}
+
+
+MYOACCESSAPI MyoError
+SYMBOL_VERSION (myoRelease, 1) ()
+{
+ MYOTRACE ("myoRelease");
+
+ assert (false);
+
+ return MYO_ERROR;
+}
+
+
+MYOACCESSAPI void
+SYMBOL_VERSION (myoSharedAlignedFree, 1) (void *ptr)
+{
+ MYOTRACE ("myoSharedAlignedFree");
+
+ assert (false);
+}
+
+
+MYOACCESSAPI void*
+SYMBOL_VERSION (myoSharedAlignedMalloc, 1) (size_t size,
+ size_t alignment)
+{
+ MYOTRACE ("myoSharedAlignedMalloc");
+
+ assert (false);
+
+ return 0;
+}
+
+
+MYOACCESSAPI void
+SYMBOL_VERSION (myoSharedFree, 1) (void *ptr)
+{
+ MYOTRACE ("myoSharedFree");
+
+ assert (false);
+}
+
+
+MYOACCESSAPI void*
+SYMBOL_VERSION (myoSharedMalloc, 1) (size_t size)
+{
+ MYOTRACE ("myoSharedMalloc");
+
+ assert (false);
+
+ return 0;
+}
+
+
+MYOACCESSAPI MyoError
+SYMBOL_VERSION (myoiLibInit, 1) (void *args,
+ void *init_func)
+{
+ MYOTRACE ("myoiLibInit");
+
+ assert (false);
+
+ return MYO_ERROR;
+}
+
+
+MYOACCESSAPI void
+SYMBOL_VERSION (myoiLibFini, 1) ()
+{
+ MYOTRACE ("myoiLibFini");
+
+ assert (false);
+}
+
+
+MyoError
+SYMBOL_VERSION (myoiMicVarTableRegister, 1) (void *table,
+ int num)
+{
+ MYOTRACE ("myoiMicVarTableRegister");
+
+ assert (false);
+
+ return MYO_ERROR;
+}
+
+
+MYOACCESSAPI MyoError
+SYMBOL_VERSION (myoiRemoteFuncRegister, 1) (MyoiRemoteFuncType type,
+ const char *name)
+{
+ MYOTRACE ("myoiRemoteFuncRegister");
+
+ /* Looks like we have nothing to do here. */
+
+ return MYO_SUCCESS;
+}
+
+
+MyoError
+SYMBOL_VERSION (myoiTargetFptrTableRegister, 1) (void *table,
+ int num,
+ int ordered)
+{
+ MYOTRACE ("myoiTargetFptrTableRegister");
+
+ assert (false);
+
+ return MYO_ERROR;
+}
+
+} // extern "C"
+
diff --git a/liboffloadmic/runtime/emulator/myo_service.h b/liboffloadmic/runtime/emulator/myo_service.h
new file mode 100644
index 00000000000..776e8c2c40d
--- /dev/null
+++ b/liboffloadmic/runtime/emulator/myo_service.h
@@ -0,0 +1,63 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef MYO_SERVICE_H_INCLUDED
+#define MYO_SERVICE_H_INCLUDED
+
+#include <myo.h>
+#include <myoimpl.h>
+#include <myotypes.h>
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define SYMBOL_VERSION(SYMBOL,VERSION) SYMBOL ## VERSION
+
+#define MYOERROR(...) \
+{ \
+ fprintf (stderr, "MYO ERROR - TARGET: "); \
+ fprintf (stderr, __VA_ARGS__); \
+ fprintf (stderr, "\n"); \
+ perror (NULL); \
+ return MYO_ERROR; \
+}
+
+#ifdef DEBUG
+ #define MYOTRACE(...) \
+ { \
+ fprintf (stderr, "MYO TRACE - TARGET: "); \
+ fprintf (stderr, __VA_ARGS__); \
+ fprintf (stderr, "\n"); \
+ }
+#else
+ #define MYOTRACE(...) {}
+#endif
+
+#endif // MYO_SERVICE_H_INCLUDED
diff --git a/liboffloadmic/runtime/emulator/myo_version_asm.h b/liboffloadmic/runtime/emulator/myo_version_asm.h
new file mode 100644
index 00000000000..2bd8302ab6a
--- /dev/null
+++ b/liboffloadmic/runtime/emulator/myo_version_asm.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2010-2013 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 2.1.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ *
+ * Disclaimer: The codes contained in these modules may be specific
+ * to the Intel Software Development Platform codenamed Knights Ferry,
+ * and the Intel product codenamed Knights Corner, and are not backward
+ * compatible with other Intel products. Additionally, Intel will NOT
+ * support the codes or instruction set in future products.
+ *
+ * Intel offers no warranty of any kind regarding the code. This code is
+ * licensed on an "AS IS" basis and Intel is not obligated to provide
+ * any support, assistance, installation, training, or other services
+ * of any kind. Intel is also not obligated to provide any updates,
+ * enhancements or extensions. Intel specifically disclaims any warranty
+ * of merchantability, non-infringement, fitness for any particular
+ * purpose, and any other warranty.
+ *
+ * Further, Intel disclaims all liability of any kind, including but
+ * not limited to liability for infringement of any proprietary rights,
+ * relating to the use of the code, even if Intel is notified of the
+ * possibility of such liability. Except as expressly stated in an Intel
+ * license agreement provided with this code and agreed upon with Intel,
+ * no license, express or implied, by estoppel or otherwise, to any
+ * intellectual property rights is granted herein.
+ */
+
+__asm__ (".symver myoAcquire1,myoAcquire@@MYO_1.0");
+__asm__ (".symver myoRelease1,myoRelease@@MYO_1.0");
+__asm__ (".symver myoSharedAlignedFree1,myoSharedAlignedFree@@MYO_1.0");
+__asm__ (".symver myoSharedAlignedMalloc1,myoSharedAlignedMalloc@@MYO_1.0");
+__asm__ (".symver myoSharedFree1,myoSharedFree@@MYO_1.0");
+__asm__ (".symver myoSharedMalloc1,myoSharedMalloc@@MYO_1.0");
+
+__asm__ (".symver myoiLibInit1,myoiLibInit@@MYO_1.0");
+__asm__ (".symver myoiLibFini1,myoiLibFini@@MYO_1.0");
+__asm__ (".symver myoiMicVarTableRegister1,myoiMicVarTableRegister@@MYO_1.0");
+__asm__ (".symver myoiRemoteFuncRegister1,myoiRemoteFuncRegister@@MYO_1.0");
+__asm__ (".symver myoiTargetFptrTableRegister1,myoiTargetFptrTableRegister@@MYO_1.0");
+
diff --git a/liboffloadmic/runtime/emulator/myo_version_linker_script.map b/liboffloadmic/runtime/emulator/myo_version_linker_script.map
new file mode 100644
index 00000000000..361b289d1b6
--- /dev/null
+++ b/liboffloadmic/runtime/emulator/myo_version_linker_script.map
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2010-2013 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, version 2.1.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ *
+ * Disclaimer: The codes contained in these modules may be specific
+ * to the Intel Software Development Platform codenamed Knights Ferry,
+ * and the Intel product codenamed Knights Corner, and are not backward
+ * compatible with other Intel products. Additionally, Intel will NOT
+ * support the codes or instruction set in future products.
+ *
+ * Intel offers no warranty of any kind regarding the code. This code is
+ * licensed on an "AS IS" basis and Intel is not obligated to provide
+ * any support, assistance, installation, training, or other services
+ * of any kind. Intel is also not obligated to provide any updates,
+ * enhancements or extensions. Intel specifically disclaims any warranty
+ * of merchantability, non-infringement, fitness for any particular
+ * purpose, and any other warranty.
+ *
+ * Further, Intel disclaims all liability of any kind, including but
+ * not limited to liability for infringement of any proprietary rights,
+ * relating to the use of the code, even if Intel is notified of the
+ * possibility of such liability. Except as expressly stated in an Intel
+ * license agreement provided with this code and agreed upon with Intel,
+ * no license, express or implied, by estoppel or otherwise, to any
+ * intellectual property rights is granted herein.
+ */
+
+MYO_1.0
+{
+ global:
+ myoAcquire;
+ myoRelease;
+ myoSharedAlignedFree;
+ myoSharedAlignedMalloc;
+ myoSharedFree;
+ myoSharedMalloc;
+
+ myoiLibInit;
+ myoiLibFini;
+ myoiMicVarTableRegister;
+ myoiRemoteFuncRegister;
+ myoiTargetFptrTableRegister;
+
+ local:
+ *;
+};
+
diff --git a/liboffloadmic/runtime/liboffload_error.c b/liboffloadmic/runtime/liboffload_error.c
new file mode 100644
index 00000000000..eb5699d3c5c
--- /dev/null
+++ b/liboffloadmic/runtime/liboffload_error.c
@@ -0,0 +1,475 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include <stdio.h>
+#include <stdarg.h>
+#ifndef va_copy
+#define va_copy(dst, src) ((dst) = (src))
+#endif
+
+#include "liboffload_msg.h"
+
+#include "liboffload_error_codes.h"
+
+/***********************************************/
+/* error-handling function, liboffload_error_support */
+/***********************************************/
+
+void __liboffload_error_support(error_types input_tag, ...)
+{
+ va_list args;
+ va_start(args, input_tag);
+
+ switch (input_tag) {
+ case c_device_is_not_available:
+ write_message(stderr, msg_c_device_is_not_available, args);
+ break;
+ case c_invalid_device_number:
+ write_message(stderr, msg_c_invalid_device_number, args);
+ break;
+ case c_send_func_ptr:
+ write_message(stderr, msg_c_send_func_ptr, args);
+ break;
+ case c_receive_func_ptr:
+ write_message(stderr, msg_c_receive_func_ptr, args);
+ break;
+ case c_malloc:
+ write_message(stderr, msg_c_malloc, args);
+ break;
+ case c_offload_malloc:
+ write_message(stderr, msg_c_offload_malloc, args);
+ break;
+ case c_offload1:
+ write_message(stderr, msg_c_offload1, args);
+ break;
+ case c_unknown_var_type:
+ write_message(stderr, c_unknown_var_type, args);
+ break;
+ case c_invalid_env_var_value:
+ write_message(stderr, msg_c_invalid_env_var_value, args);
+ break;
+ case c_invalid_env_var_int_value:
+ write_message(stderr, msg_c_invalid_env_var_int_value, args);
+ break;
+ case c_invalid_env_report_value:
+ write_message(stderr, msg_c_invalid_env_report_value, args);
+ break;
+ case c_offload_signaled1:
+ write_message(stderr, msg_c_offload_signaled1, args);
+ break;
+ case c_offload_signaled2:
+ write_message(stderr, msg_c_offload_signaled2, args);
+ break;
+ case c_myowrapper_checkresult:
+ write_message(stderr, msg_c_myowrapper_checkresult, args);
+ break;
+ case c_myotarget_checkresult:
+ write_message(stderr, msg_c_myotarget_checkresult, args);
+ break;
+ case c_offload_descriptor_offload:
+ write_message(stderr, msg_c_offload_descriptor_offload, args);
+ break;
+ case c_merge_var_descs1:
+ write_message(stderr, msg_c_merge_var_descs1, args);
+ break;
+ case c_merge_var_descs2:
+ write_message(stderr, msg_c_merge_var_descs2, args);
+ break;
+ case c_mic_parse_env_var_list1:
+ write_message(stderr, msg_c_mic_parse_env_var_list1, args);
+ break;
+ case c_mic_parse_env_var_list2:
+ write_message(stderr, msg_c_mic_parse_env_var_list2, args);
+ break;
+ case c_mic_process_exit_ret:
+ write_message(stderr, msg_c_mic_process_exit_ret, args);
+ break;
+ case c_mic_process_exit_sig:
+ write_message(stderr, msg_c_mic_process_exit_sig, args);
+ break;
+ case c_mic_process_exit:
+ write_message(stderr, msg_c_mic_process_exit, args);
+ break;
+ case c_mic_init3:
+ write_message(stderr, msg_c_mic_init3, args);
+ break;
+ case c_mic_init4:
+ write_message(stderr, msg_c_mic_init4, args);
+ break;
+ case c_mic_init5:
+ write_message(stderr, msg_c_mic_init5, args);
+ break;
+ case c_mic_init6:
+ write_message(stderr, msg_c_mic_init6, args);
+ break;
+ case c_no_static_var_data:
+ write_message(stderr, msg_c_no_static_var_data, args);
+ break;
+ case c_no_ptr_data:
+ write_message(stderr, msg_c_no_ptr_data, args);
+ break;
+ case c_get_engine_handle:
+ write_message(stderr, msg_c_get_engine_handle, args);
+ break;
+ case c_get_engine_index:
+ write_message(stderr, msg_c_get_engine_index, args);
+ break;
+ case c_process_create:
+ write_message(stderr, msg_c_process_create, args);
+ break;
+ case c_process_wait_shutdown:
+ write_message(stderr, msg_c_process_wait_shutdown, args);
+ break;
+ case c_process_proxy_flush:
+ write_message(stderr, msg_c_process_proxy_flush, args);
+ break;
+ case c_process_get_func_handles:
+ write_message(stderr, msg_c_process_get_func_handles, args);
+ break;
+ case c_load_library:
+ write_message(stderr, msg_c_load_library, args);
+ break;
+ case c_coipipe_max_number:
+ write_message(stderr, msg_c_coi_pipeline_max_number, args);
+ break;
+ case c_pipeline_create:
+ write_message(stderr, msg_c_pipeline_create, args);
+ break;
+ case c_pipeline_run_func:
+ write_message(stderr, msg_c_pipeline_run_func, args);
+ break;
+ case c_pipeline_start_run_funcs:
+ write_message(stderr, msg_c_pipeline_start_run_funcs, args);
+ break;
+ case c_buf_create:
+ write_message(stderr, msg_c_buf_create, args);
+ break;
+ case c_buf_create_out_of_mem:
+ write_message(stderr, msg_c_buf_create_out_of_mem, args);
+ break;
+ case c_buf_create_from_mem:
+ write_message(stderr, msg_c_buf_create_from_mem, args);
+ break;
+ case c_buf_destroy:
+ write_message(stderr, msg_c_buf_destroy, args);
+ break;
+ case c_buf_map:
+ write_message(stderr, msg_c_buf_map, args);
+ break;
+ case c_buf_unmap:
+ write_message(stderr, msg_c_buf_unmap, args);
+ break;
+ case c_buf_read:
+ write_message(stderr, msg_c_buf_read, args);
+ break;
+ case c_buf_write:
+ write_message(stderr, msg_c_buf_write, args);
+ break;
+ case c_buf_copy:
+ write_message(stderr, msg_c_buf_copy, args);
+ break;
+ case c_buf_get_address:
+ write_message(stderr, msg_c_buf_get_address, args);
+ break;
+ case c_buf_add_ref:
+ write_message(stderr, msg_c_buf_add_ref, args);
+ break;
+ case c_buf_release_ref:
+ write_message(stderr, msg_c_buf_release_ref, args);
+ break;
+ case c_buf_set_state:
+ write_message(stderr, msg_c_buf_set_state, args);
+ break;
+ case c_event_wait:
+ write_message(stderr, msg_c_event_wait, args);
+ break;
+ case c_zero_or_neg_ptr_len:
+ write_message(stderr, msg_c_zero_or_neg_ptr_len, args);
+ break;
+ case c_zero_or_neg_transfer_size:
+ write_message(stderr, msg_c_zero_or_neg_transfer_size, args);
+ break;
+ case c_bad_ptr_mem_range:
+ write_message(stderr, msg_c_bad_ptr_mem_range, args);
+ break;
+ case c_different_src_and_dstn_sizes:
+ write_message(stderr, msg_c_different_src_and_dstn_sizes, args);
+ break;
+ case c_ranges_dont_match:
+ write_message(stderr, msg_c_ranges_dont_match, args);
+ break;
+ case c_destination_is_over:
+ write_message(stderr, msg_c_destination_is_over, args);
+ break;
+ case c_slice_of_noncont_array:
+ write_message(stderr, msg_c_slice_of_noncont_array, args);
+ break;
+ case c_non_contiguous_dope_vector:
+ write_message(stderr, msg_c_non_contiguous_dope_vector, args);
+ break;
+ case c_pointer_array_mismatch:
+ write_message(stderr, msg_c_pointer_array_mismatch, args);
+ break;
+ case c_omp_invalid_device_num_env:
+ write_message(stderr, msg_c_omp_invalid_device_num_env, args);
+ break;
+ case c_omp_invalid_device_num:
+ write_message(stderr, msg_c_omp_invalid_device_num, args);
+ break;
+ case c_unknown_binary_type:
+ write_message(stderr, msg_c_unknown_binary_type, args);
+ break;
+ case c_multiple_target_exes:
+ write_message(stderr, msg_c_multiple_target_exes, args);
+ break;
+ case c_no_target_exe:
+ write_message(stderr, msg_c_no_target_exe, args);
+ break;
+ case c_report_unknown_timer_node:
+ write_message(stderr, msg_c_report_unknown_timer_node, args);
+ break;
+ case c_report_unknown_trace_node:
+ write_message(stderr, msg_c_report_unknown_trace_node, args);
+ break;
+ }
+ va_end(args);
+}
+
+char const * report_get_message_str(error_types input_tag)
+{
+ switch (input_tag) {
+ case c_report_title:
+ return (offload_get_message_str(msg_c_report_title));
+ case c_report_from_file:
+ return (offload_get_message_str(msg_c_report_from_file));
+ case c_report_offload:
+ return (offload_get_message_str(msg_c_report_offload));
+ case c_report_mic:
+ return (offload_get_message_str(msg_c_report_mic));
+ case c_report_file:
+ return (offload_get_message_str(msg_c_report_file));
+ case c_report_line:
+ return (offload_get_message_str(msg_c_report_line));
+ case c_report_host:
+ return (offload_get_message_str(msg_c_report_host));
+ case c_report_tag:
+ return (offload_get_message_str(msg_c_report_tag));
+ case c_report_cpu_time:
+ return (offload_get_message_str(msg_c_report_cpu_time));
+ case c_report_seconds:
+ return (offload_get_message_str(msg_c_report_seconds));
+ case c_report_cpu_to_mic_data:
+ return (offload_get_message_str(msg_c_report_cpu_to_mic_data));
+ case c_report_bytes:
+ return (offload_get_message_str(msg_c_report_bytes));
+ case c_report_mic_time:
+ return (offload_get_message_str(msg_c_report_mic_time));
+ case c_report_mic_to_cpu_data:
+ return (offload_get_message_str(msg_c_report_mic_to_cpu_data));
+ case c_report_compute:
+ return (offload_get_message_str(msg_c_report_compute));
+ case c_report_copyin_data:
+ return (offload_get_message_str(msg_c_report_copyin_data));
+ case c_report_copyout_data:
+ return (offload_get_message_str(msg_c_report_copyout_data));
+ case c_report_create_buf_host:
+ return (offload_get_message_str(c_report_create_buf_host));
+ case c_report_create_buf_mic:
+ return (offload_get_message_str(msg_c_report_create_buf_mic));
+ case c_report_destroy:
+ return (offload_get_message_str(msg_c_report_destroy));
+ case c_report_gather_copyin_data:
+ return (offload_get_message_str(msg_c_report_gather_copyin_data));
+ case c_report_gather_copyout_data:
+ return (offload_get_message_str(msg_c_report_gather_copyout_data));
+ case c_report_state_signal:
+ return (offload_get_message_str(msg_c_report_state_signal));
+ case c_report_signal:
+ return (offload_get_message_str(msg_c_report_signal));
+ case c_report_wait:
+ return (offload_get_message_str(msg_c_report_wait));
+ case c_report_init:
+ return (offload_get_message_str(msg_c_report_init));
+ case c_report_init_func:
+ return (offload_get_message_str(msg_c_report_init_func));
+ case c_report_logical_card:
+ return (offload_get_message_str(msg_c_report_logical_card));
+ case c_report_mic_myo_fptr:
+ return (offload_get_message_str(msg_c_report_mic_myo_fptr));
+ case c_report_mic_myo_shared:
+ return (offload_get_message_str(msg_c_report_mic_myo_shared));
+ case c_report_myoacquire:
+ return (offload_get_message_str(msg_c_report_myoacquire));
+ case c_report_myofini:
+ return (offload_get_message_str(msg_c_report_myofini));
+ case c_report_myoinit:
+ return (offload_get_message_str(msg_c_report_myoinit));
+ case c_report_myoregister:
+ return (offload_get_message_str(msg_c_report_myoregister));
+ case c_report_myorelease:
+ return (offload_get_message_str(msg_c_report_myorelease));
+ case c_report_myosharedalignedfree:
+ return (
+ offload_get_message_str(msg_c_report_myosharedalignedfree));
+ case c_report_myosharedalignedmalloc:
+ return (
+ offload_get_message_str(msg_c_report_myosharedalignedmalloc));
+ case c_report_myosharedfree:
+ return (offload_get_message_str(msg_c_report_myosharedfree));
+ case c_report_myosharedmalloc:
+ return (offload_get_message_str(msg_c_report_myosharedmalloc));
+ case c_report_physical_card:
+ return (offload_get_message_str(msg_c_report_physical_card));
+ case c_report_receive_pointer_data:
+ return (
+ offload_get_message_str(msg_c_report_receive_pointer_data));
+ case c_report_received_pointer_data:
+ return (
+ offload_get_message_str(msg_c_report_received_pointer_data));
+ case c_report_register:
+ return (offload_get_message_str(msg_c_report_register));
+ case c_report_scatter_copyin_data:
+ return (offload_get_message_str(msg_c_report_scatter_copyin_data));
+ case c_report_scatter_copyout_data:
+ return (
+ offload_get_message_str(msg_c_report_scatter_copyout_data));
+ case c_report_send_pointer_data:
+ return (offload_get_message_str(msg_c_report_send_pointer_data));
+ case c_report_sent_pointer_data:
+ return (offload_get_message_str(msg_c_report_sent_pointer_data));
+ case c_report_start:
+ return (offload_get_message_str(msg_c_report_start));
+ case c_report_start_target_func:
+ return (offload_get_message_str(msg_c_report_start_target_func));
+ case c_report_state:
+ return (offload_get_message_str(msg_c_report_state));
+ case c_report_unregister:
+ return (offload_get_message_str(msg_c_report_unregister));
+ case c_report_var:
+ return (offload_get_message_str(msg_c_report_var));
+
+ default:
+ LIBOFFLOAD_ERROR(c_report_unknown_trace_node);
+ abort();
+ }
+}
+
+char const * report_get_host_stage_str(int i)
+{
+ switch (i) {
+ case c_offload_host_total_offload:
+ return (
+ offload_get_message_str(msg_c_report_host_total_offload_time));
+ case c_offload_host_initialize:
+ return (offload_get_message_str(msg_c_report_host_initialize));
+ case c_offload_host_target_acquire:
+ return (
+ offload_get_message_str(msg_c_report_host_target_acquire));
+ case c_offload_host_wait_deps:
+ return (offload_get_message_str(msg_c_report_host_wait_deps));
+ case c_offload_host_setup_buffers:
+ return (offload_get_message_str(msg_c_report_host_setup_buffers));
+ case c_offload_host_alloc_buffers:
+ return (offload_get_message_str(msg_c_report_host_alloc_buffers));
+ case c_offload_host_setup_misc_data:
+ return (
+ offload_get_message_str(msg_c_report_host_setup_misc_data));
+ case c_offload_host_alloc_data_buffer:
+ return (
+ offload_get_message_str(msg_c_report_host_alloc_data_buffer));
+ case c_offload_host_send_pointers:
+ return (offload_get_message_str(msg_c_report_host_send_pointers));
+ case c_offload_host_gather_inputs:
+ return (offload_get_message_str(msg_c_report_host_gather_inputs));
+ case c_offload_host_map_in_data_buffer:
+ return (
+ offload_get_message_str(msg_c_report_host_map_in_data_buffer));
+ case c_offload_host_unmap_in_data_buffer:
+ return (offload_get_message_str(
+ msg_c_report_host_unmap_in_data_buffer));
+ case c_offload_host_start_compute:
+ return (offload_get_message_str(msg_c_report_host_start_compute));
+ case c_offload_host_wait_compute:
+ return (offload_get_message_str(msg_c_report_host_wait_compute));
+ case c_offload_host_start_buffers_reads:
+ return (offload_get_message_str(
+ msg_c_report_host_start_buffers_reads));
+ case c_offload_host_scatter_outputs:
+ return (
+ offload_get_message_str(msg_c_report_host_scatter_outputs));
+ case c_offload_host_map_out_data_buffer:
+ return (offload_get_message_str(
+ msg_c_report_host_map_out_data_buffer));
+ case c_offload_host_unmap_out_data_buffer:
+ return (offload_get_message_str(
+ msg_c_report_host_unmap_out_data_buffer));
+ case c_offload_host_wait_buffers_reads:
+ return (
+ offload_get_message_str(msg_c_report_host_wait_buffers_reads));
+ case c_offload_host_destroy_buffers:
+ return (
+ offload_get_message_str(msg_c_report_host_destroy_buffers));
+ default:
+ LIBOFFLOAD_ERROR(c_report_unknown_timer_node);
+ abort();
+ }
+}
+
+char const * report_get_target_stage_str(int i)
+{
+ switch (i) {
+ case c_offload_target_total_time:
+ return (offload_get_message_str(msg_c_report_target_total_time));
+ case c_offload_target_descriptor_setup:
+ return (
+ offload_get_message_str(msg_c_report_target_descriptor_setup));
+ case c_offload_target_func_lookup:
+ return (offload_get_message_str(msg_c_report_target_func_lookup));
+ case c_offload_target_func_time:
+ return (offload_get_message_str(msg_c_report_target_func_time));
+ case c_offload_target_scatter_inputs:
+ return (
+ offload_get_message_str(msg_c_report_target_scatter_inputs));
+ case c_offload_target_add_buffer_refs:
+ return (
+ offload_get_message_str(msg_c_report_target_add_buffer_refs));
+ case c_offload_target_compute:
+ return (offload_get_message_str(msg_c_report_target_compute));
+ case c_offload_target_gather_outputs:
+ return (offload_get_message_str
+ (msg_c_report_target_gather_outputs));
+ case c_offload_target_release_buffer_refs:
+ return (offload_get_message_str(
+ msg_c_report_target_release_buffer_refs));
+ default:
+ LIBOFFLOAD_ERROR(c_report_unknown_timer_node);
+ abort();
+ }
+}
diff --git a/liboffloadmic/runtime/liboffload_error_codes.h b/liboffloadmic/runtime/liboffload_error_codes.h
new file mode 100644
index 00000000000..c33bef56236
--- /dev/null
+++ b/liboffloadmic/runtime/liboffload_error_codes.h
@@ -0,0 +1,297 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#if !defined(LIBOFFLOAD_ERROR_CODES_H)
+#define LIBOFFLOAD_ERROR_CODES_H
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+typedef enum
+{
+ c_device_is_not_available = 0,
+ c_invalid_device_number,
+ c_offload1,
+ c_unknown_var_type,
+ c_send_func_ptr,
+ c_receive_func_ptr,
+ c_malloc,
+ c_offload_malloc,
+ c_invalid_env_var_value,
+ c_invalid_env_var_int_value,
+ c_invalid_env_report_value,
+ c_offload_signaled1,
+ c_offload_signaled2,
+ c_myotarget_checkresult,
+ c_myowrapper_checkresult,
+ c_offload_descriptor_offload,
+ c_merge_var_descs1,
+ c_merge_var_descs2,
+ c_mic_parse_env_var_list1,
+ c_mic_parse_env_var_list2,
+ c_mic_process_exit_ret,
+ c_mic_process_exit_sig,
+ c_mic_process_exit,
+ c_mic_init3,
+ c_mic_init4,
+ c_mic_init5,
+ c_mic_init6,
+ c_no_static_var_data,
+ c_no_ptr_data,
+ c_get_engine_handle,
+ c_get_engine_index,
+ c_process_create,
+ c_process_get_func_handles,
+ c_process_wait_shutdown,
+ c_process_proxy_flush,
+ c_load_library,
+ c_pipeline_create,
+ c_pipeline_run_func,
+ c_pipeline_start_run_funcs,
+ c_buf_create,
+ c_buf_create_out_of_mem,
+ c_buf_create_from_mem,
+ c_buf_destroy,
+ c_buf_map,
+ c_buf_unmap,
+ c_buf_read,
+ c_buf_write,
+ c_buf_copy,
+ c_buf_get_address,
+ c_buf_add_ref,
+ c_buf_release_ref,
+ c_buf_set_state,
+ c_event_wait,
+ c_zero_or_neg_ptr_len,
+ c_zero_or_neg_transfer_size,
+ c_bad_ptr_mem_range,
+ c_different_src_and_dstn_sizes,
+ c_ranges_dont_match,
+ c_destination_is_over,
+ c_slice_of_noncont_array,
+ c_non_contiguous_dope_vector,
+ c_pointer_array_mismatch,
+ c_omp_invalid_device_num_env,
+ c_omp_invalid_device_num,
+ c_unknown_binary_type,
+ c_multiple_target_exes,
+ c_no_target_exe,
+ c_report_host,
+ c_report_target,
+ c_report_title,
+ c_report_from_file,
+ c_report_file,
+ c_report_line,
+ c_report_tag,
+ c_report_seconds,
+ c_report_bytes,
+ c_report_mic,
+ c_report_cpu_time,
+ c_report_cpu_to_mic_data,
+ c_report_mic_time,
+ c_report_mic_to_cpu_data,
+ c_report_unknown_timer_node,
+ c_report_unknown_trace_node,
+ c_report_offload,
+ c_report_w_tag,
+ c_report_state,
+ c_report_start,
+ c_report_init,
+ c_report_logical_card,
+ c_report_physical_card,
+ c_report_register,
+ c_report_init_func,
+ c_report_create_buf_host,
+ c_report_create_buf_mic,
+ c_report_send_pointer_data,
+ c_report_sent_pointer_data,
+ c_report_gather_copyin_data,
+ c_report_copyin_data,
+ c_report_state_signal,
+ c_report_signal,
+ c_report_wait,
+ c_report_compute,
+ c_report_receive_pointer_data,
+ c_report_received_pointer_data,
+ c_report_start_target_func,
+ c_report_var,
+ c_report_scatter_copyin_data,
+ c_report_gather_copyout_data,
+ c_report_scatter_copyout_data,
+ c_report_copyout_data,
+ c_report_unregister,
+ c_report_destroy,
+ c_report_myoinit,
+ c_report_myoregister,
+ c_report_myofini,
+ c_report_mic_myo_shared,
+ c_report_mic_myo_fptr,
+ c_report_myosharedmalloc,
+ c_report_myosharedfree,
+ c_report_myosharedalignedmalloc,
+ c_report_myosharedalignedfree,
+ c_report_myoacquire,
+ c_report_myorelease,
+ c_coipipe_max_number
+} error_types;
+
+enum OffloadHostPhase {
+ // Total time on host for entire offload
+ c_offload_host_total_offload = 0,
+
+ // Time to load target binary
+ c_offload_host_initialize,
+
+ // Time to acquire lrb availability dynamically
+ c_offload_host_target_acquire,
+
+ // Time to wait for dependencies
+ c_offload_host_wait_deps,
+
+ // Time to allocate pointer buffers, initiate writes for pointers
+ // and calculate size of copyin/copyout buffer
+ c_offload_host_setup_buffers,
+
+ // Time to allocate pointer buffers
+ c_offload_host_alloc_buffers,
+
+ // Time to initialize misc data
+ c_offload_host_setup_misc_data,
+
+ // Time to allocate copyin/copyout buffer
+ c_offload_host_alloc_data_buffer,
+
+ // Time to initiate writes from host pointers to buffers
+ c_offload_host_send_pointers,
+
+ // Time to Gather IN data of offload into buffer
+ c_offload_host_gather_inputs,
+
+ // Time to map buffer
+ c_offload_host_map_in_data_buffer,
+
+ // Time to unmap buffer
+ c_offload_host_unmap_in_data_buffer,
+
+ // Time to start remote function call that does computation on lrb
+ c_offload_host_start_compute,
+
+ // Time to wait for compute to finish
+ c_offload_host_wait_compute,
+
+ // Time to initiate reads from pointer buffers
+ c_offload_host_start_buffers_reads,
+
+ // Time to update host variabels with OUT data from buffer
+ c_offload_host_scatter_outputs,
+
+ // Time to map buffer
+ c_offload_host_map_out_data_buffer,
+
+ // Time to unmap buffer
+ c_offload_host_unmap_out_data_buffer,
+
+ // Time to wait reads from buffers to finish
+ c_offload_host_wait_buffers_reads,
+
+ // Time to destroy buffers that are no longer needed
+ c_offload_host_destroy_buffers,
+
+ // LAST TIME MONITOR
+ c_offload_host_max_phase
+};
+
+enum OffloadTargetPhase {
+ // Total time spent on the target
+ c_offload_target_total_time = 0,
+
+ // Time to initialize offload descriptor
+ c_offload_target_descriptor_setup,
+
+ // Time to find target entry point in lookup table
+ c_offload_target_func_lookup,
+
+ // Total time spend executing offload entry
+ c_offload_target_func_time,
+
+ // Time to initialize target variables with IN values from buffer
+ c_offload_target_scatter_inputs,
+
+ // Time to add buffer reference for pointer buffers
+ c_offload_target_add_buffer_refs,
+
+ // Total time on lrb for computation
+ c_offload_target_compute,
+
+ // On lrb, time to copy OUT into buffer
+ c_offload_target_gather_outputs,
+
+ // Time to release buffer references
+ c_offload_target_release_buffer_refs,
+
+ // LAST TIME MONITOR
+ c_offload_target_max_phase
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+void __liboffload_error_support(error_types input_tag, ...);
+void __liboffload_report_support(error_types input_tag, ...);
+char const *offload_get_message_str(int msgCode);
+char const * report_get_message_str(error_types input_tag);
+char const * report_get_host_stage_str(int i);
+char const * report_get_target_stage_str(int i);
+#ifdef __cplusplus
+}
+#endif
+
+#define test_msg_cat(nm, msg) \
+ fprintf(stderr, "\t TEST for %s \n \t", nm); \
+ __liboffload_error_support(msg);
+
+#define test_msg_cat1(nm, msg, ...) \
+ fprintf(stderr, "\t TEST for %s \n \t", nm); \
+ __liboffload_error_support(msg, __VA_ARGS__);
+
+void write_message(FILE * file, int msgCode, va_list args_p);
+
+#define LIBOFFLOAD_ERROR __liboffload_error_support
+
+#ifdef TARGET_WINNT
+#define LIBOFFLOAD_ABORT \
+ _set_abort_behavior(0, _WRITE_ABORT_MSG); \
+ abort()
+#else
+#define LIBOFFLOAD_ABORT \
+ abort()
+#endif
+
+#endif // !defined(LIBOFFLOAD_ERROR_CODES_H)
diff --git a/liboffloadmic/runtime/liboffload_msg.c b/liboffloadmic/runtime/liboffload_msg.c
new file mode 100644
index 00000000000..c6d9fa7db1e
--- /dev/null
+++ b/liboffloadmic/runtime/liboffload_msg.c
@@ -0,0 +1,67 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+// ===========================================================================
+// Bring in the static string table and the enumerations for indexing into
+// it.
+// ===========================================================================
+
+#include "liboffload_msg.h"
+
+# define DYNART_STDERR_PUTS(__message_text__) fputs((__message_text__),stderr)
+
+// ===========================================================================
+// Now the code for accessing the message catalogs
+// ===========================================================================
+
+
+ void write_message(FILE * file, int msgCode, va_list args_p) {
+ va_list args;
+ char buf[1024];
+
+ va_copy(args, args_p);
+ buf[0] = '\n';
+ vsnprintf(buf + 1, sizeof(buf) - 2,
+ MESSAGE_TABLE_NAME[ msgCode ], args);
+ strcat(buf, "\n");
+ va_end(args);
+ fputs(buf, file);
+ fflush(file);
+ }
+
+ char const *offload_get_message_str(int msgCode) {
+ return MESSAGE_TABLE_NAME[ msgCode ];
+ }
diff --git a/liboffloadmic/runtime/liboffload_msg.h b/liboffloadmic/runtime/liboffload_msg.h
new file mode 100644
index 00000000000..e43b6b63551
--- /dev/null
+++ b/liboffloadmic/runtime/liboffload_msg.h
@@ -0,0 +1,348 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+// file: liboffload_msg.h
+enum {
+ __dummy__ = 0,
+ msg_c_device_is_not_available,
+ msg_c_invalid_device_number,
+ msg_c_send_func_ptr,
+ msg_c_receive_func_ptr,
+ msg_c_malloc,
+ msg_c_offload_malloc,
+ msg_c_offload1,
+ msg_c_unknown_var_type,
+ msg_c_invalid_env_var_value,
+ msg_c_invalid_env_var_int_value,
+ msg_c_invalid_env_report_value,
+ msg_c_offload_signaled1,
+ msg_c_offload_signaled2,
+ msg_c_myowrapper_checkresult,
+ msg_c_myotarget_checkresult,
+ msg_c_offload_descriptor_offload,
+ msg_c_merge_var_descs1,
+ msg_c_merge_var_descs2,
+ msg_c_mic_parse_env_var_list1,
+ msg_c_mic_parse_env_var_list2,
+ msg_c_mic_process_exit_ret,
+ msg_c_mic_process_exit_sig,
+ msg_c_mic_process_exit,
+ msg_c_mic_init3,
+ msg_c_mic_init4,
+ msg_c_mic_init5,
+ msg_c_mic_init6,
+ msg_c_no_static_var_data,
+ msg_c_no_ptr_data,
+ msg_c_get_engine_handle,
+ msg_c_get_engine_index,
+ msg_c_process_create,
+ msg_c_process_get_func_handles,
+ msg_c_process_wait_shutdown,
+ msg_c_process_proxy_flush,
+ msg_c_load_library,
+ msg_c_pipeline_create,
+ msg_c_pipeline_run_func,
+ msg_c_pipeline_start_run_funcs,
+ msg_c_buf_create,
+ msg_c_buf_create_out_of_mem,
+ msg_c_buf_create_from_mem,
+ msg_c_buf_destroy,
+ msg_c_buf_map,
+ msg_c_buf_unmap,
+ msg_c_buf_read,
+ msg_c_buf_write,
+ msg_c_buf_copy,
+ msg_c_buf_get_address,
+ msg_c_buf_add_ref,
+ msg_c_buf_release_ref,
+ msg_c_buf_set_state,
+ msg_c_event_wait,
+ msg_c_zero_or_neg_ptr_len,
+ msg_c_zero_or_neg_transfer_size,
+ msg_c_bad_ptr_mem_range,
+ msg_c_different_src_and_dstn_sizes,
+ msg_c_non_contiguous_dope_vector,
+ msg_c_omp_invalid_device_num_env,
+ msg_c_omp_invalid_device_num,
+ msg_c_unknown_binary_type,
+ msg_c_multiple_target_exes,
+ msg_c_no_target_exe,
+ msg_c_report_unknown_timer_node,
+ msg_c_report_unknown_trace_node,
+ msg_c_report_host,
+ msg_c_report_mic,
+ msg_c_report_title,
+ msg_c_report_seconds,
+ msg_c_report_bytes,
+ msg_c_report_cpu_time,
+ msg_c_report_mic_time,
+ msg_c_report_tag,
+ msg_c_report_from_file,
+ msg_c_report_file,
+ msg_c_report_line,
+ msg_c_report_cpu_to_mic_data,
+ msg_c_report_mic_to_cpu_data,
+ msg_c_report_offload,
+ msg_c_report_w_tag,
+ msg_c_report_state,
+ msg_c_report_start,
+ msg_c_report_init,
+ msg_c_report_logical_card,
+ msg_c_report_physical_card,
+ msg_c_report_register,
+ msg_c_report_init_func,
+ msg_c_report_create_buf_host,
+ msg_c_report_create_buf_mic,
+ msg_c_report_send_pointer_data,
+ msg_c_report_sent_pointer_data,
+ msg_c_report_gather_copyin_data,
+ msg_c_report_copyin_data,
+ msg_c_report_state_signal,
+ msg_c_report_signal,
+ msg_c_report_wait,
+ msg_c_report_compute,
+ msg_c_report_receive_pointer_data,
+ msg_c_report_received_pointer_data,
+ msg_c_report_start_target_func,
+ msg_c_report_var,
+ msg_c_report_scatter_copyin_data,
+ msg_c_report_gather_copyout_data,
+ msg_c_report_scatter_copyout_data,
+ msg_c_report_copyout_data,
+ msg_c_report_unregister,
+ msg_c_report_destroy,
+ msg_c_report_myoinit,
+ msg_c_report_myoregister,
+ msg_c_report_myofini,
+ msg_c_report_mic_myo_shared,
+ msg_c_report_mic_myo_fptr,
+ msg_c_report_myosharedmalloc,
+ msg_c_report_myosharedfree,
+ msg_c_report_myosharedalignedmalloc,
+ msg_c_report_myosharedalignedfree,
+ msg_c_report_myoacquire,
+ msg_c_report_myorelease,
+ msg_c_report_host_total_offload_time,
+ msg_c_report_host_initialize,
+ msg_c_report_host_target_acquire,
+ msg_c_report_host_wait_deps,
+ msg_c_report_host_setup_buffers,
+ msg_c_report_host_alloc_buffers,
+ msg_c_report_host_setup_misc_data,
+ msg_c_report_host_alloc_data_buffer,
+ msg_c_report_host_send_pointers,
+ msg_c_report_host_gather_inputs,
+ msg_c_report_host_map_in_data_buffer,
+ msg_c_report_host_unmap_in_data_buffer,
+ msg_c_report_host_start_compute,
+ msg_c_report_host_wait_compute,
+ msg_c_report_host_start_buffers_reads,
+ msg_c_report_host_scatter_outputs,
+ msg_c_report_host_map_out_data_buffer,
+ msg_c_report_host_unmap_out_data_buffer,
+ msg_c_report_host_wait_buffers_reads,
+ msg_c_report_host_destroy_buffers,
+ msg_c_report_target_total_time,
+ msg_c_report_target_descriptor_setup,
+ msg_c_report_target_func_lookup,
+ msg_c_report_target_func_time,
+ msg_c_report_target_scatter_inputs,
+ msg_c_report_target_add_buffer_refs,
+ msg_c_report_target_compute,
+ msg_c_report_target_gather_outputs,
+ msg_c_report_target_release_buffer_refs,
+ msg_c_coi_pipeline_max_number,
+ msg_c_ranges_dont_match,
+ msg_c_destination_is_over,
+ msg_c_slice_of_noncont_array,
+ msg_c_pointer_array_mismatch,
+ lastMsg = 153,
+ firstMsg = 1
+};
+
+
+#if !defined(MESSAGE_TABLE_NAME)
+# define MESSAGE_TABLE_NAME __liboffload_message_table
+#endif
+
+static char const * MESSAGE_TABLE_NAME[] = {
+ /* 0 __dummy__ */ "Un-used message",
+ /* 1 msg_c_device_is_not_available */ "offload error: cannot offload to MIC - device is not available",
+ /* 2 msg_c_invalid_device_number */ "offload error: expected a number greater than or equal to -1",
+ /* 3 msg_c_send_func_ptr */ "offload error: cannot find function name for address %p",
+ /* 4 msg_c_receive_func_ptr */ "offload error: cannot find address of function %s",
+ /* 5 msg_c_malloc */ "offload error: memory allocation failed",
+ /* 6 msg_c_offload_malloc */ "offload error: memory allocation failed (requested=%lld bytes, align %lld)",
+ /* 7 msg_c_offload1 */ "offload error: device %d does not have a pending signal for wait(%p)",
+ /* 8 msg_c_unknown_var_type */ "offload error: unknown variable type %d",
+ /* 9 msg_c_invalid_env_var_value */ "offload warning: ignoring invalid value specified for %s",
+ /* 10 msg_c_invalid_env_var_int_value */ "offload warning: specify an integer value for %s",
+ /* 11 msg_c_invalid_env_report_value */ "offload warning: ignoring %s setting; use a value in range 1-3",
+ /* 12 msg_c_offload_signaled1 */ "offload error: invalid device number %d specified in _Offload_signaled",
+ /* 13 msg_c_offload_signaled2 */ "offload error: invalid signal %p specified for _Offload_signaled",
+ /* 14 msg_c_myowrapper_checkresult */ "offload error: %s failed with error %d",
+ /* 15 msg_c_myotarget_checkresult */ "offload error: %s failed with error %d",
+ /* 16 msg_c_offload_descriptor_offload */ "offload error: cannot find offload entry %s",
+ /* 17 msg_c_merge_var_descs1 */ "offload error: unexpected number of variable descriptors",
+ /* 18 msg_c_merge_var_descs2 */ "offload error: unexpected variable type",
+ /* 19 msg_c_mic_parse_env_var_list1 */ "offload_error: MIC environment variable must begin with an alpabetic character",
+ /* 20 msg_c_mic_parse_env_var_list2 */ "offload_error: MIC environment variable value must be specified with \'=\'",
+ /* 21 msg_c_mic_process_exit_ret */ "offload error: process on the device %d unexpectedly exited with code %d",
+ /* 22 msg_c_mic_process_exit_sig */ "offload error: process on the device %d was terminated by signal %d (%s)",
+ /* 23 msg_c_mic_process_exit */ "offload error: process on the device %d was unexpectedly terminated",
+ /* 24 msg_c_mic_init3 */ "offload warning: ignoring MIC_STACKSIZE setting; use a value >= 16K and a multiple of 4K",
+ /* 25 msg_c_mic_init4 */ "offload error: thread key create failed with error %d",
+ /* 26 msg_c_mic_init5 */ "offload warning: specify OFFLOAD_DEVICES as comma-separated physical device numbers or 'none'",
+ /* 27 msg_c_mic_init6 */ "offload warning: OFFLOAD_DEVICES device number %d does not correspond to a physical device",
+ /* 28 msg_c_no_static_var_data */ "offload error: cannot find data associated with statically allocated variable %p",
+ /* 29 msg_c_no_ptr_data */ "offload error: cannot find data associated with pointer variable %p",
+ /* 30 msg_c_get_engine_handle */ "offload error: cannot get device %d handle (error code %d)",
+ /* 31 msg_c_get_engine_index */ "offload error: cannot get physical index for logical device %d (error code %d)",
+ /* 32 msg_c_process_create */ "offload error: cannot start process on the device %d (error code %d)",
+ /* 33 msg_c_process_get_func_handles */ "offload error: cannot get function handles on the device %d (error code %d)",
+ /* 34 msg_c_process_wait_shutdown */ "offload error: wait for process shutdown failed on device %d (error code %d)",
+ /* 35 msg_c_process_proxy_flush */ "offload error: cannot flush process output on device %d (error code %d)",
+ /* 36 msg_c_load_library */ "offload error: cannot load library to the device %d (error code %d)",
+ /* 37 msg_c_pipeline_create */ "offload error: cannot create pipeline on the device %d (error code %d)",
+ /* 38 msg_c_pipeline_run_func */ "offload error: cannot execute function on the device %d (error code %d)",
+ /* 39 msg_c_pipeline_start_run_funcs */ "offload error: cannot start executing pipeline function on the device %d (error code %d)",
+ /* 40 msg_c_buf_create */ "offload error: cannot create buffer on device %d (error code %d)",
+ /* 41 msg_c_buf_create_out_of_mem */ "offload error: cannot create buffer on device %d, out of memory",
+ /* 42 msg_c_buf_create_from_mem */ "offload error: cannot create buffer from memory on device %d (error code %d)",
+ /* 43 msg_c_buf_destroy */ "offload error: buffer destroy failed (error code %d)",
+ /* 44 msg_c_buf_map */ "offload error: buffer map failed (error code %d)",
+ /* 45 msg_c_buf_unmap */ "offload error: buffer unmap failed (error code %d)",
+ /* 46 msg_c_buf_read */ "offload error: buffer read failed (error code %d)",
+ /* 47 msg_c_buf_write */ "offload error: buffer write failed (error code %d)",
+ /* 48 msg_c_buf_copy */ "offload error: buffer copy failed (error code %d)",
+ /* 49 msg_c_buf_get_address */ "offload error: cannot get buffer address on device %d (error code %d)",
+ /* 50 msg_c_buf_add_ref */ "offload error: cannot reuse buffer memory on device %d (error code %d)",
+ /* 51 msg_c_buf_release_ref */ "offload error: cannot release buffer memory on device %d (error code %d)",
+ /* 52 msg_c_buf_set_state */ "offload error: buffer set state failed (error code %d)",
+ /* 53 msg_c_event_wait */ "offload error: wait for event to become signaled failed (error code %d)",
+ /* 54 msg_c_zero_or_neg_ptr_len */ "offload error: memory allocation of negative length is not supported",
+ /* 55 msg_c_zero_or_neg_transfer_size */ "offload error: data transfer of zero or negative size is not supported",
+ /* 56 msg_c_bad_ptr_mem_range */ "offload error: address range partially overlaps with existing allocation",
+ /* 57 msg_c_different_src_and_dstn_sizes */ "offload error: size of the source %d differs from size of the destination %d",
+ /* 58 msg_c_non_contiguous_dope_vector */ "offload error: offload data transfer supports only a single contiguous memory range per variable",
+ /* 59 msg_c_omp_invalid_device_num_env */ "offload warning: ignoring %s setting; use a non-negative integer value",
+ /* 60 msg_c_omp_invalid_device_num */ "offload error: device number should be a non-negative integer value",
+ /* 61 msg_c_unknown_binary_type */ "offload error: unexpected embedded target binary type, expected either an executable or shared library",
+ /* 62 msg_c_multiple_target_exes */ "offload error: more that one target executable found",
+ /* 63 msg_c_no_target_exe */ "offload error: target executable is not available",
+ /* 64 msg_c_report_unknown_timer_node */ "offload error: unknown timer node",
+ /* 65 msg_c_report_unknown_trace_node */ "offload error: unknown trace node",
+ /* 66 msg_c_report_host */ "HOST",
+ /* 67 msg_c_report_mic */ "MIC",
+ /* 68 msg_c_report_title */ "timer data (sec)",
+ /* 69 msg_c_report_seconds */ "(seconds)",
+ /* 70 msg_c_report_bytes */ "(bytes)",
+ /* 71 msg_c_report_cpu_time */ "CPU Time",
+ /* 72 msg_c_report_mic_time */ "MIC Time",
+ /* 73 msg_c_report_tag */ "Tag",
+ /* 74 msg_c_report_from_file */ "Offload from file",
+ /* 75 msg_c_report_file */ "File",
+ /* 76 msg_c_report_line */ "Line",
+ /* 77 msg_c_report_cpu_to_mic_data */ "CPU->MIC Data",
+ /* 78 msg_c_report_mic_to_cpu_data */ "MIC->CPU Data",
+ /* 79 msg_c_report_offload */ "Offload",
+ /* 80 msg_c_report_w_tag */ "Tag %d",
+ /* 81 msg_c_report_state */ "State",
+ /* 82 msg_c_report_start */ "Start target",
+ /* 83 msg_c_report_init */ "Initialize",
+ /* 84 msg_c_report_logical_card */ "logical card",
+ /* 85 msg_c_report_physical_card */ "physical card",
+ /* 86 msg_c_report_register */ "Register static data tables",
+ /* 87 msg_c_report_init_func */ "Setup target entry",
+ /* 88 msg_c_report_create_buf_host */ "Create host buffer",
+ /* 89 msg_c_report_create_buf_mic */ "Create target buffer",
+ /* 90 msg_c_report_send_pointer_data */ "Send pointer data",
+ /* 91 msg_c_report_sent_pointer_data */ "Host->target pointer data",
+ /* 92 msg_c_report_gather_copyin_data */ "Gather copyin data",
+ /* 93 msg_c_report_copyin_data */ "Host->target copyin data",
+ /* 94 msg_c_report_state_signal */ "Signal",
+ /* 95 msg_c_report_signal */ "signal :",
+ /* 96 msg_c_report_wait */ "waits :",
+ /* 97 msg_c_report_compute */ "Execute task on target",
+ /* 98 msg_c_report_receive_pointer_data */ "Receive pointer data",
+ /* 99 msg_c_report_received_pointer_data */ "Target->host pointer data",
+ /* 100 msg_c_report_start_target_func */ "Start target entry",
+ /* 101 msg_c_report_var */ "Var",
+ /* 102 msg_c_report_scatter_copyin_data */ "Scatter copyin data",
+ /* 103 msg_c_report_gather_copyout_data */ "Gather copyout data",
+ /* 104 msg_c_report_scatter_copyout_data */ "Scatter copyout data",
+ /* 105 msg_c_report_copyout_data */ "Target->host copyout data",
+ /* 106 msg_c_report_unregister */ "Unregister data tables",
+ /* 107 msg_c_report_destroy */ "Destroy",
+ /* 108 msg_c_report_myoinit */ "Initialize MYO",
+ /* 109 msg_c_report_myoregister */ "Register MYO tables",
+ /* 110 msg_c_report_myofini */ "Finalize MYO",
+ /* 111 msg_c_report_mic_myo_shared */ "MIC MYO shared table register",
+ /* 112 msg_c_report_mic_myo_fptr */ "MIC MYO fptr table register",
+ /* 113 msg_c_report_myosharedmalloc */ "MYO shared malloc",
+ /* 114 msg_c_report_myosharedfree */ "MYO shared free",
+ /* 115 msg_c_report_myosharedalignedmalloc */ "MYO shared aligned malloc",
+ /* 116 msg_c_report_myosharedalignedfree */ "MYO shared aligned free",
+ /* 117 msg_c_report_myoacquire */ "MYO acquire",
+ /* 118 msg_c_report_myorelease */ "MYO release",
+ /* 119 msg_c_report_host_total_offload_time */ "host: total offload time",
+ /* 120 msg_c_report_host_initialize */ "host: initialize target",
+ /* 121 msg_c_report_host_target_acquire */ "host: acquire target",
+ /* 122 msg_c_report_host_wait_deps */ "host: wait dependencies",
+ /* 123 msg_c_report_host_setup_buffers */ "host: setup buffers",
+ /* 124 msg_c_report_host_alloc_buffers */ "host: allocate buffers",
+ /* 125 msg_c_report_host_setup_misc_data */ "host: setup misc_data",
+ /* 126 msg_c_report_host_alloc_data_buffer */ "host: allocate buffer",
+ /* 127 msg_c_report_host_send_pointers */ "host: send pointers",
+ /* 128 msg_c_report_host_gather_inputs */ "host: gather inputs",
+ /* 129 msg_c_report_host_map_in_data_buffer */ "host: map IN data buffer",
+ /* 130 msg_c_report_host_unmap_in_data_buffer */ "host: unmap IN data buffer",
+ /* 131 msg_c_report_host_start_compute */ "host: initiate compute",
+ /* 132 msg_c_report_host_wait_compute */ "host: wait compute",
+ /* 133 msg_c_report_host_start_buffers_reads */ "host: initiate pointer reads",
+ /* 134 msg_c_report_host_scatter_outputs */ "host: scatter outputs",
+ /* 135 msg_c_report_host_map_out_data_buffer */ "host: map OUT data buffer",
+ /* 136 msg_c_report_host_unmap_out_data_buffer */ "host: unmap OUT data buffer",
+ /* 137 msg_c_report_host_wait_buffers_reads */ "host: wait pointer reads",
+ /* 138 msg_c_report_host_destroy_buffers */ "host: destroy buffers",
+ /* 139 msg_c_report_target_total_time */ "target: total time",
+ /* 140 msg_c_report_target_descriptor_setup */ "target: setup offload descriptor",
+ /* 141 msg_c_report_target_func_lookup */ "target: entry lookup",
+ /* 142 msg_c_report_target_func_time */ "target: entry time",
+ /* 143 msg_c_report_target_scatter_inputs */ "target: scatter inputs",
+ /* 144 msg_c_report_target_add_buffer_refs */ "target: add buffer reference",
+ /* 145 msg_c_report_target_compute */ "target: compute",
+ /* 146 msg_c_report_target_gather_outputs */ "target: gather outputs",
+ /* 147 msg_c_report_target_release_buffer_refs */ "target: remove buffer reference",
+ /* 148 msg_c_coi_pipeline_max_number */ "number of host threads doing offload exceeds maximum of %d",
+ /* 149 msg_c_ranges_dont_match */ "ranges of source and destination don't match together",
+ /* 150 msg_c_destination_is_over */ "insufficient destination memory to transfer source",
+ /* 151 msg_c_slice_of_noncont_array */ "a non-contiguous slice may be taken of contiguous arrays only",
+ /* 152 msg_c_pointer_array_mismatch */ "number of %s elements is less than described by the source",
+};
diff --git a/liboffloadmic/runtime/mic_lib.f90 b/liboffloadmic/runtime/mic_lib.f90
new file mode 100644
index 00000000000..c68e059aa19
--- /dev/null
+++ b/liboffloadmic/runtime/mic_lib.f90
@@ -0,0 +1,282 @@
+!
+! Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+!
+! Redistribution and use in source and binary forms, with or without
+! modification, are permitted provided that the following conditions
+! are met:
+!
+! * Redistributions of source code must retain the above copyright
+! notice, this list of conditions and the following disclaimer.
+! * Redistributions in binary form must reproduce the above copyright
+! notice, this list of conditions and the following disclaimer in the
+! documentation and/or other materials provided with the distribution.
+! * Neither the name of Intel Corporation nor the names of its
+! contributors may be used to endorse or promote products derived
+! from this software without specific prior written permission.
+!
+! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+! A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+! HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+! LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+! DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+! THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+! (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+! OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+!
+
+
+! **********************************************************************************
+! * This file is intended to support the Intel(r) Many Integrated Core Architecture.
+! **********************************************************************************
+! free form Fortran source - should be named .f90
+! lines are longer than 72 characters
+
+module mic_lib
+use, intrinsic :: iso_c_binding
+
+integer, parameter:: target_mic=2
+integer, parameter:: default_target_type=target_mic
+integer, parameter:: default_target_number=0
+
+enum, bind(C)
+ enumerator :: OFFLOAD_SUCCESS = 0
+ enumerator :: OFFLOAD_DISABLED ! offload is disabled
+ enumerator :: OFFLOAD_UNAVAILABLE ! card is not available
+ enumerator :: OFFLOAD_OUT_OF_MEMORY ! not enough memory on device
+ enumerator :: OFFLOAD_PROCESS_DIED ! target process has died
+ enumerator :: OFFLOAD_ERROR ! unspecified error
+end enum
+
+type, bind (C) :: offload_status
+ integer(kind=c_int) :: result = OFFLOAD_DISABLED
+ integer(kind=c_int) :: device_number = -1
+ integer(kind=c_size_t) :: data_sent = 0
+ integer(kind=c_size_t) :: data_received = 0
+end type offload_status
+
+interface
+function offload_number_of_devices () &
+ bind (C, name = "_Offload_number_of_devices")
+!dec$ attributes default :: offload_number_of_devices
+ import :: c_int
+ integer (kind=c_int) :: offload_number_of_devices
+!dec$ attributes offload:mic :: offload_number_of_devices
+!dir$ attributes known_intrinsic :: offload_number_of_devices
+end function offload_number_of_devices
+
+function offload_signaled(target_number, signal) &
+ bind (C, name = "_Offload_signaled")
+!dec$ attributes default :: offload_signaled
+ import :: c_int, c_int64_t
+ integer (kind=c_int) :: offload_signaled
+ integer (kind=c_int), value :: target_number
+ integer (kind=c_int64_t), value :: signal
+!dec$ attributes offload:mic :: offload_signaled
+end function offload_signaled
+
+subroutine offload_report(val) &
+ bind (C, name = "_Offload_report")
+!dec$ attributes default :: offload_report
+ import :: c_int
+ integer (kind=c_int), value :: val
+!dec$ attributes offload:mic :: offload_report
+end subroutine offload_report
+
+function offload_get_device_number() &
+ bind (C, name = "_Offload_get_device_number")
+!dec$ attributes default :: offload_get_device_number
+ import :: c_int
+ integer (kind=c_int) :: offload_get_device_number
+!dec$ attributes offload:mic :: offload_get_device_number
+end function offload_get_device_number
+
+function offload_get_physical_device_number() &
+ bind (C, name = "_Offload_get_physical_device_number")
+!dec$ attributes default :: offload_get_physical_device_number
+ import :: c_int
+ integer (kind=c_int) :: offload_get_physical_device_number
+!dec$ attributes offload:mic :: offload_get_physical_device_number
+end function offload_get_physical_device_number
+
+! OpenMP API wrappers
+
+subroutine omp_set_num_threads_target (target_type, &
+ target_number, &
+ num_threads) &
+ bind (C, name = "omp_set_num_threads_target")
+ import :: c_int
+ integer (kind=c_int), value :: target_type, target_number, num_threads
+end subroutine omp_set_num_threads_target
+
+function omp_get_max_threads_target (target_type, &
+ target_number) &
+ bind (C, name = "omp_get_max_threads_target")
+ import :: c_int
+ integer (kind=c_int) :: omp_get_max_threads_target
+ integer (kind=c_int), value :: target_type, target_number
+end function omp_get_max_threads_target
+
+function omp_get_num_procs_target (target_type, &
+ target_number) &
+ bind (C, name = "omp_get_num_procs_target")
+ import :: c_int
+ integer (kind=c_int) :: omp_get_num_procs_target
+ integer (kind=c_int), value :: target_type, target_number
+end function omp_get_num_procs_target
+
+subroutine omp_set_dynamic_target (target_type, &
+ target_number, &
+ num_threads) &
+ bind (C, name = "omp_set_dynamic_target")
+ import :: c_int
+ integer (kind=c_int), value :: target_type, target_number, num_threads
+end subroutine omp_set_dynamic_target
+
+function omp_get_dynamic_target (target_type, &
+ target_number) &
+ bind (C, name = "omp_get_dynamic_target")
+ import :: c_int
+ integer (kind=c_int) :: omp_get_dynamic_target
+ integer (kind=c_int), value :: target_type, target_number
+end function omp_get_dynamic_target
+
+subroutine omp_set_nested_target (target_type, &
+ target_number, &
+ nested) &
+ bind (C, name = "omp_set_nested_target")
+ import :: c_int
+ integer (kind=c_int), value :: target_type, target_number, nested
+end subroutine omp_set_nested_target
+
+function omp_get_nested_target (target_type, &
+ target_number) &
+ bind (C, name = "omp_get_nested_target")
+ import :: c_int
+ integer (kind=c_int) :: omp_get_nested_target
+ integer (kind=c_int), value :: target_type, target_number
+end function omp_get_nested_target
+
+subroutine omp_set_schedule_target (target_type, &
+ target_number, &
+ kind, &
+ modifier) &
+ bind (C, name = "omp_set_schedule_target")
+ import :: c_int
+ integer (kind=c_int), value :: target_type, target_number, kind, modifier
+end subroutine omp_set_schedule_target
+
+subroutine omp_get_schedule_target (target_type, &
+ target_number, &
+ kind, &
+ modifier) &
+ bind (C, name = "omp_get_schedule_target")
+ import :: c_int, c_intptr_t
+ integer (kind=c_int), value :: target_type, target_number
+ integer (kind=c_intptr_t), value :: kind, modifier
+end subroutine omp_get_schedule_target
+
+! lock API functions
+
+subroutine omp_init_lock_target (target_type, &
+ target_number, &
+ lock) &
+ bind (C, name = "omp_init_lock_target")
+ import :: c_int, c_intptr_t
+ !dir$ attributes known_intrinsic :: omp_init_lock_target
+ integer (kind=c_int), value :: target_type, target_number
+ integer (kind=c_intptr_t), value :: lock
+end subroutine omp_init_lock_target
+
+subroutine omp_destroy_lock_target (target_type, &
+ target_number, &
+ lock) &
+ bind (C, name = "omp_destroy_lock_target")
+ import :: c_int, c_intptr_t
+ !dir$ attributes known_intrinsic :: omp_destroy_lock_target
+ integer (kind=c_int), value :: target_type, target_number
+ integer (kind=c_intptr_t), value :: lock
+end subroutine omp_destroy_lock_target
+
+subroutine omp_set_lock_target (target_type, &
+ target_number, &
+ lock) &
+ bind (C, name = "omp_set_lock_target")
+ import :: c_int, c_intptr_t
+ !dir$ attributes known_intrinsic :: omp_set_lock_target
+ integer (kind=c_int), value :: target_type, target_number
+ integer (kind=c_intptr_t), value :: lock
+end subroutine omp_set_lock_target
+
+subroutine omp_unset_lock_target (target_type, &
+ target_number, &
+ lock) &
+ bind (C, name = "omp_unset_lock_target")
+ import :: c_int, c_intptr_t
+ !dir$ attributes known_intrinsic :: omp_unset_lock_target
+ integer (kind=c_int), value :: target_type, target_number
+ integer (kind=c_intptr_t), value :: lock
+end subroutine omp_unset_lock_target
+
+function omp_test_lock_target (target_type, &
+ target_number, &
+ lock) &
+ bind (C, name = "omp_test_lock_target")
+ import :: c_int, c_intptr_t
+ integer (kind=c_int) :: omp_test_lock_target
+ integer (kind=c_int), value :: target_type, target_number
+ integer (kind=c_intptr_t), value :: lock
+end function omp_test_lock_target
+
+! nested lock API functions
+
+subroutine omp_init_nest_lock_target (target_type, &
+ target_number, &
+ lock) &
+ bind (C, name = "omp_init_nest_lock_target")
+ import :: c_int, c_intptr_t
+ integer (kind=c_int), value :: target_type, target_number
+ integer (kind=c_intptr_t), value :: lock
+end subroutine omp_init_nest_lock_target
+
+subroutine omp_destroy_nest_lock_target (target_type, &
+ target_number, &
+ lock) &
+ bind (C, name = "omp_destroy_nest_lock_target")
+ import :: c_int, c_intptr_t
+ integer (kind=c_int), value :: target_type, target_number
+ integer (kind=c_intptr_t), value :: lock
+end subroutine omp_destroy_nest_lock_target
+
+subroutine omp_set_nest_lock_target (target_type, &
+ target_number, &
+ lock) &
+ bind (C, name = "omp_set_nest_lock_target")
+ import :: c_int, c_intptr_t
+ integer (kind=c_int), value :: target_type, target_number
+ integer (kind=c_intptr_t), value :: lock
+end subroutine omp_set_nest_lock_target
+
+subroutine omp_unset_nest_lock_target (target_type, &
+ target_number, &
+ lock) &
+ bind (C, name = "omp_unset_nest_lock_target")
+ import :: c_int, c_intptr_t
+ integer (kind=c_int), value :: target_type, target_number
+ integer (kind=c_intptr_t), value :: lock
+end subroutine omp_unset_nest_lock_target
+
+function omp_test_nest_lock_target (target_type, &
+ target_number, &
+ lock) &
+ bind (C, name = "omp_test_nest_lock_target")
+ import :: c_int, c_intptr_t
+ integer (kind=c_int) :: omp_test_nest_lock_target
+ integer (kind=c_int), value :: target_type, target_number
+ integer (kind=c_intptr_t), value :: lock
+end function omp_test_nest_lock_target
+
+end interface
+end module mic_lib
diff --git a/liboffloadmic/runtime/offload.h b/liboffloadmic/runtime/offload.h
new file mode 100644
index 00000000000..9234b0011f9
--- /dev/null
+++ b/liboffloadmic/runtime/offload.h
@@ -0,0 +1,371 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+/*
+ * Include file for Offload API.
+ */
+
+#ifndef OFFLOAD_H_INCLUDED
+#define OFFLOAD_H_INCLUDED
+
+#if defined(LINUX) || defined(FREEBSD)
+#include <bits/functexcept.h>
+#endif
+
+#include <stddef.h>
+#include <omp.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define TARGET_ATTRIBUTE __declspec(target(mic))
+
+/*
+ * The target architecture.
+ */
+typedef enum TARGET_TYPE {
+ TARGET_NONE, /* Undefine target */
+ TARGET_HOST, /* Host used as target */
+ TARGET_MIC /* MIC target */
+} TARGET_TYPE;
+
+/*
+ * The default target type.
+ */
+#define DEFAULT_TARGET_TYPE TARGET_MIC
+
+/*
+ * The default target number.
+ */
+#define DEFAULT_TARGET_NUMBER 0
+
+/*
+ * Offload status.
+ */
+typedef enum {
+ OFFLOAD_SUCCESS = 0,
+ OFFLOAD_DISABLED, /* offload is disabled */
+ OFFLOAD_UNAVAILABLE, /* card is not available */
+ OFFLOAD_OUT_OF_MEMORY, /* not enough memory on device */
+ OFFLOAD_PROCESS_DIED, /* target process has died */
+ OFFLOAD_ERROR /* unspecified error */
+} _Offload_result;
+
+typedef struct {
+ _Offload_result result; /* result, see above */
+ int device_number; /* device number */
+ size_t data_sent; /* number of bytes sent to the target */
+ size_t data_received; /* number of bytes received by host */
+} _Offload_status;
+
+#define OFFLOAD_STATUS_INIT(x) \
+ ((x).result = OFFLOAD_DISABLED)
+
+#define OFFLOAD_STATUS_INITIALIZER \
+ { OFFLOAD_DISABLED, -1, 0, 0 }
+
+/* Offload runtime interfaces */
+
+extern int _Offload_number_of_devices(void);
+extern int _Offload_get_device_number(void);
+extern int _Offload_get_physical_device_number(void);
+
+extern void* _Offload_shared_malloc(size_t size);
+extern void _Offload_shared_free(void *ptr);
+
+extern void* _Offload_shared_aligned_malloc(size_t size, size_t align);
+extern void _Offload_shared_aligned_free(void *ptr);
+
+extern int _Offload_signaled(int index, void *signal);
+extern void _Offload_report(int val);
+
+/* OpenMP API */
+
+extern void omp_set_default_device(int num) __GOMP_NOTHROW;
+extern int omp_get_default_device(void) __GOMP_NOTHROW;
+extern int omp_get_num_devices(void) __GOMP_NOTHROW;
+
+/* OpenMP API wrappers */
+
+/* Set num_threads on target */
+extern void omp_set_num_threads_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ int num_threads
+);
+
+/* Get max_threads from target */
+extern int omp_get_max_threads_target(
+ TARGET_TYPE target_type,
+ int target_number
+);
+
+/* Get num_procs from target */
+extern int omp_get_num_procs_target(
+ TARGET_TYPE target_type,
+ int target_number
+);
+
+/* Set dynamic on target */
+extern void omp_set_dynamic_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ int num_threads
+);
+
+/* Get dynamic from target */
+extern int omp_get_dynamic_target(
+ TARGET_TYPE target_type,
+ int target_number
+);
+
+/* Set nested on target */
+extern void omp_set_nested_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ int nested
+);
+
+/* Get nested from target */
+extern int omp_get_nested_target(
+ TARGET_TYPE target_type,
+ int target_number
+);
+
+extern void omp_set_num_threads_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ int num_threads
+);
+
+extern int omp_get_max_threads_target(
+ TARGET_TYPE target_type,
+ int target_number
+);
+
+extern int omp_get_num_procs_target(
+ TARGET_TYPE target_type,
+ int target_number
+);
+
+extern void omp_set_dynamic_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ int num_threads
+);
+
+extern int omp_get_dynamic_target(
+ TARGET_TYPE target_type,
+ int target_number
+);
+
+extern void omp_set_nested_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ int num_threads
+);
+
+extern int omp_get_nested_target(
+ TARGET_TYPE target_type,
+ int target_number
+);
+
+extern void omp_set_schedule_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_sched_t kind,
+ int modifier
+);
+
+extern void omp_get_schedule_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_sched_t *kind,
+ int *modifier
+);
+
+/* lock API functions */
+
+typedef struct {
+ omp_lock_t lock;
+} omp_lock_target_t;
+
+extern void omp_init_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_lock_target_t *lock
+);
+
+extern void omp_destroy_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_lock_target_t *lock
+);
+
+extern void omp_set_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_lock_target_t *lock
+);
+
+extern void omp_unset_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_lock_target_t *lock
+);
+
+extern int omp_test_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_lock_target_t *lock
+);
+
+/* nested lock API functions */
+
+typedef struct {
+ omp_nest_lock_t lock;
+} omp_nest_lock_target_t;
+
+extern void omp_init_nest_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_nest_lock_target_t *lock
+);
+
+extern void omp_destroy_nest_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_nest_lock_target_t *lock
+);
+
+extern void omp_set_nest_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_nest_lock_target_t *lock
+);
+
+extern void omp_unset_nest_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_nest_lock_target_t *lock
+);
+
+extern int omp_test_nest_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_nest_lock_target_t *lock
+);
+
+#ifdef __cplusplus
+} /* extern "C" */
+
+/* Namespace for the shared_allocator. */
+namespace __offload {
+ /* This follows the specification for std::allocator. */
+ /* Forward declaration of the class template. */
+ template <typename T>
+ class shared_allocator;
+
+ /* Specialization for shared_allocator<void>. */
+ template <>
+ class shared_allocator<void> {
+ public:
+ typedef void *pointer;
+ typedef const void *const_pointer;
+ typedef void value_type;
+ template <class U> struct rebind { typedef shared_allocator<U> other; };
+ };
+
+ /* Definition of shared_allocator<T>. */
+ template <class T>
+ class shared_allocator {
+ public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef T *pointer;
+ typedef const T *const_pointer;
+ typedef T &reference;
+ typedef const T &const_reference;
+ typedef T value_type;
+ template <class U> struct rebind { typedef shared_allocator<U> other; };
+ shared_allocator() throw() { }
+ shared_allocator(const shared_allocator&) throw() { }
+ template <class U> shared_allocator(const shared_allocator<U>&) throw() { }
+ ~shared_allocator() throw() { }
+ pointer address(reference x) const { return &x; }
+ const_pointer address(const_reference x) const { return &x; }
+ pointer allocate(
+ size_type, shared_allocator<void>::const_pointer hint = 0);
+ void deallocate(pointer p, size_type n);
+ size_type max_size() const throw() {
+ return size_type(-1)/sizeof(T);
+ } /* max_size */
+ void construct(pointer p, const T& arg) {
+ ::new (p) T(arg);
+ } /* construct */
+ void destroy(pointer p) {
+ p->~T();
+ } /* destroy */
+ };
+
+ /* Definition for allocate. */
+ template <class T>
+ typename shared_allocator<T>::pointer
+ shared_allocator<T>::allocate(shared_allocator<T>::size_type s,
+ shared_allocator<void>::const_pointer) {
+ /* Allocate from shared memory. */
+ void *ptr = _Offload_shared_malloc(s*sizeof(T));
+ if (ptr == 0) std::__throw_bad_alloc();
+ return static_cast<pointer>(ptr);
+ } /* allocate */
+
+ template <class T>
+ void shared_allocator<T>::deallocate(pointer p,
+ shared_allocator<T>::size_type) {
+ /* Free the shared memory. */
+ _Offload_shared_free(p);
+ } /* deallocate */
+
+ template <typename _T1, typename _T2>
+ inline bool operator==(const shared_allocator<_T1> &,
+ const shared_allocator<_T2> &) throw() {
+ return true;
+ } /* operator== */
+
+ template <typename _T1, typename _T2>
+ inline bool operator!=(const shared_allocator<_T1> &,
+ const shared_allocator<_T2> &) throw() {
+ return false;
+ } /* operator!= */
+} /* __offload */
+#endif /* __cplusplus */
+
+#endif /* OFFLOAD_H_INCLUDED */
diff --git a/liboffloadmic/runtime/offload_common.cpp b/liboffloadmic/runtime/offload_common.cpp
new file mode 100644
index 00000000000..72c355f6f18
--- /dev/null
+++ b/liboffloadmic/runtime/offload_common.cpp
@@ -0,0 +1,190 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#if defined(LINUX) || defined(FREEBSD)
+#include <mm_malloc.h>
+#endif
+
+#include "offload_common.h"
+
+// The debug routines
+
+#if OFFLOAD_DEBUG > 0
+
+void __dump_bytes(
+ int trace_level,
+ const void *data,
+ int len
+)
+{
+ if (console_enabled > trace_level) {
+ const uint8_t *arr = (const uint8_t*) data;
+ char buffer[4096];
+ char *bufferp;
+ int count = 0;
+
+ bufferp = buffer;
+ while (len--) {
+ sprintf(bufferp, "%02x", *arr++);
+ bufferp += 2;
+ count++;
+ if ((count&3) == 0) {
+ sprintf(bufferp, " ");
+ bufferp++;
+ }
+ if ((count&63) == 0) {
+ OFFLOAD_DEBUG_TRACE(trace_level, "%s\n", buffer);
+ bufferp = buffer;
+ count = 0;
+ }
+ }
+ if (count) {
+ OFFLOAD_DEBUG_TRACE(trace_level, "%s\n", buffer);
+ }
+ }
+}
+#endif // OFFLOAD_DEBUG
+
+// The Marshaller and associated routines
+
+void Marshaller::send_data(
+ const void *data,
+ int64_t length
+)
+{
+ OFFLOAD_DEBUG_TRACE(2, "send_data(%p, %lld)\n",
+ data, length);
+ memcpy(buffer_ptr, data, (size_t)length);
+ buffer_ptr += length;
+ tfr_size += length;
+}
+
+void Marshaller::receive_data(
+ void *data,
+ int64_t length
+)
+{
+ OFFLOAD_DEBUG_TRACE(2, "receive_data(%p, %lld)\n",
+ data, length);
+ memcpy(data, buffer_ptr, (size_t)length);
+ buffer_ptr += length;
+ tfr_size += length;
+}
+
+// Send function pointer
+void Marshaller::send_func_ptr(
+ const void* data
+)
+{
+ const char* name;
+ size_t length;
+
+ if (data != 0) {
+ name = __offload_funcs.find_name(data);
+ if (name == 0) {
+#if OFFLOAD_DEBUG > 0
+ if (console_enabled > 2) {
+ __offload_funcs.dump();
+ }
+#endif // OFFLOAD_DEBUG > 0
+
+ LIBOFFLOAD_ERROR(c_send_func_ptr, data);
+ exit(1);
+ }
+ length = strlen(name) + 1;
+ }
+ else {
+ name = "";
+ length = 1;
+ }
+
+ memcpy(buffer_ptr, name, length);
+ buffer_ptr += length;
+ tfr_size += length;
+}
+
+// Receive function pointer
+void Marshaller::receive_func_ptr(
+ const void** data
+)
+{
+ const char* name;
+ size_t length;
+
+ name = (const char*) buffer_ptr;
+ if (name[0] != '\0') {
+ *data = __offload_funcs.find_addr(name);
+ if (*data == 0) {
+#if OFFLOAD_DEBUG > 0
+ if (console_enabled > 2) {
+ __offload_funcs.dump();
+ }
+#endif // OFFLOAD_DEBUG > 0
+
+ LIBOFFLOAD_ERROR(c_receive_func_ptr, name);
+ exit(1);
+ }
+ length = strlen(name) + 1;
+ }
+ else {
+ *data = 0;
+ length = 1;
+ }
+
+ buffer_ptr += length;
+ tfr_size += length;
+}
+
+// End of the Marshaller and associated routines
+
+extern void *OFFLOAD_MALLOC(
+ size_t size,
+ size_t align
+)
+{
+ void *ptr;
+ int err;
+
+ OFFLOAD_DEBUG_TRACE(2, "%s(%lld, %lld)\n", __func__, size, align);
+
+ if (align < sizeof(void*)) {
+ align = sizeof(void*);
+ }
+
+ ptr = _mm_malloc(size, align);
+ if (ptr == NULL) {
+ LIBOFFLOAD_ERROR(c_offload_malloc, size, align);
+ exit(1);
+ }
+
+ OFFLOAD_DEBUG_TRACE(2, "%s returned %p\n", __func__, ptr);
+
+ return ptr;
+}
diff --git a/liboffloadmic/runtime/offload_common.h b/liboffloadmic/runtime/offload_common.h
new file mode 100644
index 00000000000..60b5045b9b5
--- /dev/null
+++ b/liboffloadmic/runtime/offload_common.h
@@ -0,0 +1,475 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+/*! \file
+ \brief The parts of the runtime library common to host and target
+*/
+
+#ifndef OFFLOAD_COMMON_H_INCLUDED
+#define OFFLOAD_COMMON_H_INCLUDED
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <memory.h>
+
+#if (defined(LINUX) || defined(FREEBSD)) && !defined(__INTEL_COMPILER)
+#include <mm_malloc.h>
+#endif
+
+#include "offload.h"
+#include "offload_table.h"
+#include "offload_trace.h"
+#include "offload_timer.h"
+#include "offload_util.h"
+#include "cean_util.h"
+#include "dv_util.h"
+#include "liboffload_error_codes.h"
+
+#include <stdarg.h>
+
+// Use secure getenv if it's supported
+#ifdef HAVE_SECURE_GETENV
+ #define getenv(x) secure_getenv(x)
+#elif HAVE___SECURE_GETENV
+ #define getenv(x) __secure_getenv(x)
+#endif
+
+// The debug routines
+
+// Host console and file logging
+extern int console_enabled;
+extern int offload_report_level;
+
+#define OFFLOAD_DO_TRACE (offload_report_level == 3)
+
+extern const char *prefix;
+extern int offload_number;
+#if !HOST_LIBRARY
+extern int mic_index;
+#endif
+
+#if HOST_LIBRARY
+void Offload_Report_Prolog(OffloadHostTimerData* timer_data);
+void Offload_Report_Epilog(OffloadHostTimerData* timer_data);
+void offload_report_free_data(OffloadHostTimerData * timer_data);
+void Offload_Timer_Print(void);
+
+#ifndef TARGET_WINNT
+#define OFFLOAD_DEBUG_INCR_OFLD_NUM() \
+ __sync_add_and_fetch(&offload_number, 1)
+#else
+#define OFFLOAD_DEBUG_INCR_OFLD_NUM() \
+ _InterlockedIncrement(reinterpret_cast<long*>(&offload_number))
+#endif
+
+#define OFFLOAD_DEBUG_PRINT_TAG_PREFIX() \
+ printf("%s: ", prefix);
+
+#define OFFLOAD_DEBUG_PRINT_PREFIX() \
+ printf("%s: ", prefix);
+#else
+#define OFFLOAD_DEBUG_PRINT_PREFIX() \
+ printf("%s%d: ", prefix, mic_index);
+#endif // HOST_LIBRARY
+
+#define OFFLOAD_TRACE(trace_level, ...) \
+ if (console_enabled >= trace_level) { \
+ OFFLOAD_DEBUG_PRINT_PREFIX(); \
+ printf(__VA_ARGS__); \
+ fflush(NULL); \
+ }
+
+#if OFFLOAD_DEBUG > 0
+
+#define OFFLOAD_DEBUG_TRACE(level, ...) \
+ OFFLOAD_TRACE(level, __VA_ARGS__)
+
+#define OFFLOAD_REPORT(level, offload_number, stage, ...) \
+ if (OFFLOAD_DO_TRACE) { \
+ offload_stage_print(stage, offload_number, __VA_ARGS__); \
+ fflush(NULL); \
+ }
+
+#define OFFLOAD_DEBUG_TRACE_1(level, offload_number, stage, ...) \
+ if (OFFLOAD_DO_TRACE) { \
+ offload_stage_print(stage, offload_number, __VA_ARGS__); \
+ fflush(NULL); \
+ } \
+ if (!OFFLOAD_DO_TRACE) { \
+ OFFLOAD_TRACE(level, __VA_ARGS__) \
+ }
+
+#define OFFLOAD_DEBUG_DUMP_BYTES(level, a, b) \
+ __dump_bytes(level, a, b)
+
+extern void __dump_bytes(
+ int level,
+ const void *data,
+ int len
+);
+
+#else
+
+#define OFFLOAD_DEBUG_LOG(level, ...)
+#define OFFLOAD_DEBUG_DUMP_BYTES(level, a, b)
+
+#endif
+
+// Runtime interface
+
+#define OFFLOAD_PREFIX(a) __offload_##a
+
+#define OFFLOAD_MALLOC OFFLOAD_PREFIX(malloc)
+#define OFFLOAD_FREE(a) _mm_free(a)
+
+// Forward functions
+
+extern void *OFFLOAD_MALLOC(size_t size, size_t align);
+
+// The Marshaller
+
+//! \enum Indicator for the type of entry on an offload item list.
+enum OffloadItemType {
+ c_data = 1, //!< Plain data
+ c_data_ptr, //!< Pointer data
+ c_func_ptr, //!< Function pointer
+ c_void_ptr, //!< void*
+ c_string_ptr, //!< C string
+ c_dv, //!< Dope vector variable
+ c_dv_data, //!< Dope-vector data
+ c_dv_data_slice, //!< Dope-vector data's slice
+ c_dv_ptr, //!< Dope-vector variable pointer
+ c_dv_ptr_data, //!< Dope-vector pointer data
+ c_dv_ptr_data_slice,//!< Dope-vector pointer data's slice
+ c_cean_var, //!< CEAN variable
+ c_cean_var_ptr, //!< Pointer to CEAN variable
+ c_data_ptr_array, //!< Pointer to data pointer array
+ c_func_ptr_array, //!< Pointer to function pointer array
+ c_void_ptr_array, //!< Pointer to void* pointer array
+ c_string_ptr_array //!< Pointer to char* pointer array
+};
+
+#define VAR_TYPE_IS_PTR(t) ((t) == c_string_ptr || \
+ (t) == c_data_ptr || \
+ (t) == c_cean_var_ptr || \
+ (t) == c_dv_ptr)
+
+#define VAR_TYPE_IS_SCALAR(t) ((t) == c_data || \
+ (t) == c_void_ptr || \
+ (t) == c_cean_var || \
+ (t) == c_dv)
+
+#define VAR_TYPE_IS_DV_DATA(t) ((t) == c_dv_data || \
+ (t) == c_dv_ptr_data)
+
+#define VAR_TYPE_IS_DV_DATA_SLICE(t) ((t) == c_dv_data_slice || \
+ (t) == c_dv_ptr_data_slice)
+
+
+//! \enum Specify direction to copy offloaded variable.
+enum OffloadParameterType {
+ c_parameter_unknown = -1, //!< Unknown clause
+ c_parameter_nocopy, //!< Variable listed in "nocopy" clause
+ c_parameter_in, //!< Variable listed in "in" clause
+ c_parameter_out, //!< Variable listed in "out" clause
+ c_parameter_inout //!< Variable listed in "inout" clause
+};
+
+//! An Offload Variable descriptor
+struct VarDesc {
+ //! OffloadItemTypes of source and destination
+ union {
+ struct {
+ uint8_t dst : 4; //!< OffloadItemType of destination
+ uint8_t src : 4; //!< OffloadItemType of source
+ };
+ uint8_t bits;
+ } type;
+
+ //! OffloadParameterType that describes direction of data transfer
+ union {
+ struct {
+ uint8_t in : 1; //!< Set if IN or INOUT
+ uint8_t out : 1; //!< Set if OUT or INOUT
+ };
+ uint8_t bits;
+ } direction;
+
+ uint8_t alloc_if; //!< alloc_if modifier value
+ uint8_t free_if; //!< free_if modifier value
+ uint32_t align; //!< MIC alignment requested for pointer data
+ //! Not used by compiler; set to 0
+ /*! Used by runtime as offset to data from start of MIC buffer */
+ uint32_t mic_offset;
+ //! Flags describing this variable
+ union {
+ struct {
+ //! source variable has persistent storage
+ uint32_t is_static : 1;
+ //! destination variable has persistent storage
+ uint32_t is_static_dstn : 1;
+ //! has length for c_dv && c_dv_ptr
+ uint32_t has_length : 1;
+ //! persisted local scalar is in stack buffer
+ uint32_t is_stack_buf : 1;
+ //! buffer address is sent in data
+ uint32_t sink_addr : 1;
+ //! alloc displacement is sent in data
+ uint32_t alloc_disp : 1;
+ //! source data is noncontiguous
+ uint32_t is_noncont_src : 1;
+ //! destination data is noncontiguous
+ uint32_t is_noncont_dst : 1;
+ };
+ uint32_t bits;
+ } flags;
+ //! Not used by compiler; set to 0
+ /*! Used by runtime as offset to base from data stored in a buffer */
+ int64_t offset;
+ //! Element byte-size of data to be transferred
+ /*! For dope-vector, the size of the dope-vector */
+ int64_t size;
+ union {
+ //! Set to 0 for array expressions and dope-vectors
+ /*! Set to 1 for scalars */
+ /*! Set to value of length modifier for pointers */
+ int64_t count;
+ //! Displacement not used by compiler
+ int64_t disp;
+ };
+
+ //! This field not used by OpenMP 4.0
+ /*! The alloc section expression in #pragma offload */
+ union {
+ void *alloc;
+ int64_t ptr_arr_offset;
+ };
+
+ //! This field not used by OpenMP 4.0
+ /*! The into section expression in #pragma offload */
+ /*! For c_data_ptr_array this is the into ptr array */
+ void *into;
+
+ //! For an ordinary variable, address of the variable
+ /*! For c_cean_var (C/C++ array expression),
+ pointer to arr_desc, which is an array descriptor. */
+ /*! For c_data_ptr_array (array of data pointers),
+ pointer to ptr_array_descriptor,
+ which is a descriptor for pointer array transfers. */
+ void *ptr;
+};
+
+//! Auxiliary struct used when -g is enabled that holds variable names
+struct VarDesc2 {
+ const char *sname; //!< Source name
+ const char *dname; //!< Destination name (when "into" is used)
+};
+
+/*! When the OffloadItemType is c_data_ptr_array
+ the ptr field of the main descriptor points to this struct. */
+/*! The type in VarDesc1 merely says c_cean_data_ptr, but the pointer
+ type can be c_data_ptr, c_func_ptr, c_void_ptr, or c_string_ptr.
+ Therefore the actual pointer type is in the flags field of VarDesc3. */
+/*! If flag_align_is_array/flag_alloc_if_is_array/flag_free_if_is_array
+ is 0 then alignment/alloc_if/free_if are specified in VarDesc1. */
+/*! If flag_align_is_array/flag_alloc_if_is_array/flag_free_if_is_array
+ is 1 then align_array/alloc_if_array/free_if_array specify
+ the set of alignment/alloc_if/free_if values. */
+/*! For the other fields, if neither the scalar nor the array flag
+ is set, then that modifier was not specified. If the bits are set
+ they specify which modifier was set and whether it was a
+ scalar or an array expression. */
+struct VarDesc3
+{
+ void *ptr_array; //!< Pointer to arr_desc of array of pointers
+ void *align_array; //!< Scalar value or pointer to arr_desc
+ void *alloc_if_array; //!< Scalar value or pointer to arr_desc
+ void *free_if_array; //!< Scalar value or pointer to arr_desc
+ void *extent_start; //!< Scalar value or pointer to arr_desc
+ void *extent_elements; //!< Scalar value or pointer to arr_desc
+ void *into_start; //!< Scalar value or pointer to arr_desc
+ void *into_elements; //!< Scalar value or pointer to arr_desc
+ void *alloc_start; //!< Scalar value or pointer to arr_desc
+ void *alloc_elements; //!< Scalar value or pointer to arr_desc
+ /*! Flags that describe the pointer type and whether each field
+ is a scalar value or an array expression. */
+ /*! First 6 bits are pointer array element type:
+ c_data_ptr, c_func_ptr, c_void_ptr, c_string_ptr */
+ /*! Then single bits specify: */
+ /*! align_array is an array */
+ /*! alloc_if_array is an array */
+ /*! free_if_array is an array */
+ /*! extent_start is a scalar expression */
+ /*! extent_start is an array expression */
+ /*! extent_elements is a scalar expression */
+ /*! extent_elements is an array expression */
+ /*! into_start is a scalar expression */
+ /*! into_start is an array expression */
+ /*! into_elements is a scalar expression */
+ /*! into_elements is an array expression */
+ /*! alloc_start is a scalar expression */
+ /*! alloc_start is an array expression */
+ /*! alloc_elements is a scalar expression */
+ /*! alloc_elements is an array expression */
+ uint32_t array_fields;
+};
+const int flag_align_is_array = 6;
+const int flag_alloc_if_is_array = 7;
+const int flag_free_if_is_array = 8;
+const int flag_extent_start_is_scalar = 9;
+const int flag_extent_start_is_array = 10;
+const int flag_extent_elements_is_scalar = 11;
+const int flag_extent_elements_is_array = 12;
+const int flag_into_start_is_scalar = 13;
+const int flag_into_start_is_array = 14;
+const int flag_into_elements_is_scalar = 15;
+const int flag_into_elements_is_array = 16;
+const int flag_alloc_start_is_scalar = 17;
+const int flag_alloc_start_is_array = 18;
+const int flag_alloc_elements_is_scalar = 19;
+const int flag_alloc_elements_is_array = 20;
+
+// The Marshaller
+class Marshaller
+{
+private:
+ // Start address of buffer
+ char *buffer_start;
+
+ // Current pointer within buffer
+ char *buffer_ptr;
+
+ // Physical size of data sent (including flags)
+ long long buffer_size;
+
+ // User data sent/received
+ long long tfr_size;
+
+public:
+ // Constructor
+ Marshaller() :
+ buffer_start(0), buffer_ptr(0),
+ buffer_size(0), tfr_size(0)
+ {
+ }
+
+ // Return count of user data sent/received
+ long long get_tfr_size() const
+ {
+ return tfr_size;
+ }
+
+ // Return pointer to buffer
+ char *get_buffer_start() const
+ {
+ return buffer_start;
+ }
+
+ // Return current size of data in buffer
+ long long get_buffer_size() const
+ {
+ return buffer_size;
+ }
+
+ // Set buffer pointer
+ void init_buffer(
+ char *d,
+ long long s
+ )
+ {
+ buffer_start = buffer_ptr = d;
+ buffer_size = s;
+ }
+
+ // Send data
+ void send_data(
+ const void *data,
+ int64_t length
+ );
+
+ // Receive data
+ void receive_data(
+ void *data,
+ int64_t length
+ );
+
+ // Send function pointer
+ void send_func_ptr(
+ const void* data
+ );
+
+ // Receive function pointer
+ void receive_func_ptr(
+ const void** data
+ );
+};
+
+// End of the Marshaller
+
+// The offloaded function descriptor.
+// Sent from host to target to specify which function to run.
+// Also, sets console and file tracing levels.
+struct FunctionDescriptor
+{
+ // Input data size.
+ long long in_datalen;
+
+ // Output data size.
+ long long out_datalen;
+
+ // Whether trace is requested on console.
+ // A value of 1 produces only function name and data sent/received.
+ // Values > 1 produce copious trace information.
+ uint8_t console_enabled;
+
+ // Flag controlling timing on the target side.
+ // Values > 0 enable timing on sink.
+ uint8_t timer_enabled;
+
+ int offload_report_level;
+ int offload_number;
+
+ // number of variable descriptors
+ int vars_num;
+
+ // inout data offset if data is passed as misc/return data
+ // otherwise it should be zero.
+ int data_offset;
+
+ // The name of the offloaded function
+ char data[];
+};
+
+// typedef OFFLOAD.
+// Pointer to OffloadDescriptor.
+typedef struct OffloadDescriptor *OFFLOAD;
+
+#endif // OFFLOAD_COMMON_H_INCLUDED
diff --git a/liboffloadmic/runtime/offload_engine.cpp b/liboffloadmic/runtime/offload_engine.cpp
new file mode 100644
index 00000000000..2fe0d24430c
--- /dev/null
+++ b/liboffloadmic/runtime/offload_engine.cpp
@@ -0,0 +1,551 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "offload_engine.h"
+#include <signal.h>
+#include <errno.h>
+
+#include <algorithm>
+#include <vector>
+
+#include "offload_host.h"
+#include "offload_table.h"
+
+const char* Engine::m_func_names[Engine::c_funcs_total] =
+{
+ "server_compute",
+#ifdef MYO_SUPPORT
+ "server_myoinit",
+ "server_myofini",
+#endif // MYO_SUPPORT
+ "server_init",
+ "server_var_table_size",
+ "server_var_table_copy"
+};
+
+// Symbolic representation of system signals. Fix for CQ233593
+const char* Engine::c_signal_names[Engine::c_signal_max] =
+{
+ "Unknown SIGNAL",
+ "SIGHUP", /* 1, Hangup (POSIX). */
+ "SIGINT", /* 2, Interrupt (ANSI). */
+ "SIGQUIT", /* 3, Quit (POSIX). */
+ "SIGILL", /* 4, Illegal instruction (ANSI). */
+ "SIGTRAP", /* 5, Trace trap (POSIX). */
+ "SIGABRT", /* 6, Abort (ANSI). */
+ "SIGBUS", /* 7, BUS error (4.2 BSD). */
+ "SIGFPE", /* 8, Floating-point exception (ANSI). */
+ "SIGKILL", /* 9, Kill, unblockable (POSIX). */
+ "SIGUSR1", /* 10, User-defined signal 1 (POSIX). */
+ "SIGSEGV", /* 11, Segmentation violation (ANSI). */
+ "SIGUSR2", /* 12, User-defined signal 2 (POSIX). */
+ "SIGPIPE", /* 13, Broken pipe (POSIX). */
+ "SIGALRM", /* 14, Alarm clock (POSIX). */
+ "SIGTERM", /* 15, Termination (ANSI). */
+ "SIGSTKFLT", /* 16, Stack fault. */
+ "SIGCHLD", /* 17, Child status has changed (POSIX). */
+ "SIGCONT", /* 18, Continue (POSIX). */
+ "SIGSTOP", /* 19, Stop, unblockable (POSIX). */
+ "SIGTSTP", /* 20, Keyboard stop (POSIX). */
+ "SIGTTIN", /* 21, Background read from tty (POSIX). */
+ "SIGTTOU", /* 22, Background write to tty (POSIX). */
+ "SIGURG", /* 23, Urgent condition on socket (4.2 BSD). */
+ "SIGXCPU", /* 24, CPU limit exceeded (4.2 BSD). */
+ "SIGXFSZ", /* 25, File size limit exceeded (4.2 BSD). */
+ "SIGVTALRM", /* 26, Virtual alarm clock (4.2 BSD). */
+ "SIGPROF", /* 27, Profiling alarm clock (4.2 BSD). */
+ "SIGWINCH", /* 28, Window size change (4.3 BSD, Sun). */
+ "SIGIO", /* 29, I/O now possible (4.2 BSD). */
+ "SIGPWR", /* 30, Power failure restart (System V). */
+ "SIGSYS" /* 31, Bad system call. */
+};
+
+void Engine::init(void)
+{
+ if (!m_ready) {
+ mutex_locker_t locker(m_lock);
+
+ if (!m_ready) {
+ // start process if not done yet
+ if (m_process == 0) {
+ init_process();
+ }
+
+ // load penging images
+ load_libraries();
+
+ // and (re)build pointer table
+ init_ptr_data();
+
+ // it is ready now
+ m_ready = true;
+ }
+ }
+}
+
+void Engine::init_process(void)
+{
+ COIENGINE engine;
+ COIRESULT res;
+ const char **environ;
+
+ // create environment for the target process
+ environ = (const char**) mic_env_vars.create_environ_for_card(m_index);
+ if (environ != 0) {
+ for (const char **p = environ; *p != 0; p++) {
+ OFFLOAD_DEBUG_TRACE(3, "Env Var for card %d: %s\n", m_index, *p);
+ }
+ }
+
+ // Create execution context in the specified device
+ OFFLOAD_DEBUG_TRACE(2, "Getting device %d (engine %d) handle\n", m_index,
+ m_physical_index);
+ res = COI::EngineGetHandle(COI_ISA_KNC, m_physical_index, &engine);
+ check_result(res, c_get_engine_handle, m_index, res);
+
+ // Target executable should be available by the time when we
+ // attempt to initialize the device
+ if (__target_exe == 0) {
+ LIBOFFLOAD_ERROR(c_no_target_exe);
+ exit(1);
+ }
+
+ OFFLOAD_DEBUG_TRACE(2,
+ "Loading target executable \"%s\" from %p, size %lld\n",
+ __target_exe->name, __target_exe->data, __target_exe->size);
+
+ res = COI::ProcessCreateFromMemory(
+ engine, // in_Engine
+ __target_exe->name, // in_pBinaryName
+ __target_exe->data, // in_pBinaryBuffer
+ __target_exe->size, // in_BinaryBufferLength,
+ 0, // in_Argc
+ 0, // in_ppArgv
+ environ == 0, // in_DupEnv
+ environ, // in_ppAdditionalEnv
+ mic_proxy_io, // in_ProxyActive
+ mic_proxy_fs_root, // in_ProxyfsRoot
+ mic_buffer_size, // in_BufferSpace
+ mic_library_path, // in_LibrarySearchPath
+ __target_exe->origin, // in_FileOfOrigin
+ __target_exe->offset, // in_FileOfOriginOffset
+ &m_process // out_pProcess
+ );
+ check_result(res, c_process_create, m_index, res);
+
+ // get function handles
+ res = COI::ProcessGetFunctionHandles(m_process, c_funcs_total,
+ m_func_names, m_funcs);
+ check_result(res, c_process_get_func_handles, m_index, res);
+
+ // initialize device side
+ pid_t pid = init_device();
+
+ // For IDB
+ if (__dbg_is_attached) {
+ // TODO: we have in-memory executable now.
+ // Check with IDB team what should we provide them now?
+ if (strlen(__target_exe->name) < MAX_TARGET_NAME) {
+ strcpy(__dbg_target_exe_name, __target_exe->name);
+ }
+ __dbg_target_so_pid = pid;
+ __dbg_target_id = m_physical_index;
+ __dbg_target_so_loaded();
+ }
+}
+
+void Engine::fini_process(bool verbose)
+{
+ if (m_process != 0) {
+ uint32_t sig;
+ int8_t ret;
+
+ // destroy target process
+ OFFLOAD_DEBUG_TRACE(2, "Destroying process on the device %d\n",
+ m_index);
+
+ COIRESULT res = COI::ProcessDestroy(m_process, -1, 0, &ret, &sig);
+ m_process = 0;
+
+ if (res == COI_SUCCESS) {
+ OFFLOAD_DEBUG_TRACE(3, "Device process: signal %d, exit code %d\n",
+ sig, ret);
+ if (verbose) {
+ if (sig != 0) {
+ LIBOFFLOAD_ERROR(
+ c_mic_process_exit_sig, m_index, sig,
+ c_signal_names[sig >= c_signal_max ? 0 : sig]);
+ }
+ else {
+ LIBOFFLOAD_ERROR(c_mic_process_exit_ret, m_index, ret);
+ }
+ }
+
+ // for idb
+ if (__dbg_is_attached) {
+ __dbg_target_so_unloaded();
+ }
+ }
+ else {
+ if (verbose) {
+ LIBOFFLOAD_ERROR(c_mic_process_exit, m_index);
+ }
+ }
+ }
+}
+
+void Engine::load_libraries()
+{
+ // load libraries collected so far
+ for (TargetImageList::iterator it = m_images.begin();
+ it != m_images.end(); it++) {
+ OFFLOAD_DEBUG_TRACE(2, "Loading library \"%s\" from %p, size %llu\n",
+ it->name, it->data, it->size);
+
+ // load library to the device
+ COILIBRARY lib;
+ COIRESULT res;
+ res = COI::ProcessLoadLibraryFromMemory(m_process,
+ it->data,
+ it->size,
+ it->name,
+ mic_library_path,
+ it->origin,
+ it->offset,
+ COI_LOADLIBRARY_V1_FLAGS,
+ &lib);
+
+ if (res != COI_SUCCESS && res != COI_ALREADY_EXISTS) {
+ check_result(res, c_load_library, m_index, res);
+ }
+ }
+ m_images.clear();
+}
+
+static bool target_entry_cmp(
+ const VarList::BufEntry &l,
+ const VarList::BufEntry &r
+)
+{
+ const char *l_name = reinterpret_cast<const char*>(l.name);
+ const char *r_name = reinterpret_cast<const char*>(r.name);
+ return strcmp(l_name, r_name) < 0;
+}
+
+static bool host_entry_cmp(
+ const VarTable::Entry *l,
+ const VarTable::Entry *r
+)
+{
+ return strcmp(l->name, r->name) < 0;
+}
+
+void Engine::init_ptr_data(void)
+{
+ COIRESULT res;
+ COIEVENT event;
+
+ // Prepare table of host entries
+ std::vector<const VarTable::Entry*> host_table(__offload_vars.begin(),
+ __offload_vars.end());
+
+ // no need to do anything further is host table is empty
+ if (host_table.size() <= 0) {
+ return;
+ }
+
+ // Get var table entries from the target.
+ // First we need to get size for the buffer to copy data
+ struct {
+ int64_t nelems;
+ int64_t length;
+ } params;
+
+ res = COI::PipelineRunFunction(get_pipeline(),
+ m_funcs[c_func_var_table_size],
+ 0, 0, 0,
+ 0, 0,
+ 0, 0,
+ &params, sizeof(params),
+ &event);
+ check_result(res, c_pipeline_run_func, m_index, res);
+
+ res = COI::EventWait(1, &event, -1, 1, 0, 0);
+ check_result(res, c_event_wait, res);
+
+ if (params.length == 0) {
+ return;
+ }
+
+ // create buffer for target entries and copy data to host
+ COIBUFFER buffer;
+ res = COI::BufferCreate(params.length, COI_BUFFER_NORMAL, 0, 0, 1,
+ &m_process, &buffer);
+ check_result(res, c_buf_create, m_index, res);
+
+ COI_ACCESS_FLAGS flags = COI_SINK_WRITE;
+ res = COI::PipelineRunFunction(get_pipeline(),
+ m_funcs[c_func_var_table_copy],
+ 1, &buffer, &flags,
+ 0, 0,
+ &params.nelems, sizeof(params.nelems),
+ 0, 0,
+ &event);
+ check_result(res, c_pipeline_run_func, m_index, res);
+
+ res = COI::EventWait(1, &event, -1, 1, 0, 0);
+ check_result(res, c_event_wait, res);
+
+ // patch names in target data
+ VarList::BufEntry *target_table;
+ COIMAPINSTANCE map_inst;
+ res = COI::BufferMap(buffer, 0, params.length, COI_MAP_READ_ONLY, 0, 0,
+ 0, &map_inst,
+ reinterpret_cast<void**>(&target_table));
+ check_result(res, c_buf_map, res);
+
+ VarList::table_patch_names(target_table, params.nelems);
+
+ // and sort entries
+ std::sort(target_table, target_table + params.nelems, target_entry_cmp);
+ std::sort(host_table.begin(), host_table.end(), host_entry_cmp);
+
+ // merge host and target entries and enter matching vars map
+ std::vector<const VarTable::Entry*>::const_iterator hi =
+ host_table.begin();
+ std::vector<const VarTable::Entry*>::const_iterator he =
+ host_table.end();
+ const VarList::BufEntry *ti = target_table;
+ const VarList::BufEntry *te = target_table + params.nelems;
+
+ while (hi != he && ti != te) {
+ int res = strcmp((*hi)->name, reinterpret_cast<const char*>(ti->name));
+ if (res == 0) {
+ // add matching entry to var map
+ std::pair<PtrSet::iterator, bool> res =
+ m_ptr_set.insert(PtrData((*hi)->addr, (*hi)->size));
+
+ // store address for new entries
+ if (res.second) {
+ PtrData *ptr = const_cast<PtrData*>(res.first.operator->());
+ ptr->mic_addr = ti->addr;
+ ptr->is_static = true;
+ }
+
+ hi++;
+ ti++;
+ }
+ else if (res < 0) {
+ hi++;
+ }
+ else {
+ ti++;
+ }
+ }
+
+ // cleanup
+ res = COI::BufferUnmap(map_inst, 0, 0, 0);
+ check_result(res, c_buf_unmap, res);
+
+ res = COI::BufferDestroy(buffer);
+ check_result(res, c_buf_destroy, res);
+}
+
+COIRESULT Engine::compute(
+ const std::list<COIBUFFER> &buffers,
+ const void* data,
+ uint16_t data_size,
+ void* ret,
+ uint16_t ret_size,
+ uint32_t num_deps,
+ const COIEVENT* deps,
+ COIEVENT* event
+) /* const */
+{
+ COIBUFFER *bufs;
+ COI_ACCESS_FLAGS *flags;
+ COIRESULT res;
+
+ // convert buffers list to array
+ int num_bufs = buffers.size();
+ if (num_bufs > 0) {
+ bufs = (COIBUFFER*) alloca(num_bufs * sizeof(COIBUFFER));
+ flags = (COI_ACCESS_FLAGS*) alloca(num_bufs *
+ sizeof(COI_ACCESS_FLAGS));
+
+ int i = 0;
+ for (std::list<COIBUFFER>::const_iterator it = buffers.begin();
+ it != buffers.end(); it++) {
+ bufs[i] = *it;
+
+ // TODO: this should be fixed
+ flags[i++] = COI_SINK_WRITE;
+ }
+ }
+ else {
+ bufs = 0;
+ flags = 0;
+ }
+
+ // start computation
+ res = COI::PipelineRunFunction(get_pipeline(),
+ m_funcs[c_func_compute],
+ num_bufs, bufs, flags,
+ num_deps, deps,
+ data, data_size,
+ ret, ret_size,
+ event);
+ return res;
+}
+
+pid_t Engine::init_device(void)
+{
+ struct init_data {
+ int device_index;
+ int devices_total;
+ int console_level;
+ int offload_report_level;
+ } data;
+ COIRESULT res;
+ COIEVENT event;
+ pid_t pid;
+
+ OFFLOAD_DEBUG_TRACE_1(2, 0, c_offload_init,
+ "Initializing device with logical index %d "
+ "and physical index %d\n",
+ m_index, m_physical_index);
+
+ // setup misc data
+ data.device_index = m_index;
+ data.devices_total = mic_engines_total;
+ data.console_level = console_enabled;
+ data.offload_report_level = offload_report_level;
+
+ res = COI::PipelineRunFunction(get_pipeline(),
+ m_funcs[c_func_init],
+ 0, 0, 0, 0, 0,
+ &data, sizeof(data),
+ &pid, sizeof(pid),
+ &event);
+ check_result(res, c_pipeline_run_func, m_index, res);
+
+ res = COI::EventWait(1, &event, -1, 1, 0, 0);
+ check_result(res, c_event_wait, res);
+
+ OFFLOAD_DEBUG_TRACE(2, "Device process pid is %d\n", pid);
+
+ return pid;
+}
+
+// data associated with each thread
+struct Thread {
+ Thread(long* addr_coipipe_counter) {
+ m_addr_coipipe_counter = addr_coipipe_counter;
+ memset(m_pipelines, 0, sizeof(m_pipelines));
+ }
+
+ ~Thread() {
+#ifndef TARGET_WINNT
+ __sync_sub_and_fetch(m_addr_coipipe_counter, 1);
+#else // TARGET_WINNT
+ _InterlockedDecrement(m_addr_coipipe_counter);
+#endif // TARGET_WINNT
+ for (int i = 0; i < mic_engines_total; i++) {
+ if (m_pipelines[i] != 0) {
+ COI::PipelineDestroy(m_pipelines[i]);
+ }
+ }
+ }
+
+ COIPIPELINE get_pipeline(int index) const {
+ return m_pipelines[index];
+ }
+
+ void set_pipeline(int index, COIPIPELINE pipeline) {
+ m_pipelines[index] = pipeline;
+ }
+
+ AutoSet& get_auto_vars() {
+ return m_auto_vars;
+ }
+
+private:
+ long* m_addr_coipipe_counter;
+ AutoSet m_auto_vars;
+ COIPIPELINE m_pipelines[MIC_ENGINES_MAX];
+};
+
+COIPIPELINE Engine::get_pipeline(void)
+{
+ Thread* thread = (Thread*) thread_getspecific(mic_thread_key);
+ if (thread == 0) {
+ thread = new Thread(&m_proc_number);
+ thread_setspecific(mic_thread_key, thread);
+ }
+
+ COIPIPELINE pipeline = thread->get_pipeline(m_index);
+ if (pipeline == 0) {
+ COIRESULT res;
+ int proc_num;
+
+#ifndef TARGET_WINNT
+ proc_num = __sync_fetch_and_add(&m_proc_number, 1);
+#else // TARGET_WINNT
+ proc_num = _InterlockedIncrement(&m_proc_number);
+#endif // TARGET_WINNT
+
+ if (proc_num > COI_PIPELINE_MAX_PIPELINES) {
+ LIBOFFLOAD_ERROR(c_coipipe_max_number, COI_PIPELINE_MAX_PIPELINES);
+ LIBOFFLOAD_ABORT;
+ }
+ // create pipeline for this thread
+ res = COI::PipelineCreate(m_process, 0, mic_stack_size, &pipeline);
+ check_result(res, c_pipeline_create, m_index, res);
+
+ thread->set_pipeline(m_index, pipeline);
+ }
+ return pipeline;
+}
+
+AutoSet& Engine::get_auto_vars(void)
+{
+ Thread* thread = (Thread*) thread_getspecific(mic_thread_key);
+ if (thread == 0) {
+ thread = new Thread(&m_proc_number);
+ thread_setspecific(mic_thread_key, thread);
+ }
+
+ return thread->get_auto_vars();
+}
+
+void Engine::destroy_thread_data(void *data)
+{
+ delete static_cast<Thread*>(data);
+}
diff --git a/liboffloadmic/runtime/offload_engine.h b/liboffloadmic/runtime/offload_engine.h
new file mode 100644
index 00000000000..501890c5834
--- /dev/null
+++ b/liboffloadmic/runtime/offload_engine.h
@@ -0,0 +1,502 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#ifndef OFFLOAD_ENGINE_H_INCLUDED
+#define OFFLOAD_ENGINE_H_INCLUDED
+
+#include <limits.h>
+
+#include <list>
+#include <set>
+#include <map>
+#include "offload_common.h"
+#include "coi/coi_client.h"
+
+// Address range
+class MemRange {
+public:
+ MemRange() : m_start(0), m_length(0) {}
+ MemRange(const void *addr, uint64_t len) : m_start(addr), m_length(len) {}
+
+ const void* start() const {
+ return m_start;
+ }
+
+ const void* end() const {
+ return static_cast<const char*>(m_start) + m_length;
+ }
+
+ uint64_t length() const {
+ return m_length;
+ }
+
+ // returns true if given range overlaps with another one
+ bool overlaps(const MemRange &o) const {
+ // Two address ranges A[start, end) and B[start,end) overlap
+ // if A.start < B.end and A.end > B.start.
+ return start() < o.end() && end() > o.start();
+ }
+
+ // returns true if given range contains the other range
+ bool contains(const MemRange &o) const {
+ return start() <= o.start() && o.end() <= end();
+ }
+
+private:
+ const void* m_start;
+ uint64_t m_length;
+};
+
+// Data associated with a pointer variable
+class PtrData {
+public:
+ PtrData(const void *addr, uint64_t len) :
+ cpu_addr(addr, len), cpu_buf(0),
+ mic_addr(0), alloc_disp(0), mic_buf(0), mic_offset(0),
+ ref_count(0), is_static(false)
+ {}
+
+ //
+ // Copy constructor
+ //
+ PtrData(const PtrData& ptr):
+ cpu_addr(ptr.cpu_addr), cpu_buf(ptr.cpu_buf),
+ mic_addr(ptr.mic_addr), alloc_disp(ptr.alloc_disp),
+ mic_buf(ptr.mic_buf), mic_offset(ptr.mic_offset),
+ ref_count(ptr.ref_count), is_static(ptr.is_static)
+ {}
+
+ bool operator<(const PtrData &o) const {
+ // Variables are sorted by the CPU start address.
+ // Overlapping memory ranges are considered equal.
+ return (cpu_addr.start() < o.cpu_addr.start()) &&
+ !cpu_addr.overlaps(o.cpu_addr);
+ }
+
+ long add_reference() {
+ if (is_static) {
+ return LONG_MAX;
+ }
+#ifndef TARGET_WINNT
+ return __sync_fetch_and_add(&ref_count, 1);
+#else // TARGET_WINNT
+ return _InterlockedIncrement(&ref_count) - 1;
+#endif // TARGET_WINNT
+ }
+
+ long remove_reference() {
+ if (is_static) {
+ return LONG_MAX;
+ }
+#ifndef TARGET_WINNT
+ return __sync_sub_and_fetch(&ref_count, 1);
+#else // TARGET_WINNT
+ return _InterlockedDecrement(&ref_count);
+#endif // TARGET_WINNT
+ }
+
+ long get_reference() const {
+ if (is_static) {
+ return LONG_MAX;
+ }
+ return ref_count;
+ }
+
+public:
+ // CPU address range
+ const MemRange cpu_addr;
+
+ // CPU and MIC buffers
+ COIBUFFER cpu_buf;
+ COIBUFFER mic_buf;
+
+ // placeholder for buffer address on mic
+ uint64_t mic_addr;
+
+ uint64_t alloc_disp;
+
+ // additional offset to pointer data on MIC for improving bandwidth for
+ // data which is not 4K aligned
+ uint32_t mic_offset;
+
+ // if true buffers are created from static memory
+ bool is_static;
+ mutex_t alloc_ptr_data_lock;
+
+private:
+ // reference count for the entry
+ long ref_count;
+};
+
+typedef std::list<PtrData*> PtrDataList;
+
+// Data associated with automatic variable
+class AutoData {
+public:
+ AutoData(const void *addr, uint64_t len) :
+ cpu_addr(addr, len), ref_count(0)
+ {}
+
+ bool operator<(const AutoData &o) const {
+ // Variables are sorted by the CPU start address.
+ // Overlapping memory ranges are considered equal.
+ return (cpu_addr.start() < o.cpu_addr.start()) &&
+ !cpu_addr.overlaps(o.cpu_addr);
+ }
+
+ long add_reference() {
+#ifndef TARGET_WINNT
+ return __sync_fetch_and_add(&ref_count, 1);
+#else // TARGET_WINNT
+ return _InterlockedIncrement(&ref_count) - 1;
+#endif // TARGET_WINNT
+ }
+
+ long remove_reference() {
+#ifndef TARGET_WINNT
+ return __sync_sub_and_fetch(&ref_count, 1);
+#else // TARGET_WINNT
+ return _InterlockedDecrement(&ref_count);
+#endif // TARGET_WINNT
+ }
+
+ long get_reference() const {
+ return ref_count;
+ }
+
+public:
+ // CPU address range
+ const MemRange cpu_addr;
+
+private:
+ // reference count for the entry
+ long ref_count;
+};
+
+// Set of autimatic variables
+typedef std::set<AutoData> AutoSet;
+
+// Target image data
+struct TargetImage
+{
+ TargetImage(const char *_name, const void *_data, uint64_t _size,
+ const char *_origin, uint64_t _offset) :
+ name(_name), data(_data), size(_size),
+ origin(_origin), offset(_offset)
+ {}
+
+ // library name
+ const char* name;
+
+ // contents and size
+ const void* data;
+ uint64_t size;
+
+ // file of origin and offset within that file
+ const char* origin;
+ uint64_t offset;
+};
+
+typedef std::list<TargetImage> TargetImageList;
+
+// Data associated with persistent auto objects
+struct PersistData
+{
+ PersistData(const void *addr, uint64_t routine_num, uint64_t size) :
+ stack_cpu_addr(addr), routine_id(routine_num)
+ {
+ stack_ptr_data = new PtrData(0, size);
+ }
+ // 1-st key value - begining of the stack at CPU
+ const void * stack_cpu_addr;
+ // 2-nd key value - identifier of routine invocation at CPU
+ uint64_t routine_id;
+ // corresponded PtrData; only stack_ptr_data->mic_buf is used
+ PtrData * stack_ptr_data;
+ // used to get offset of the variable in stack buffer
+ char * cpu_stack_addr;
+};
+
+typedef std::list<PersistData> PersistDataList;
+
+// class representing a single engine
+struct Engine {
+ friend void __offload_init_library_once(void);
+ friend void __offload_fini_library(void);
+
+#define check_result(res, tag, ...) \
+ { \
+ if (res == COI_PROCESS_DIED) { \
+ fini_process(true); \
+ exit(1); \
+ } \
+ if (res != COI_SUCCESS) { \
+ __liboffload_error_support(tag, __VA_ARGS__); \
+ exit(1); \
+ } \
+ }
+
+ int get_logical_index() const {
+ return m_index;
+ }
+
+ int get_physical_index() const {
+ return m_physical_index;
+ }
+
+ const COIPROCESS& get_process() const {
+ return m_process;
+ }
+
+ // initialize device
+ void init(void);
+
+ // add new library
+ void add_lib(const TargetImage &lib)
+ {
+ m_lock.lock();
+ m_ready = false;
+ m_images.push_back(lib);
+ m_lock.unlock();
+ }
+
+ COIRESULT compute(
+ const std::list<COIBUFFER> &buffers,
+ const void* data,
+ uint16_t data_size,
+ void* ret,
+ uint16_t ret_size,
+ uint32_t num_deps,
+ const COIEVENT* deps,
+ COIEVENT* event
+ );
+
+#ifdef MYO_SUPPORT
+ // temporary workaround for blocking behavior for myoiLibInit/Fini calls
+ void init_myo(COIEVENT *event) {
+ COIRESULT res;
+ res = COI::PipelineRunFunction(get_pipeline(),
+ m_funcs[c_func_myo_init],
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ event);
+ check_result(res, c_pipeline_run_func, m_index, res);
+ }
+
+ void fini_myo(COIEVENT *event) {
+ COIRESULT res;
+ res = COI::PipelineRunFunction(get_pipeline(),
+ m_funcs[c_func_myo_fini],
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ event);
+ check_result(res, c_pipeline_run_func, m_index, res);
+ }
+#endif // MYO_SUPPORT
+
+ //
+ // Memory association table
+ //
+ PtrData* find_ptr_data(const void *ptr) {
+ m_ptr_lock.lock();
+ PtrSet::iterator res = m_ptr_set.find(PtrData(ptr, 0));
+ m_ptr_lock.unlock();
+ if (res == m_ptr_set.end()) {
+ return 0;
+ }
+ return const_cast<PtrData*>(res.operator->());
+ }
+
+ PtrData* insert_ptr_data(const void *ptr, uint64_t len, bool &is_new) {
+ m_ptr_lock.lock();
+ std::pair<PtrSet::iterator, bool> res =
+ m_ptr_set.insert(PtrData(ptr, len));
+ PtrData* ptr_data = const_cast<PtrData*>(res.first.operator->());
+ m_ptr_lock.unlock();
+
+ is_new = res.second;
+ if (is_new) {
+ // It's necessary to lock as soon as possible.
+ // unlock must be done at call site of insert_ptr_data at
+ // branch for is_new
+ ptr_data->alloc_ptr_data_lock.lock();
+ }
+ return ptr_data;
+ }
+
+ void remove_ptr_data(const void *ptr) {
+ m_ptr_lock.lock();
+ m_ptr_set.erase(PtrData(ptr, 0));
+ m_ptr_lock.unlock();
+ }
+
+ //
+ // Automatic variables
+ //
+ AutoData* find_auto_data(const void *ptr) {
+ AutoSet &auto_vars = get_auto_vars();
+ AutoSet::iterator res = auto_vars.find(AutoData(ptr, 0));
+ if (res == auto_vars.end()) {
+ return 0;
+ }
+ return const_cast<AutoData*>(res.operator->());
+ }
+
+ AutoData* insert_auto_data(const void *ptr, uint64_t len) {
+ AutoSet &auto_vars = get_auto_vars();
+ std::pair<AutoSet::iterator, bool> res =
+ auto_vars.insert(AutoData(ptr, len));
+ return const_cast<AutoData*>(res.first.operator->());
+ }
+
+ void remove_auto_data(const void *ptr) {
+ get_auto_vars().erase(AutoData(ptr, 0));
+ }
+
+ //
+ // Signals
+ //
+ void add_signal(const void *signal, OffloadDescriptor *desc) {
+ m_signal_lock.lock();
+ m_signal_map[signal] = desc;
+ m_signal_lock.unlock();
+ }
+
+ OffloadDescriptor* find_signal(const void *signal, bool remove) {
+ OffloadDescriptor *desc = 0;
+
+ m_signal_lock.lock();
+ {
+ SignalMap::iterator it = m_signal_map.find(signal);
+ if (it != m_signal_map.end()) {
+ desc = it->second;
+ if (remove) {
+ m_signal_map.erase(it);
+ }
+ }
+ }
+ m_signal_lock.unlock();
+
+ return desc;
+ }
+
+ // stop device process
+ void fini_process(bool verbose);
+
+ // list of stacks active at the engine
+ PersistDataList m_persist_list;
+
+private:
+ Engine() : m_index(-1), m_physical_index(-1), m_process(0), m_ready(false),
+ m_proc_number(0)
+ {}
+
+ ~Engine() {
+ if (m_process != 0) {
+ fini_process(false);
+ }
+ }
+
+ // set indexes
+ void set_indexes(int logical_index, int physical_index) {
+ m_index = logical_index;
+ m_physical_index = physical_index;
+ }
+
+ // start process on device
+ void init_process();
+
+ void load_libraries(void);
+ void init_ptr_data(void);
+
+ // performs library intialization on the device side
+ pid_t init_device(void);
+
+private:
+ // get pipeline associated with a calling thread
+ COIPIPELINE get_pipeline(void);
+
+ // get automatic vars set associated with the calling thread
+ AutoSet& get_auto_vars(void);
+
+ // destructor for thread data
+ static void destroy_thread_data(void *data);
+
+private:
+ typedef std::set<PtrData> PtrSet;
+ typedef std::map<const void*, OffloadDescriptor*> SignalMap;
+
+ // device indexes
+ int m_index;
+ int m_physical_index;
+
+ // number of COI pipes created for the engine
+ long m_proc_number;
+
+ // process handle
+ COIPROCESS m_process;
+
+ // If false, device either has not been initialized or new libraries
+ // have been added.
+ bool m_ready;
+ mutex_t m_lock;
+
+ // List of libraries to be loaded
+ TargetImageList m_images;
+
+ // var table
+ PtrSet m_ptr_set;
+ mutex_t m_ptr_lock;
+
+ // signals
+ SignalMap m_signal_map;
+ mutex_t m_signal_lock;
+
+ // constants for accessing device function handles
+ enum {
+ c_func_compute = 0,
+#ifdef MYO_SUPPORT
+ c_func_myo_init,
+ c_func_myo_fini,
+#endif // MYO_SUPPORT
+ c_func_init,
+ c_func_var_table_size,
+ c_func_var_table_copy,
+ c_funcs_total
+ };
+ static const char* m_func_names[c_funcs_total];
+
+ // device function handles
+ COIFUNCTION m_funcs[c_funcs_total];
+
+ // int -> name mapping for device signals
+ static const int c_signal_max = 32;
+ static const char* c_signal_names[c_signal_max];
+};
+
+#endif // OFFLOAD_ENGINE_H_INCLUDED
diff --git a/liboffloadmic/runtime/offload_env.cpp b/liboffloadmic/runtime/offload_env.cpp
new file mode 100644
index 00000000000..447c6edf74e
--- /dev/null
+++ b/liboffloadmic/runtime/offload_env.cpp
@@ -0,0 +1,378 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "offload_env.h"
+#include <string.h>
+#include <ctype.h>
+#include "offload_util.h"
+#include "liboffload_error_codes.h"
+
+// for environment variables valid on all cards
+const int MicEnvVar::any_card = -1;
+
+MicEnvVar::~MicEnvVar()
+{
+ for (std::list<MicEnvVar::CardEnvVars*>::const_iterator
+ it = card_spec_list.begin();
+ it != card_spec_list.end(); it++) {
+ CardEnvVars *card_data = *it;
+ delete card_data;
+ }
+}
+
+MicEnvVar::VarValue::~VarValue()
+{
+ free(env_var_value);
+}
+
+MicEnvVar::CardEnvVars::~CardEnvVars()
+{
+ for (std::list<MicEnvVar::VarValue*>::const_iterator it = env_vars.begin();
+ it != env_vars.end(); it++) {
+ VarValue *var_value = *it;
+ delete var_value;
+ }
+}
+
+// Searching for card in "card_spec_list" list with the same "number"
+
+MicEnvVar::CardEnvVars* MicEnvVar::get_card(int number)
+{
+ if (number == any_card) {
+ return &common_vars;
+ }
+ for (std::list<MicEnvVar::CardEnvVars*>::const_iterator
+ it = card_spec_list.begin();
+ it != card_spec_list.end(); it++) {
+ CardEnvVars *card_data = *it;
+ if (card_data->card_number == number) {
+ return card_data;
+ }
+ }
+ return NULL;
+}
+
+// Searching for environment variable in "env_var" list with the same name
+
+MicEnvVar::VarValue* MicEnvVar::CardEnvVars::find_var(
+ char* env_var_name,
+ int env_var_name_length
+)
+{
+ for (std::list<MicEnvVar::VarValue*>::const_iterator it = env_vars.begin();
+ it != env_vars.end(); it++) {
+ VarValue *var_value = *it;
+ if (var_value->length == env_var_name_length &&
+ !strncmp(var_value->env_var, env_var_name,
+ env_var_name_length)) {
+ return var_value;
+ }
+ }
+ return NULL;
+}
+
+void MicEnvVar::analyze_env_var(char *env_var_string)
+{
+ char *env_var_name;
+ char *env_var_def;
+ int card_number;
+ int env_var_name_length;
+ MicEnvVarKind env_var_kind;
+
+ env_var_kind = get_env_var_kind(env_var_string,
+ &card_number,
+ &env_var_name,
+ &env_var_name_length,
+ &env_var_def);
+ switch (env_var_kind) {
+ case c_mic_var:
+ case c_mic_card_var:
+ add_env_var(card_number,
+ env_var_name,
+ env_var_name_length,
+ env_var_def);
+ break;
+ case c_mic_card_env:
+ mic_parse_env_var_list(card_number, env_var_def);
+ break;
+ case c_no_mic:
+ default:
+ break;
+ }
+}
+
+void MicEnvVar::add_env_var(
+ int card_number,
+ char *env_var_name,
+ int env_var_name_length,
+ char *env_var_def
+)
+{
+ VarValue *var;
+ CardEnvVars *card;
+
+ // The case corresponds to common env var definition of kind
+ // <mic-prefix>_<var>
+ if (card_number == any_card) {
+ card = &common_vars;
+ }
+ else {
+ card = get_card(card_number);
+ if (!card) {
+ // definition for new card occured
+ card = new CardEnvVars(card_number);
+ card_spec_list.push_back(card);
+ }
+
+ }
+ var = card->find_var(env_var_name, env_var_name_length);
+ if (!var) {
+ // put new env var definition in "env_var" list
+ var = new VarValue(env_var_name, env_var_name_length, env_var_def);
+ card->env_vars.push_back(var);
+ }
+}
+
+// The routine analyses string pointed by "env_var_string" argument
+// according to the following syntax:
+//
+// Specification of prefix for MIC environment variables
+// MIC_ENV_PREFIX=<mic-prefix>
+//
+// Setting single MIC environment variable
+// <mic-prefix>_<var>=<value>
+// <mic-prefix>_<card-number>_<var>=<value>
+
+// Setting multiple MIC environment variables
+// <mic-prefix>_<card-number>_ENV=<env-vars>
+
+MicEnvVarKind MicEnvVar::get_env_var_kind(
+ char *env_var_string,
+ int *card_number,
+ char **env_var_name,
+ int *env_var_name_length,
+ char **env_var_def
+)
+{
+ int len = strlen(prefix);
+ char *c = env_var_string;
+ int num = 0;
+ bool card_is_set = false;
+
+ if (strncmp(c, prefix, len) != 0 || c[len] != '_') {
+ return c_no_mic;
+ }
+ c += len + 1;
+
+ *card_number = any_card;
+ if (isdigit(*c)) {
+ while (isdigit (*c)) {
+ num = (*c++ - '0') + (num * 10);
+ }
+ if (*c != '_') {
+ return c_no_mic;
+ }
+ c++;
+ *card_number = num;
+ card_is_set = true;
+ }
+ if (!isalpha(*c)) {
+ return c_no_mic;
+ }
+ *env_var_name = *env_var_def = c;
+ if (strncmp(c, "ENV=", 4) == 0) {
+ if (!card_is_set) {
+ *env_var_name_length = 3;
+ *env_var_name = *env_var_def = c;
+ *env_var_def = strdup(*env_var_def);
+ return c_mic_var;
+ }
+ *env_var_def = c + strlen("ENV=");
+ *env_var_def = strdup(*env_var_def);
+ return c_mic_card_env;
+ }
+ if (isalpha(*c)) {
+ *env_var_name_length = 0;
+ while (isalnum(*c) || *c == '_') {
+ c++;
+ (*env_var_name_length)++;
+ }
+ }
+ if (*c != '=') {
+ return c_no_mic;
+ }
+ *env_var_def = strdup(*env_var_def);
+ return card_is_set? c_mic_card_var : c_mic_var;
+}
+
+// analysing <env-vars> in form:
+// <mic-prefix>_<card-number>_ENV=<env-vars>
+// where:
+//
+// <env-vars>:
+// <env-var>
+// <env-vars> | <env-var>
+//
+// <env-var>:
+// variable=value
+// variable="value"
+// variable=
+
+void MicEnvVar::mic_parse_env_var_list(
+ int card_number, char *env_vars_def_list)
+{
+ char *c = env_vars_def_list;
+ char *env_var_name;
+ int env_var_name_length;
+ char *env_var_def;
+ bool var_is_quoted;
+
+ if (*c == '"') {
+ c++;
+ }
+ while (*c != 0) {
+ var_is_quoted = false;
+ env_var_name = c;
+ env_var_name_length = 0;
+ if (isalpha(*c)) {
+ while (isalnum(*c) || *c == '_') {
+ c++;
+ env_var_name_length++;
+ }
+ }
+ else {
+ LIBOFFLOAD_ERROR(c_mic_parse_env_var_list1);
+ return;
+ }
+ if (*c != '=') {
+ LIBOFFLOAD_ERROR(c_mic_parse_env_var_list2);
+ return;
+ }
+ c++;
+
+ if (*c == '"') {
+ var_is_quoted = true;
+ c++;
+ }
+ // Environment variable values that contain | will need to be escaped.
+ while (*c != 0 && *c != '|' &&
+ (!var_is_quoted || *c != '"'))
+ {
+ // skip escaped symbol
+ if (*c == '\\') {
+ c++;
+ }
+ c++;
+ }
+ if (var_is_quoted) {
+ c++; // for "
+ while (*c != 0 && *c != '|') {
+ c++;
+ }
+ }
+
+ int sz = c - env_var_name;
+ env_var_def = (char*)malloc(sz);
+ if (env_var_def == NULL)
+ LIBOFFLOAD_ERROR(c_malloc);
+ memcpy(env_var_def, env_var_name, sz);
+ env_var_def[sz] = 0;
+
+ if (*c == '|') {
+ c++;
+ while (*c != 0 && *c == ' ') {
+ c++;
+ }
+ }
+ add_env_var(card_number,
+ env_var_name,
+ env_var_name_length,
+ env_var_def);
+ }
+}
+
+// Collect all definitions for the card with number "card_num".
+// The returned result is vector of string pointers defining one
+// environment variable. The vector is terminated by NULL pointer.
+// In the begining of the vector there are env vars defined as
+// <mic-prefix>_<card-number>_<var>=<value>
+// or
+// <mic-prefix>_<card-number>_ENV=<env-vars>
+// where <card-number> is equal to "card_num"
+// They are followed by definitions valid for any card
+// and absent in previous definitions.
+
+char** MicEnvVar::create_environ_for_card(int card_num)
+{
+ VarValue *var_value;
+ VarValue *var_value_find;
+ CardEnvVars *card_data = get_card(card_num);
+ CardEnvVars *card_data_common;
+ std::list<char*> new_env;
+ char **rez;
+
+ if (!prefix) {
+ return NULL;
+ }
+ // There is no personel env var definitions for the card with
+ // number "card_num"
+ if (!card_data) {
+ return create_environ_for_card(any_card);
+ }
+
+ for (std::list<MicEnvVar::VarValue*>::const_iterator
+ it = card_data->env_vars.begin();
+ it != card_data->env_vars.end(); it++) {
+ var_value = *it;
+ new_env.push_back(var_value->env_var_value);
+ }
+
+ if (card_num != any_card) {
+ card_data_common = get_card(any_card);
+ for (std::list<MicEnvVar::VarValue*>::const_iterator
+ it = card_data_common->env_vars.begin();
+ it != card_data_common->env_vars.end(); it++) {
+ var_value = *it;
+ var_value_find = card_data->find_var(var_value->env_var,
+ var_value->length);
+ if (!var_value_find) {
+ new_env.push_back(var_value->env_var_value);
+ }
+ }
+ }
+
+ int new_env_size = new_env.size();
+ rez = (char**) malloc((new_env_size + 1) * sizeof(char*));
+ if (rez == NULL)
+ LIBOFFLOAD_ERROR(c_malloc);
+ std::copy(new_env.begin(), new_env.end(), rez);
+ rez[new_env_size] = 0;
+ return rez;
+}
diff --git a/liboffloadmic/runtime/offload_env.h b/liboffloadmic/runtime/offload_env.h
new file mode 100644
index 00000000000..e60e8601e9c
--- /dev/null
+++ b/liboffloadmic/runtime/offload_env.h
@@ -0,0 +1,111 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#ifndef OFFLOAD_ENV_H_INCLUDED
+#define OFFLOAD_ENV_H_INCLUDED
+
+#include <list>
+
+// data structure and routines to parse MIC user environment and pass to MIC
+
+enum MicEnvVarKind
+{
+ c_no_mic, // not MIC env var
+ c_mic_var, // for <mic-prefix>_<var>
+ c_mic_card_var, // for <mic-prefix>_<card-number>_<var>
+ c_mic_card_env // for <mic-prefix>_<card-number>_ENV
+};
+
+struct MicEnvVar {
+public:
+ MicEnvVar() : prefix(0) {}
+ ~MicEnvVar();
+
+ void analyze_env_var(char *env_var_string);
+ char** create_environ_for_card(int card_num);
+ MicEnvVarKind get_env_var_kind(
+ char *env_var_string,
+ int *card_number,
+ char **env_var_name,
+ int *env_var_name_length,
+ char **env_var_def
+ );
+ void add_env_var(
+ int card_number,
+ char *env_var_name,
+ int env_var_name_length,
+ char *env_var_def
+ );
+
+ void set_prefix(const char *pref) {
+ prefix = (pref && *pref != '\0') ? pref : 0;
+ }
+
+ struct VarValue {
+ public:
+ char* env_var;
+ int length;
+ char* env_var_value;
+
+ VarValue(char* var, int ln, char* value)
+ {
+ env_var = var;
+ length = ln;
+ env_var_value = value;
+ }
+ ~VarValue();
+ };
+
+ struct CardEnvVars {
+ public:
+
+ int card_number;
+ std::list<struct VarValue*> env_vars;
+
+ CardEnvVars() { card_number = any_card; }
+ CardEnvVars(int num) { card_number = num; }
+ ~CardEnvVars();
+
+ void add_new_env_var(int number, char *env_var, int length,
+ char *env_var_value);
+ VarValue* find_var(char* env_var_name, int env_var_name_length);
+ };
+ static const int any_card;
+
+private:
+ void mic_parse_env_var_list(int card_number, char *env_var_def);
+ CardEnvVars* get_card(int number);
+
+ const char *prefix;
+ std::list<struct CardEnvVars *> card_spec_list;
+ CardEnvVars common_vars;
+};
+
+#endif // OFFLOAD_ENV_H_INCLUDED
diff --git a/liboffloadmic/runtime/offload_host.cpp b/liboffloadmic/runtime/offload_host.cpp
new file mode 100644
index 00000000000..23a873f3886
--- /dev/null
+++ b/liboffloadmic/runtime/offload_host.cpp
@@ -0,0 +1,4402 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+// Forward declaration as the following 2 functions are declared as friend in offload_engine.h
+// CLANG does not like static to been after friend declaration.
+static void __offload_init_library_once(void);
+static void __offload_fini_library(void);
+
+#include "offload_host.h"
+#ifdef MYO_SUPPORT
+#include "offload_myo_host.h"
+#endif
+
+#include <malloc.h>
+#ifndef TARGET_WINNT
+#include <alloca.h>
+#include <elf.h>
+#endif // TARGET_WINNT
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <algorithm>
+#include <bitset>
+
+#if defined(HOST_WINNT)
+#define PATH_SEPARATOR ";"
+#else
+#define PATH_SEPARATOR ":"
+#endif
+
+#define GET_OFFLOAD_NUMBER(timer_data) \
+ timer_data? timer_data->offload_number : 0
+
+#ifdef TARGET_WINNT
+// Small subset of ELF declarations for Windows which is needed to compile
+// this file. ELF header is used to understand what binary type is contained
+// in the target image - shared library or executable.
+
+typedef uint16_t Elf64_Half;
+typedef uint32_t Elf64_Word;
+typedef uint64_t Elf64_Addr;
+typedef uint64_t Elf64_Off;
+
+#define EI_NIDENT 16
+
+#define ET_EXEC 2
+#define ET_DYN 3
+
+typedef struct
+{
+ unsigned char e_ident[EI_NIDENT];
+ Elf64_Half e_type;
+ Elf64_Half e_machine;
+ Elf64_Word e_version;
+ Elf64_Addr e_entry;
+ Elf64_Off e_phoff;
+ Elf64_Off e_shoff;
+ Elf64_Word e_flags;
+ Elf64_Half e_ehsize;
+ Elf64_Half e_phentsize;
+ Elf64_Half e_phnum;
+ Elf64_Half e_shentsize;
+ Elf64_Half e_shnum;
+ Elf64_Half e_shstrndx;
+} Elf64_Ehdr;
+#endif // TARGET_WINNT
+
+// Host console and file logging
+const char *prefix;
+int console_enabled = 0;
+int offload_number = 0;
+
+static const char *htrace_envname = "H_TRACE";
+static const char *offload_report_envname = "OFFLOAD_REPORT";
+static char *timer_envname = "H_TIME";
+
+// Trace information
+static const char* vardesc_direction_as_string[] = {
+ "NOCOPY",
+ "IN",
+ "OUT",
+ "INOUT"
+};
+static const char* vardesc_type_as_string[] = {
+ "unknown",
+ "data",
+ "data_ptr",
+ "func_ptr",
+ "void_ptr",
+ "string_ptr",
+ "dv",
+ "dv_data",
+ "dv_data_slice",
+ "dv_ptr",
+ "dv_ptr_data",
+ "dv_ptr_data_slice",
+ "cean_var",
+ "cean_var_ptr",
+ "c_data_ptr_array",
+ "c_func_ptr_array",
+ "c_void_ptr_array",
+ "c_string_ptr_array"
+};
+
+Engine* mic_engines = 0;
+uint32_t mic_engines_total = 0;
+pthread_key_t mic_thread_key;
+MicEnvVar mic_env_vars;
+uint64_t cpu_frequency = 0;
+
+// MIC_STACKSIZE
+uint32_t mic_stack_size = 12 * 1024 * 1024;
+
+// MIC_BUFFERSIZE
+uint64_t mic_buffer_size = 0;
+
+// MIC_LD_LIBRARY_PATH
+char* mic_library_path = 0;
+
+// MIC_PROXY_IO
+bool mic_proxy_io = true;
+
+// MIC_PROXY_FS_ROOT
+char* mic_proxy_fs_root = 0;
+
+// Threshold for creating buffers with large pages. Buffer is created
+// with large pages hint if its size exceeds the threshold value.
+// By default large pages are disabled right now (by setting default
+// value for threshold to MAX) due to HSD 4114629.
+uint64_t __offload_use_2mb_buffers = 0xffffffffffffffffULL;
+static const char *mic_use_2mb_buffers_envname =
+ "MIC_USE_2MB_BUFFERS";
+
+static uint64_t __offload_use_async_buffer_write = 2 * 1024 * 1024;
+static const char *mic_use_async_buffer_write_envname =
+ "MIC_USE_ASYNC_BUFFER_WRITE";
+
+static uint64_t __offload_use_async_buffer_read = 2 * 1024 * 1024;
+static const char *mic_use_async_buffer_read_envname =
+ "MIC_USE_ASYNC_BUFFER_READ";
+
+// device initialization type
+OffloadInitType __offload_init_type = c_init_on_offload_all;
+static const char *offload_init_envname = "OFFLOAD_INIT";
+
+// active wait
+static bool __offload_active_wait = true;
+static const char *offload_active_wait_envname = "OFFLOAD_ACTIVE_WAIT";
+
+// OMP_DEFAULT_DEVICE
+int __omp_device_num = 0;
+static const char *omp_device_num_envname = "OMP_DEFAULT_DEVICE";
+
+// The list of pending target libraries
+static bool __target_libs;
+static TargetImageList __target_libs_list;
+static mutex_t __target_libs_lock;
+static mutex_t stack_alloc_lock;
+
+// Target executable
+TargetImage* __target_exe;
+
+static char * offload_get_src_base(void * ptr, uint8_t type)
+{
+ char *base;
+ if (VAR_TYPE_IS_PTR(type)) {
+ base = *static_cast<char**>(ptr);
+ }
+ else if (VAR_TYPE_IS_SCALAR(type)) {
+ base = static_cast<char*>(ptr);
+ }
+ else if (VAR_TYPE_IS_DV_DATA_SLICE(type) || VAR_TYPE_IS_DV_DATA(type)) {
+ ArrDesc *dvp;
+ if (VAR_TYPE_IS_DV_DATA_SLICE(type)) {
+ const arr_desc *ap = static_cast<const arr_desc*>(ptr);
+ dvp = (type == c_dv_data_slice) ?
+ reinterpret_cast<ArrDesc*>(ap->base) :
+ *reinterpret_cast<ArrDesc**>(ap->base);
+ }
+ else {
+ dvp = (type == c_dv_data) ?
+ static_cast<ArrDesc*>(ptr) :
+ *static_cast<ArrDesc**>(ptr);
+ }
+ base = reinterpret_cast<char*>(dvp->Base);
+ }
+ else {
+ base = NULL;
+ }
+ return base;
+}
+
+void OffloadDescriptor::report_coi_error(error_types msg, COIRESULT res)
+{
+ // special case for the 'process died' error
+ if (res == COI_PROCESS_DIED) {
+ m_device.fini_process(true);
+ }
+ else {
+ switch (msg) {
+ case c_buf_create:
+ if (res == COI_OUT_OF_MEMORY) {
+ msg = c_buf_create_out_of_mem;
+ }
+ /* fallthru */
+
+ case c_buf_create_from_mem:
+ case c_buf_get_address:
+ case c_pipeline_create:
+ case c_pipeline_run_func:
+ LIBOFFLOAD_ERROR(msg, m_device.get_logical_index(), res);
+ break;
+
+ case c_buf_read:
+ case c_buf_write:
+ case c_buf_copy:
+ case c_buf_map:
+ case c_buf_unmap:
+ case c_buf_destroy:
+ case c_buf_set_state:
+ LIBOFFLOAD_ERROR(msg, res);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ exit(1);
+}
+
+_Offload_result OffloadDescriptor::translate_coi_error(COIRESULT res) const
+{
+ switch (res) {
+ case COI_SUCCESS:
+ return OFFLOAD_SUCCESS;
+
+ case COI_PROCESS_DIED:
+ return OFFLOAD_PROCESS_DIED;
+
+ case COI_OUT_OF_MEMORY:
+ return OFFLOAD_OUT_OF_MEMORY;
+
+ default:
+ return OFFLOAD_ERROR;
+ }
+}
+
+bool OffloadDescriptor::alloc_ptr_data(
+ PtrData* &ptr_data,
+ void *base,
+ int64_t disp,
+ int64_t size,
+ int64_t alloc_disp,
+ int align
+)
+{
+ // total length of base
+ int64_t length = disp + size;
+ bool is_new;
+
+ OFFLOAD_TRACE(3, "Creating association for data: addr %p, length %lld\n",
+ base, length);
+
+ // add new entry
+ ptr_data = m_device.insert_ptr_data(base, length, is_new);
+ if (is_new) {
+
+ OFFLOAD_TRACE(3, "Added new association\n");
+
+ if (length > 0) {
+ OffloadTimer timer(get_timer_data(), c_offload_host_alloc_buffers);
+ COIRESULT res;
+
+ // align should be a power of 2
+ if (align > 0 && (align & (align - 1)) == 0) {
+ // offset within mic_buffer. Can do offset optimization
+ // only when source address alignment satisfies requested
+ // alignment on the target (cq172736).
+ if ((reinterpret_cast<intptr_t>(base) & (align - 1)) == 0) {
+ ptr_data->mic_offset = reinterpret_cast<intptr_t>(base) & 4095;
+ }
+ }
+
+ // buffer size and flags
+ uint64_t buffer_size = length + ptr_data->mic_offset;
+ uint32_t buffer_flags = 0;
+
+ // create buffer with large pages if data length exceeds
+ // large page threshold
+ if (length >= __offload_use_2mb_buffers) {
+ buffer_flags = COI_OPTIMIZE_HUGE_PAGE_SIZE;
+ }
+
+ // create CPU buffer
+ OFFLOAD_DEBUG_TRACE_1(3,
+ GET_OFFLOAD_NUMBER(get_timer_data()),
+ c_offload_create_buf_host,
+ "Creating buffer from source memory %p, "
+ "length %lld\n", base, length);
+
+ // result is not checked because we can continue without cpu
+ // buffer. In this case we will use COIBufferRead/Write instead
+ // of COIBufferCopy.
+ COI::BufferCreateFromMemory(length,
+ COI_BUFFER_NORMAL,
+ 0,
+ base,
+ 1,
+ &m_device.get_process(),
+ &ptr_data->cpu_buf);
+
+ OFFLOAD_DEBUG_TRACE_1(3,
+ GET_OFFLOAD_NUMBER(get_timer_data()),
+ c_offload_create_buf_mic,
+ "Creating buffer for sink: size %lld, offset %d, "
+ "flags =0x%x\n", buffer_size - alloc_disp,
+ ptr_data->mic_offset, buffer_flags);
+
+ // create MIC buffer
+ res = COI::BufferCreate(buffer_size - alloc_disp,
+ COI_BUFFER_NORMAL,
+ buffer_flags,
+ 0,
+ 1,
+ &m_device.get_process(),
+ &ptr_data->mic_buf);
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ }
+ else if (m_is_mandatory) {
+ report_coi_error(c_buf_create, res);
+ }
+ ptr_data->alloc_ptr_data_lock.unlock();
+ return false;
+ }
+
+ // make buffer valid on the device.
+ res = COI::BufferSetState(ptr_data->mic_buf,
+ m_device.get_process(),
+ COI_BUFFER_VALID,
+ COI_BUFFER_NO_MOVE,
+ 0, 0, 0);
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ }
+ else if (m_is_mandatory) {
+ report_coi_error(c_buf_set_state, res);
+ }
+ ptr_data->alloc_ptr_data_lock.unlock();
+ return false;
+ }
+
+ res = COI::BufferSetState(ptr_data->mic_buf,
+ COI_PROCESS_SOURCE,
+ COI_BUFFER_INVALID,
+ COI_BUFFER_NO_MOVE,
+ 0, 0, 0);
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ }
+ else if (m_is_mandatory) {
+ report_coi_error(c_buf_set_state, res);
+ }
+ ptr_data->alloc_ptr_data_lock.unlock();
+ return false;
+ }
+ }
+
+ ptr_data->alloc_disp = alloc_disp;
+ ptr_data->alloc_ptr_data_lock.unlock();
+ }
+ else {
+ mutex_locker_t locker(ptr_data->alloc_ptr_data_lock);
+
+ OFFLOAD_TRACE(3, "Found existing association: addr %p, length %lld, "
+ "is_static %d\n",
+ ptr_data->cpu_addr.start(), ptr_data->cpu_addr.length(),
+ ptr_data->is_static);
+
+ // This is not a new entry. Make sure that provided address range fits
+ // into existing one.
+ MemRange addr_range(base, length - ptr_data->alloc_disp);
+ if (!ptr_data->cpu_addr.contains(addr_range)) {
+ LIBOFFLOAD_ERROR(c_bad_ptr_mem_range);
+ exit(1);
+ }
+
+ // if the entry is associated with static data it may not have buffers
+ // created because they are created on demand.
+ if (ptr_data->is_static && !init_static_ptr_data(ptr_data)) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool OffloadDescriptor::find_ptr_data(
+ PtrData* &ptr_data,
+ void *base,
+ int64_t disp,
+ int64_t size,
+ bool report_error
+)
+{
+ // total length of base
+ int64_t length = disp + size;
+
+ OFFLOAD_TRACE(3, "Looking for association for data: addr %p, "
+ "length %lld\n", base, length);
+
+ // find existing association in pointer table
+ ptr_data = m_device.find_ptr_data(base);
+ if (ptr_data == 0) {
+ if (report_error) {
+ LIBOFFLOAD_ERROR(c_no_ptr_data, base);
+ exit(1);
+ }
+ OFFLOAD_TRACE(3, "Association does not exist\n");
+ return true;
+ }
+
+ OFFLOAD_TRACE(3, "Found association: base %p, length %lld, is_static %d\n",
+ ptr_data->cpu_addr.start(), ptr_data->cpu_addr.length(),
+ ptr_data->is_static);
+
+ // make sure that provided address range fits into existing one
+ MemRange addr_range(base, length);
+ if (!ptr_data->cpu_addr.contains(addr_range)) {
+ if (report_error) {
+ LIBOFFLOAD_ERROR(c_bad_ptr_mem_range);
+ exit(1);
+ }
+ OFFLOAD_TRACE(3, "Existing association partially overlaps with "
+ "data address range\n");
+ ptr_data = 0;
+ return true;
+ }
+
+ // if the entry is associated with static data it may not have buffers
+ // created because they are created on demand.
+ if (ptr_data->is_static && !init_static_ptr_data(ptr_data)) {
+ return false;
+ }
+
+ return true;
+}
+
+bool OffloadDescriptor::init_static_ptr_data(PtrData *ptr_data)
+{
+ OffloadTimer timer(get_timer_data(), c_offload_host_alloc_buffers);
+
+ if (ptr_data->cpu_buf == 0) {
+ OFFLOAD_TRACE(3, "Creating buffer from source memory %llx\n",
+ ptr_data->cpu_addr.start());
+
+ COIRESULT res = COI::BufferCreateFromMemory(
+ ptr_data->cpu_addr.length(),
+ COI_BUFFER_NORMAL,
+ 0,
+ const_cast<void*>(ptr_data->cpu_addr.start()),
+ 1, &m_device.get_process(),
+ &ptr_data->cpu_buf);
+
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ return false;
+ }
+ report_coi_error(c_buf_create_from_mem, res);
+ }
+ }
+
+ if (ptr_data->mic_buf == 0) {
+ OFFLOAD_TRACE(3, "Creating buffer from sink memory %llx\n",
+ ptr_data->mic_addr);
+
+ COIRESULT res = COI::BufferCreateFromMemory(
+ ptr_data->cpu_addr.length(),
+ COI_BUFFER_NORMAL,
+ COI_SINK_MEMORY,
+ reinterpret_cast<void*>(ptr_data->mic_addr),
+ 1, &m_device.get_process(),
+ &ptr_data->mic_buf);
+
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ return false;
+ }
+ report_coi_error(c_buf_create_from_mem, res);
+ }
+ }
+
+ return true;
+}
+
+bool OffloadDescriptor::init_mic_address(PtrData *ptr_data)
+{
+ if (ptr_data->mic_buf != 0 && ptr_data->mic_addr == 0) {
+ COIRESULT res = COI::BufferGetSinkAddress(ptr_data->mic_buf,
+ &ptr_data->mic_addr);
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ }
+ else if (m_is_mandatory) {
+ report_coi_error(c_buf_get_address, res);
+ }
+ return false;
+ }
+ }
+ return true;
+}
+
+bool OffloadDescriptor::nullify_target_stack(
+ COIBUFFER targ_buf,
+ uint64_t size
+)
+{
+ char * ptr = (char*)malloc(size);
+ if (ptr == NULL)
+ LIBOFFLOAD_ERROR(c_malloc);
+ COIRESULT res;
+
+ memset(ptr, 0, size);
+ res = COI::BufferWrite(
+ targ_buf,
+ 0,
+ ptr,
+ size,
+ COI_COPY_UNSPECIFIED,
+ 0, 0, 0);
+ free(ptr);
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ return false;
+ }
+ report_coi_error(c_buf_write, res);
+ }
+ return true;
+}
+
+bool OffloadDescriptor::offload_stack_memory_manager(
+ const void * stack_begin,
+ int routine_id,
+ int buf_size,
+ int align,
+ bool *is_new)
+{
+ mutex_locker_t locker(stack_alloc_lock);
+
+ PersistData * new_el;
+ PersistDataList::iterator it_begin = m_device.m_persist_list.begin();
+ PersistDataList::iterator it_end;
+ int erase = 0;
+
+ *is_new = false;
+
+ for (PersistDataList::iterator it = m_device.m_persist_list.begin();
+ it != m_device.m_persist_list.end(); it++) {
+ PersistData cur_el = *it;
+
+ if (stack_begin > it->stack_cpu_addr) {
+ // this stack data must be destroyed
+ m_destroy_stack.push_front(cur_el.stack_ptr_data);
+ it_end = it;
+ erase++;
+ }
+ else if (stack_begin == it->stack_cpu_addr) {
+ if (routine_id != it-> routine_id) {
+ // this stack data must be destroyed
+ m_destroy_stack.push_front(cur_el.stack_ptr_data);
+ it_end = it;
+ erase++;
+ break;
+ }
+ else {
+ // stack data is reused
+ m_stack_ptr_data = it->stack_ptr_data;
+ if (erase > 0) {
+ // all obsolete stack sections must be erased from the list
+ m_device.m_persist_list.erase(it_begin, ++it_end);
+
+ m_in_datalen +=
+ erase * sizeof(new_el->stack_ptr_data->mic_addr);
+ }
+ OFFLOAD_TRACE(3, "Reuse of stack buffer with addr %p\n",
+ m_stack_ptr_data->mic_addr);
+ return true;
+ }
+ }
+ else if (stack_begin < it->stack_cpu_addr) {
+ break;
+ }
+ }
+
+ if (erase > 0) {
+ // all obsolete stack sections must be erased from the list
+ m_device.m_persist_list.erase(it_begin, ++it_end);
+ m_in_datalen += erase * sizeof(new_el->stack_ptr_data->mic_addr);
+ }
+ // new stack table is created
+ new_el = new PersistData(stack_begin, routine_id, buf_size);
+ // create MIC buffer
+ COIRESULT res;
+ uint32_t buffer_flags = 0;
+
+ // create buffer with large pages if data length exceeds
+ // large page threshold
+ if (buf_size >= __offload_use_2mb_buffers) {
+ buffer_flags = COI_OPTIMIZE_HUGE_PAGE_SIZE;
+ }
+ res = COI::BufferCreate(buf_size,
+ COI_BUFFER_NORMAL,
+ buffer_flags,
+ 0,
+ 1,
+ &m_device.get_process(),
+ &new_el->stack_ptr_data->mic_buf);
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ }
+ else if (m_is_mandatory) {
+ report_coi_error(c_buf_create, res);
+ }
+ return false;
+ }
+ // make buffer valid on the device.
+ res = COI::BufferSetState(new_el->stack_ptr_data->mic_buf,
+ m_device.get_process(),
+ COI_BUFFER_VALID,
+ COI_BUFFER_NO_MOVE,
+ 0, 0, 0);
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ }
+ else if (m_is_mandatory) {
+ report_coi_error(c_buf_set_state, res);
+ }
+ return false;
+ }
+ res = COI::BufferSetState(new_el->stack_ptr_data->mic_buf,
+ COI_PROCESS_SOURCE,
+ COI_BUFFER_INVALID,
+ COI_BUFFER_NO_MOVE,
+ 0, 0, 0);
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ }
+ else if (m_is_mandatory) {
+ report_coi_error(c_buf_set_state, res);
+ }
+ return false;
+ }
+ // persistence algorithm requires target stack initialy to be nullified
+ if (!nullify_target_stack(new_el->stack_ptr_data->mic_buf, buf_size)) {
+ return false;
+ }
+
+ m_stack_ptr_data = new_el->stack_ptr_data;
+ init_mic_address(m_stack_ptr_data);
+ OFFLOAD_TRACE(3, "Allocating stack buffer with addr %p\n",
+ m_stack_ptr_data->mic_addr);
+ m_device.m_persist_list.push_front(*new_el);
+ init_mic_address(new_el->stack_ptr_data);
+ *is_new = true;
+ return true;
+}
+
+bool OffloadDescriptor::setup_descriptors(
+ VarDesc *vars,
+ VarDesc2 *vars2,
+ int vars_total,
+ int entry_id,
+ const void *stack_addr
+)
+{
+ COIRESULT res;
+
+ OffloadTimer timer(get_timer_data(), c_offload_host_setup_buffers);
+
+ // make a copy of variable descriptors
+ m_vars_total = vars_total;
+ if (vars_total > 0) {
+ m_vars = (VarDesc*) malloc(m_vars_total * sizeof(VarDesc));
+ if (m_vars == NULL)
+ LIBOFFLOAD_ERROR(c_malloc);
+ memcpy(m_vars, vars, m_vars_total * sizeof(VarDesc));
+ m_vars_extra = (VarExtra*) malloc(m_vars_total * sizeof(VarExtra));
+ if (m_vars_extra == NULL)
+ LIBOFFLOAD_ERROR(c_malloc);
+ }
+
+ // dependencies
+ m_in_deps = (COIEVENT*) malloc(sizeof(COIEVENT) * (m_vars_total + 1));
+ if (m_in_deps == NULL)
+ LIBOFFLOAD_ERROR(c_malloc);
+ if (m_vars_total > 0) {
+ m_out_deps = (COIEVENT*) malloc(sizeof(COIEVENT) * m_vars_total);
+ if (m_out_deps == NULL)
+ LIBOFFLOAD_ERROR(c_malloc);
+ }
+
+ // copyin/copyout data length
+ m_in_datalen = 0;
+ m_out_datalen = 0;
+
+ // First pass over variable descriptors
+ // - Calculate size of the input and output non-pointer data
+ // - Allocate buffers for input and output pointers
+ for (int i = 0; i < m_vars_total; i++) {
+ void* alloc_base = NULL;
+ int64_t alloc_disp = 0;
+ int64_t alloc_size;
+ bool src_is_for_mic = (m_vars[i].direction.out ||
+ m_vars[i].into == NULL);
+
+ const char *var_sname = "";
+ if (vars2 != NULL && i < vars_total) {
+ if (vars2[i].sname != NULL) {
+ var_sname = vars2[i].sname;
+ }
+ }
+ OFFLOAD_TRACE(2, " VarDesc %d, var=%s, %s, %s\n",
+ i, var_sname,
+ vardesc_direction_as_string[m_vars[i].direction.bits],
+ vardesc_type_as_string[m_vars[i].type.src]);
+ if (vars2 != NULL && i < vars_total && vars2[i].dname != NULL) {
+ OFFLOAD_TRACE(2, " into=%s, %s\n", vars2[i].dname,
+ vardesc_type_as_string[m_vars[i].type.dst]);
+ }
+ OFFLOAD_TRACE(2,
+ " type_src=%d, type_dstn=%d, direction=%d, "
+ "alloc_if=%d, free_if=%d, align=%d, mic_offset=%d, flags=0x%x, "
+ "offset=%lld, size=%lld, count/disp=%lld, ptr=%p, into=%p\n",
+ m_vars[i].type.src,
+ m_vars[i].type.dst,
+ m_vars[i].direction.bits,
+ m_vars[i].alloc_if,
+ m_vars[i].free_if,
+ m_vars[i].align,
+ m_vars[i].mic_offset,
+ m_vars[i].flags.bits,
+ m_vars[i].offset,
+ m_vars[i].size,
+ m_vars[i].count,
+ m_vars[i].ptr,
+ m_vars[i].into);
+
+ if (m_vars[i].alloc != NULL) {
+ // array descriptor
+ const arr_desc *ap =
+ static_cast<const arr_desc*>(m_vars[i].alloc);
+
+ // debug dump
+ __arr_desc_dump(" ", "ALLOC", ap, 0);
+
+ __arr_data_offset_and_length(ap, alloc_disp, alloc_size);
+
+ alloc_base = reinterpret_cast<void*>(ap->base);
+ }
+
+ m_vars_extra[i].cpu_disp = 0;
+ m_vars_extra[i].cpu_offset = 0;
+ m_vars_extra[i].src_data = 0;
+ m_vars_extra[i].read_rng_src = 0;
+ m_vars_extra[i].read_rng_dst = 0;
+ // flag is_arr_ptr_el is 1 only for var_descs generated
+ // for c_data_ptr_array type
+ if (i < vars_total) {
+ m_vars_extra[i].is_arr_ptr_el = 0;
+ }
+
+ switch (m_vars[i].type.src) {
+ case c_data_ptr_array:
+ {
+ const arr_desc *ap;
+ const VarDesc3 *vd3 =
+ static_cast<const VarDesc3*>(m_vars[i].ptr);
+ int flags = vd3->array_fields;
+ OFFLOAD_TRACE(2,
+ " pointer array flags = %04x\n", flags);
+ OFFLOAD_TRACE(2,
+ " pointer array type is %s\n",
+ vardesc_type_as_string[flags & 0x3f]);
+ ap = static_cast<const arr_desc*>(vd3->ptr_array);
+ __arr_desc_dump(" ", "ptr array", ap, 0);
+ if (m_vars[i].into) {
+ ap = static_cast<const arr_desc*>(m_vars[i].into);
+ __arr_desc_dump(
+ " ", "into array", ap, 0);
+ }
+ if ((flags & (1<<flag_align_is_array)) != 0) {
+ ap = static_cast<const arr_desc*>(vd3->align_array);
+ __arr_desc_dump(
+ " ", "align array", ap, 0);
+ }
+ if ((flags & (1<<flag_alloc_if_is_array)) != 0) {
+ ap = static_cast<const arr_desc*>(vd3->alloc_if_array);
+ __arr_desc_dump(
+ " ", "alloc_if array", ap, 0);
+ }
+ if ((flags & (1<<flag_free_if_is_array)) != 0) {
+ ap = static_cast<const arr_desc*>(vd3->free_if_array);
+ __arr_desc_dump(
+ " ", "free_if array", ap, 0);
+ }
+ if ((flags & (1<<flag_extent_start_is_array)) != 0) {
+ ap = static_cast<const arr_desc*>(vd3->extent_start);
+ __arr_desc_dump(
+ " ", "extent_start array", ap, 0);
+ } else if ((flags &
+ (1<<flag_extent_start_is_scalar)) != 0) {
+ OFFLOAD_TRACE(2,
+ " extent_start scalar = %d\n",
+ (int64_t)vd3->extent_start);
+ }
+ if ((flags & (1<<flag_extent_elements_is_array)) != 0) {
+ ap = static_cast<const arr_desc*>
+ (vd3->extent_elements);
+ __arr_desc_dump(
+ " ", "extent_elements array", ap, 0);
+ } else if ((flags &
+ (1<<flag_extent_elements_is_scalar)) != 0) {
+ OFFLOAD_TRACE(2,
+ " extent_elements scalar = %d\n",
+ (int64_t)vd3->extent_elements);
+ }
+ if ((flags & (1<<flag_into_start_is_array)) != 0) {
+ ap = static_cast<const arr_desc*>(vd3->into_start);
+ __arr_desc_dump(
+ " ", "into_start array", ap, 0);
+ } else if ((flags &
+ (1<<flag_into_start_is_scalar)) != 0) {
+ OFFLOAD_TRACE(2,
+ " into_start scalar = %d\n",
+ (int64_t)vd3->into_start);
+ }
+ if ((flags & (1<<flag_into_elements_is_array)) != 0) {
+ ap = static_cast<const arr_desc*>(vd3->into_elements);
+ __arr_desc_dump(
+ " ", "into_elements array", ap, 0);
+ } else if ((flags &
+ (1<<flag_into_elements_is_scalar)) != 0) {
+ OFFLOAD_TRACE(2,
+ " into_elements scalar = %d\n",
+ (int64_t)vd3->into_elements);
+ }
+ if ((flags & (1<<flag_alloc_start_is_array)) != 0) {
+ ap = static_cast<const arr_desc*>(vd3->alloc_start);
+ __arr_desc_dump(
+ " ", "alloc_start array", ap, 0);
+ } else if ((flags &
+ (1<<flag_alloc_start_is_scalar)) != 0) {
+ OFFLOAD_TRACE(2,
+ " alloc_start scalar = %d\n",
+ (int64_t)vd3->alloc_start);
+ }
+ if ((flags & (1<<flag_alloc_elements_is_array)) != 0) {
+ ap = static_cast<const arr_desc*>(vd3->alloc_elements);
+ __arr_desc_dump(
+ " ", "alloc_elements array", ap, 0);
+ } else if ((flags &
+ (1<<flag_alloc_elements_is_scalar)) != 0) {
+ OFFLOAD_TRACE(2,
+ " alloc_elements scalar = %d\n",
+ (int64_t)vd3->alloc_elements);
+ }
+ }
+ if (!gen_var_descs_for_pointer_array(i)) {
+ return false;
+ }
+ break;
+
+ case c_data:
+ case c_void_ptr:
+ case c_cean_var:
+ // In all uses later
+ // VarDesc.size will have the length of the data to be
+ // transferred
+ // VarDesc.disp will have an offset from base
+ if (m_vars[i].type.src == c_cean_var) {
+ // array descriptor
+ const arr_desc *ap =
+ static_cast<const arr_desc*>(m_vars[i].ptr);
+
+ // debug dump
+ __arr_desc_dump("", "IN/OUT", ap, 0);
+
+ // offset and length are derived from the array descriptor
+ __arr_data_offset_and_length(ap, m_vars[i].disp,
+ m_vars[i].size);
+ if (!is_arr_desc_contiguous(ap)) {
+ m_vars[i].flags.is_noncont_src = 1;
+ m_vars_extra[i].read_rng_src =
+ init_read_ranges_arr_desc(ap);
+ }
+ // all necessary information about length and offset is
+ // transferred in var descriptor. There is no need to send
+ // array descriptor to the target side.
+ m_vars[i].ptr = reinterpret_cast<void*>(ap->base);
+ }
+ else {
+ m_vars[i].size *= m_vars[i].count;
+ m_vars[i].disp = 0;
+ }
+
+ if (m_vars[i].direction.bits) {
+ // make sure that transfer size > 0
+ if (m_vars[i].size <= 0) {
+ LIBOFFLOAD_ERROR(c_zero_or_neg_transfer_size);
+ exit(1);
+ }
+
+ if (m_vars[i].flags.is_static) {
+ PtrData *ptr_data;
+
+ // find data associated with variable
+ if (!find_ptr_data(ptr_data,
+ m_vars[i].ptr,
+ m_vars[i].disp,
+ m_vars[i].size,
+ false)) {
+ return false;
+ }
+
+ if (ptr_data != 0) {
+ // offset to base from the beginning of the buffer
+ // memory
+ m_vars[i].offset =
+ (char*) m_vars[i].ptr -
+ (char*) ptr_data->cpu_addr.start();
+ }
+ else {
+ m_vars[i].flags.is_static = false;
+ if (m_vars[i].into == NULL) {
+ m_vars[i].flags.is_static_dstn = false;
+ }
+ }
+ m_vars_extra[i].src_data = ptr_data;
+ }
+
+ if (m_is_openmp) {
+ if (m_vars[i].flags.is_static) {
+ // Static data is transferred only by omp target
+ // update construct which passes zeros for
+ // alloc_if and free_if.
+ if (m_vars[i].alloc_if || m_vars[i].free_if) {
+ m_vars[i].direction.bits = c_parameter_nocopy;
+ }
+ }
+ else {
+ AutoData *auto_data;
+ if (m_vars[i].alloc_if) {
+ auto_data = m_device.insert_auto_data(
+ m_vars[i].ptr, m_vars[i].size);
+ auto_data->add_reference();
+ }
+ else {
+ // TODO: what should be done if var is not in
+ // the table?
+ auto_data = m_device.find_auto_data(
+ m_vars[i].ptr);
+ }
+
+ // For automatic variables data is transferred
+ // only if alloc_if == 0 && free_if == 0
+ // or reference count is 1
+ if ((m_vars[i].alloc_if || m_vars[i].free_if) &&
+ auto_data != 0 &&
+ auto_data->get_reference() != 1) {
+ m_vars[i].direction.bits = c_parameter_nocopy;
+ }
+
+ // save data for later use
+ m_vars_extra[i].auto_data = auto_data;
+ }
+ }
+
+ if (m_vars[i].direction.in &&
+ !m_vars[i].flags.is_static) {
+ m_in_datalen += m_vars[i].size;
+
+ // for non-static target destination defined as CEAN
+ // expression we pass to target its size and dist
+ if (m_vars[i].into == NULL &&
+ m_vars[i].type.src == c_cean_var) {
+ m_in_datalen += 2 * sizeof(uint64_t);
+ }
+ m_need_runfunction = true;
+ }
+ if (m_vars[i].direction.out &&
+ !m_vars[i].flags.is_static) {
+ m_out_datalen += m_vars[i].size;
+ m_need_runfunction = true;
+ }
+ }
+ break;
+
+ case c_dv:
+ if (m_vars[i].direction.bits ||
+ m_vars[i].alloc_if ||
+ m_vars[i].free_if) {
+ ArrDesc *dvp = static_cast<ArrDesc*>(m_vars[i].ptr);
+
+ // debug dump
+ __dv_desc_dump("IN/OUT", dvp);
+
+ // send dope vector contents excluding base
+ m_in_datalen += m_vars[i].size - sizeof(uint64_t);
+ m_need_runfunction = true;
+ }
+ break;
+
+ case c_string_ptr:
+ if ((m_vars[i].direction.bits ||
+ m_vars[i].alloc_if ||
+ m_vars[i].free_if) &&
+ m_vars[i].size == 0) {
+ m_vars[i].size = 1;
+ m_vars[i].count =
+ strlen(*static_cast<char**>(m_vars[i].ptr)) + 1;
+ }
+ /* fallthru */
+
+ case c_data_ptr:
+ if (m_vars[i].flags.is_stack_buf &&
+ !m_vars[i].direction.bits &&
+ m_vars[i].alloc_if) {
+ // this var_desc is for stack buffer
+ bool is_new;
+
+ if (!offload_stack_memory_manager(
+ stack_addr, entry_id,
+ m_vars[i].count, m_vars[i].align, &is_new)) {
+ return false;
+ }
+ if (is_new) {
+ m_compute_buffers.push_back(
+ m_stack_ptr_data->mic_buf);
+ m_device.m_persist_list.front().cpu_stack_addr =
+ static_cast<char*>(m_vars[i].ptr);
+ }
+ else {
+ m_vars[i].flags.sink_addr = 1;
+ m_in_datalen += sizeof(m_stack_ptr_data->mic_addr);
+ }
+ m_vars[i].size = m_destroy_stack.size();
+ m_vars_extra[i].src_data = m_stack_ptr_data;
+ // need to add reference for buffer
+ m_need_runfunction = true;
+ break;
+ }
+ /* fallthru */
+
+ case c_cean_var_ptr:
+ case c_dv_ptr:
+ if (m_vars[i].type.src == c_cean_var_ptr) {
+ // array descriptor
+ const arr_desc *ap =
+ static_cast<const arr_desc*>(m_vars[i].ptr);
+
+ // debug dump
+ __arr_desc_dump("", "IN/OUT", ap, 1);
+
+ // offset and length are derived from the array descriptor
+ __arr_data_offset_and_length(ap, m_vars[i].disp,
+ m_vars[i].size);
+
+ if (!is_arr_desc_contiguous(ap)) {
+ m_vars[i].flags.is_noncont_src = 1;
+ m_vars_extra[i].read_rng_src =
+ init_read_ranges_arr_desc(ap);
+ }
+ // all necessary information about length and offset is
+ // transferred in var descriptor. There is no need to send
+ // array descriptor to the target side.
+ m_vars[i].ptr = reinterpret_cast<void*>(ap->base);
+ }
+ else if (m_vars[i].type.src == c_dv_ptr) {
+ // need to send DV to the device unless it is 'nocopy'
+ if (m_vars[i].direction.bits ||
+ m_vars[i].alloc_if ||
+ m_vars[i].free_if) {
+ ArrDesc *dvp = *static_cast<ArrDesc**>(m_vars[i].ptr);
+
+ // debug dump
+ __dv_desc_dump("IN/OUT", dvp);
+
+ m_vars[i].direction.bits = c_parameter_in;
+ }
+
+ // no displacement
+ m_vars[i].disp = 0;
+ }
+ else {
+ // c_data_ptr or c_string_ptr
+ m_vars[i].size *= m_vars[i].count;
+ m_vars[i].disp = 0;
+ }
+
+ if (m_vars[i].direction.bits ||
+ m_vars[i].alloc_if ||
+ m_vars[i].free_if) {
+ PtrData *ptr_data;
+
+ // check that buffer length >= 0
+ if (m_vars[i].alloc_if &&
+ m_vars[i].disp + m_vars[i].size < 0) {
+ LIBOFFLOAD_ERROR(c_zero_or_neg_ptr_len);
+ exit(1);
+ }
+
+ // base address
+ void *base = *static_cast<void**>(m_vars[i].ptr);
+
+ // allocate buffer if we have no INTO and don't need
+ // allocation for the ptr at target
+ if (src_is_for_mic) {
+ if (m_vars[i].flags.is_stack_buf) {
+ // for stack persistent objects ptr data is created
+ // by var_desc with number 0.
+ // Its ptr_data is stored at m_stack_ptr_data
+ ptr_data = m_stack_ptr_data;
+ m_vars[i].flags.sink_addr = 1;
+ }
+ else if (m_vars[i].alloc_if) {
+ // add new entry
+ if (!alloc_ptr_data(
+ ptr_data,
+ base,
+ (alloc_base != NULL) ?
+ alloc_disp : m_vars[i].disp,
+ (alloc_base != NULL) ?
+ alloc_size : m_vars[i].size,
+ alloc_disp,
+ (alloc_base != NULL) ?
+ 0 : m_vars[i].align)) {
+ return false;
+ }
+
+ if (ptr_data->add_reference() == 0 &&
+ ptr_data->mic_buf != 0) {
+ // add buffer to the list of buffers that
+ // are passed to dispatch call
+ m_compute_buffers.push_back(
+ ptr_data->mic_buf);
+ }
+ else {
+ // will send buffer address to device
+ m_vars[i].flags.sink_addr = 1;
+ }
+
+ if (!ptr_data->is_static) {
+ // need to add reference for buffer
+ m_need_runfunction = true;
+ }
+ }
+ else {
+ bool error_if_not_found = true;
+ if (m_is_openmp) {
+ // For omp target update variable is ignored
+ // if it does not exist.
+ if (!m_vars[i].alloc_if &&
+ !m_vars[i].free_if) {
+ error_if_not_found = false;
+ }
+ }
+
+ // use existing association from pointer table
+ if (!find_ptr_data(ptr_data,
+ base,
+ m_vars[i].disp,
+ m_vars[i].size,
+ error_if_not_found)) {
+ return false;
+ }
+
+ if (m_is_openmp) {
+ // make var nocopy if it does not exist
+ if (ptr_data == 0) {
+ m_vars[i].direction.bits =
+ c_parameter_nocopy;
+ }
+ }
+
+ if (ptr_data != 0) {
+ m_vars[i].flags.sink_addr = 1;
+ }
+ }
+
+ if (ptr_data != 0) {
+ if (m_is_openmp) {
+ // data is transferred only if
+ // alloc_if == 0 && free_if == 0
+ // or reference count is 1
+ if ((m_vars[i].alloc_if ||
+ m_vars[i].free_if) &&
+ ptr_data->get_reference() != 1) {
+ m_vars[i].direction.bits =
+ c_parameter_nocopy;
+ }
+ }
+
+ if (ptr_data->alloc_disp != 0) {
+ m_vars[i].flags.alloc_disp = 1;
+ m_in_datalen += sizeof(alloc_disp);
+ }
+
+ if (m_vars[i].flags.sink_addr) {
+ // get buffers's address on the sink
+ if (!init_mic_address(ptr_data)) {
+ return false;
+ }
+
+ m_in_datalen += sizeof(ptr_data->mic_addr);
+ }
+
+ if (!ptr_data->is_static && m_vars[i].free_if) {
+ // need to decrement buffer reference on target
+ m_need_runfunction = true;
+ }
+
+ // offset to base from the beginning of the buffer
+ // memory
+ m_vars[i].offset = (char*) base -
+ (char*) ptr_data->cpu_addr.start();
+
+ // copy other pointer properties to var descriptor
+ m_vars[i].mic_offset = ptr_data->mic_offset;
+ m_vars[i].flags.is_static = ptr_data->is_static;
+ }
+ }
+ else {
+ if (!find_ptr_data(ptr_data,
+ base,
+ m_vars[i].disp,
+ m_vars[i].size,
+ false)) {
+ return false;
+ }
+ if (ptr_data) {
+ m_vars[i].offset =
+ (char*) base -
+ (char*) ptr_data->cpu_addr.start();
+ }
+ }
+
+ // save pointer data
+ m_vars_extra[i].src_data = ptr_data;
+ }
+ break;
+
+ case c_func_ptr:
+ if (m_vars[i].direction.in) {
+ m_in_datalen += __offload_funcs.max_name_length();
+ }
+ if (m_vars[i].direction.out) {
+ m_out_datalen += __offload_funcs.max_name_length();
+ }
+ m_need_runfunction = true;
+ break;
+
+ case c_dv_data:
+ case c_dv_ptr_data:
+ case c_dv_data_slice:
+ case c_dv_ptr_data_slice:
+ ArrDesc *dvp;
+ if (VAR_TYPE_IS_DV_DATA_SLICE(m_vars[i].type.src)) {
+ const arr_desc *ap;
+ ap = static_cast<const arr_desc*>(m_vars[i].ptr);
+
+ dvp = (m_vars[i].type.src == c_dv_data_slice) ?
+ reinterpret_cast<ArrDesc*>(ap->base) :
+ *reinterpret_cast<ArrDesc**>(ap->base);
+ }
+ else {
+ dvp = (m_vars[i].type.src == c_dv_data) ?
+ static_cast<ArrDesc*>(m_vars[i].ptr) :
+ *static_cast<ArrDesc**>(m_vars[i].ptr);
+ }
+
+ // if allocatable dope vector isn't allocated don't
+ // transfer its data
+ if (!__dv_is_allocated(dvp)) {
+ m_vars[i].direction.bits = c_parameter_nocopy;
+ m_vars[i].alloc_if = 0;
+ m_vars[i].free_if = 0;
+ }
+ if (m_vars[i].direction.bits ||
+ m_vars[i].alloc_if ||
+ m_vars[i].free_if) {
+ const arr_desc *ap;
+
+ if (VAR_TYPE_IS_DV_DATA_SLICE(m_vars[i].type.src)) {
+ ap = static_cast<const arr_desc*>(m_vars[i].ptr);
+
+ // debug dump
+ __arr_desc_dump("", "IN/OUT", ap, 0);
+ }
+ if (!__dv_is_contiguous(dvp)) {
+ m_vars[i].flags.is_noncont_src = 1;
+ m_vars_extra[i].read_rng_src =
+ init_read_ranges_dv(dvp);
+ }
+
+ // size and displacement
+ if (VAR_TYPE_IS_DV_DATA_SLICE(m_vars[i].type.src)) {
+ // offset and length are derived from the
+ // array descriptor
+ __arr_data_offset_and_length(ap,
+ m_vars[i].disp,
+ m_vars[i].size);
+ if (m_vars[i].direction.bits) {
+ if (!is_arr_desc_contiguous(ap)) {
+ if (m_vars[i].flags.is_noncont_src) {
+ LIBOFFLOAD_ERROR(c_slice_of_noncont_array);
+ return false;
+ }
+ m_vars[i].flags.is_noncont_src = 1;
+ m_vars_extra[i].read_rng_src =
+ init_read_ranges_arr_desc(ap);
+ }
+ }
+ }
+ else {
+ if (m_vars[i].flags.has_length) {
+ m_vars[i].size =
+ __dv_data_length(dvp, m_vars[i].count);
+ }
+ else {
+ m_vars[i].size = __dv_data_length(dvp);
+ }
+ m_vars[i].disp = 0;
+ }
+
+ // check that length >= 0
+ if (m_vars[i].alloc_if &&
+ (m_vars[i].disp + m_vars[i].size < 0)) {
+ LIBOFFLOAD_ERROR(c_zero_or_neg_ptr_len);
+ exit(1);
+ }
+
+ // base address
+ void *base = reinterpret_cast<void*>(dvp->Base);
+ PtrData *ptr_data;
+
+ // allocate buffer if we have no INTO and don't need
+ // allocation for the ptr at target
+ if (src_is_for_mic) {
+ if (m_vars[i].alloc_if) {
+ // add new entry
+ if (!alloc_ptr_data(
+ ptr_data,
+ base,
+ (alloc_base != NULL) ?
+ alloc_disp : m_vars[i].disp,
+ (alloc_base != NULL) ?
+ alloc_size : m_vars[i].size,
+ alloc_disp,
+ (alloc_base != NULL) ?
+ 0 : m_vars[i].align)) {
+ return false;
+ }
+
+ if (ptr_data->add_reference() == 0 &&
+ ptr_data->mic_buf != 0) {
+ // add buffer to the list of buffers
+ // that are passed to dispatch call
+ m_compute_buffers.push_back(
+ ptr_data->mic_buf);
+ }
+ else {
+ // will send buffer address to device
+ m_vars[i].flags.sink_addr = 1;
+ }
+
+ if (!ptr_data->is_static) {
+ // need to add reference for buffer
+ m_need_runfunction = true;
+ }
+ }
+ else {
+ bool error_if_not_found = true;
+ if (m_is_openmp) {
+ // For omp target update variable is ignored
+ // if it does not exist.
+ if (!m_vars[i].alloc_if &&
+ !m_vars[i].free_if) {
+ error_if_not_found = false;
+ }
+ }
+
+ // use existing association from pointer table
+ if (!find_ptr_data(ptr_data,
+ base,
+ m_vars[i].disp,
+ m_vars[i].size,
+ error_if_not_found)) {
+ return false;
+ }
+
+ if (m_is_openmp) {
+ // make var nocopy if it does not exist
+ if (ptr_data == 0) {
+ m_vars[i].direction.bits =
+ c_parameter_nocopy;
+ }
+ }
+
+ if (ptr_data != 0) {
+ // need to update base in dope vector on device
+ m_vars[i].flags.sink_addr = 1;
+ }
+ }
+
+ if (ptr_data != 0) {
+ if (m_is_openmp) {
+ // data is transferred only if
+ // alloc_if == 0 && free_if == 0
+ // or reference count is 1
+ if ((m_vars[i].alloc_if ||
+ m_vars[i].free_if) &&
+ ptr_data->get_reference() != 1) {
+ m_vars[i].direction.bits =
+ c_parameter_nocopy;
+ }
+ }
+
+ if (ptr_data->alloc_disp != 0) {
+ m_vars[i].flags.alloc_disp = 1;
+ m_in_datalen += sizeof(alloc_disp);
+ }
+
+ if (m_vars[i].flags.sink_addr) {
+ // get buffers's address on the sink
+ if (!init_mic_address(ptr_data)) {
+ return false;
+ }
+
+ m_in_datalen += sizeof(ptr_data->mic_addr);
+ }
+
+ if (!ptr_data->is_static && m_vars[i].free_if) {
+ // need to decrement buffer reference on target
+ m_need_runfunction = true;
+ }
+
+ // offset to base from the beginning of the buffer
+ // memory
+ m_vars[i].offset =
+ (char*) base -
+ (char*) ptr_data->cpu_addr.start();
+
+ // copy other pointer properties to var descriptor
+ m_vars[i].mic_offset = ptr_data->mic_offset;
+ m_vars[i].flags.is_static = ptr_data->is_static;
+ }
+ }
+ else { // !src_is_for_mic
+ if (!find_ptr_data(ptr_data,
+ base,
+ m_vars[i].disp,
+ m_vars[i].size,
+ false)) {
+ return false;
+ }
+ m_vars[i].offset = !ptr_data ? 0 :
+ (char*) base -
+ (char*) ptr_data->cpu_addr.start();
+ }
+
+ // save pointer data
+ m_vars_extra[i].src_data = ptr_data;
+ }
+ break;
+
+ default:
+ LIBOFFLOAD_ERROR(c_unknown_var_type, m_vars[i].type.src);
+ LIBOFFLOAD_ABORT;
+ }
+ if (m_vars[i].type.src == c_data_ptr_array) {
+ continue;
+ }
+
+ if (src_is_for_mic && m_vars[i].flags.is_stack_buf) {
+ m_vars[i].offset = static_cast<char*>(m_vars[i].ptr) -
+ m_device.m_persist_list.front().cpu_stack_addr;
+ }
+ // if source is used at CPU save its offset and disp
+ if (m_vars[i].into == NULL || m_vars[i].direction.in) {
+ m_vars_extra[i].cpu_offset = m_vars[i].offset;
+ m_vars_extra[i].cpu_disp = m_vars[i].disp;
+ }
+
+ // If "into" is define we need to do the similar work for it
+ if (!m_vars[i].into) {
+ continue;
+ }
+
+ int64_t into_disp =0, into_offset = 0;
+
+ switch (m_vars[i].type.dst) {
+ case c_data_ptr_array:
+ break;
+ case c_data:
+ case c_void_ptr:
+ case c_cean_var: {
+ int64_t size = m_vars[i].size;
+
+ if (m_vars[i].type.dst == c_cean_var) {
+ // array descriptor
+ const arr_desc *ap =
+ static_cast<const arr_desc*>(m_vars[i].into);
+
+ // debug dump
+ __arr_desc_dump(" ", "INTO", ap, 0);
+
+ // offset and length are derived from the array descriptor
+ __arr_data_offset_and_length(ap, into_disp, size);
+
+ if (!is_arr_desc_contiguous(ap)) {
+ m_vars[i].flags.is_noncont_dst = 1;
+ m_vars_extra[i].read_rng_dst =
+ init_read_ranges_arr_desc(ap);
+ if (!cean_ranges_match(
+ m_vars_extra[i].read_rng_src,
+ m_vars_extra[i].read_rng_dst)) {
+ LIBOFFLOAD_ERROR(c_ranges_dont_match);
+ exit(1);
+ }
+ }
+ m_vars[i].into = reinterpret_cast<void*>(ap->base);
+ }
+
+ int64_t size_src = m_vars_extra[i].read_rng_src ?
+ cean_get_transf_size(m_vars_extra[i].read_rng_src) :
+ m_vars[i].size;
+ int64_t size_dst = m_vars_extra[i].read_rng_dst ?
+ cean_get_transf_size(m_vars_extra[i].read_rng_dst) :
+ size;
+ // It's supposed that "into" size must be not less
+ // than src size
+ if (size_src > size_dst) {
+ LIBOFFLOAD_ERROR(c_different_src_and_dstn_sizes,
+ size_src, size_dst);
+ exit(1);
+ }
+
+ if (m_vars[i].direction.bits) {
+ if (m_vars[i].flags.is_static_dstn) {
+ PtrData *ptr_data;
+
+ // find data associated with variable
+ if (!find_ptr_data(ptr_data, m_vars[i].into,
+ into_disp, size, false)) {
+ return false;
+ }
+ if (ptr_data != 0) {
+ // offset to base from the beginning of the buffer
+ // memory
+ into_offset =
+ (char*) m_vars[i].into -
+ (char*) ptr_data->cpu_addr.start();
+ }
+ else {
+ m_vars[i].flags.is_static_dstn = false;
+ }
+ m_vars_extra[i].dst_data = ptr_data;
+ }
+ }
+
+ if (m_vars[i].direction.in &&
+ !m_vars[i].flags.is_static_dstn) {
+ m_in_datalen += m_vars[i].size;
+
+ // for non-static target destination defined as CEAN
+ // expression we pass to target its size and dist
+ if (m_vars[i].type.dst == c_cean_var) {
+ m_in_datalen += 2 * sizeof(uint64_t);
+ }
+ m_need_runfunction = true;
+ }
+ break;
+ }
+
+ case c_dv:
+ if (m_vars[i].direction.bits ||
+ m_vars[i].alloc_if ||
+ m_vars[i].free_if) {
+ ArrDesc *dvp = static_cast<ArrDesc*>(m_vars[i].into);
+
+ // debug dump
+ __dv_desc_dump("INTO", dvp);
+
+ // send dope vector contents excluding base
+ m_in_datalen += m_vars[i].size - sizeof(uint64_t);
+ m_need_runfunction = true;
+ }
+ break;
+
+ case c_string_ptr:
+ case c_data_ptr:
+ case c_cean_var_ptr:
+ case c_dv_ptr: {
+ int64_t size = m_vars[i].size;
+
+ if (m_vars[i].type.dst == c_cean_var_ptr) {
+ // array descriptor
+ const arr_desc *ap =
+ static_cast<const arr_desc*>(m_vars[i].into);
+
+ // debug dump
+ __arr_desc_dump(" ", "INTO", ap, 1);
+
+ // offset and length are derived from the array descriptor
+ __arr_data_offset_and_length(ap, into_disp, size);
+
+ if (!is_arr_desc_contiguous(ap)) {
+ m_vars[i].flags.is_noncont_src = 1;
+ m_vars_extra[i].read_rng_dst =
+ init_read_ranges_arr_desc(ap);
+ if (!cean_ranges_match(
+ m_vars_extra[i].read_rng_src,
+ m_vars_extra[i].read_rng_dst)) {
+ LIBOFFLOAD_ERROR(c_ranges_dont_match);
+ }
+ }
+ m_vars[i].into = reinterpret_cast<char**>(ap->base);
+ }
+ else if (m_vars[i].type.dst == c_dv_ptr) {
+ // need to send DV to the device unless it is 'nocopy'
+ if (m_vars[i].direction.bits ||
+ m_vars[i].alloc_if ||
+ m_vars[i].free_if) {
+ ArrDesc *dvp = *static_cast<ArrDesc**>(m_vars[i].into);
+
+ // debug dump
+ __dv_desc_dump("INTO", dvp);
+
+ m_vars[i].direction.bits = c_parameter_in;
+ }
+ }
+
+ int64_t size_src = m_vars_extra[i].read_rng_src ?
+ cean_get_transf_size(m_vars_extra[i].read_rng_src) :
+ m_vars[i].size;
+ int64_t size_dst = m_vars_extra[i].read_rng_dst ?
+ cean_get_transf_size(m_vars_extra[i].read_rng_dst) :
+ size;
+ // It's supposed that "into" size must be not less than
+ // src size
+ if (size_src > size_dst) {
+ LIBOFFLOAD_ERROR(c_different_src_and_dstn_sizes,
+ size_src, size_dst);
+ exit(1);
+ }
+
+ if (m_vars[i].direction.bits) {
+ PtrData *ptr_data;
+
+ // base address
+ void *base = *static_cast<void**>(m_vars[i].into);
+
+ if (m_vars[i].direction.in) {
+ // allocate buffer
+ if (m_vars[i].flags.is_stack_buf) {
+ // for stack persistent objects ptr data is created
+ // by var_desc with number 0.
+ // Its ptr_data is stored at m_stack_ptr_data
+ ptr_data = m_stack_ptr_data;
+ m_vars[i].flags.sink_addr = 1;
+ }
+ else if (m_vars[i].alloc_if) {
+ // add new entry
+ if (!alloc_ptr_data(
+ ptr_data,
+ base,
+ (alloc_base != NULL) ?
+ alloc_disp : into_disp,
+ (alloc_base != NULL) ?
+ alloc_size : size,
+ alloc_disp,
+ (alloc_base != NULL) ?
+ 0 : m_vars[i].align)) {
+ return false;
+ }
+
+ if (ptr_data->add_reference() == 0 &&
+ ptr_data->mic_buf != 0) {
+ // add buffer to the list of buffers that
+ // are passed to dispatch call
+ m_compute_buffers.push_back(
+ ptr_data->mic_buf);
+ }
+ else {
+ // will send buffer address to device
+ m_vars[i].flags.sink_addr = 1;
+ }
+
+ if (!ptr_data->is_static) {
+ // need to add reference for buffer
+ m_need_runfunction = true;
+ }
+ }
+ else {
+ // use existing association from pointer table
+ if (!find_ptr_data(ptr_data, base, into_disp, size)) {
+ return false;
+ }
+ m_vars[i].flags.sink_addr = 1;
+ }
+
+ if (ptr_data->alloc_disp != 0) {
+ m_vars[i].flags.alloc_disp = 1;
+ m_in_datalen += sizeof(alloc_disp);
+ }
+
+ if (m_vars[i].flags.sink_addr) {
+ // get buffers's address on the sink
+ if (!init_mic_address(ptr_data)) {
+ return false;
+ }
+
+ m_in_datalen += sizeof(ptr_data->mic_addr);
+ }
+
+ if (!ptr_data->is_static && m_vars[i].free_if) {
+ // need to decrement buffer reference on target
+ m_need_runfunction = true;
+ }
+
+ // copy other pointer properties to var descriptor
+ m_vars[i].mic_offset = ptr_data->mic_offset;
+ m_vars[i].flags.is_static_dstn = ptr_data->is_static;
+ }
+ else {
+ if (!find_ptr_data(ptr_data,
+ base,
+ into_disp,
+ m_vars[i].size,
+ false)) {
+ return false;
+ }
+ }
+ if (ptr_data) {
+ into_offset = ptr_data ?
+ (char*) base -
+ (char*) ptr_data->cpu_addr.start() :
+ 0;
+ }
+ // save pointer data
+ m_vars_extra[i].dst_data = ptr_data;
+ }
+ break;
+ }
+
+ case c_func_ptr:
+ break;
+
+ case c_dv_data:
+ case c_dv_ptr_data:
+ case c_dv_data_slice:
+ case c_dv_ptr_data_slice:
+ if (m_vars[i].direction.bits ||
+ m_vars[i].alloc_if ||
+ m_vars[i].free_if) {
+ const arr_desc *ap;
+ ArrDesc *dvp;
+ PtrData *ptr_data;
+ int64_t disp;
+ int64_t size;
+
+ if (VAR_TYPE_IS_DV_DATA_SLICE(m_vars[i].type.dst)) {
+ ap = static_cast<const arr_desc*>(m_vars[i].into);
+
+ // debug dump
+ __arr_desc_dump(" ", "INTO", ap, 0);
+
+ dvp = (m_vars[i].type.dst == c_dv_data_slice) ?
+ reinterpret_cast<ArrDesc*>(ap->base) :
+ *reinterpret_cast<ArrDesc**>(ap->base);
+ }
+ else {
+ dvp = (m_vars[i].type.dst == c_dv_data) ?
+ static_cast<ArrDesc*>(m_vars[i].into) :
+ *static_cast<ArrDesc**>(m_vars[i].into);
+ }
+ if (!__dv_is_contiguous(dvp)) {
+ m_vars[i].flags.is_noncont_dst = 1;
+ m_vars_extra[i].read_rng_dst =
+ init_read_ranges_dv(dvp);
+ }
+ // size and displacement
+ if (VAR_TYPE_IS_DV_DATA_SLICE(m_vars[i].type.dst)) {
+ // offset and length are derived from the array
+ // descriptor
+ __arr_data_offset_and_length(ap, into_disp, size);
+ if (m_vars[i].direction.bits) {
+ if (!is_arr_desc_contiguous(ap)) {
+ if (m_vars[i].flags.is_noncont_dst) {
+ LIBOFFLOAD_ERROR(c_slice_of_noncont_array);
+ return false;
+ }
+ m_vars[i].flags.is_noncont_dst = 1;
+ m_vars_extra[i].read_rng_dst =
+ init_read_ranges_arr_desc(ap);
+ if (!cean_ranges_match(
+ m_vars_extra[i].read_rng_src,
+ m_vars_extra[i].read_rng_dst)) {
+ LIBOFFLOAD_ERROR(c_ranges_dont_match);
+ }
+ }
+ }
+ }
+ else {
+ if (m_vars[i].flags.has_length) {
+ size = __dv_data_length(dvp, m_vars[i].count);
+ }
+ else {
+ size = __dv_data_length(dvp);
+ }
+ disp = 0;
+ }
+
+ int64_t size_src =
+ m_vars_extra[i].read_rng_src ?
+ cean_get_transf_size(m_vars_extra[i].read_rng_src) :
+ m_vars[i].size;
+ int64_t size_dst =
+ m_vars_extra[i].read_rng_dst ?
+ cean_get_transf_size(m_vars_extra[i].read_rng_dst) :
+ size;
+ // It's supposed that "into" size must be not less
+ // than src size
+ if (size_src > size_dst) {
+ LIBOFFLOAD_ERROR(c_different_src_and_dstn_sizes,
+ size_src, size_dst);
+ exit(1);
+ }
+
+ // base address
+ void *base = reinterpret_cast<void*>(dvp->Base);
+
+ // allocate buffer
+ if (m_vars[i].direction.in) {
+ if (m_vars[i].alloc_if) {
+ // add new entry
+ if (!alloc_ptr_data(
+ ptr_data,
+ base,
+ (alloc_base != NULL) ?
+ alloc_disp : into_disp,
+ (alloc_base != NULL) ?
+ alloc_size : size,
+ alloc_disp,
+ (alloc_base != NULL) ?
+ 0 : m_vars[i].align)) {
+ return false;
+ }
+ if (ptr_data->add_reference() == 0 &&
+ ptr_data->mic_buf !=0) {
+ // add buffer to the list of buffers
+ // that are passed to dispatch call
+ m_compute_buffers.push_back(
+ ptr_data->mic_buf);
+ }
+ else {
+ // will send buffer address to device
+ m_vars[i].flags.sink_addr = 1;
+ }
+
+ if (!ptr_data->is_static) {
+ // need to add reference for buffer
+ m_need_runfunction = true;
+ }
+ }
+ else {
+ // use existing association from pointer table
+ if (!find_ptr_data(ptr_data, base, into_disp, size)) {
+ return false;
+ }
+
+ // need to update base in dope vector on device
+ m_vars[i].flags.sink_addr = 1;
+ }
+
+ if (ptr_data->alloc_disp != 0) {
+ m_vars[i].flags.alloc_disp = 1;
+ m_in_datalen += sizeof(alloc_disp);
+ }
+
+ if (m_vars[i].flags.sink_addr) {
+ // get buffers's address on the sink
+ if (!init_mic_address(ptr_data)) {
+ return false;
+ }
+ m_in_datalen += sizeof(ptr_data->mic_addr);
+ }
+
+ if (!ptr_data->is_static && m_vars[i].free_if) {
+ // need to decrement buffer reference on target
+ m_need_runfunction = true;
+ }
+
+ // offset to base from the beginning of the buffer
+ // memory
+ into_offset =
+ (char*) base - (char*) ptr_data->cpu_addr.start();
+
+ // copy other pointer properties to var descriptor
+ m_vars[i].mic_offset = ptr_data->mic_offset;
+ m_vars[i].flags.is_static_dstn = ptr_data->is_static;
+ }
+ else { // src_is_for_mic
+ if (!find_ptr_data(ptr_data,
+ base,
+ into_disp,
+ size,
+ false)) {
+ return false;
+ }
+ into_offset = !ptr_data ?
+ 0 :
+ (char*) base - (char*) ptr_data->cpu_addr.start();
+ }
+
+ // save pointer data
+ m_vars_extra[i].dst_data = ptr_data;
+ }
+ break;
+
+ default:
+ LIBOFFLOAD_ERROR(c_unknown_var_type, m_vars[i].type.src);
+ LIBOFFLOAD_ABORT;
+ }
+ // if into is used at CPU save its offset and disp
+ if (m_vars[i].direction.out) {
+ m_vars_extra[i].cpu_offset = into_offset;
+ m_vars_extra[i].cpu_disp = into_disp;
+ }
+ else {
+ if (m_vars[i].flags.is_stack_buf) {
+ into_offset = static_cast<char*>(m_vars[i].into) -
+ m_device.m_persist_list.front().cpu_stack_addr;
+ }
+ m_vars[i].offset = into_offset;
+ m_vars[i].disp = into_disp;
+ }
+ }
+
+ return true;
+}
+
+bool OffloadDescriptor::setup_misc_data(const char *name)
+{
+ OffloadTimer timer(get_timer_data(), c_offload_host_setup_misc_data);
+
+ // we can skip run functon call together with wait if offloaded
+ // region is empty and there is no user defined non-pointer IN/OUT data
+ if (m_need_runfunction) {
+ // variable descriptors are sent as input data
+ m_in_datalen += m_vars_total * sizeof(VarDesc);
+
+ // timer data is sent as a part of the output data
+ m_out_datalen += OFFLOAD_TIMER_DATALEN();
+
+ // max from input data and output data length
+ uint64_t data_len = m_in_datalen > m_out_datalen ? m_in_datalen :
+ m_out_datalen;
+
+ // Misc data has the following layout
+ // <Function Descriptor>
+ // <Function Name>
+ // <In/Out Data> (optional)
+ //
+ // We can transfer copyin/copyout data in misc/return data which can
+ // be passed to run function call if its size does not exceed
+ // COI_PIPELINE_MAX_IN_MISC_DATA_LEN. Otherwise we have to allocate
+ // buffer for it.
+
+ m_func_desc_size = sizeof(FunctionDescriptor) + strlen(name) + 1;
+ m_func_desc_size = (m_func_desc_size + 7) & ~7;
+
+ int misc_data_offset = 0;
+ int misc_data_size = 0;
+ if (data_len > 0) {
+ if (m_func_desc_size +
+ m_in_datalen <= COI_PIPELINE_MAX_IN_MISC_DATA_LEN &&
+ m_out_datalen <= COI_PIPELINE_MAX_IN_MISC_DATA_LEN) {
+ // use misc/return data for copyin/copyout
+ misc_data_offset = m_func_desc_size;
+ misc_data_size = data_len;
+ }
+ else {
+ OffloadTimer timer_buf(get_timer_data(),
+ c_offload_host_alloc_data_buffer);
+
+ // send/receive data using buffer
+ COIRESULT res = COI::BufferCreate(data_len,
+ COI_BUFFER_NORMAL,
+ 0, 0,
+ 1, &m_device.get_process(),
+ &m_inout_buf);
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ return false;
+ }
+ report_coi_error(c_buf_create, res);
+ }
+
+ m_compute_buffers.push_back(m_inout_buf);
+ m_destroy_buffers.push_back(m_inout_buf);
+ }
+ }
+
+ // initialize function descriptor
+ m_func_desc = (FunctionDescriptor*) malloc(m_func_desc_size +
+ misc_data_size);
+ if (m_func_desc == NULL)
+ LIBOFFLOAD_ERROR(c_malloc);
+ m_func_desc->console_enabled = console_enabled;
+ m_func_desc->timer_enabled =
+ timer_enabled || (offload_report_level && offload_report_enabled);
+ m_func_desc->offload_report_level = offload_report_level;
+ m_func_desc->offload_number = GET_OFFLOAD_NUMBER(get_timer_data());
+ m_func_desc->in_datalen = m_in_datalen;
+ m_func_desc->out_datalen = m_out_datalen;
+ m_func_desc->vars_num = m_vars_total;
+ m_func_desc->data_offset = misc_data_offset;
+
+ // append entry name
+ strcpy(m_func_desc->data, name);
+ }
+
+ return true;
+}
+
+bool OffloadDescriptor::wait_dependencies(
+ const void **waits,
+ int num_waits
+)
+{
+ OffloadTimer timer(get_timer_data(), c_offload_host_wait_deps);
+ bool ret = true;
+
+ for (int i = 0; i < num_waits; i++) {
+
+ OffloadDescriptor *task = m_device.find_signal(waits[i], true);
+ if (task == 0) {
+ LIBOFFLOAD_ERROR(c_offload1, m_device.get_logical_index(),
+ waits[i]);
+ LIBOFFLOAD_ABORT;
+ }
+
+ if (!task->offload_finish()) {
+ ret = false;
+ }
+
+ task->cleanup();
+ delete task;
+ }
+
+ return ret;
+}
+
+bool OffloadDescriptor::offload(
+ const char *name,
+ bool is_empty,
+ VarDesc *vars,
+ VarDesc2 *vars2,
+ int vars_total,
+ const void **waits,
+ int num_waits,
+ const void **signal,
+ int entry_id,
+ const void *stack_addr
+)
+{
+ if (signal == 0) {
+ OFFLOAD_DEBUG_TRACE_1(1,
+ GET_OFFLOAD_NUMBER(get_timer_data()),
+ c_offload_init_func,
+ "Offload function %s, is_empty=%d, #varDescs=%d, "
+ "#waits=%d, signal=none\n",
+ name, is_empty, vars_total, num_waits);
+ OFFLOAD_REPORT(3, GET_OFFLOAD_NUMBER(get_timer_data()),
+ c_offload_sent_pointer_data,
+ "#Wait : %d \n", num_waits);
+ OFFLOAD_REPORT(3, GET_OFFLOAD_NUMBER(get_timer_data()),
+ c_offload_signal,
+ "none %d\n", 0);
+ }
+ else {
+ OFFLOAD_DEBUG_TRACE_1(1,
+ GET_OFFLOAD_NUMBER(get_timer_data()),
+ c_offload_init_func,
+ "Offload function %s, is_empty=%d, #varDescs=%d, "
+ "#waits=%d, signal=%p\n",
+ name, is_empty, vars_total, num_waits,
+ *signal);
+
+ OFFLOAD_REPORT(3, GET_OFFLOAD_NUMBER(get_timer_data()),
+ c_offload_signal,
+ "%d\n", signal);
+ }
+ OFFLOAD_REPORT(3, GET_OFFLOAD_NUMBER(get_timer_data()),
+ c_offload_wait,
+ "#Wait : %d %p\n", num_waits, waits);
+
+ if (m_status != 0) {
+ m_status->result = OFFLOAD_SUCCESS;
+ m_status->device_number = m_device.get_logical_index();
+ }
+
+ m_need_runfunction = !is_empty;
+
+ // wait for dependencies to finish
+ if (!wait_dependencies(waits, num_waits)) {
+ cleanup();
+ return false;
+ }
+
+ // setup buffers
+ if (!setup_descriptors(vars, vars2, vars_total, entry_id, stack_addr)) {
+ cleanup();
+ return false;
+ }
+
+ // initiate send for pointers. Want to do it as early as possible.
+ if (!send_pointer_data(signal != 0)) {
+ cleanup();
+ return false;
+ }
+
+ // setup misc data for run function
+ if (!setup_misc_data(name)) {
+ cleanup();
+ return false;
+ }
+
+ // gather copyin data into buffer
+ if (!gather_copyin_data()) {
+ cleanup();
+ return false;
+ }
+
+ // Start the computation
+ if (!compute()) {
+ cleanup();
+ return false;
+ }
+
+ // initiate receive for pointers
+ if (!receive_pointer_data(signal != 0)) {
+ cleanup();
+ return false;
+ }
+
+ // if there is a signal save descriptor for the later use.
+ if (signal != 0) {
+ m_device.add_signal(*signal, this);
+ return true;
+ }
+
+ // wait for the offload to finish.
+ if (!offload_finish()) {
+ cleanup();
+ return false;
+ }
+
+ cleanup();
+ return true;
+}
+
+bool OffloadDescriptor::offload_finish()
+{
+ COIRESULT res;
+
+ // wait for compute dependencies to become signaled
+ if (m_in_deps_total > 0) {
+ OffloadTimer timer(get_timer_data(), c_offload_host_wait_compute);
+
+ if (__offload_active_wait) {
+ // keep CPU busy
+ do {
+ res = COI::EventWait(m_in_deps_total, m_in_deps, 0, 1, 0, 0);
+ }
+ while (res == COI_TIME_OUT_REACHED);
+ }
+ else {
+ res = COI::EventWait(m_in_deps_total, m_in_deps, -1, 1, 0, 0);
+ }
+
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ return false;
+ }
+ report_coi_error(c_event_wait, res);
+ }
+ }
+
+ // scatter copyout data received from target
+ if (!scatter_copyout_data()) {
+ return false;
+ }
+ // wait for receive dependencies to become signaled
+ if (m_out_deps_total > 0) {
+ OffloadTimer timer(get_timer_data(), c_offload_host_wait_buffers_reads);
+
+ if (__offload_active_wait) {
+ // keep CPU busy
+ do {
+ res = COI::EventWait(m_out_deps_total, m_out_deps, 0, 1, 0, 0);
+ }
+ while (res == COI_TIME_OUT_REACHED);
+ }
+ else {
+ res = COI::EventWait(m_out_deps_total, m_out_deps, -1, 1, 0, 0);
+ }
+
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ return false;
+ }
+ report_coi_error(c_event_wait, res);
+ }
+ }
+
+ // destroy buffers
+ {
+ OffloadTimer timer(get_timer_data(), c_offload_host_destroy_buffers);
+
+ for (BufferList::const_iterator it = m_destroy_buffers.begin();
+ it != m_destroy_buffers.end(); it++) {
+ res = COI::BufferDestroy(*it);
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ return false;
+ }
+ report_coi_error(c_buf_destroy, res);
+ }
+ }
+ }
+
+ return true;
+}
+
+void OffloadDescriptor::cleanup()
+{
+ // release device in orsl
+ ORSL::release(m_device.get_logical_index());
+
+ OFFLOAD_TIMER_STOP(get_timer_data(), c_offload_host_total_offload);
+
+ // report stuff
+ Offload_Report_Epilog(get_timer_data());
+}
+
+bool OffloadDescriptor::is_signaled()
+{
+ bool signaled = true;
+ COIRESULT res;
+
+ // check compute and receive dependencies
+ if (m_in_deps_total > 0) {
+ res = COI::EventWait(m_in_deps_total, m_in_deps, 0, 1, 0, 0);
+ signaled = signaled && (res == COI_SUCCESS);
+ }
+ if (m_out_deps_total > 0) {
+ res = COI::EventWait(m_out_deps_total, m_out_deps, 0, 1, 0, 0);
+ signaled = signaled && (res == COI_SUCCESS);
+ }
+
+ return signaled;
+}
+
+// Send pointer data if source or destination or both of them are
+// noncontiguous. There is guarantee that length of destination enough for
+// transfered data.
+bool OffloadDescriptor::send_noncontiguous_pointer_data(
+ int i,
+ PtrData* src_data,
+ PtrData* dst_data,
+ COIEVENT *event
+ )
+{
+ int64_t offset_src, offset_dst;
+ int64_t length_src, length_dst;
+ int64_t length_src_cur, length_dst_cur;
+ int64_t send_size, data_sent = 0;
+ COIRESULT res;
+ bool dst_is_empty = true;
+ bool src_is_empty = true;
+
+ // Set length_src and length_dst
+ length_src = (m_vars_extra[i].read_rng_src) ?
+ m_vars_extra[i].read_rng_src->range_size : m_vars[i].size;
+ length_dst = !m_vars[i].into ? length_src :
+ (m_vars_extra[i].read_rng_dst) ?
+ m_vars_extra[i].read_rng_dst->range_size : m_vars[i].size;
+ send_size = (length_src < length_dst) ? length_src : length_dst;
+
+ // consequently get contiguous ranges,
+ // define corresponded destination offset and send data
+ do {
+ if (src_is_empty) {
+ if (m_vars_extra[i].read_rng_src) {
+ if (!get_next_range(m_vars_extra[i].read_rng_src,
+ &offset_src)) {
+ // source ranges are over - nothing to send
+ break;
+ }
+ }
+ else if (data_sent == 0) {
+ offset_src = m_vars_extra[i].cpu_disp;
+ }
+ else {
+ break;
+ }
+ length_src_cur = length_src;
+ }
+ else {
+ // if source is contiguous or its contiguous range is greater
+ // than destination one
+ offset_src += send_size;
+ }
+ length_src_cur -= send_size;
+ src_is_empty = length_src_cur == 0;
+
+ if (dst_is_empty) {
+ if (m_vars[i].into) {
+ if (m_vars_extra[i].read_rng_dst) {
+ if (!get_next_range(m_vars_extra[i].read_rng_dst,
+ &offset_dst)) {
+ // destination ranges are over
+ LIBOFFLOAD_ERROR(c_destination_is_over);
+ return false;
+ }
+ }
+ // into is contiguous.
+ else {
+ offset_dst = m_vars[i].disp;
+ }
+ length_dst_cur = length_dst;
+ }
+ // same as source
+ else {
+ offset_dst = offset_src;
+ length_dst_cur = length_src;
+ }
+ }
+ else {
+ // if destination is contiguous or its contiguous range is greater
+ // than source one
+ offset_dst += send_size;
+ }
+ length_dst_cur -= send_size;
+ dst_is_empty = length_dst_cur == 0;
+
+ if (src_data != 0 && src_data->cpu_buf != 0) {
+ res = COI::BufferCopy(
+ dst_data->mic_buf,
+ src_data->cpu_buf,
+ m_vars[i].mic_offset - dst_data->alloc_disp +
+ m_vars[i].offset + offset_dst,
+ m_vars_extra[i].cpu_offset + offset_src,
+ send_size,
+ COI_COPY_UNSPECIFIED,
+ 0, 0,
+ event);
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ return false;
+ }
+ report_coi_error(c_buf_copy, res);
+ }
+ }
+ else {
+ char *base = offload_get_src_base(m_vars[i].ptr,
+ m_vars[i].type.src);
+
+ res = COI::BufferWrite(
+ dst_data->mic_buf,
+ m_vars[i].mic_offset - dst_data->alloc_disp +
+ m_vars[i].offset + offset_dst,
+ base + offset_src,
+ send_size,
+ COI_COPY_UNSPECIFIED,
+ 0, 0,
+ event);
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ return false;
+ }
+ report_coi_error(c_buf_write, res);
+ }
+ }
+ data_sent += length_src;
+ }
+ while (true);
+ return true;
+}
+
+bool OffloadDescriptor::send_pointer_data(bool is_async)
+{
+ OffloadTimer timer(get_timer_data(), c_offload_host_send_pointers);
+
+ uint64_t ptr_sent = 0;
+ COIRESULT res;
+
+ // Initiate send for pointer data
+ for (int i = 0; i < m_vars_total; i++) {
+ switch (m_vars[i].type.dst) {
+ case c_data_ptr_array:
+ break;
+ case c_data:
+ case c_void_ptr:
+ case c_cean_var:
+ if (m_vars[i].direction.in &&
+ m_vars[i].flags.is_static_dstn) {
+ COIEVENT *event =
+ (is_async ||
+ m_vars[i].size >= __offload_use_async_buffer_write) ?
+ &m_in_deps[m_in_deps_total++] : 0;
+ PtrData* dst_data = m_vars[i].into ?
+ m_vars_extra[i].dst_data :
+ m_vars_extra[i].src_data;
+ PtrData* src_data =
+ VAR_TYPE_IS_PTR(m_vars[i].type.src) ||
+ VAR_TYPE_IS_SCALAR(m_vars[i].type.src) &&
+ m_vars[i].flags.is_static ?
+ m_vars_extra[i].src_data : 0;
+
+ if (m_vars[i].flags.is_noncont_src ||
+ m_vars[i].flags.is_noncont_dst) {
+ if (!send_noncontiguous_pointer_data(
+ i, src_data, dst_data, event)) {
+ return false;
+ }
+ }
+ else if (src_data != 0 && src_data->cpu_buf != 0) {
+ res = COI::BufferCopy(
+ dst_data->mic_buf,
+ src_data->cpu_buf,
+ m_vars[i].mic_offset - dst_data->alloc_disp +
+ m_vars[i].offset + m_vars[i].disp,
+ m_vars_extra[i].cpu_offset +
+ m_vars_extra[i].cpu_disp,
+ m_vars[i].size,
+ COI_COPY_UNSPECIFIED,
+ 0, 0,
+ event);
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ return false;
+ }
+ report_coi_error(c_buf_copy, res);
+ }
+ }
+ else {
+ char *base = offload_get_src_base(m_vars[i].ptr,
+ m_vars[i].type.src);
+ res = COI::BufferWrite(
+ dst_data->mic_buf,
+ m_vars[i].mic_offset - dst_data->alloc_disp +
+ m_vars[i].offset + m_vars[i].disp,
+ base + m_vars_extra[i].cpu_disp,
+ m_vars[i].size,
+ COI_COPY_UNSPECIFIED,
+ 0, 0,
+ event);
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ return false;
+ }
+ report_coi_error(c_buf_write, res);
+ }
+ }
+ ptr_sent += m_vars[i].size;
+ }
+ break;
+
+ case c_string_ptr:
+ case c_data_ptr:
+ case c_cean_var_ptr:
+ case c_dv_ptr:
+ if (m_vars[i].direction.in && m_vars[i].size > 0) {
+ COIEVENT *event =
+ (is_async ||
+ m_vars[i].size >= __offload_use_async_buffer_write) ?
+ &m_in_deps[m_in_deps_total++] : 0;
+ PtrData* dst_data = m_vars[i].into ?
+ m_vars_extra[i].dst_data :
+ m_vars_extra[i].src_data;
+ PtrData* src_data =
+ VAR_TYPE_IS_PTR(m_vars[i].type.src) ||
+ VAR_TYPE_IS_SCALAR(m_vars[i].type.src) &&
+ m_vars[i].flags.is_static ?
+ m_vars_extra[i].src_data : 0;
+
+ if (m_vars[i].flags.is_noncont_src ||
+ m_vars[i].flags.is_noncont_dst) {
+ send_noncontiguous_pointer_data(
+ i, src_data, dst_data, event);
+ }
+ else if (src_data != 0 && src_data->cpu_buf != 0) {
+ res = COI::BufferCopy(
+ dst_data->mic_buf,
+ src_data->cpu_buf,
+ m_vars[i].mic_offset - dst_data->alloc_disp +
+ m_vars[i].offset + m_vars[i].disp,
+ m_vars_extra[i].cpu_offset +
+ m_vars_extra[i].cpu_disp,
+ m_vars[i].size,
+ COI_COPY_UNSPECIFIED,
+ 0, 0,
+ event);
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ return false;
+ }
+ report_coi_error(c_buf_copy, res);
+ }
+ }
+ else {
+ char *base = offload_get_src_base(m_vars[i].ptr,
+ m_vars[i].type.src);
+ res = COI::BufferWrite(
+ dst_data->mic_buf,
+ m_vars[i].mic_offset - dst_data->alloc_disp +
+ m_vars[i].offset + m_vars[i].disp,
+ base + m_vars_extra[i].cpu_disp,
+ m_vars[i].size,
+ COI_COPY_UNSPECIFIED,
+ 0, 0,
+ event);
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ return false;
+ }
+ report_coi_error(c_buf_write, res);
+ }
+ }
+
+ ptr_sent += m_vars[i].size;
+ }
+ break;
+
+ case c_dv_data:
+ case c_dv_ptr_data:
+ if (m_vars[i].direction.in &&
+ m_vars[i].size > 0) {
+ PtrData *ptr_data = m_vars[i].into ?
+ m_vars_extra[i].dst_data :
+ m_vars_extra[i].src_data;
+ PtrData* src_data = m_vars_extra[i].src_data;
+
+ COIEVENT *event =
+ (is_async ||
+ m_vars[i].size >= __offload_use_async_buffer_write) ?
+ &m_in_deps[m_in_deps_total++] : 0;
+
+ if (m_vars[i].flags.is_noncont_src ||
+ m_vars[i].flags.is_noncont_dst) {
+ send_noncontiguous_pointer_data(
+ i, src_data, ptr_data, event);
+ }
+ else if (src_data && src_data->cpu_buf != 0) {
+ res = COI::BufferCopy(
+ ptr_data->mic_buf,
+ src_data->cpu_buf,
+ m_vars[i].offset + ptr_data->mic_offset -
+ ptr_data->alloc_disp +
+ m_vars[i].disp,
+ m_vars_extra[i].cpu_offset +
+ m_vars_extra[i].cpu_disp,
+ m_vars[i].size,
+ COI_COPY_UNSPECIFIED,
+ 0, 0,
+ event);
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ return false;
+ }
+ report_coi_error(c_buf_copy, res);
+ }
+ }
+ else {
+ char *base = offload_get_src_base(m_vars[i].ptr,
+ m_vars[i].type.src);
+ res = COI::BufferWrite(
+ ptr_data->mic_buf,
+ ptr_data->mic_offset - ptr_data->alloc_disp +
+ m_vars[i].offset + m_vars[i].disp,
+ base + m_vars_extra[i].cpu_disp,
+ m_vars[i].size,
+ COI_COPY_UNSPECIFIED,
+ 0, 0,
+ event);
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ return false;
+ }
+ report_coi_error(c_buf_write, res);
+ }
+ }
+ ptr_sent += m_vars[i].size;
+ }
+ break;
+
+ case c_dv_data_slice:
+ case c_dv_ptr_data_slice:
+ if (m_vars[i].direction.in &&
+ m_vars[i].size > 0) {
+ PtrData *dst_data = m_vars[i].into ?
+ m_vars_extra[i].dst_data :
+ m_vars_extra[i].src_data;
+ PtrData* src_data =
+ (VAR_TYPE_IS_PTR(m_vars[i].type.src) ||
+ VAR_TYPE_IS_DV_DATA(m_vars[i].type.src) ||
+ VAR_TYPE_IS_DV_DATA_SLICE(m_vars[i].type.src) ||
+ VAR_TYPE_IS_SCALAR(m_vars[i].type.src) &&
+ m_vars[i].flags.is_static) ?
+ m_vars_extra[i].src_data : 0;
+ COIEVENT *event =
+ (is_async ||
+ m_vars[i].size >= __offload_use_async_buffer_write) ?
+ &m_in_deps[m_in_deps_total++] : 0;
+ if (m_vars[i].flags.is_noncont_src ||
+ m_vars[i].flags.is_noncont_dst) {
+ send_noncontiguous_pointer_data(
+ i, src_data, dst_data, event);
+ }
+ else if (src_data && src_data->cpu_buf != 0) {
+ res = COI::BufferCopy(
+ dst_data->mic_buf,
+ src_data->cpu_buf,
+ m_vars[i].offset - dst_data->alloc_disp +
+ dst_data->mic_offset +
+ m_vars[i].disp,
+ m_vars_extra[i].cpu_offset +
+ m_vars_extra[i].cpu_disp,
+ m_vars[i].size,
+ COI_COPY_UNSPECIFIED,
+ 0, 0,
+ event);
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ return false;
+ }
+ report_coi_error(c_buf_copy, res);
+ }
+ }
+ else {
+ char *base = offload_get_src_base(m_vars[i].ptr,
+ m_vars[i].type.src);
+ res = COI::BufferWrite(
+ dst_data->mic_buf,
+ dst_data->mic_offset - dst_data->alloc_disp +
+ m_vars[i].offset + m_vars[i].disp,
+ base + m_vars_extra[i].cpu_disp,
+ m_vars[i].size,
+ COI_COPY_UNSPECIFIED,
+ 0, 0,
+ event);
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ return false;
+ }
+ report_coi_error(c_buf_write, res);
+ }
+ }
+
+ ptr_sent += m_vars[i].size;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ // alloc field isn't used at target.
+ // We can reuse it for offset of array pointers.
+ if (m_vars_extra[i].is_arr_ptr_el) {
+ m_vars[i].ptr_arr_offset = m_vars_extra[i].ptr_arr_offset;
+ }
+ }
+
+ if (m_status) {
+ m_status->data_sent += ptr_sent;
+ }
+
+ OFFLOAD_TIMER_HOST_SDATA(get_timer_data(), ptr_sent);
+ OFFLOAD_DEBUG_TRACE_1(1, GET_OFFLOAD_NUMBER(get_timer_data()),
+ c_offload_sent_pointer_data,
+ "Total pointer data sent to target: [%lld] bytes\n",
+ ptr_sent);
+
+ return true;
+}
+
+bool OffloadDescriptor::gather_copyin_data()
+{
+ OffloadTimer timer(get_timer_data(), c_offload_host_gather_inputs);
+
+ if (m_need_runfunction && m_in_datalen > 0) {
+ COIMAPINSTANCE map_inst;
+ char *data;
+
+ // init marshaller
+ if (m_inout_buf != 0) {
+ OffloadTimer timer_map(get_timer_data(),
+ c_offload_host_map_in_data_buffer);
+
+ COIRESULT res = COI::BufferMap(m_inout_buf, 0, m_in_datalen,
+ COI_MAP_WRITE_ENTIRE_BUFFER,
+ 0, 0, 0, &map_inst,
+ reinterpret_cast<void**>(&data));
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ return false;
+ }
+ report_coi_error(c_buf_map, res);
+ }
+ }
+ else {
+ data = (char*) m_func_desc + m_func_desc->data_offset;
+ }
+
+ // send variable descriptors
+ memcpy(data, m_vars, m_vars_total * sizeof(VarDesc));
+ data += m_vars_total * sizeof(VarDesc);
+
+ // init marshaller
+ m_in.init_buffer(data, m_in_datalen);
+
+ // Gather copy data into buffer
+ for (int i = 0; i < m_vars_total; i++) {
+ bool src_is_for_mic = (m_vars[i].direction.out ||
+ m_vars[i].into == NULL);
+ PtrData* ptr_data = src_is_for_mic ?
+ m_vars_extra[i].src_data :
+ m_vars_extra[i].dst_data;
+ if (m_vars[i].flags.alloc_disp) {
+ m_in.send_data(&ptr_data->alloc_disp,
+ sizeof(ptr_data->alloc_disp));
+ }
+
+ // send sink address to the target
+ if (m_vars[i].flags.sink_addr) {
+ m_in.send_data(&ptr_data->mic_addr,
+ sizeof(ptr_data->mic_addr));
+ }
+
+ switch (m_vars[i].type.dst) {
+ case c_data_ptr_array:
+ break;
+ case c_data:
+ case c_void_ptr:
+ case c_cean_var:
+ if (m_vars[i].direction.in &&
+ !m_vars[i].flags.is_static_dstn) {
+
+ char *ptr = offload_get_src_base(m_vars[i].ptr,
+ m_vars[i].type.src);
+ if (m_vars[i].type.dst == c_cean_var) {
+ // offset and length are derived from the array
+ // descriptor
+ int64_t size = m_vars[i].size;
+ int64_t disp = m_vars[i].disp;
+ m_in.send_data(reinterpret_cast<char*>(&size),
+ sizeof(int64_t));
+ m_in.send_data(reinterpret_cast<char*>(&disp),
+ sizeof(int64_t));
+ }
+
+ m_in.send_data(ptr + m_vars_extra[i].cpu_disp,
+ m_vars[i].size);
+ }
+ break;
+
+ case c_dv:
+ if (m_vars[i].direction.bits ||
+ m_vars[i].alloc_if ||
+ m_vars[i].free_if) {
+ // send dope vector excluding base
+ char *ptr = static_cast<char*>(m_vars[i].ptr);
+ m_in.send_data(ptr + sizeof(uint64_t),
+ m_vars[i].size - sizeof(uint64_t));
+ }
+ break;
+
+ case c_data_ptr:
+ // send to target addresses of obsolete
+ // stacks to be released
+ if (m_vars[i].flags.is_stack_buf &&
+ !m_vars[i].direction.bits &&
+ m_vars[i].alloc_if &&
+ m_vars[i].size != 0) {
+ for (PtrDataList::iterator it =
+ m_destroy_stack.begin();
+ it != m_destroy_stack.end(); it++) {
+ PtrData * ptr_data = *it;
+ m_in.send_data(&(ptr_data->mic_addr),
+ sizeof(ptr_data->mic_addr));
+ }
+ }
+ break;
+ case c_func_ptr:
+ if (m_vars[i].direction.in) {
+ m_in.send_func_ptr(*((const void**) m_vars[i].ptr));
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (m_status) {
+ m_status->data_sent += m_in.get_tfr_size();
+ }
+
+ if (m_func_desc->data_offset == 0) {
+ OffloadTimer timer_unmap(get_timer_data(),
+ c_offload_host_unmap_in_data_buffer);
+ COIRESULT res = COI::BufferUnmap(map_inst, 0, 0, 0);
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ return false;
+ }
+ report_coi_error(c_buf_unmap, res);
+ }
+ }
+ }
+
+ OFFLOAD_TIMER_HOST_SDATA(get_timer_data(), m_in.get_tfr_size());
+ OFFLOAD_DEBUG_TRACE_1(1,
+ GET_OFFLOAD_NUMBER(get_timer_data()), c_offload_copyin_data,
+ "Total copyin data sent to target: [%lld] bytes\n",
+ m_in.get_tfr_size());
+
+ return true;
+}
+
+bool OffloadDescriptor::compute()
+{
+ OffloadTimer timer(get_timer_data(), c_offload_host_start_compute);
+
+ if (m_need_runfunction) {
+ OFFLOAD_DEBUG_TRACE_1(2, GET_OFFLOAD_NUMBER(get_timer_data()),
+ c_offload_compute, "Compute task on MIC\n");
+
+ void* misc = m_func_desc;
+ int misc_len = m_func_desc_size;
+ void* ret = 0;
+ int ret_len = 0;
+
+ if (m_func_desc->data_offset != 0) {
+ misc_len += m_in_datalen;
+
+ if (m_out_datalen > 0) {
+ ret = (char*) m_func_desc + m_func_desc->data_offset;
+ ret_len = m_out_datalen;
+ }
+ }
+
+ // dispatch task
+ COIRESULT res;
+ COIEVENT event;
+ res = m_device.compute(m_compute_buffers,
+ misc, misc_len,
+ ret, ret_len,
+ m_in_deps_total,
+ m_in_deps_total > 0 ? m_in_deps : 0,
+ &event);
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ return false;
+ }
+ report_coi_error(c_pipeline_run_func, res);
+ }
+
+ m_in_deps_total = 1;
+ m_in_deps[0] = event;
+ }
+
+ return true;
+}
+
+// recieve pointer data if source or destination or both of them are
+// noncontiguous. There is guarantee that length of destination enough for
+// transfered data.
+bool OffloadDescriptor::recieve_noncontiguous_pointer_data(
+ int i,
+ char* base,
+ COIBUFFER dst_buf,
+ COIEVENT *event
+)
+{
+ int64_t offset_src, offset_dst;
+ int64_t length_src, length_dst;
+ int64_t length_src_cur, length_dst_cur;
+ int64_t recieve_size, data_recieved = 0;
+ COIRESULT res;
+ bool dst_is_empty = true;
+ bool src_is_empty = true;
+
+ // Set length_src and length_dst
+ length_src = (m_vars_extra[i].read_rng_src) ?
+ m_vars_extra[i].read_rng_src->range_size : m_vars[i].size;
+ length_dst = !m_vars[i].into ? length_src :
+ (m_vars_extra[i].read_rng_dst) ?
+ m_vars_extra[i].read_rng_dst->range_size : m_vars[i].size;
+ recieve_size = (length_src < length_dst) ? length_src : length_dst;
+
+ // consequently get contiguous ranges,
+ // define corresponded destination offset and recieve data
+ do {
+ // get sorce offset
+ if (src_is_empty) {
+ if (m_vars_extra[i].read_rng_src) {
+ if (!get_next_range(m_vars_extra[i].read_rng_src,
+ &offset_src)) {
+ // source ranges are over - nothing to send
+ break;
+ }
+ }
+ else if (data_recieved == 0) {
+ offset_src = 0;
+ }
+ else {
+ break;
+ }
+ length_src_cur = length_src;
+ }
+ else {
+ // if source is contiguous or its contiguous range is greater
+ // than destination one
+ offset_src += recieve_size;
+ }
+ length_src_cur -= recieve_size;
+ src_is_empty = length_src_cur == 0;
+
+ // get destination offset
+ if (dst_is_empty) {
+ if (m_vars[i].into) {
+ if (m_vars_extra[i].read_rng_dst) {
+ if (!get_next_range(m_vars_extra[i].read_rng_dst,
+ &offset_dst)) {
+ // destination ranges are over
+ LIBOFFLOAD_ERROR(c_destination_is_over);
+ return false;
+ }
+ }
+ // destination is contiguous.
+ else {
+ offset_dst = m_vars_extra[i].cpu_disp;
+ }
+ length_dst_cur = length_dst;
+ }
+ // same as source
+ else {
+ offset_dst = offset_src;
+ length_dst_cur = length_src;
+ }
+ }
+ else {
+ // if destination is contiguous or its contiguous range is greater
+ // than source one
+ offset_dst += recieve_size;
+ }
+ length_dst_cur -= recieve_size;
+ dst_is_empty = length_dst_cur == 0;
+
+ if (dst_buf != 0) {
+ res = COI::BufferCopy(
+ dst_buf,
+ m_vars_extra[i].src_data->mic_buf,
+ m_vars_extra[i].cpu_offset + offset_dst,
+ m_vars[i].offset + offset_src +
+ m_vars[i].mic_offset -
+ m_vars_extra[i].src_data->alloc_disp,
+ recieve_size,
+ COI_COPY_UNSPECIFIED,
+ m_in_deps_total,
+ m_in_deps_total > 0 ? m_in_deps : 0,
+ event);
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ return false;
+ }
+ report_coi_error(c_buf_copy, res);
+ }
+ }
+ else {
+ res = COI::BufferRead(
+ m_vars_extra[i].src_data->mic_buf,
+ m_vars[i].offset + offset_src +
+ m_vars[i].mic_offset -
+ m_vars_extra[i].src_data->alloc_disp,
+ base + offset_dst,
+ recieve_size,
+ COI_COPY_UNSPECIFIED,
+ m_in_deps_total,
+ m_in_deps_total > 0 ? m_in_deps : 0,
+ event);
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ return false;
+ }
+ report_coi_error(c_buf_read, res);
+ }
+ }
+ data_recieved += recieve_size;
+ }
+ while (true);
+ return true;
+}
+
+bool OffloadDescriptor::receive_pointer_data(bool is_async)
+{
+ OffloadTimer timer(get_timer_data(), c_offload_host_start_buffers_reads);
+
+ uint64_t ptr_received = 0;
+ COIRESULT res;
+
+ for (int i = 0; i < m_vars_total; i++) {
+ switch (m_vars[i].type.src) {
+ case c_data_ptr_array:
+ break;
+ case c_data:
+ case c_void_ptr:
+ case c_cean_var:
+ if (m_vars[i].direction.out &&
+ m_vars[i].flags.is_static) {
+ COIEVENT *event =
+ (is_async ||
+ m_in_deps_total > 0 ||
+ m_vars[i].size >= __offload_use_async_buffer_read) ?
+ &m_out_deps[m_out_deps_total++] : 0;
+ PtrData *ptr_data = NULL;
+ COIBUFFER dst_buf = NULL; // buffer at host
+ char *base;
+
+ if (VAR_TYPE_IS_PTR(m_vars[i].type.dst)) {
+ ptr_data = m_vars[i].into ?
+ m_vars_extra[i].dst_data :
+ m_vars_extra[i].src_data;
+ }
+ else if (VAR_TYPE_IS_SCALAR(m_vars[i].type.dst)) {
+ if (m_vars[i].flags.is_static_dstn) {
+ ptr_data = m_vars[i].into ?
+ m_vars_extra[i].dst_data :
+ m_vars_extra[i].src_data;
+ }
+ }
+ dst_buf = ptr_data ? ptr_data->cpu_buf : NULL;
+ if (dst_buf == NULL) {
+ base = offload_get_src_base(
+ m_vars[i].into ?
+ static_cast<char*>(m_vars[i].into) :
+ static_cast<char*>(m_vars[i].ptr),
+ m_vars[i].type.dst);
+ }
+
+ if (m_vars[i].flags.is_noncont_src ||
+ m_vars[i].flags.is_noncont_dst) {
+ recieve_noncontiguous_pointer_data(
+ i, base, dst_buf, event);
+ }
+ else if (dst_buf != 0) {
+ res = COI::BufferCopy(
+ dst_buf,
+ m_vars_extra[i].src_data->mic_buf,
+ m_vars_extra[i].cpu_offset +
+ m_vars_extra[i].cpu_disp,
+ m_vars[i].offset + m_vars[i].disp,
+ m_vars[i].size,
+ COI_COPY_UNSPECIFIED,
+ m_in_deps_total,
+ m_in_deps_total > 0 ? m_in_deps : 0,
+ event);
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ return false;
+ }
+ report_coi_error(c_buf_copy, res);
+ }
+ }
+ else {
+ res = COI::BufferRead(
+ m_vars_extra[i].src_data->mic_buf,
+ m_vars[i].offset + m_vars[i].disp,
+ base + m_vars_extra[i].cpu_offset +
+ m_vars_extra[i].cpu_disp,
+ m_vars[i].size,
+ COI_COPY_UNSPECIFIED,
+ m_in_deps_total,
+ m_in_deps_total > 0 ? m_in_deps : 0,
+ event);
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ return false;
+ }
+ report_coi_error(c_buf_read, res);
+ }
+ }
+ ptr_received += m_vars[i].size;
+ }
+ break;
+
+ case c_string_ptr:
+ case c_data_ptr:
+ case c_cean_var_ptr:
+ case c_dv_data:
+ case c_dv_ptr_data:
+ case c_dv_data_slice:
+ case c_dv_ptr_data_slice:
+ case c_dv_ptr: {
+ COIBUFFER dst_buf = NULL; // buffer on host
+ if (m_vars[i].direction.out && m_vars[i].size > 0) {
+ COIEVENT *event =
+ (is_async ||
+ m_in_deps_total > 0 ||
+ m_vars[i].size >= __offload_use_async_buffer_read) ?
+ &m_out_deps[m_out_deps_total++] : 0;
+
+ uint64_t dst_offset = 0;
+ char *base = static_cast<char*>(m_vars[i].ptr);
+
+ if (VAR_TYPE_IS_PTR(m_vars[i].type.dst)) {
+ PtrData *ptr_data = m_vars[i].into ?
+ m_vars_extra[i].dst_data :
+ m_vars_extra[i].src_data;
+ dst_buf = ptr_data ? ptr_data->cpu_buf : NULL;
+ if (dst_buf == NULL) {
+ base = m_vars[i].into ?
+ *static_cast<char**>(m_vars[i].into) :
+ *static_cast<char**>(m_vars[i].ptr);
+ }
+ dst_offset = m_vars_extra[i].cpu_offset +
+ m_vars_extra[i].cpu_disp;
+ }
+ else if (VAR_TYPE_IS_SCALAR(m_vars[i].type.dst)) {
+ if (m_vars[i].flags.is_static_dstn) {
+ dst_buf = m_vars[i].into ?
+ m_vars_extra[i].dst_data->cpu_buf :
+ m_vars_extra[i].src_data->cpu_buf;
+ }
+ if (dst_buf == NULL) {
+ base = offload_get_src_base(
+ m_vars[i].into ?
+ static_cast<char*>(m_vars[i].into) :
+ static_cast<char*>(m_vars[i].ptr),
+ m_vars[i].type.dst);
+ }
+ dst_offset = m_vars_extra[i].cpu_offset +
+ m_vars_extra[i].cpu_disp;
+ }
+ else if (VAR_TYPE_IS_DV_DATA(m_vars[i].type.dst) ||
+ VAR_TYPE_IS_DV_DATA_SLICE(m_vars[i].type.dst)) {
+ PtrData *ptr_data = m_vars[i].into != 0 ?
+ m_vars_extra[i].dst_data :
+ m_vars_extra[i].src_data;
+ dst_buf = ptr_data != 0 ? ptr_data->cpu_buf : 0;
+ if (dst_buf == NULL) {
+ base = offload_get_src_base(
+ m_vars[i].into ?
+ static_cast<char*>(m_vars[i].into) :
+ static_cast<char*>(m_vars[i].ptr),
+ m_vars[i].type.dst);
+
+ }
+ dst_offset = m_vars_extra[i].cpu_offset +
+ m_vars_extra[i].cpu_disp;
+ }
+
+ if (m_vars[i].flags.is_noncont_src ||
+ m_vars[i].flags.is_noncont_dst) {
+ recieve_noncontiguous_pointer_data(
+ i, base, dst_buf, event);
+ }
+ else if (dst_buf != 0) {
+ res = COI::BufferCopy(
+ dst_buf,
+ m_vars_extra[i].src_data->mic_buf,
+ dst_offset,
+ m_vars[i].offset + m_vars[i].disp +
+ m_vars[i].mic_offset -
+ m_vars_extra[i].src_data->alloc_disp,
+ m_vars[i].size,
+ COI_COPY_UNSPECIFIED,
+ m_in_deps_total,
+ m_in_deps_total > 0 ? m_in_deps : 0,
+ event);
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ return false;
+ }
+ report_coi_error(c_buf_copy, res);
+ }
+ }
+ else {
+ res = COI::BufferRead(
+ m_vars_extra[i].src_data->mic_buf,
+ m_vars[i].offset + m_vars[i].disp +
+ m_vars[i].mic_offset -
+ m_vars_extra[i].src_data->alloc_disp,
+ base + dst_offset,
+ m_vars[i].size,
+ COI_COPY_UNSPECIFIED,
+ m_in_deps_total,
+ m_in_deps_total > 0 ? m_in_deps : 0,
+ event);
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ return false;
+ }
+ report_coi_error(c_buf_read, res);
+ }
+ }
+ ptr_received += m_vars[i].size;
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ // destroy buffers for obsolete stacks
+ if (m_destroy_stack.size() != 0) {
+ for (PtrDataList::iterator it = m_destroy_stack.begin();
+ it != m_destroy_stack.end(); it++) {
+ PtrData *ptr_data = *it;
+ m_destroy_buffers.push_back(ptr_data->mic_buf);
+ OFFLOAD_TRACE(3, "Removing stack buffer with addr %p\n",
+ ptr_data->mic_addr);
+ }
+ m_destroy_stack.clear();
+ }
+ if (m_vars[i].free_if) {
+ // remove association for automatic variables
+ if (m_is_openmp && !m_vars[i].flags.is_static &&
+ (m_vars[i].type.src == c_data ||
+ m_vars[i].type.src == c_void_ptr ||
+ m_vars[i].type.src == c_cean_var)) {
+ AutoData *auto_data = m_vars_extra[i].auto_data;
+ if (auto_data != 0 && auto_data->remove_reference() == 0) {
+ m_device.remove_auto_data(auto_data->cpu_addr.start());
+ }
+ }
+
+ // destroy buffers
+ if (m_vars[i].direction.out || m_vars[i].into == NULL) {
+ if (!VAR_TYPE_IS_PTR(m_vars[i].type.src) &&
+ !VAR_TYPE_IS_DV_DATA_SLICE(m_vars[i].type.src) &&
+ !VAR_TYPE_IS_DV_DATA(m_vars[i].type.src)) {
+ continue;
+ }
+
+ PtrData *ptr_data = m_vars_extra[i].src_data;
+ if (ptr_data->remove_reference() == 0) {
+ // destroy buffers
+ if (ptr_data->cpu_buf != 0) {
+ m_destroy_buffers.push_back(ptr_data->cpu_buf);
+ }
+ if (ptr_data->mic_buf != 0) {
+ m_destroy_buffers.push_back(ptr_data->mic_buf);
+ }
+ OFFLOAD_TRACE(3, "Removing association for addr %p\n",
+ ptr_data->cpu_addr.start());
+
+ // remove association from map
+ m_device.remove_ptr_data(ptr_data->cpu_addr.start());
+ }
+ }
+ else if (VAR_TYPE_IS_PTR(m_vars[i].type.dst) ||
+ VAR_TYPE_IS_DV_DATA_SLICE(m_vars[i].type.dst) ||
+ VAR_TYPE_IS_DV_DATA(m_vars[i].type.dst)) {
+ PtrData *ptr_data = m_vars_extra[i].dst_data;
+ if (ptr_data->remove_reference() == 0) {
+ // destroy buffers
+ if (ptr_data->cpu_buf != 0) {
+ m_destroy_buffers.push_back(ptr_data->cpu_buf);
+ }
+ if (ptr_data->mic_buf != 0) {
+ m_destroy_buffers.push_back(ptr_data->mic_buf);
+ }
+ OFFLOAD_TRACE(3, "Removing association for addr %p\n",
+ ptr_data->cpu_addr.start());
+
+ // remove association from map
+ m_device.remove_ptr_data(ptr_data->cpu_addr.start());
+ }
+ }
+ }
+ }
+
+ if (m_status) {
+ m_status->data_received += ptr_received;
+ }
+
+ OFFLOAD_TIMER_HOST_RDATA(get_timer_data(), ptr_received);
+ OFFLOAD_DEBUG_TRACE_1(1, GET_OFFLOAD_NUMBER(get_timer_data()),
+ c_offload_received_pointer_data,
+ "Total pointer data received from target: [%lld] bytes\n",
+ ptr_received);
+
+ return true;
+}
+
+bool OffloadDescriptor::scatter_copyout_data()
+{
+ OffloadTimer timer(get_timer_data(), c_offload_host_scatter_outputs);
+
+ if (m_need_runfunction && m_out_datalen > 0) {
+
+ // total size that need to be transferred from target to host
+ COIMAPINSTANCE map_inst;
+ COIRESULT res;
+ char *data;
+
+ // output data buffer
+ if (m_func_desc->data_offset == 0) {
+ OffloadTimer timer_map(get_timer_data(),
+ c_offload_host_map_out_data_buffer);
+
+ COIRESULT res = COI::BufferMap(m_inout_buf, 0, m_out_datalen,
+ COI_MAP_READ_ONLY, 0, 0, 0,
+ &map_inst,
+ reinterpret_cast<void**>(&data));
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ return false;
+ }
+ report_coi_error(c_buf_map, res);
+ }
+ }
+ else {
+ data = (char*) m_func_desc + m_func_desc->data_offset;
+ }
+
+ // get timing data
+ OFFLOAD_TIMER_TARGET_DATA(get_timer_data(), data);
+ data += OFFLOAD_TIMER_DATALEN();
+
+ // initialize output marshaller
+ m_out.init_buffer(data, m_out_datalen);
+
+ for (int i = 0; i < m_vars_total; i++) {
+ switch (m_vars[i].type.src) {
+ case c_data_ptr_array:
+ break;
+ case c_data:
+ case c_void_ptr:
+ case c_cean_var:
+ if (m_vars[i].direction.out &&
+ !m_vars[i].flags.is_static) {
+
+ if (m_vars[i].into) {
+ char *ptr = offload_get_src_base(
+ static_cast<char*>(m_vars[i].into),
+ m_vars[i].type.dst);
+ m_out.receive_data(ptr + m_vars_extra[i].cpu_disp,
+ m_vars[i].size);
+ }
+ else {
+ m_out.receive_data(
+ static_cast<char*>(m_vars[i].ptr) +
+ m_vars_extra[i].cpu_disp,
+ m_vars[i].size);
+ }
+ }
+ break;
+
+ case c_func_ptr:
+ if (m_vars[i].direction.out) {
+ m_out.receive_func_ptr((const void**) m_vars[i].ptr);
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (m_status) {
+ m_status->data_received += m_out.get_tfr_size();
+ }
+
+ if (m_func_desc->data_offset == 0) {
+ OffloadTimer timer_unmap(get_timer_data(),
+ c_offload_host_unmap_out_data_buffer);
+
+ COIRESULT res = COI::BufferUnmap(map_inst, 0, 0, 0);
+ if (res != COI_SUCCESS) {
+ if (m_status != 0) {
+ m_status->result = translate_coi_error(res);
+ return false;
+ }
+ report_coi_error(c_buf_unmap, res);
+ }
+ }
+ }
+
+ OFFLOAD_TIMER_HOST_RDATA(get_timer_data(), m_out.get_tfr_size());
+ OFFLOAD_TRACE(1, "Total copyout data received from target: [%lld] bytes\n",
+ m_out.get_tfr_size());
+
+ return true;
+}
+
+void get_arr_desc_numbers(
+ const arr_desc *ap,
+ int64_t el_size,
+ int64_t &offset,
+ int64_t &size,
+ int &el_number,
+ CeanReadRanges* &ptr_ranges
+)
+{
+ if (is_arr_desc_contiguous(ap)) {
+ ptr_ranges = NULL;
+ __arr_data_offset_and_length(ap, offset, size);
+ el_number = size / el_size;
+ }
+ else {
+ ptr_ranges = init_read_ranges_arr_desc(ap);
+ el_number = (ptr_ranges->range_size / el_size) *
+ ptr_ranges->range_max_number;
+ size = ptr_ranges->range_size;
+ }
+}
+
+arr_desc * make_arr_desc(
+ void* ptr_val,
+ int64_t extent_start_val,
+ int64_t extent_elements_val,
+ int64_t size
+)
+{
+ arr_desc *res;
+ res = (arr_desc *)malloc(sizeof(arr_desc));
+ if (res == NULL)
+ LIBOFFLOAD_ERROR(c_malloc);
+ res->base = reinterpret_cast<int64_t>(ptr_val);
+ res->rank = 1;
+ res->dim[0].size = size;
+ res->dim[0].lindex = 0;
+ res->dim[0].lower = extent_start_val;
+ res->dim[0].upper = extent_elements_val + extent_start_val - 1;
+ res->dim[0].stride = 1;
+ return res;
+}
+
+bool OffloadDescriptor::gen_var_descs_for_pointer_array(int i)
+{
+ int pointers_number;
+ int tmp_val;
+ int new_index = m_vars_total;
+ const arr_desc *ap;
+ const VarDesc3 *vd3 = static_cast<const VarDesc3*>(m_vars[i].ptr);
+ int flags = vd3->array_fields;
+ bool src_is_for_mic = (m_vars[i].direction.out ||
+ m_vars[i].into == NULL);
+
+ ReadArrElements<void *> ptr;
+ ReadArrElements<void *> into;
+ ReadArrElements<int64_t> ext_start;
+ ReadArrElements<int64_t> ext_elements;
+ ReadArrElements<int64_t> align;
+ ReadArrElements<int64_t> alloc_if;
+ ReadArrElements<int64_t> free_if;
+ ReadArrElements<int64_t> into_start;
+ ReadArrElements<int64_t> into_elem;
+ ReadArrElements<int64_t> alloc_start;
+ ReadArrElements<int64_t> alloc_elem;
+
+
+ ap = static_cast<const arr_desc*>(vd3->ptr_array);
+
+ // "pointers_number" for total number of transfered pointers.
+ // For each of them we create new var_desc and put it at the bottom
+ // of the var_desc's array
+ get_arr_desc_numbers(ap, sizeof(void *), ptr.offset, ptr.size,
+ pointers_number, ptr.ranges);
+ ptr.base = reinterpret_cast<char*>(ap->base);
+
+ // 2. prepare memory for new var_descs
+ m_vars_total += pointers_number;
+ m_vars = (VarDesc*)realloc(m_vars, m_vars_total * sizeof(VarDesc));
+ if (m_vars == NULL)
+ LIBOFFLOAD_ERROR(c_malloc);
+ m_vars_extra =
+ (VarExtra*)realloc(m_vars_extra, m_vars_total * sizeof(VarExtra));
+ if (m_vars_extra == NULL)
+ LIBOFFLOAD_ERROR(c_malloc);
+ m_in_deps =
+ (COIEVENT*)realloc(m_in_deps, sizeof(COIEVENT) * (m_vars_total + 1));
+ if (m_in_deps == NULL)
+ LIBOFFLOAD_ERROR(c_malloc);
+ m_out_deps =
+ (COIEVENT*)realloc(m_out_deps, sizeof(COIEVENT) * m_vars_total);
+ if (m_out_deps == NULL)
+ LIBOFFLOAD_ERROR(c_malloc);
+
+ // 3. Prepare for reading new var_desc's fields
+ // EXTENT START
+ if ((flags & (1<<flag_extent_start_is_array)) != 0) {
+ ap = static_cast<const arr_desc*>(vd3->extent_start);
+ get_arr_desc_numbers(ap, ap->dim[ap->rank - 1].size, ext_start.offset,
+ ext_start.size, tmp_val, ext_start.ranges);
+ ext_start.base = reinterpret_cast<char*>(ap->base);
+ ext_start.el_size = ap->dim[ap->rank - 1].size;
+
+ if (tmp_val < pointers_number) {
+ LIBOFFLOAD_ERROR(c_pointer_array_mismatch, "extent start");
+ return false;
+ }
+ }
+ else if ((flags & (1<<flag_extent_start_is_scalar)) != 0) {
+ ext_start.val = (int64_t)vd3->extent_start;
+ }
+ else {
+ ext_start.val = 0;
+ }
+
+ // EXTENT ELEMENTS NUMBER
+ if ((flags & (1<<flag_extent_elements_is_array)) != 0) {
+ ap = static_cast<const arr_desc*>(vd3->extent_elements);
+ get_arr_desc_numbers(ap, ap->dim[ap->rank - 1].size,
+ ext_elements.offset, ext_elements.size,
+ tmp_val, ext_elements.ranges);
+ ext_elements.base = reinterpret_cast<char*>(ap->base);
+ ext_elements.el_size = ap->dim[ap->rank - 1].size;
+
+ if (tmp_val < pointers_number) {
+ LIBOFFLOAD_ERROR(c_pointer_array_mismatch, "extent elements");
+ return false;
+ }
+ }
+ else if ((flags & (1<<flag_extent_elements_is_scalar)) != 0) {
+ ext_elements.val = (int64_t)vd3->extent_elements;
+ }
+ else {
+ ext_elements.val = m_vars[i].count;
+ }
+
+ // ALLOC_IF
+ if ((flags & (1<<flag_alloc_if_is_array)) != 0) {
+ ap = static_cast<const arr_desc*>(vd3->alloc_if_array);
+ get_arr_desc_numbers(ap, ap->dim[ap->rank - 1].size, alloc_if.offset,
+ alloc_if.size, tmp_val, alloc_if.ranges);
+ alloc_if.base = reinterpret_cast<char*>(ap->base);
+ alloc_if.el_size = ap->dim[ap->rank - 1].size;
+
+ if (tmp_val < pointers_number) {
+ LIBOFFLOAD_ERROR(c_pointer_array_mismatch, "alloc_if");
+ return false;
+ }
+ }
+ else {
+ alloc_if.val = m_vars[i].count;
+ }
+
+ // FREE_IF
+ if ((flags & (1<<flag_free_if_is_array)) != 0) {
+ ap = static_cast<const arr_desc*>(vd3->free_if_array);
+ get_arr_desc_numbers(ap, ap->dim[ap->rank - 1].size, free_if.offset,
+ free_if.size, tmp_val, free_if.ranges);
+ free_if.base = reinterpret_cast<char*>(ap->base);
+ free_if.el_size = ap->dim[ap->rank - 1].size;
+
+ if (tmp_val < pointers_number) {
+ LIBOFFLOAD_ERROR(c_pointer_array_mismatch, "free_if");
+ return false;
+ }
+ }
+ else {
+ free_if.val = m_vars[i].count;
+ }
+
+ // ALIGN
+
+ if ((flags & (1<<flag_align_is_array)) != 0) {
+ ap = static_cast<const arr_desc*>(vd3->align_array);
+ get_arr_desc_numbers(ap, ap->dim[ap->rank - 1].size, align.offset,
+ align.size, tmp_val, align.ranges);
+ align.base = reinterpret_cast<char*>(ap->base);
+ align.el_size = ap->dim[ap->rank - 1].size;
+
+ if (tmp_val < pointers_number) {
+ LIBOFFLOAD_ERROR(c_pointer_array_mismatch, "align");
+ return false;
+ }
+ }
+ else {
+ align.val = m_vars[i].align;
+ }
+
+ // 3.1 INTO
+
+ if (m_vars[i].into) {
+ ap = static_cast<const arr_desc*>(m_vars[i].into);
+ get_arr_desc_numbers(ap, ap->dim[ap->rank - 1].size, into.offset,
+ into.size, tmp_val, into.ranges);
+ into.base = reinterpret_cast<char*>(ap->base);
+
+ if (tmp_val < pointers_number) {
+ LIBOFFLOAD_ERROR(c_pointer_array_mismatch, "into");
+ return false;
+ }
+ }
+
+ // 3.2 INTO_START
+
+ if ((flags & (1<<flag_into_start_is_array)) != 0) {
+ ap = static_cast<const arr_desc*>(vd3->into_start);
+ get_arr_desc_numbers(ap, ap->dim[ap->rank - 1].size, into_start.offset,
+ into_start.size, tmp_val, into_start.ranges);
+ into_start.base = reinterpret_cast<char*>(ap->base);
+ into_start.el_size = ap->dim[ap->rank - 1].size;
+
+ if (tmp_val < pointers_number) {
+ LIBOFFLOAD_ERROR(c_pointer_array_mismatch, "into_extent start");
+ return false;
+ }
+ }
+ else if ((flags & (1<<flag_into_start_is_scalar)) != 0) {
+ into_start.val = (int64_t)vd3->into_start;
+ }
+ else {
+ into_start.val = 0;
+ }
+
+ // 3.3 INTO_ELEMENTS
+
+ if ((flags & (1<<flag_into_elements_is_array)) != 0) {
+ ap = static_cast<const arr_desc*>(vd3->into_elements);
+ get_arr_desc_numbers(ap, ap->dim[ap->rank - 1].size, into_elem.offset,
+ into_elem.size, tmp_val, into_elem.ranges);
+ into_elem.base = reinterpret_cast<char*>(ap->base);
+ into_elem.el_size = ap->dim[ap->rank - 1].size;
+
+ if (tmp_val < pointers_number) {
+ LIBOFFLOAD_ERROR(c_pointer_array_mismatch, "into_extent elements");
+ return false;
+ }
+ }
+ else if ((flags & (1<<flag_into_elements_is_scalar)) != 0) {
+ into_elem.val = (int64_t)vd3->into_elements;
+ }
+ else {
+ into_elem.val = m_vars[i].count;
+ }
+
+ // alloc_start
+
+ if ((flags & (1<<flag_alloc_start_is_array)) != 0) {
+ ap = static_cast<const arr_desc*>(vd3->alloc_start);
+ get_arr_desc_numbers(ap, ap->dim[ap->rank - 1].size,
+ alloc_start.offset, alloc_start.size, tmp_val,
+ alloc_start.ranges);
+ alloc_start.base = reinterpret_cast<char*>(ap->base);
+ alloc_start.el_size = ap->dim[ap->rank - 1].size;
+
+ if (tmp_val < pointers_number) {
+ LIBOFFLOAD_ERROR(c_pointer_array_mismatch, "alloc_extent start");
+ return false;
+ }
+ }
+ else if ((flags & (1<<flag_alloc_start_is_scalar)) != 0) {
+ alloc_start.val = (int64_t)vd3->alloc_start;
+ }
+ else {
+ alloc_start.val = 0;
+ }
+
+ // alloc_elem
+
+ if ((flags & (1<<flag_alloc_elements_is_array)) != 0) {
+ ap = static_cast<const arr_desc*>(vd3->alloc_elements);
+ get_arr_desc_numbers(ap, ap->dim[ap->rank - 1].size, alloc_elem.offset,
+ alloc_elem.size, tmp_val, alloc_elem.ranges);
+ alloc_elem.base = reinterpret_cast<char*>(ap->base);
+ alloc_elem.el_size = ap->dim[ap->rank - 1].size;
+ if (tmp_val < pointers_number) {
+ LIBOFFLOAD_ERROR(c_pointer_array_mismatch,
+ "alloc_extent elements");
+ return false;
+ }
+ }
+ else if ((flags & (1<<flag_alloc_elements_is_scalar)) != 0) {
+ alloc_elem.val = (int64_t)vd3->alloc_elements;
+ }
+ else {
+ alloc_elem.val = 0;
+ }
+
+ for (int k = 0; k < pointers_number; k++) {
+ int type = flags & 0x3f;
+ int type_src, type_dst;
+ // Get new values
+ // type_src, type_dst
+ type_src = type_dst = (type == c_data_ptr_array) ?
+ c_data_ptr : (type == c_func_ptr_array) ?
+ c_func_ptr : (type == c_void_ptr_array) ?
+ c_void_ptr : (type == c_string_ptr_array) ?
+ c_string_ptr : 0;
+
+ // Get ptr val
+ if (!ptr.read_next(true)) {
+ break;
+ }
+ else {
+ ptr.val = (void*)(ptr.base + ptr.offset);
+ }
+
+ // !!! If we got error at phase of reading - it's an internal
+ // !!! error, as we must detect mismatch before
+
+ // Get into val
+ if (m_vars[i].into) {
+ if (!into.read_next(true)) {
+ LIBOFFLOAD_ERROR(c_pointer_array_mismatch, "into");
+ LIBOFFLOAD_ABORT;
+ }
+ else {
+ into.val = (void*)(into.base + into.offset);
+ }
+ }
+
+ // Get other components of the clause
+ if (!ext_start.read_next(flags & (1<<flag_extent_start_is_array))) {
+ LIBOFFLOAD_ERROR(c_pointer_array_mismatch, "extent start");
+ LIBOFFLOAD_ABORT;
+ }
+ if (!ext_elements.read_next(
+ flags & (1<<flag_extent_elements_is_array))) {
+ LIBOFFLOAD_ERROR(c_pointer_array_mismatch, "extent elements");
+ LIBOFFLOAD_ABORT;
+ }
+ if (!alloc_if.read_next(flags & (1<<flag_alloc_if_is_array))) {
+ LIBOFFLOAD_ERROR(c_pointer_array_mismatch, "alloc_if");
+ LIBOFFLOAD_ABORT;
+ }
+ if (!free_if.read_next(flags & (1<<flag_free_if_is_array))) {
+ LIBOFFLOAD_ERROR(c_pointer_array_mismatch, "free_if");
+ LIBOFFLOAD_ABORT;
+ }
+ if (!align.read_next(flags & (1<<flag_align_is_array))) {
+ LIBOFFLOAD_ERROR(c_pointer_array_mismatch, "align");
+ LIBOFFLOAD_ABORT;
+ }
+ if (!into_start.read_next(flags & (1<<flag_into_start_is_array))) {
+ LIBOFFLOAD_ERROR(c_pointer_array_mismatch, "into_extent start");
+ LIBOFFLOAD_ABORT;
+ }
+ if (!into_elem.read_next(flags & (1<<flag_into_elements_is_array))) {
+ LIBOFFLOAD_ERROR(c_pointer_array_mismatch, "into_extent elements");
+ LIBOFFLOAD_ABORT;
+ }
+ if (!alloc_start.read_next(flags & (1<<flag_alloc_start_is_array))) {
+ LIBOFFLOAD_ERROR(c_pointer_array_mismatch, "alloc_extent start");
+ LIBOFFLOAD_ABORT;
+ }
+ if (!alloc_elem.read_next(
+ flags & (1<<flag_alloc_elements_is_array))) {
+ LIBOFFLOAD_ERROR(c_pointer_array_mismatch, "alloc_extent elements");
+ LIBOFFLOAD_ABORT;
+ }
+
+ m_vars[new_index + k].direction.bits = m_vars[i].direction.bits;
+ m_vars[new_index + k].alloc_if = alloc_if.val;
+ m_vars[new_index + k].free_if = free_if.val;
+ m_vars[new_index + k].align = align.val;
+ m_vars[new_index + k].mic_offset = 0;
+ m_vars[new_index + k].flags.bits = m_vars[i].flags.bits;
+ m_vars[new_index + k].offset = 0;
+ m_vars[new_index + k].size = m_vars[i].size;
+
+ if (ext_start.val == 0) {
+ m_vars[new_index + k].count = ext_elements.val;
+ m_vars[new_index + k].ptr = ptr.val;
+ if (type_src == c_string_ptr) {
+ m_vars[new_index + k].size = 0;
+ }
+ }
+ else {
+ m_vars[new_index + k].count = 0;
+ m_vars[new_index + k].ptr =
+ static_cast<void*>(make_arr_desc(
+ ptr.val,
+ ext_start.val,
+ ext_elements.val,
+ m_vars[i].size));
+
+ type_src = type_src == c_data_ptr ? c_cean_var_ptr :
+ c_string_ptr ? c_cean_var_ptr :
+ type_src;
+ if (!m_vars[i].into) {
+ type_dst = type_src;
+ }
+ }
+
+ if (m_vars[i].into && into_elem.val != 0) {
+ m_vars[new_index + k].into =
+ static_cast<void*>(make_arr_desc(
+ into.val,
+ into_start.val,
+ into_elem.val,
+ m_vars[i].size));
+ type_dst = (type == c_data_ptr_array) ? c_cean_var_ptr :
+ (type == c_string_ptr_array) ? c_cean_var_ptr :
+ type_src;
+ }
+ else {
+ m_vars[new_index + k].into = NULL;
+ }
+
+ if (alloc_elem.val != 0) {
+ m_vars[new_index + k].alloc =
+ static_cast<void*>(make_arr_desc(
+ ptr.val,
+ alloc_start.val,
+ alloc_elem.val,
+ m_vars[i].size));
+ }
+ else {
+ m_vars[new_index + k].alloc = NULL;
+ }
+
+ m_vars[new_index + k].type.src = type_src;
+ m_vars[new_index + k].type.dst = type_dst;
+
+ m_vars_extra[new_index + k].is_arr_ptr_el = 1;
+ m_vars_extra[new_index + k].ptr_arr_offset =
+ src_is_for_mic ? ptr.offset : into.offset;
+ }
+ // count and alloc fields are useless at target. They can be reused
+ // for pointer arrays.
+ m_vars[i].count = pointers_number;
+ m_vars[i].ptr_arr_offset = new_index;
+ return true;
+}
+
+static void __offload_fini_library(void)
+{
+ OFFLOAD_DEBUG_TRACE(2, "Cleanup offload library ...\n");
+ if (mic_engines_total > 0) {
+ delete[] mic_engines;
+
+ if (mic_proxy_fs_root != 0) {
+ free(mic_proxy_fs_root);
+ mic_proxy_fs_root = 0;
+ }
+
+ if (mic_library_path != 0) {
+ free(mic_library_path);
+ mic_library_path = 0;
+ }
+
+ // destroy thread key
+ thread_key_delete(mic_thread_key);
+ }
+
+ // unload COI library
+ if (COI::is_available) {
+ COI::fini();
+ }
+
+ OFFLOAD_DEBUG_TRACE(2, "Cleanup offload library ... done\n");
+}
+
+static void __offload_init_library_once(void)
+{
+ COIRESULT res;
+ uint32_t num_devices;
+ std::bitset<MIC_ENGINES_MAX> devices;
+
+ prefix = report_get_message_str(c_report_host);
+
+ // initialize trace
+ const char *env_var = getenv(htrace_envname);
+ if (env_var != 0 && *env_var != '\0') {
+ int64_t new_val;
+ if (__offload_parse_int_string(env_var, new_val)) {
+ console_enabled = new_val & 0x0f;
+ }
+ }
+
+ env_var = getenv(offload_report_envname);
+ if (env_var != 0 && *env_var != '\0') {
+ int64_t env_val;
+ if (__offload_parse_int_string(env_var, env_val)) {
+ if (env_val == OFFLOAD_REPORT_1 ||
+ env_val == OFFLOAD_REPORT_2 ||
+ env_val == OFFLOAD_REPORT_3) {
+ offload_report_level = env_val;
+ }
+ else {
+ LIBOFFLOAD_ERROR(c_invalid_env_report_value,
+ offload_report_envname);
+ }
+ }
+ else {
+ LIBOFFLOAD_ERROR(c_invalid_env_var_int_value,
+ offload_report_envname);
+ }
+ }
+ else if (!offload_report_level) {
+ env_var = getenv(timer_envname);
+ if (env_var != 0 && *env_var != '\0') {
+ timer_enabled = atoi(env_var);
+ }
+ }
+
+ // initialize COI
+ if (!COI::init()) {
+ return;
+ }
+
+ // get number of devices installed in the system
+ res = COI::EngineGetCount(COI_ISA_KNC, &num_devices);
+ if (res != COI_SUCCESS) {
+ return;
+ }
+
+ if (num_devices > MIC_ENGINES_MAX) {
+ num_devices = MIC_ENGINES_MAX;
+ }
+
+ // fill in the list of devices that can be used for offloading
+ env_var = getenv("OFFLOAD_DEVICES");
+ if (env_var != 0) {
+ if (strcasecmp(env_var, "none") != 0) {
+ // value is composed of comma separated physical device indexes
+ char *buf = strdup(env_var);
+ char *str, *ptr;
+ for (str = strtok_r(buf, ",", &ptr); str != 0;
+ str = strtok_r(0, ",", &ptr)) {
+ // convert string to an int
+ int64_t num;
+ if (!__offload_parse_int_string(str, num)) {
+ LIBOFFLOAD_ERROR(c_mic_init5);
+
+ // fallback to using all installed devices
+ devices.reset();
+ for (int i = 0; i < num_devices; i++) {
+ devices.set(i);
+ }
+ break;
+ }
+ if (num < 0 || num >= num_devices) {
+ LIBOFFLOAD_ERROR(c_mic_init6, num);
+ continue;
+ }
+ devices.set(num);
+ }
+ free(buf);
+ }
+ }
+ else {
+ // use all available devices
+ for (int i = 0; i < num_devices; i++) {
+ COIENGINE engine;
+ res = COI::EngineGetHandle(COI_ISA_KNC, i, &engine);
+ if (res == COI_SUCCESS) {
+ devices.set(i);
+ }
+ }
+ }
+
+ mic_engines_total = devices.count();
+
+ // no need to continue if there are no devices to offload to
+ if (mic_engines_total <= 0) {
+ return;
+ }
+
+ // initialize indexes for available devices
+ mic_engines = new Engine[mic_engines_total];
+ for (int p_idx = 0, l_idx = 0; p_idx < num_devices; p_idx++) {
+ if (devices[p_idx]) {
+ mic_engines[l_idx].set_indexes(l_idx, p_idx);
+ l_idx++;
+ }
+ }
+
+ // library search path for device binaries
+ env_var = getenv("MIC_LD_LIBRARY_PATH");
+ if (env_var != 0) {
+ mic_library_path = strdup(env_var);
+ }
+
+ // memory size reserved for COI buffers
+ env_var = getenv("MIC_BUFFERSIZE");
+ if (env_var != 0) {
+ uint64_t new_size;
+ if (__offload_parse_size_string(env_var, new_size)) {
+ mic_buffer_size = new_size;
+ }
+ else {
+ LIBOFFLOAD_ERROR(c_invalid_env_var_value, "MIC_BUFFERSIZE");
+ }
+ }
+
+ // determine stacksize for the pipeline on the device
+ env_var = getenv("MIC_STACKSIZE");
+ if (env_var != 0 && *env_var != '\0') {
+ uint64_t new_size;
+ if (__offload_parse_size_string(env_var, new_size) &&
+ (new_size >= 16384) && ((new_size & 4095) == 0)) {
+ mic_stack_size = new_size;
+ }
+ else {
+ LIBOFFLOAD_ERROR(c_mic_init3);
+ }
+ }
+
+ // proxy I/O
+ env_var = getenv("MIC_PROXY_IO");
+ if (env_var != 0 && *env_var != '\0') {
+ int64_t new_val;
+ if (__offload_parse_int_string(env_var, new_val)) {
+ mic_proxy_io = new_val;
+ }
+ else {
+ LIBOFFLOAD_ERROR(c_invalid_env_var_int_value, "MIC_PROXY_IO");
+ }
+ }
+ env_var = getenv("MIC_PROXY_FS_ROOT");
+ if (env_var != 0 && *env_var != '\0') {
+ mic_proxy_fs_root = strdup(env_var);
+ }
+
+ // Prepare environment for the target process using the following
+ // rules
+ // - If MIC_ENV_PREFIX is set then any environment variable on the
+ // host which has that prefix are copied to the device without
+ // the prefix.
+ // All other host environment variables are ignored.
+ // - If MIC_ENV_PREFIX is not set or if MIC_ENV_PREFIX="" then host
+ // environment is duplicated.
+ env_var = getenv("MIC_ENV_PREFIX");
+ if (env_var != 0 && *env_var != '\0') {
+ mic_env_vars.set_prefix(env_var);
+
+ int len = strlen(env_var);
+ for (int i = 0; environ[i] != 0; i++) {
+ if (strncmp(environ[i], env_var, len) == 0 &&
+ strncmp(environ[i], "MIC_LD_LIBRARY_PATH", 19) != 0 &&
+ environ[i][len] != '=') {
+ mic_env_vars.analyze_env_var(environ[i]);
+ }
+ }
+ }
+
+ // create key for thread data
+ if (thread_key_create(&mic_thread_key, Engine::destroy_thread_data)) {
+ LIBOFFLOAD_ERROR(c_mic_init4, errno);
+ return;
+ }
+
+ // cpu frequency
+ cpu_frequency = COI::PerfGetCycleFrequency();
+
+ env_var = getenv(mic_use_2mb_buffers_envname);
+ if (env_var != 0 && *env_var != '\0') {
+ uint64_t new_size;
+ if (__offload_parse_size_string(env_var, new_size)) {
+ __offload_use_2mb_buffers = new_size;
+ }
+ else {
+ LIBOFFLOAD_ERROR(c_invalid_env_var_value,
+ mic_use_2mb_buffers_envname);
+ }
+ }
+
+ env_var = getenv(mic_use_async_buffer_write_envname);
+ if (env_var != 0 && *env_var != '\0') {
+ uint64_t new_size;
+ if (__offload_parse_size_string(env_var, new_size)) {
+ __offload_use_async_buffer_write = new_size;
+ }
+ }
+
+ env_var = getenv(mic_use_async_buffer_read_envname);
+ if (env_var != 0 && *env_var != '\0') {
+ uint64_t new_size;
+ if (__offload_parse_size_string(env_var, new_size)) {
+ __offload_use_async_buffer_read = new_size;
+ }
+ }
+
+ // mic initialization type
+ env_var = getenv(offload_init_envname);
+ if (env_var != 0 && *env_var != '\0') {
+ if (strcmp(env_var, "on_offload") == 0) {
+ __offload_init_type = c_init_on_offload;
+ }
+ else if (strcmp(env_var, "on_offload_all") == 0) {
+ __offload_init_type = c_init_on_offload_all;
+ }
+#ifndef TARGET_WINNT
+ else if (strcmp(env_var, "on_start") == 0) {
+ __offload_init_type = c_init_on_start;
+ }
+#endif // TARGET_WINNT
+ else {
+ LIBOFFLOAD_ERROR(c_invalid_env_var_value, offload_init_envname);
+ }
+ }
+
+ // active wait
+ env_var = getenv(offload_active_wait_envname);
+ if (env_var != 0 && *env_var != '\0') {
+ int64_t new_val;
+ if (__offload_parse_int_string(env_var, new_val)) {
+ __offload_active_wait = new_val;
+ }
+ else {
+ LIBOFFLOAD_ERROR(c_invalid_env_var_int_value,
+ offload_active_wait_envname);
+ }
+ }
+
+ // omp device num
+ env_var = getenv(omp_device_num_envname);
+ if (env_var != 0 && *env_var != '\0') {
+ int64_t new_val;
+ if (__offload_parse_int_string(env_var, new_val) && new_val >= 0) {
+ __omp_device_num = new_val;
+ }
+ else {
+ LIBOFFLOAD_ERROR(c_omp_invalid_device_num_env,
+ omp_device_num_envname);
+ }
+ }
+
+ // init ORSL
+ ORSL::init();
+}
+
+extern int __offload_init_library(void)
+{
+ // do one time intialization
+ static OffloadOnceControl ctrl = OFFLOAD_ONCE_CONTROL_INIT;
+ __offload_run_once(&ctrl, __offload_init_library_once);
+
+ // offload is available if COI is available and the number of devices > 0
+ bool is_available = COI::is_available && (mic_engines_total > 0);
+
+ // register pending libraries if there are any
+ if (is_available && __target_libs) {
+ mutex_locker_t locker(__target_libs_lock);
+
+ for (TargetImageList::iterator it = __target_libs_list.begin();
+ it != __target_libs_list.end(); it++) {
+ // Register library in COI
+ COI::ProcessRegisterLibraries(1, &it->data, &it->size,
+ &it->origin, &it->offset);
+
+ // add lib to all engines
+ for (int i = 0; i < mic_engines_total; i++) {
+ mic_engines[i].add_lib(*it);
+ }
+ }
+
+ __target_libs = false;
+ __target_libs_list.clear();
+ }
+
+ return is_available;
+}
+
+extern "C" void __offload_register_image(const void *target_image)
+{
+ const struct Image *image = static_cast<const struct Image*>(target_image);
+
+ // decode image
+ const char *name = image->data;
+ const void *data = image->data + strlen(image->data) + 1;
+ uint64_t size = image->size;
+ const char *origin = 0;
+ uint64_t offset = 0;
+
+ // our actions depend on the image type
+ const Elf64_Ehdr *hdr = static_cast<const Elf64_Ehdr*>(data);
+ switch (hdr->e_type) {
+ case ET_EXEC:
+ // Each offload application is supposed to have only one target
+ // image representing target executable.
+ // No thread synchronization is required here as the initialization
+ // code is always executed in a single thread.
+ if (__target_exe != 0) {
+ LIBOFFLOAD_ERROR(c_multiple_target_exes);
+ exit(1);
+ }
+ __target_exe = new TargetImage(name, data, size, origin, offset);
+
+ // Registration code for execs is always called from the context
+ // of main and thus we can safely call any function here,
+ // including LoadLibrary API on windows. This is the place where
+ // we do the offload library initialization.
+ if (__offload_init_library()) {
+ // initialize engine if init_type is on_start
+ if (__offload_init_type == c_init_on_start) {
+ for (int i = 0; i < mic_engines_total; i++) {
+ mic_engines[i].init();
+ }
+ }
+ }
+ break;
+
+ case ET_DYN:
+ // Registration code for libraries is called from the DllMain
+ // context (on windows) and thus we cannot do anything usefull
+ // here. So we just add it to the list of pending libraries for
+ // the later use.
+ __target_libs_lock.lock();
+ __target_libs = true;
+ __target_libs_list.push_back(TargetImage(name, data, size,
+ origin, offset));
+ __target_libs_lock.unlock();
+ break;
+
+ default:
+ // something is definitely wrong, issue an error and exit
+ LIBOFFLOAD_ERROR(c_unknown_binary_type);
+ exit(1);
+ }
+}
+
+extern "C" void __offload_unregister_image(const void *target_image)
+{
+ // Target image is packed as follows:
+ // 8 bytes - size of the target binary
+ // null-terminated string - binary name
+ // <size> bytes - binary contents
+ const struct Image {
+ int64_t size;
+ char data[];
+ } *image = static_cast<const struct Image*>(target_image);
+
+ // decode image
+ const char *name = image->data;
+ const void *data = image->data + strlen(image->data) + 1;
+
+ // our actions depend on the image type
+ const Elf64_Ehdr *hdr = static_cast<const Elf64_Ehdr*>(data);
+ if (hdr->e_type == ET_EXEC) {
+ // We are executing exec's desctructors.
+ // It is time to do a library cleanup.
+ if (timer_enabled) {
+ Offload_Timer_Print();
+ }
+
+#ifdef MYO_SUPPORT
+ __offload_myoFini();
+#endif // MYO_SUPPORT
+
+ __offload_fini_library();
+ }
+}
+
+// Runtime trace interface for user programs
+
+void __offload_console_trace(int level)
+{
+ console_enabled = level;
+}
+
+// User-visible offload API
+
+int _Offload_number_of_devices(void)
+{
+ __offload_init_library();
+ return mic_engines_total;
+}
+
+int _Offload_get_device_number(void)
+{
+ return -1;
+}
+
+int _Offload_get_physical_device_number(void)
+{
+ return -1;
+}
+
+int _Offload_signaled(int index, void *signal)
+{
+ __offload_init_library();
+
+ // check index value
+ if (index < 0 || mic_engines_total <= 0) {
+ LIBOFFLOAD_ERROR(c_offload_signaled1, index);
+ LIBOFFLOAD_ABORT;
+ }
+
+ // find associated async task
+ OffloadDescriptor *task =
+ mic_engines[index % mic_engines_total].find_signal(signal, false);
+ if (task == 0) {
+ LIBOFFLOAD_ERROR(c_offload_signaled2, signal);
+ LIBOFFLOAD_ABORT;
+ }
+
+ return task->is_signaled();
+}
+
+void _Offload_report(int val)
+{
+ if (val == OFFLOAD_REPORT_ON ||
+ val == OFFLOAD_REPORT_OFF) {
+ offload_report_enabled = val;
+ }
+}
+
+// IDB support
+int __dbg_is_attached = 0;
+int __dbg_target_id = -1;
+pid_t __dbg_target_so_pid = -1;
+char __dbg_target_exe_name[MAX_TARGET_NAME] = {0};
+const int __dbg_api_major_version = 1;
+const int __dbg_api_minor_version = 0;
+
+void __dbg_target_so_loaded()
+{
+}
+void __dbg_target_so_unloaded()
+{
+}
diff --git a/liboffloadmic/runtime/offload_host.h b/liboffloadmic/runtime/offload_host.h
new file mode 100644
index 00000000000..2212dec5149
--- /dev/null
+++ b/liboffloadmic/runtime/offload_host.h
@@ -0,0 +1,363 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+/*! \file
+ \brief The parts of the runtime library used only on the host
+*/
+
+#ifndef OFFLOAD_HOST_H_INCLUDED
+#define OFFLOAD_HOST_H_INCLUDED
+
+#ifndef TARGET_WINNT
+#include <unistd.h>
+#endif // TARGET_WINNT
+#include "offload_common.h"
+#include "offload_util.h"
+#include "offload_engine.h"
+#include "offload_env.h"
+#include "offload_orsl.h"
+#include "coi/coi_client.h"
+
+// MIC engines.
+extern Engine* mic_engines;
+extern uint32_t mic_engines_total;
+
+//! The target image is packed as follows.
+/*! 1. 8 bytes containing the size of the target binary */
+/*! 2. a null-terminated string which is the binary name */
+/*! 3. <size> number of bytes that are the contents of the image */
+/*! The address of symbol __offload_target_image
+ is the address of this structure. */
+struct Image {
+ int64_t size; //!< Size in bytes of the target binary name and contents
+ char data[]; //!< The name and contents of the target image
+};
+
+// The offload descriptor.
+class OffloadDescriptor
+{
+public:
+ OffloadDescriptor(
+ int index,
+ _Offload_status *status,
+ bool is_mandatory,
+ bool is_openmp,
+ OffloadHostTimerData * timer_data
+ ) :
+ m_device(mic_engines[index % mic_engines_total]),
+ m_is_mandatory(is_mandatory),
+ m_is_openmp(is_openmp),
+ m_inout_buf(0),
+ m_func_desc(0),
+ m_func_desc_size(0),
+ m_in_deps(0),
+ m_in_deps_total(0),
+ m_out_deps(0),
+ m_out_deps_total(0),
+ m_vars(0),
+ m_vars_extra(0),
+ m_status(status),
+ m_timer_data(timer_data)
+ {}
+
+ ~OffloadDescriptor()
+ {
+ if (m_in_deps != 0) {
+ free(m_in_deps);
+ }
+ if (m_out_deps != 0) {
+ free(m_out_deps);
+ }
+ if (m_func_desc != 0) {
+ free(m_func_desc);
+ }
+ if (m_vars != 0) {
+ free(m_vars);
+ free(m_vars_extra);
+ }
+ }
+
+ bool offload(const char *name, bool is_empty,
+ VarDesc *vars, VarDesc2 *vars2, int vars_total,
+ const void **waits, int num_waits, const void **signal,
+ int entry_id, const void *stack_addr);
+ bool offload_finish();
+
+ bool is_signaled();
+
+ OffloadHostTimerData* get_timer_data() const {
+ return m_timer_data;
+ }
+
+private:
+ bool wait_dependencies(const void **waits, int num_waits);
+ bool setup_descriptors(VarDesc *vars, VarDesc2 *vars2, int vars_total,
+ int entry_id, const void *stack_addr);
+ bool setup_misc_data(const char *name);
+ bool send_pointer_data(bool is_async);
+ bool send_noncontiguous_pointer_data(
+ int i,
+ PtrData* src_buf,
+ PtrData* dst_buf,
+ COIEVENT *event);
+ bool recieve_noncontiguous_pointer_data(
+ int i,
+ char* src_data,
+ COIBUFFER dst_buf,
+ COIEVENT *event);
+
+ bool gather_copyin_data();
+
+ bool compute();
+
+ bool receive_pointer_data(bool is_async);
+ bool scatter_copyout_data();
+
+ void cleanup();
+
+ bool find_ptr_data(PtrData* &ptr_data, void *base, int64_t disp,
+ int64_t length, bool error_does_not_exist = true);
+ bool alloc_ptr_data(PtrData* &ptr_data, void *base, int64_t disp,
+ int64_t length, int64_t alloc_disp, int align);
+ bool init_static_ptr_data(PtrData *ptr_data);
+ bool init_mic_address(PtrData *ptr_data);
+ bool offload_stack_memory_manager(const void * stack_begin, int routine_id,
+ int buf_size, int align, bool *is_new);
+ bool nullify_target_stack(COIBUFFER targ_buf, uint64_t size);
+
+ bool gen_var_descs_for_pointer_array(int i);
+
+ void report_coi_error(error_types msg, COIRESULT res);
+ _Offload_result translate_coi_error(COIRESULT res) const;
+
+private:
+ typedef std::list<COIBUFFER> BufferList;
+
+ // extra data associated with each variable descriptor
+ struct VarExtra {
+ PtrData* src_data;
+ PtrData* dst_data;
+ AutoData* auto_data;
+ int64_t cpu_disp;
+ int64_t cpu_offset;
+ CeanReadRanges *read_rng_src;
+ CeanReadRanges *read_rng_dst;
+ int64_t ptr_arr_offset;
+ bool is_arr_ptr_el;
+ };
+
+ template<typename T> class ReadArrElements {
+ public:
+ ReadArrElements():
+ ranges(NULL),
+ el_size(sizeof(T)),
+ offset(0),
+ count(0),
+ is_empty(true),
+ base(NULL)
+ {}
+
+ bool read_next(bool flag)
+ {
+ if (flag != 0) {
+ if (is_empty) {
+ if (ranges) {
+ if (!get_next_range(ranges, &offset)) {
+ // ranges are over
+ return false;
+ }
+ }
+ // all contiguous elements are over
+ else if (count != 0) {
+ return false;
+ }
+
+ length_cur = size;
+ }
+ else {
+ offset += el_size;
+ }
+ val = (T)get_el_value(base, offset, el_size);
+ length_cur -= el_size;
+ count++;
+ is_empty = length_cur == 0;
+ }
+ return true;
+ }
+ public:
+ CeanReadRanges * ranges;
+ T val;
+ int el_size;
+ int64_t size,
+ offset,
+ length_cur;
+ bool is_empty;
+ int count;
+ char *base;
+ };
+
+ // ptr_data for persistent auto objects
+ PtrData* m_stack_ptr_data;
+ PtrDataList m_destroy_stack;
+
+ // Engine
+ Engine& m_device;
+
+ // if true offload is mandatory
+ bool m_is_mandatory;
+
+ // if true offload has openmp origin
+ const bool m_is_openmp;
+
+ // The Marshaller for the inputs of the offloaded region.
+ Marshaller m_in;
+
+ // The Marshaller for the outputs of the offloaded region.
+ Marshaller m_out;
+
+ // List of buffers that are passed to dispatch call
+ BufferList m_compute_buffers;
+
+ // List of buffers that need to be destroyed at the end of offload
+ BufferList m_destroy_buffers;
+
+ // Variable descriptors
+ VarDesc* m_vars;
+ VarExtra* m_vars_extra;
+ int m_vars_total;
+
+ // Pointer to a user-specified status variable
+ _Offload_status *m_status;
+
+ // Function descriptor
+ FunctionDescriptor* m_func_desc;
+ uint32_t m_func_desc_size;
+
+ // Buffer for transferring copyin/copyout data
+ COIBUFFER m_inout_buf;
+
+ // Dependencies
+ COIEVENT *m_in_deps;
+ uint32_t m_in_deps_total;
+ COIEVENT *m_out_deps;
+ uint32_t m_out_deps_total;
+
+ // Timer data
+ OffloadHostTimerData *m_timer_data;
+
+ // copyin/copyout data length
+ uint64_t m_in_datalen;
+ uint64_t m_out_datalen;
+
+ // a boolean value calculated in setup_descriptors. If true we need to do
+ // a run function on the target. Otherwise it may be optimized away.
+ bool m_need_runfunction;
+};
+
+// Initialization types for MIC
+enum OffloadInitType {
+ c_init_on_start, // all devices before entering main
+ c_init_on_offload, // single device before starting the first offload
+ c_init_on_offload_all // all devices before starting the first offload
+};
+
+// Initializes library and registers specified offload image.
+extern "C" void __offload_register_image(const void* image);
+extern "C" void __offload_unregister_image(const void* image);
+
+// Initializes offload runtime library.
+extern int __offload_init_library(void);
+
+// thread data for associating pipelines with threads
+extern pthread_key_t mic_thread_key;
+
+// Environment variables for devices
+extern MicEnvVar mic_env_vars;
+
+// CPU frequency
+extern uint64_t cpu_frequency;
+
+// LD_LIBRARY_PATH for MIC libraries
+extern char* mic_library_path;
+
+// stack size for target
+extern uint32_t mic_stack_size;
+
+// Preallocated memory size for buffers on MIC
+extern uint64_t mic_buffer_size;
+
+// Setting controlling inout proxy
+extern bool mic_proxy_io;
+extern char* mic_proxy_fs_root;
+
+// Threshold for creating buffers with large pages
+extern uint64_t __offload_use_2mb_buffers;
+
+// offload initialization type
+extern OffloadInitType __offload_init_type;
+
+// Device number to offload to when device is not explicitly specified.
+extern int __omp_device_num;
+
+// target executable
+extern TargetImage* __target_exe;
+
+// IDB support
+
+// Called by the offload runtime after initialization of offload infrastructure
+// has been completed.
+extern "C" void __dbg_target_so_loaded();
+
+// Called by the offload runtime when the offload infrastructure is about to be
+// shut down, currently at application exit.
+extern "C" void __dbg_target_so_unloaded();
+
+// Null-terminated string containing path to the process image of the hosting
+// application (offload_main)
+#define MAX_TARGET_NAME 512
+extern "C" char __dbg_target_exe_name[MAX_TARGET_NAME];
+
+// Integer specifying the process id
+extern "C" pid_t __dbg_target_so_pid;
+
+// Integer specifying the 0-based device number
+extern "C" int __dbg_target_id;
+
+// Set to non-zero by the host-side debugger to enable offload debugging
+// support
+extern "C" int __dbg_is_attached;
+
+// Major version of the debugger support API
+extern "C" const int __dbg_api_major_version;
+
+// Minor version of the debugger support API
+extern "C" const int __dbg_api_minor_version;
+
+#endif // OFFLOAD_HOST_H_INCLUDED
diff --git a/liboffloadmic/runtime/offload_myo_host.cpp b/liboffloadmic/runtime/offload_myo_host.cpp
new file mode 100644
index 00000000000..987d077957a
--- /dev/null
+++ b/liboffloadmic/runtime/offload_myo_host.cpp
@@ -0,0 +1,829 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "offload_myo_host.h"
+#include <errno.h>
+#include <malloc.h>
+#include "offload_host.h"
+
+#if defined(LINUX) || defined(FREEBSD)
+#include <mm_malloc.h>
+#endif
+
+#define MYO_VERSION1 "MYO_1.0"
+
+extern "C" void __cilkrts_cilk_for_32(void*, void*, uint32_t, int32_t);
+extern "C" void __cilkrts_cilk_for_64(void*, void*, uint64_t, int32_t);
+
+#ifndef TARGET_WINNT
+#pragma weak __cilkrts_cilk_for_32
+#pragma weak __cilkrts_cilk_for_64
+#endif // TARGET_WINNT
+
+#ifdef TARGET_WINNT
+#define MYO_TABLE_END_MARKER() reinterpret_cast<const char*>(-1)
+#else // TARGET_WINNT
+#define MYO_TABLE_END_MARKER() reinterpret_cast<const char*>(0)
+#endif // TARGET_WINNT
+
+class MyoWrapper {
+public:
+ MyoWrapper() : m_lib_handle(0), m_is_available(false)
+ {}
+
+ bool is_available() const {
+ return m_is_available;
+ }
+
+ bool LoadLibrary(void);
+
+ // unloads the library
+ void UnloadLibrary(void) {
+// if (m_lib_handle != 0) {
+// DL_close(m_lib_handle);
+// m_lib_handle = 0;
+// }
+ }
+
+ // Wrappers for MYO client functions
+ void LibInit(void *arg, void *func) const {
+ OFFLOAD_DEBUG_TRACE_1(4, 0, c_offload_myoinit,
+ "%s(%p, %p)\n", __func__, arg, func);
+ CheckResult(__func__, m_lib_init(arg, func));
+ }
+
+ void LibFini(void) const {
+ OFFLOAD_DEBUG_TRACE_1(4, 0, c_offload_myofini, "%s()\n", __func__);
+ m_lib_fini();
+ }
+
+ void* SharedMalloc(size_t size) const {
+ OFFLOAD_DEBUG_TRACE_1(4, 0, c_offload_myosharedmalloc,
+ "%s(%lld)\n", __func__, size);
+ return m_shared_malloc(size);
+ }
+
+ void SharedFree(void *ptr) const {
+ OFFLOAD_DEBUG_TRACE_1(4, 0, c_offload_myosharedfree,
+ "%s(%p)\n", __func__, ptr);
+ m_shared_free(ptr);
+ }
+
+ void* SharedAlignedMalloc(size_t size, size_t align) const {
+ OFFLOAD_DEBUG_TRACE_1(4, 0, c_offload_myosharedalignedmalloc,
+ "%s(%lld, %lld)\n", __func__, size, align);
+ return m_shared_aligned_malloc(size, align);
+ }
+
+ void SharedAlignedFree(void *ptr) const {
+ OFFLOAD_DEBUG_TRACE_1(4, 0, c_offload_myosharedalignedfree,
+ "%s(%p)\n", __func__, ptr);
+ m_shared_aligned_free(ptr);
+ }
+
+ void Acquire(void) const {
+ OFFLOAD_DEBUG_TRACE_1(4, 0, c_offload_myoacquire,
+ "%s()\n", __func__);
+ CheckResult(__func__, m_acquire());
+ }
+
+ void Release(void) const {
+ OFFLOAD_DEBUG_TRACE_1(4, 0, c_offload_myorelease,
+ "%s()\n", __func__);
+ CheckResult(__func__, m_release());
+ }
+
+ void HostVarTablePropagate(void *table, int num_entries) const {
+ OFFLOAD_DEBUG_TRACE(4, "%s(%p, %d)\n", __func__, table, num_entries);
+ CheckResult(__func__, m_host_var_table_propagate(table, num_entries));
+ }
+
+ void HostFptrTableRegister(void *table, int num_entries,
+ int ordered) const {
+ OFFLOAD_DEBUG_TRACE_1(4, 0, c_offload_myoregister,
+ "%s(%p, %d, %d)\n", __func__, table,
+ num_entries, ordered);
+ CheckResult(__func__,
+ m_host_fptr_table_register(table, num_entries, ordered));
+ }
+
+ void RemoteThunkCall(void *thunk, void *args, int device) {
+ OFFLOAD_DEBUG_TRACE(4, "%s(%p, %p, %d)\n", __func__, thunk, args,
+ device);
+ CheckResult(__func__, m_remote_thunk_call(thunk, args, device));
+ }
+
+ MyoiRFuncCallHandle RemoteCall(char *func, void *args, int device) const {
+ OFFLOAD_DEBUG_TRACE(4, "%s(%s, %p, %d)\n", __func__, func, args,
+ device);
+ return m_remote_call(func, args, device);
+ }
+
+ void GetResult(MyoiRFuncCallHandle handle) const {
+ OFFLOAD_DEBUG_TRACE(4, "%s(%p)\n", __func__, handle);
+ CheckResult(__func__, m_get_result(handle));
+ }
+
+private:
+ void CheckResult(const char *func, MyoError error) const {
+ if (error != MYO_SUCCESS) {
+ LIBOFFLOAD_ERROR(c_myowrapper_checkresult, func, error);
+ exit(1);
+ }
+ }
+
+private:
+ void* m_lib_handle;
+ bool m_is_available;
+
+ // pointers to functions from myo library
+ MyoError (*m_lib_init)(void*, void*);
+ void (*m_lib_fini)(void);
+ void* (*m_shared_malloc)(size_t);
+ void (*m_shared_free)(void*);
+ void* (*m_shared_aligned_malloc)(size_t, size_t);
+ void (*m_shared_aligned_free)(void*);
+ MyoError (*m_acquire)(void);
+ MyoError (*m_release)(void);
+ MyoError (*m_host_var_table_propagate)(void*, int);
+ MyoError (*m_host_fptr_table_register)(void*, int, int);
+ MyoError (*m_remote_thunk_call)(void*, void*, int);
+ MyoiRFuncCallHandle (*m_remote_call)(char*, void*, int);
+ MyoError (*m_get_result)(MyoiRFuncCallHandle);
+};
+
+bool MyoWrapper::LoadLibrary(void)
+{
+#ifndef TARGET_WINNT
+ const char *lib_name = "libmyo-client.so";
+#else // TARGET_WINNT
+ const char *lib_name = "myo-client.dll";
+#endif // TARGET_WINNT
+
+ OFFLOAD_DEBUG_TRACE(2, "Loading MYO library %s ...\n", lib_name);
+
+ m_lib_handle = DL_open(lib_name);
+ if (m_lib_handle == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to load the library. errno = %d\n",
+ errno);
+ return false;
+ }
+
+ m_lib_init = (MyoError (*)(void*, void*))
+ DL_sym(m_lib_handle, "myoiLibInit", MYO_VERSION1);
+ if (m_lib_init == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in MYO library\n",
+ "myoiLibInit");
+ UnloadLibrary();
+ return false;
+ }
+
+ m_lib_fini = (void (*)(void))
+ DL_sym(m_lib_handle, "myoiLibFini", MYO_VERSION1);
+ if (m_lib_fini == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in MYO library\n",
+ "myoiLibFini");
+ UnloadLibrary();
+ return false;
+ }
+
+ m_shared_malloc = (void* (*)(size_t))
+ DL_sym(m_lib_handle, "myoSharedMalloc", MYO_VERSION1);
+ if (m_shared_malloc == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in MYO library\n",
+ "myoSharedMalloc");
+ UnloadLibrary();
+ return false;
+ }
+
+ m_shared_free = (void (*)(void*))
+ DL_sym(m_lib_handle, "myoSharedFree", MYO_VERSION1);
+ if (m_shared_free == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in MYO library\n",
+ "myoSharedFree");
+ UnloadLibrary();
+ return false;
+ }
+
+ m_shared_aligned_malloc = (void* (*)(size_t, size_t))
+ DL_sym(m_lib_handle, "myoSharedAlignedMalloc", MYO_VERSION1);
+ if (m_shared_aligned_malloc == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in MYO library\n",
+ "myoSharedAlignedMalloc");
+ UnloadLibrary();
+ return false;
+ }
+
+ m_shared_aligned_free = (void (*)(void*))
+ DL_sym(m_lib_handle, "myoSharedAlignedFree", MYO_VERSION1);
+ if (m_shared_aligned_free == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in MYO library\n",
+ "myoSharedAlignedFree");
+ UnloadLibrary();
+ return false;
+ }
+
+ m_acquire = (MyoError (*)(void))
+ DL_sym(m_lib_handle, "myoAcquire", MYO_VERSION1);
+ if (m_acquire == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in MYO library\n",
+ "myoAcquire");
+ UnloadLibrary();
+ return false;
+ }
+
+ m_release = (MyoError (*)(void))
+ DL_sym(m_lib_handle, "myoRelease", MYO_VERSION1);
+ if (m_release == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in MYO library\n",
+ "myoRelease");
+ UnloadLibrary();
+ return false;
+ }
+
+ m_host_var_table_propagate = (MyoError (*)(void*, int))
+ DL_sym(m_lib_handle, "myoiHostVarTablePropagate", MYO_VERSION1);
+ if (m_host_var_table_propagate == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in MYO library\n",
+ "myoiHostVarTablePropagate");
+ UnloadLibrary();
+ return false;
+ }
+
+ m_host_fptr_table_register = (MyoError (*)(void*, int, int))
+ DL_sym(m_lib_handle, "myoiHostFptrTableRegister", MYO_VERSION1);
+ if (m_host_fptr_table_register == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in MYO library\n",
+ "myoiHostFptrTableRegister");
+ UnloadLibrary();
+ return false;
+ }
+
+ m_remote_thunk_call = (MyoError (*)(void*, void*, int))
+ DL_sym(m_lib_handle, "myoiRemoteThunkCall", MYO_VERSION1);
+ if (m_remote_thunk_call == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in MYO library\n",
+ "myoiRemoteThunkCall");
+ UnloadLibrary();
+ return false;
+ }
+
+ m_remote_call = (MyoiRFuncCallHandle (*)(char*, void*, int))
+ DL_sym(m_lib_handle, "myoiRemoteCall", MYO_VERSION1);
+ if (m_remote_call == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in MYO library\n",
+ "myoiRemoteCall");
+ UnloadLibrary();
+ return false;
+ }
+
+ m_get_result = (MyoError (*)(MyoiRFuncCallHandle))
+ DL_sym(m_lib_handle, "myoiGetResult", MYO_VERSION1);
+ if (m_get_result == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in MYO library\n",
+ "myoiGetResult");
+ UnloadLibrary();
+ return false;
+ }
+
+ OFFLOAD_DEBUG_TRACE(2, "The library was successfully loaded\n");
+
+ m_is_available = true;
+
+ return true;
+}
+
+static bool myo_is_available;
+static MyoWrapper myo_wrapper;
+
+struct MyoTable
+{
+ MyoTable(SharedTableEntry *tab, int len) : var_tab(tab), var_tab_len(len)
+ {}
+
+ SharedTableEntry* var_tab;
+ int var_tab_len;
+};
+
+typedef std::list<MyoTable> MyoTableList;
+static MyoTableList __myo_table_list;
+static mutex_t __myo_table_lock;
+static bool __myo_tables = false;
+
+static void __offload_myo_shared_table_register(SharedTableEntry *entry);
+static void __offload_myo_shared_init_table_register(InitTableEntry* entry);
+static void __offload_myo_fptr_table_register(FptrTableEntry *entry);
+
+static void __offload_myoLoadLibrary_once(void)
+{
+ if (__offload_init_library()) {
+ myo_wrapper.LoadLibrary();
+ }
+}
+
+static bool __offload_myoLoadLibrary(void)
+{
+ static OffloadOnceControl ctrl = OFFLOAD_ONCE_CONTROL_INIT;
+ __offload_run_once(&ctrl, __offload_myoLoadLibrary_once);
+
+ return myo_wrapper.is_available();
+}
+
+static void __offload_myoInit_once(void)
+{
+ if (!__offload_myoLoadLibrary()) {
+ return;
+ }
+
+ // initialize all devices
+ for (int i = 0; i < mic_engines_total; i++) {
+ mic_engines[i].init();
+ }
+
+ // load and initialize MYO library
+ OFFLOAD_DEBUG_TRACE(2, "Initializing MYO library ...\n");
+
+ COIEVENT events[MIC_ENGINES_MAX];
+ MyoiUserParams params[MIC_ENGINES_MAX+1];
+
+ // load target library to all devices
+ for (int i = 0; i < mic_engines_total; i++) {
+ mic_engines[i].init_myo(&events[i]);
+
+ params[i].type = MYOI_USERPARAMS_DEVID;
+ params[i].nodeid = mic_engines[i].get_physical_index() + 1;
+ }
+
+ params[mic_engines_total].type = MYOI_USERPARAMS_LAST_MSG;
+
+ // initialize myo runtime on host
+ myo_wrapper.LibInit(params, 0);
+
+ // wait for the target init calls to finish
+ COIRESULT res;
+ res = COI::EventWait(mic_engines_total, events, -1, 1, 0, 0);
+ if (res != COI_SUCCESS) {
+ LIBOFFLOAD_ERROR(c_event_wait, res);
+ exit(1);
+ }
+
+ myo_is_available = true;
+
+ OFFLOAD_DEBUG_TRACE(2, "Initializing MYO library ... done\n");
+}
+
+static bool __offload_myoInit(void)
+{
+ static OffloadOnceControl ctrl = OFFLOAD_ONCE_CONTROL_INIT;
+ __offload_run_once(&ctrl, __offload_myoInit_once);
+
+ // register pending shared var tables
+ if (myo_is_available && __myo_tables) {
+ mutex_locker_t locker(__myo_table_lock);
+
+ if (__myo_tables) {
+ // Register tables with MYO so it can propagate to target.
+ for(MyoTableList::const_iterator it = __myo_table_list.begin();
+ it != __myo_table_list.end(); ++it) {
+#ifdef TARGET_WINNT
+ for (SharedTableEntry *entry = it->var_tab;
+ entry->varName != MYO_TABLE_END_MARKER(); entry++) {
+ if (entry->varName == 0) {
+ continue;
+ }
+ myo_wrapper.HostVarTablePropagate(entry, 1);
+ }
+#else // TARGET_WINNT
+ myo_wrapper.HostVarTablePropagate(it->var_tab,
+ it->var_tab_len);
+#endif // TARGET_WINNT
+ }
+
+ __myo_table_list.clear();
+ __myo_tables = false;
+ }
+ }
+
+ return myo_is_available;
+}
+
+static bool shared_table_entries(
+ SharedTableEntry *entry
+)
+{
+ OFFLOAD_DEBUG_TRACE(3, "%s(%p)\n", __func__, entry);
+
+ for (; entry->varName != MYO_TABLE_END_MARKER(); entry++) {
+#ifdef TARGET_WINNT
+ if (entry->varName == 0) {
+ continue;
+ }
+#endif // TARGET_WINNT
+
+ return true;
+ }
+
+ return false;
+}
+
+static bool fptr_table_entries(
+ FptrTableEntry *entry
+)
+{
+ OFFLOAD_DEBUG_TRACE(3, "%s(%p)\n", __func__, entry);
+
+ for (; entry->funcName != MYO_TABLE_END_MARKER(); entry++) {
+#ifdef TARGET_WINNT
+ if (entry->funcName == 0) {
+ continue;
+ }
+#endif // TARGET_WINNT
+
+ return true;
+ }
+
+ return false;
+}
+
+extern "C" void __offload_myoRegisterTables(
+ InitTableEntry* init_table,
+ SharedTableEntry *shared_table,
+ FptrTableEntry *fptr_table
+)
+{
+ // check whether we need to initialize MYO library. It is
+ // initialized only if at least one myo table is not empty
+ if (shared_table_entries(shared_table) || fptr_table_entries(fptr_table)) {
+ // make sure myo library is loaded
+ __offload_myoLoadLibrary();
+
+ // register tables
+ __offload_myo_shared_table_register(shared_table);
+ __offload_myo_fptr_table_register(fptr_table);
+ __offload_myo_shared_init_table_register(init_table);
+ }
+}
+
+void __offload_myoFini(void)
+{
+ if (myo_is_available) {
+ OFFLOAD_DEBUG_TRACE(3, "%s\n", __func__);
+
+ COIEVENT events[MIC_ENGINES_MAX];
+
+ // kick off myoiLibFini calls on all devices
+ for (int i = 0; i < mic_engines_total; i++) {
+ mic_engines[i].fini_myo(&events[i]);
+ }
+
+ // cleanup myo runtime on host
+ myo_wrapper.LibFini();
+
+ // wait for the target fini calls to finish
+ COIRESULT res;
+ res = COI::EventWait(mic_engines_total, events, -1, 1, 0, 0);
+ if (res != COI_SUCCESS) {
+ LIBOFFLOAD_ERROR(c_event_wait, res);
+ exit(1);
+ }
+ }
+}
+
+static void __offload_myo_shared_table_register(
+ SharedTableEntry *entry
+)
+{
+ OFFLOAD_DEBUG_TRACE(3, "%s(%p)\n", __func__, entry);
+
+ SharedTableEntry *start = entry;
+ int entries = 0;
+
+ // allocate shared memory for vars
+ for (; entry->varName != MYO_TABLE_END_MARKER(); entry++) {
+#ifdef TARGET_WINNT
+ if (entry->varName == 0) {
+ OFFLOAD_DEBUG_TRACE(4, "skip registering a NULL MyoSharedTable entry\n");
+ continue;
+ }
+#endif // TARGET_WINNT
+
+ OFFLOAD_DEBUG_TRACE(4, "registering MyoSharedTable entry for %s @%p\n",
+ entry->varName, entry);
+
+ // Invoke the function to create shared memory
+ reinterpret_cast<void(*)(void)>(entry->sharedAddr)();
+ entries++;
+ }
+
+ // and table to the list if it is not empty
+ if (entries > 0) {
+ mutex_locker_t locker(__myo_table_lock);
+ __myo_table_list.push_back(MyoTable(start, entries));
+ __myo_tables = true;
+ }
+}
+
+static void __offload_myo_shared_init_table_register(InitTableEntry* entry)
+{
+ OFFLOAD_DEBUG_TRACE(3, "%s(%p)\n", __func__, entry);
+
+#ifdef TARGET_WINNT
+ for (; entry->funcName != MYO_TABLE_END_MARKER(); entry++) {
+ if (entry->funcName == 0) {
+ OFFLOAD_DEBUG_TRACE(4, "skip registering a NULL MyoSharedInit entry\n");
+ continue;
+ }
+
+ // Invoke the function to init the shared memory
+ entry->func();
+ }
+#else // TARGET_WINNT
+ for (; entry->func != 0; entry++) {
+ // Invoke the function to init the shared memory
+ entry->func();
+ }
+#endif // TARGET_WINNT
+}
+
+static void __offload_myo_fptr_table_register(
+ FptrTableEntry *entry
+)
+{
+ OFFLOAD_DEBUG_TRACE(3, "%s(%p)\n", __func__, entry);
+
+ FptrTableEntry *start = entry;
+ int entries = 0;
+
+ for (; entry->funcName != MYO_TABLE_END_MARKER(); entry++) {
+#ifdef TARGET_WINNT
+ if (entry->funcName == 0) {
+ OFFLOAD_DEBUG_TRACE(4, "skip registering a NULL MyoFptrTable entry\n");
+ continue;
+ }
+#endif // TARGET_WINNT
+
+ if (!myo_wrapper.is_available()) {
+ *(static_cast<void**>(entry->localThunkAddr)) = entry->funcAddr;
+ }
+
+ OFFLOAD_DEBUG_TRACE(4, "registering MyoFptrTable entry for %s @%p\n",
+ entry->funcName, entry);
+
+#ifdef TARGET_WINNT
+ if (myo_wrapper.is_available()) {
+ myo_wrapper.HostFptrTableRegister(entry, 1, false);
+ }
+#endif // TARGET_WINNT
+
+ entries++;
+ }
+
+#ifndef TARGET_WINNT
+ if (myo_wrapper.is_available() && entries > 0) {
+ myo_wrapper.HostFptrTableRegister(start, entries, false);
+ }
+#endif // TARGET_WINNT
+}
+
+extern "C" int __offload_myoIsAvailable(int target_number)
+{
+ OFFLOAD_DEBUG_TRACE(3, "%s(%d)\n", __func__, target_number);
+
+ if (target_number >= -2) {
+ bool is_default_number = (target_number == -2);
+
+ if (__offload_myoInit()) {
+ if (target_number >= 0) {
+ // User provided the device number
+ int num = target_number % mic_engines_total;
+
+ // reserve device in ORSL
+ target_number = ORSL::reserve(num) ? num : -1;
+ }
+ else {
+ // try to use device 0
+ target_number = ORSL::reserve(0) ? 0 : -1;
+ }
+
+ // make sure device is initialized
+ if (target_number >= 0) {
+ mic_engines[target_number].init();
+ }
+ }
+ else {
+ // fallback to CPU
+ target_number = -1;
+ }
+
+ if (target_number < 0 && !is_default_number) {
+ LIBOFFLOAD_ERROR(c_device_is_not_available);
+ exit(1);
+ }
+ }
+ else {
+ LIBOFFLOAD_ERROR(c_invalid_device_number);
+ exit(1);
+ }
+
+ return target_number;
+}
+
+extern "C" void __offload_myoiRemoteIThunkCall(
+ void *thunk,
+ void *arg,
+ int target_number
+)
+{
+ OFFLOAD_DEBUG_TRACE(3, "%s(%p, %p, %d)\n", __func__, thunk, arg,
+ target_number);
+
+ myo_wrapper.Release();
+ myo_wrapper.RemoteThunkCall(thunk, arg, target_number);
+ myo_wrapper.Acquire();
+
+ ORSL::release(target_number);
+}
+
+extern "C" void* _Offload_shared_malloc(size_t size)
+{
+ OFFLOAD_DEBUG_TRACE(3, "%s(%lld)\n", __func__, size);
+
+ if (__offload_myoLoadLibrary()) {
+ return myo_wrapper.SharedMalloc(size);
+ }
+ else {
+ return malloc(size);
+ }
+}
+
+extern "C" void _Offload_shared_free(void *ptr)
+{
+ OFFLOAD_DEBUG_TRACE(3, "%s(%p)\n", __func__, ptr);
+
+ if (__offload_myoLoadLibrary()) {
+ myo_wrapper.SharedFree(ptr);
+ }
+ else {
+ free(ptr);
+ }
+}
+
+extern "C" void* _Offload_shared_aligned_malloc(size_t size, size_t align)
+{
+ OFFLOAD_DEBUG_TRACE(3, "%s(%lld, %lld)\n", __func__, size, align);
+
+ if (__offload_myoLoadLibrary()) {
+ return myo_wrapper.SharedAlignedMalloc(size, align);
+ }
+ else {
+ if (align < sizeof(void*)) {
+ align = sizeof(void*);
+ }
+ return _mm_malloc(size, align);
+ }
+}
+
+extern "C" void _Offload_shared_aligned_free(void *ptr)
+{
+ OFFLOAD_DEBUG_TRACE(3, "%s(%p)\n", __func__, ptr);
+
+ if (__offload_myoLoadLibrary()) {
+ myo_wrapper.SharedAlignedFree(ptr);
+ }
+ else {
+ _mm_free(ptr);
+ }
+}
+
+extern "C" void __intel_cilk_for_32_offload(
+ int size,
+ void (*copy_constructor)(void*, void*),
+ int target_number,
+ void *raddr,
+ void *closure_object,
+ unsigned int iters,
+ unsigned int grain_size)
+{
+ OFFLOAD_DEBUG_TRACE(3, "%s\n", __func__);
+
+ target_number = __offload_myoIsAvailable(target_number);
+ if (target_number >= 0) {
+ struct S {
+ void *M1;
+ unsigned int M2;
+ unsigned int M3;
+ char closure[];
+ } *args;
+
+ args = (struct S*) _Offload_shared_malloc(sizeof(struct S) + size);
+ if (args == NULL)
+ LIBOFFLOAD_ERROR(c_malloc);
+ args->M1 = raddr;
+ args->M2 = iters;
+ args->M3 = grain_size;
+
+ if (copy_constructor == 0) {
+ memcpy(args->closure, closure_object, size);
+ }
+ else {
+ copy_constructor(args->closure, closure_object);
+ }
+
+ myo_wrapper.Release();
+ myo_wrapper.GetResult(
+ myo_wrapper.RemoteCall("__intel_cilk_for_32_offload",
+ args, target_number)
+ );
+ myo_wrapper.Acquire();
+
+ _Offload_shared_free(args);
+
+ ORSL::release(target_number);
+ }
+ else {
+ __cilkrts_cilk_for_32(raddr,
+ closure_object,
+ iters,
+ grain_size);
+ }
+}
+
+extern "C" void __intel_cilk_for_64_offload(
+ int size,
+ void (*copy_constructor)(void*, void*),
+ int target_number,
+ void *raddr,
+ void *closure_object,
+ uint64_t iters,
+ uint64_t grain_size)
+{
+ OFFLOAD_DEBUG_TRACE(3, "%s\n", __func__);
+
+ target_number = __offload_myoIsAvailable(target_number);
+ if (target_number >= 0) {
+ struct S {
+ void *M1;
+ uint64_t M2;
+ uint64_t M3;
+ char closure[];
+ } *args;
+
+ args = (struct S*) _Offload_shared_malloc(sizeof(struct S) + size);
+ if (args == NULL)
+ LIBOFFLOAD_ERROR(c_malloc);
+ args->M1 = raddr;
+ args->M2 = iters;
+ args->M3 = grain_size;
+
+ if (copy_constructor == 0) {
+ memcpy(args->closure, closure_object, size);
+ }
+ else {
+ copy_constructor(args->closure, closure_object);
+ }
+
+ myo_wrapper.Release();
+ myo_wrapper.GetResult(
+ myo_wrapper.RemoteCall("__intel_cilk_for_64_offload", args,
+ target_number)
+ );
+ myo_wrapper.Acquire();
+
+ _Offload_shared_free(args);
+
+ ORSL::release(target_number);
+ }
+ else {
+ __cilkrts_cilk_for_64(raddr,
+ closure_object,
+ iters,
+ grain_size);
+ }
+}
diff --git a/liboffloadmic/runtime/offload_myo_host.h b/liboffloadmic/runtime/offload_myo_host.h
new file mode 100644
index 00000000000..1116ee3601e
--- /dev/null
+++ b/liboffloadmic/runtime/offload_myo_host.h
@@ -0,0 +1,100 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#ifndef OFFLOAD_MYO_HOST_H_INCLUDED
+#define OFFLOAD_MYO_HOST_H_INCLUDED
+
+#include <myotypes.h>
+#include <myoimpl.h>
+#include <myo.h>
+#include "offload.h"
+
+typedef MyoiSharedVarEntry SharedTableEntry;
+//typedef MyoiHostSharedFptrEntry FptrTableEntry;
+typedef struct {
+ //! Function Name
+ const char *funcName;
+ //! Function Address
+ void *funcAddr;
+ //! Local Thunk Address
+ void *localThunkAddr;
+#ifdef TARGET_WINNT
+ // Dummy to pad up to 32 bytes
+ void *dummy;
+#endif // TARGET_WINNT
+} FptrTableEntry;
+
+struct InitTableEntry {
+#ifdef TARGET_WINNT
+ // Dummy to pad up to 16 bytes
+ // Function Name
+ const char *funcName;
+#endif // TARGET_WINNT
+ void (*func)(void);
+};
+
+#ifdef TARGET_WINNT
+#define OFFLOAD_MYO_SHARED_TABLE_SECTION_START ".MyoSharedTable$a"
+#define OFFLOAD_MYO_SHARED_TABLE_SECTION_END ".MyoSharedTable$z"
+
+#define OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_START ".MyoSharedInitTable$a"
+#define OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_END ".MyoSharedInitTable$z"
+
+#define OFFLOAD_MYO_FPTR_TABLE_SECTION_START ".MyoFptrTable$a"
+#define OFFLOAD_MYO_FPTR_TABLE_SECTION_END ".MyoFptrTable$z"
+#else // TARGET_WINNT
+#define OFFLOAD_MYO_SHARED_TABLE_SECTION_START ".MyoSharedTable."
+#define OFFLOAD_MYO_SHARED_TABLE_SECTION_END ".MyoSharedTable."
+
+#define OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_START ".MyoSharedInitTable."
+#define OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_END ".MyoSharedInitTable."
+
+#define OFFLOAD_MYO_FPTR_TABLE_SECTION_START ".MyoFptrTable."
+#define OFFLOAD_MYO_FPTR_TABLE_SECTION_END ".MyoFptrTable."
+#endif // TARGET_WINNT
+
+#pragma section(OFFLOAD_MYO_SHARED_TABLE_SECTION_START, read, write)
+#pragma section(OFFLOAD_MYO_SHARED_TABLE_SECTION_END, read, write)
+
+#pragma section(OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_START, read, write)
+#pragma section(OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_END, read, write)
+
+#pragma section(OFFLOAD_MYO_FPTR_TABLE_SECTION_START, read, write)
+#pragma section(OFFLOAD_MYO_FPTR_TABLE_SECTION_END, read, write)
+
+extern "C" void __offload_myoRegisterTables(
+ InitTableEntry *init_table,
+ SharedTableEntry *shared_table,
+ FptrTableEntry *fptr_table
+);
+
+extern void __offload_myoFini(void);
+
+#endif // OFFLOAD_MYO_HOST_H_INCLUDED
diff --git a/liboffloadmic/runtime/offload_myo_target.cpp b/liboffloadmic/runtime/offload_myo_target.cpp
new file mode 100644
index 00000000000..bd5ad17adbc
--- /dev/null
+++ b/liboffloadmic/runtime/offload_myo_target.cpp
@@ -0,0 +1,204 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "offload_myo_target.h"
+#include "offload_target.h"
+
+extern "C" void __cilkrts_cilk_for_32(void*, void*, uint32_t, int32_t);
+extern "C" void __cilkrts_cilk_for_64(void*, void*, uint64_t, int32_t);
+
+#pragma weak __cilkrts_cilk_for_32
+#pragma weak __cilkrts_cilk_for_64
+
+static void CheckResult(const char *func, MyoError error) {
+ if (error != MYO_SUCCESS) {
+ LIBOFFLOAD_ERROR(c_myotarget_checkresult, func, error);
+ exit(1);
+ }
+}
+
+static void __offload_myo_shared_table_register(SharedTableEntry *entry)
+{
+ int entries = 0;
+ SharedTableEntry *t_start;
+
+ OFFLOAD_DEBUG_TRACE(3, "%s(%p)\n", __func__, entry);
+
+ t_start = entry;
+ while (t_start->varName != 0) {
+ OFFLOAD_DEBUG_TRACE_1(4, 0, c_offload_mic_myo_shared,
+ "myo shared entry name = \"%s\" addr = %p\n",
+ t_start->varName, t_start->sharedAddr);
+ t_start++;
+ entries++;
+ }
+
+ if (entries > 0) {
+ OFFLOAD_DEBUG_TRACE(3, "myoiMicVarTableRegister(%p, %d)\n", entry,
+ entries);
+ CheckResult("myoiMicVarTableRegister",
+ myoiMicVarTableRegister(entry, entries));
+ }
+}
+
+static void __offload_myo_fptr_table_register(
+ FptrTableEntry *entry
+)
+{
+ int entries = 0;
+ FptrTableEntry *t_start;
+
+ OFFLOAD_DEBUG_TRACE(3, "%s(%p)\n", __func__, entry);
+
+ t_start = entry;
+ while (t_start->funcName != 0) {
+ OFFLOAD_DEBUG_TRACE_1(4, 0, c_offload_mic_myo_fptr,
+ "myo fptr entry name = \"%s\" addr = %p\n",
+ t_start->funcName, t_start->funcAddr);
+ t_start++;
+ entries++;
+ }
+
+ if (entries > 0) {
+ OFFLOAD_DEBUG_TRACE(3, "myoiTargetFptrTableRegister(%p, %d, 0)\n",
+ entry, entries);
+ CheckResult("myoiTargetFptrTableRegister",
+ myoiTargetFptrTableRegister(entry, entries, 0));
+ }
+}
+
+extern "C" void __offload_myoAcquire(void)
+{
+ OFFLOAD_DEBUG_TRACE(3, "%s\n", __func__);
+ CheckResult("myoAcquire", myoAcquire());
+}
+
+extern "C" void __offload_myoRelease(void)
+{
+ OFFLOAD_DEBUG_TRACE(3, "%s\n", __func__);
+ CheckResult("myoRelease", myoRelease());
+}
+
+extern "C" void __intel_cilk_for_32_offload_wrapper(void *args_)
+{
+ OFFLOAD_DEBUG_TRACE(3, "%s\n", __func__);
+
+ struct S {
+ void *M1;
+ unsigned int M2;
+ unsigned int M3;
+ char closure[];
+ } *args = (struct S*) args_;
+
+ __cilkrts_cilk_for_32(args->M1, args->closure, args->M2, args->M3);
+}
+
+extern "C" void __intel_cilk_for_64_offload_wrapper(void *args_)
+{
+ OFFLOAD_DEBUG_TRACE(3, "%s\n", __func__);
+
+ struct S {
+ void *M1;
+ uint64_t M2;
+ uint64_t M3;
+ char closure[];
+ } *args = (struct S*) args_;
+
+ __cilkrts_cilk_for_64(args->M1, args->closure, args->M2, args->M3);
+}
+
+static void __offload_myo_once_init(void)
+{
+ CheckResult("myoiRemoteFuncRegister",
+ myoiRemoteFuncRegister(
+ (MyoiRemoteFuncType) __intel_cilk_for_32_offload_wrapper,
+ "__intel_cilk_for_32_offload"));
+ CheckResult("myoiRemoteFuncRegister",
+ myoiRemoteFuncRegister(
+ (MyoiRemoteFuncType) __intel_cilk_for_64_offload_wrapper,
+ "__intel_cilk_for_64_offload"));
+}
+
+extern "C" void __offload_myoRegisterTables(
+ SharedTableEntry *shared_table,
+ FptrTableEntry *fptr_table
+)
+{
+ OFFLOAD_DEBUG_TRACE(3, "%s\n", __func__);
+
+ // one time registration of Intel(R) Cilk(TM) language entries
+ static pthread_once_t once_control = PTHREAD_ONCE_INIT;
+ pthread_once(&once_control, __offload_myo_once_init);
+
+ // register module's tables
+ if (shared_table->varName == 0 && fptr_table->funcName == 0) {
+ return;
+ }
+
+ __offload_myo_shared_table_register(shared_table);
+ __offload_myo_fptr_table_register(fptr_table);
+}
+
+extern "C" void* _Offload_shared_malloc(size_t size)
+{
+ OFFLOAD_DEBUG_TRACE(3, "%s(%lld)\n", __func__, size);
+ return myoSharedMalloc(size);
+}
+
+extern "C" void _Offload_shared_free(void *ptr)
+{
+ OFFLOAD_DEBUG_TRACE(3, "%s(%p)\n", __func__, ptr);
+ myoSharedFree(ptr);
+}
+
+extern "C" void* _Offload_shared_aligned_malloc(size_t size, size_t align)
+{
+ OFFLOAD_DEBUG_TRACE(3, "%s(%lld, %lld)\n", __func__, size, align);
+ return myoSharedAlignedMalloc(size, align);
+}
+
+extern "C" void _Offload_shared_aligned_free(void *ptr)
+{
+ OFFLOAD_DEBUG_TRACE(3, "%s(%p)\n", __func__, ptr);
+ myoSharedAlignedFree(ptr);
+}
+
+// temporary workaround for blocking behavior of myoiLibInit/Fini calls
+extern "C" void __offload_myoLibInit()
+{
+ OFFLOAD_DEBUG_TRACE(3, "%s()\n", __func__);
+ CheckResult("myoiLibInit", myoiLibInit(0, 0));
+}
+
+extern "C" void __offload_myoLibFini()
+{
+ OFFLOAD_DEBUG_TRACE(3, "%s()\n", __func__);
+ myoiLibFini();
+}
diff --git a/liboffloadmic/runtime/offload_myo_target.h b/liboffloadmic/runtime/offload_myo_target.h
new file mode 100644
index 00000000000..777a3da1aca
--- /dev/null
+++ b/liboffloadmic/runtime/offload_myo_target.h
@@ -0,0 +1,74 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#ifndef OFFLOAD_MYO_TARGET_H_INCLUDED
+#define OFFLOAD_MYO_TARGET_H_INCLUDED
+
+#include <myotypes.h>
+#include <myoimpl.h>
+#include <myo.h>
+#include "offload.h"
+
+typedef MyoiSharedVarEntry SharedTableEntry;
+typedef MyoiTargetSharedFptrEntry FptrTableEntry;
+
+#ifdef TARGET_WINNT
+#define OFFLOAD_MYO_SHARED_TABLE_SECTION_START ".MyoSharedTable$a"
+#define OFFLOAD_MYO_SHARED_TABLE_SECTION_END ".MyoSharedTable$z"
+
+#define OFFLOAD_MYO_FPTR_TABLE_SECTION_START ".MyoFptrTable$a"
+#define OFFLOAD_MYO_FPTR_TABLE_SECTION_END ".MyoFptrTable$z"
+#else // TARGET_WINNT
+#define OFFLOAD_MYO_SHARED_TABLE_SECTION_START ".MyoSharedTable."
+#define OFFLOAD_MYO_SHARED_TABLE_SECTION_END ".MyoSharedTable."
+
+#define OFFLOAD_MYO_FPTR_TABLE_SECTION_START ".MyoFptrTable."
+#define OFFLOAD_MYO_FPTR_TABLE_SECTION_END ".MyoFptrTable."
+#endif // TARGET_WINNT
+
+#pragma section(OFFLOAD_MYO_SHARED_TABLE_SECTION_START, read, write)
+#pragma section(OFFLOAD_MYO_SHARED_TABLE_SECTION_END, read, write)
+
+#pragma section(OFFLOAD_MYO_FPTR_TABLE_SECTION_START, read, write)
+#pragma section(OFFLOAD_MYO_FPTR_TABLE_SECTION_END, read, write)
+
+extern "C" void __offload_myoRegisterTables(
+ SharedTableEntry *shared_table,
+ FptrTableEntry *fptr_table
+);
+
+extern "C" void __offload_myoAcquire(void);
+extern "C" void __offload_myoRelease(void);
+
+// temporary workaround for blocking behavior for myoiLibInit/Fini calls
+extern "C" void __offload_myoLibInit();
+extern "C" void __offload_myoLibFini();
+
+#endif // OFFLOAD_MYO_TARGET_H_INCLUDED
diff --git a/liboffloadmic/runtime/offload_omp_host.cpp b/liboffloadmic/runtime/offload_omp_host.cpp
new file mode 100644
index 00000000000..ceba612ac3b
--- /dev/null
+++ b/liboffloadmic/runtime/offload_omp_host.cpp
@@ -0,0 +1,485 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include <omp.h>
+#include "offload.h"
+#include "compiler_if_host.h"
+
+// OpenMP API
+
+void omp_set_default_device(int num) __GOMP_NOTHROW
+{
+ if (num >= 0) {
+ __omp_device_num = num;
+ }
+}
+
+int omp_get_default_device(void) __GOMP_NOTHROW
+{
+ return __omp_device_num;
+}
+
+int omp_get_num_devices() __GOMP_NOTHROW
+{
+ __offload_init_library();
+ return mic_engines_total;
+}
+
+// OpenMP API wrappers
+
+static void omp_set_int_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ int setting,
+ const char* f_name
+)
+{
+ OFFLOAD ofld = OFFLOAD_TARGET_ACQUIRE(target_type, target_number, 0, NULL,
+ f_name, 0);
+ if (ofld) {
+ VarDesc vars[1] = {0};
+
+ vars[0].type.src = c_data;
+ vars[0].type.dst = c_data;
+ vars[0].direction.bits = c_parameter_in;
+ vars[0].size = sizeof(int);
+ vars[0].count = 1;
+ vars[0].ptr = &setting;
+
+ OFFLOAD_OFFLOAD(ofld, f_name, 0, 1, vars, NULL, 0, 0, 0);
+ }
+}
+
+static int omp_get_int_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ const char * f_name
+)
+{
+ int setting = 0;
+
+ OFFLOAD ofld = OFFLOAD_TARGET_ACQUIRE(target_type, target_number, 0, NULL,
+ f_name, 0);
+ if (ofld) {
+ VarDesc vars[1] = {0};
+
+ vars[0].type.src = c_data;
+ vars[0].type.dst = c_data;
+ vars[0].direction.bits = c_parameter_out;
+ vars[0].size = sizeof(int);
+ vars[0].count = 1;
+ vars[0].ptr = &setting;
+
+ OFFLOAD_OFFLOAD(ofld, f_name, 0, 1, vars, NULL, 0, 0, 0);
+ }
+ return setting;
+}
+
+void omp_set_num_threads_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ int num_threads
+)
+{
+ omp_set_int_target(target_type, target_number, num_threads,
+ "omp_set_num_threads_target");
+}
+
+int omp_get_max_threads_target(
+ TARGET_TYPE target_type,
+ int target_number
+)
+{
+ return omp_get_int_target(target_type, target_number,
+ "omp_get_max_threads_target");
+}
+
+int omp_get_num_procs_target(
+ TARGET_TYPE target_type,
+ int target_number
+)
+{
+ return omp_get_int_target(target_type, target_number,
+ "omp_get_num_procs_target");
+}
+
+void omp_set_dynamic_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ int num_threads
+)
+{
+ omp_set_int_target(target_type, target_number, num_threads,
+ "omp_set_dynamic_target");
+}
+
+int omp_get_dynamic_target(
+ TARGET_TYPE target_type,
+ int target_number
+)
+{
+ return omp_get_int_target(target_type, target_number,
+ "omp_get_dynamic_target");
+}
+
+void omp_set_nested_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ int nested
+)
+{
+ omp_set_int_target(target_type, target_number, nested,
+ "omp_set_nested_target");
+}
+
+int omp_get_nested_target(
+ TARGET_TYPE target_type,
+ int target_number
+)
+{
+ return omp_get_int_target(target_type, target_number,
+ "omp_get_nested_target");
+}
+
+void omp_set_schedule_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_sched_t kind,
+ int modifier
+)
+{
+ OFFLOAD ofld = OFFLOAD_TARGET_ACQUIRE(target_type, target_number, 0, NULL,
+ __func__, 0);
+ if (ofld != 0) {
+ VarDesc vars[2] = {0};
+
+ vars[0].type.src = c_data;
+ vars[0].type.dst = c_data;
+ vars[0].direction.bits = c_parameter_in;
+ vars[0].size = sizeof(omp_sched_t);
+ vars[0].count = 1;
+ vars[0].ptr = &kind;
+
+ vars[1].type.src = c_data;
+ vars[1].type.dst = c_data;
+ vars[1].direction.bits = c_parameter_in;
+ vars[1].size = sizeof(int);
+ vars[1].count = 1;
+ vars[1].ptr = &modifier;
+
+ OFFLOAD_OFFLOAD(ofld, "omp_set_schedule_target",
+ 0, 2, vars, NULL, 0, 0, 0);
+ }
+}
+
+void omp_get_schedule_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_sched_t *kind,
+ int *modifier
+)
+{
+ OFFLOAD ofld = OFFLOAD_TARGET_ACQUIRE(target_type, target_number, 0, NULL,
+ __func__, 0);
+ if (ofld != 0) {
+ VarDesc vars[2] = {0};
+
+ vars[0].type.src = c_data;
+ vars[0].type.dst = c_data;
+ vars[0].direction.bits = c_parameter_out;
+ vars[0].size = sizeof(omp_sched_t);
+ vars[0].count = 1;
+ vars[0].ptr = kind;
+
+ vars[1].type.src = c_data;
+ vars[1].type.dst = c_data;
+ vars[1].direction.bits = c_parameter_out;
+ vars[1].size = sizeof(int);
+ vars[1].count = 1;
+ vars[1].ptr = modifier;
+
+ OFFLOAD_OFFLOAD(ofld, "omp_get_schedule_target",
+ 0, 2, vars, NULL, 0, 0, 0);
+ }
+}
+
+// lock API functions
+
+void omp_init_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_lock_target_t *lock
+)
+{
+ OFFLOAD ofld = OFFLOAD_TARGET_ACQUIRE(target_type, target_number, 0, NULL,
+ __func__, 0);
+ if (ofld != 0) {
+ VarDesc vars[1] = {0};
+
+ vars[0].type.src = c_data;
+ vars[0].type.dst = c_data;
+ vars[0].direction.bits = c_parameter_out;
+ vars[0].size = sizeof(omp_lock_target_t);
+ vars[0].count = 1;
+ vars[0].ptr = lock;
+
+ OFFLOAD_OFFLOAD(ofld, "omp_init_lock_target",
+ 0, 1, vars, NULL, 0, 0, 0);
+ }
+}
+
+void omp_destroy_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_lock_target_t *lock
+)
+{
+ OFFLOAD ofld = OFFLOAD_TARGET_ACQUIRE(target_type, target_number, 0, NULL,
+ __func__, 0);
+ if (ofld != 0) {
+ VarDesc vars[1] = {0};
+
+ vars[0].type.src = c_data;
+ vars[0].type.dst = c_data;
+ vars[0].direction.bits = c_parameter_in;
+ vars[0].size = sizeof(omp_lock_target_t);
+ vars[0].count = 1;
+ vars[0].ptr = lock;
+
+ OFFLOAD_OFFLOAD(ofld, "omp_destroy_lock_target",
+ 0, 1, vars, NULL, 0, 0, 0);
+ }
+}
+
+void omp_set_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_lock_target_t *lock
+)
+{
+ OFFLOAD ofld = OFFLOAD_TARGET_ACQUIRE(target_type, target_number, 0, NULL,
+ __func__, 0);
+ if (ofld != 0) {
+ VarDesc vars[1] = {0};
+
+ vars[0].type.src = c_data;
+ vars[0].type.dst = c_data;
+ vars[0].direction.bits = c_parameter_inout;
+ vars[0].size = sizeof(omp_lock_target_t);
+ vars[0].count = 1;
+ vars[0].ptr = lock;
+
+ OFFLOAD_OFFLOAD(ofld, "omp_set_lock_target",
+ 0, 1, vars, NULL, 0, 0, 0);
+ }
+}
+
+void omp_unset_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_lock_target_t *lock
+)
+{
+ OFFLOAD ofld = OFFLOAD_TARGET_ACQUIRE(target_type, target_number, 0, NULL,
+ __func__, 0);
+ if (ofld != 0) {
+ VarDesc vars[1] = {0};
+
+ vars[0].type.src = c_data;
+ vars[0].type.dst = c_data;
+ vars[0].direction.bits = c_parameter_inout;
+ vars[0].size = sizeof(omp_lock_target_t);
+ vars[0].count = 1;
+ vars[0].ptr = lock;
+
+ OFFLOAD_OFFLOAD(ofld, "omp_unset_lock_target",
+ 0, 1, vars, NULL, 0, 0, 0);
+ }
+}
+
+int omp_test_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_lock_target_t *lock
+)
+{
+ int result = 0;
+
+ OFFLOAD ofld = OFFLOAD_TARGET_ACQUIRE(target_type, target_number, 0, NULL,
+ __func__, 0);
+ if (ofld != 0) {
+ VarDesc vars[2] = {0};
+
+ vars[0].type.src = c_data;
+ vars[0].type.dst = c_data;
+ vars[0].direction.bits = c_parameter_inout;
+ vars[0].size = sizeof(omp_lock_target_t);
+ vars[0].count = 1;
+ vars[0].ptr = lock;
+
+ vars[1].type.src = c_data;
+ vars[1].type.dst = c_data;
+ vars[1].direction.bits = c_parameter_out;
+ vars[1].size = sizeof(int);
+ vars[1].count = 1;
+ vars[1].ptr = &result;
+
+ OFFLOAD_OFFLOAD(ofld, "omp_test_lock_target",
+ 0, 2, vars, NULL, 0, 0, 0);
+ }
+ return result;
+}
+
+// nested lock API functions
+
+void omp_init_nest_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_nest_lock_target_t *lock
+)
+{
+ OFFLOAD ofld = OFFLOAD_TARGET_ACQUIRE(target_type, target_number, 0, NULL,
+ __func__, 0);
+ if (ofld != 0) {
+ VarDesc vars[1] = {0};
+
+ vars[0].type.src = c_data;
+ vars[0].type.dst = c_data;
+ vars[0].direction.bits = c_parameter_out;
+ vars[0].size = sizeof(omp_nest_lock_target_t);
+ vars[0].count = 1;
+ vars[0].ptr = lock;
+
+ OFFLOAD_OFFLOAD(ofld, "omp_init_nest_lock_target",
+ 0, 1, vars, NULL, 0, 0, 0);
+ }
+}
+
+void omp_destroy_nest_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_nest_lock_target_t *lock
+)
+{
+ OFFLOAD ofld = OFFLOAD_TARGET_ACQUIRE(target_type, target_number, 0, NULL,
+ __func__, 0);
+ if (ofld != 0) {
+ VarDesc vars[1] = {0};
+
+ vars[0].type.src = c_data;
+ vars[0].type.dst = c_data;
+ vars[0].direction.bits = c_parameter_in;
+ vars[0].size = sizeof(omp_nest_lock_target_t);
+ vars[0].count = 1;
+ vars[0].ptr = lock;
+
+ OFFLOAD_OFFLOAD(ofld, "omp_destroy_nest_lock_target",
+ 0, 1, vars, NULL, 0, 0, 0);
+ }
+}
+
+void omp_set_nest_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_nest_lock_target_t *lock
+)
+{
+ OFFLOAD ofld = OFFLOAD_TARGET_ACQUIRE(target_type, target_number, 0, NULL,
+ __func__, 0);
+ if (ofld != 0) {
+ VarDesc vars[1] = {0};
+
+ vars[0].type.src = c_data;
+ vars[0].type.dst = c_data;
+ vars[0].direction.bits = c_parameter_inout;
+ vars[0].size = sizeof(omp_nest_lock_target_t);
+ vars[0].count = 1;
+ vars[0].ptr = lock;
+
+ OFFLOAD_OFFLOAD(ofld, "omp_set_nest_lock_target",
+ 0, 1, vars, NULL, 0, 0, 0);
+ }
+}
+
+void omp_unset_nest_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_nest_lock_target_t *lock
+)
+{
+ OFFLOAD ofld = OFFLOAD_TARGET_ACQUIRE(target_type, target_number, 0, NULL,
+ __func__, 0);
+ if (ofld != 0) {
+ VarDesc vars[1] = {0};
+
+ vars[0].type.src = c_data;
+ vars[0].type.dst = c_data;
+ vars[0].direction.bits = c_parameter_inout;
+ vars[0].size = sizeof(omp_nest_lock_target_t);
+ vars[0].count = 1;
+ vars[0].ptr = lock;
+
+ OFFLOAD_OFFLOAD(ofld, "omp_unset_nest_lock_target",
+ 0, 1, vars, NULL, 0, 0, 0);
+ }
+}
+
+int omp_test_nest_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_nest_lock_target_t *lock
+)
+{
+ int result = 0;
+
+ OFFLOAD ofld = OFFLOAD_TARGET_ACQUIRE(target_type, target_number, 0, NULL,
+ __func__, 0);
+ if (ofld != 0) {
+ VarDesc vars[2] = {0};
+
+ vars[0].type.src = c_data;
+ vars[0].type.dst = c_data;
+ vars[0].direction.bits = c_parameter_inout;
+ vars[0].size = sizeof(omp_nest_lock_target_t);
+ vars[0].count = 1;
+ vars[0].ptr = lock;
+
+ vars[1].type.src = c_data;
+ vars[1].type.dst = c_data;
+ vars[1].direction.bits = c_parameter_out;
+ vars[1].size = sizeof(int);
+ vars[1].count = 1;
+ vars[1].ptr = &result;
+
+ OFFLOAD_OFFLOAD(ofld, "omp_test_nest_lock_target",
+ 0, 2, vars, NULL, 0, 0, 0);
+ }
+ return result;
+}
diff --git a/liboffloadmic/runtime/offload_omp_target.cpp b/liboffloadmic/runtime/offload_omp_target.cpp
new file mode 100644
index 00000000000..2ccce7c7687
--- /dev/null
+++ b/liboffloadmic/runtime/offload_omp_target.cpp
@@ -0,0 +1,560 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include <omp.h>
+#include "offload.h"
+#include "compiler_if_target.h"
+
+// OpenMP API
+
+void omp_set_default_device(int num) __GOMP_NOTHROW
+{
+}
+
+int omp_get_default_device(void) __GOMP_NOTHROW
+{
+ return mic_index;
+}
+
+int omp_get_num_devices() __GOMP_NOTHROW
+{
+ return mic_engines_total;
+}
+
+// OpenMP API wrappers
+
+static void omp_send_int_to_host(
+ void *ofld_,
+ int setting
+)
+{
+ OFFLOAD ofld = (OFFLOAD) ofld_;
+ VarDesc vars[1] = {0};
+
+ vars[0].type.src = c_data;
+ vars[0].type.dst = c_data;
+ vars[0].direction.bits = c_parameter_out;
+ vars[0].ptr = &setting;
+
+ OFFLOAD_TARGET_ENTER(ofld, 1, vars, NULL);
+ OFFLOAD_TARGET_LEAVE(ofld);
+}
+
+static int omp_get_int_from_host(
+ void *ofld_
+)
+{
+ OFFLOAD ofld = (OFFLOAD) ofld_;
+ VarDesc vars[1] = {0};
+ int setting;
+
+ vars[0].type.src = c_data;
+ vars[0].type.dst = c_data;
+ vars[0].direction.bits = c_parameter_in;
+ vars[0].ptr = &setting;
+
+ OFFLOAD_TARGET_ENTER(ofld, 1, vars, NULL);
+ OFFLOAD_TARGET_LEAVE(ofld);
+
+ return setting;
+}
+
+void omp_set_num_threads_lrb(
+ void *ofld
+)
+{
+ int num_threads;
+
+ num_threads = omp_get_int_from_host(ofld);
+ omp_set_num_threads(num_threads);
+}
+
+void omp_get_max_threads_lrb(
+ void *ofld
+)
+{
+ int num_threads;
+
+ num_threads = omp_get_max_threads();
+ omp_send_int_to_host(ofld, num_threads);
+}
+
+void omp_get_num_procs_lrb(
+ void *ofld
+)
+{
+ int num_procs;
+
+ num_procs = omp_get_num_procs();
+ omp_send_int_to_host(ofld, num_procs);
+}
+
+void omp_set_dynamic_lrb(
+ void *ofld
+)
+{
+ int dynamic;
+
+ dynamic = omp_get_int_from_host(ofld);
+ omp_set_dynamic(dynamic);
+}
+
+void omp_get_dynamic_lrb(
+ void *ofld
+)
+{
+ int dynamic;
+
+ dynamic = omp_get_dynamic();
+ omp_send_int_to_host(ofld, dynamic);
+}
+
+void omp_set_nested_lrb(
+ void *ofld
+)
+{
+ int nested;
+
+ nested = omp_get_int_from_host(ofld);
+ omp_set_nested(nested);
+}
+
+void omp_get_nested_lrb(
+ void *ofld
+)
+{
+ int nested;
+
+ nested = omp_get_nested();
+ omp_send_int_to_host(ofld, nested);
+}
+
+void omp_set_schedule_lrb(
+ void *ofld_
+)
+{
+ OFFLOAD ofld = (OFFLOAD) ofld_;
+ VarDesc vars[2] = {0};
+ omp_sched_t kind;
+ int modifier;
+
+ vars[0].type.src = c_data;
+ vars[0].type.dst = c_data;
+ vars[0].direction.bits = c_parameter_in;
+ vars[0].ptr = &kind;
+
+ vars[1].type.src = c_data;
+ vars[1].type.dst = c_data;
+ vars[1].direction.bits = c_parameter_in;
+ vars[1].ptr = &modifier;
+
+ OFFLOAD_TARGET_ENTER(ofld, 2, vars, NULL);
+ omp_set_schedule(kind, modifier);
+ OFFLOAD_TARGET_LEAVE(ofld);
+}
+
+void omp_get_schedule_lrb(
+ void *ofld_
+)
+{
+ OFFLOAD ofld = (OFFLOAD) ofld_;
+ VarDesc vars[2] = {0};
+ omp_sched_t kind;
+ int modifier;
+
+ vars[0].type.src = c_data;
+ vars[0].type.dst = c_data;
+ vars[0].direction.bits = c_parameter_out;
+ vars[0].ptr = &kind;
+
+ vars[1].type.src = c_data;
+ vars[1].type.dst = c_data;
+ vars[1].direction.bits = c_parameter_out;
+ vars[1].ptr = &modifier;
+
+ OFFLOAD_TARGET_ENTER(ofld, 2, vars, NULL);
+ omp_get_schedule(&kind, &modifier);
+ OFFLOAD_TARGET_LEAVE(ofld);
+}
+
+// lock API functions
+
+void omp_init_lock_lrb(
+ void *ofld_
+)
+{
+ OFFLOAD ofld = (OFFLOAD) ofld_;
+ VarDesc vars[1] = {0};
+ omp_lock_target_t lock;
+
+ vars[0].type.src = c_data;
+ vars[0].type.dst = c_data;
+ vars[0].direction.bits = c_parameter_out;
+ vars[0].ptr = &lock;
+
+ OFFLOAD_TARGET_ENTER(ofld, 1, vars, NULL);
+ omp_init_lock(&lock.lock);
+ OFFLOAD_TARGET_LEAVE(ofld);
+}
+
+void omp_destroy_lock_lrb(
+ void *ofld_
+)
+{
+ OFFLOAD ofld = (OFFLOAD) ofld_;
+ VarDesc vars[1] = {0};
+ omp_lock_target_t lock;
+
+ vars[0].type.src = c_data;
+ vars[0].type.dst = c_data;
+ vars[0].direction.bits = c_parameter_in;
+ vars[0].ptr = &lock;
+
+ OFFLOAD_TARGET_ENTER(ofld, 1, vars, NULL);
+ omp_destroy_lock(&lock.lock);
+ OFFLOAD_TARGET_LEAVE(ofld);
+}
+
+void omp_set_lock_lrb(
+ void *ofld_
+)
+{
+ OFFLOAD ofld = (OFFLOAD) ofld_;
+ VarDesc vars[1] = {0};
+ omp_lock_target_t lock;
+
+ vars[0].type.src = c_data;
+ vars[0].type.dst = c_data;
+ vars[0].direction.bits = c_parameter_inout;
+ vars[0].ptr = &lock;
+
+ OFFLOAD_TARGET_ENTER(ofld, 1, vars, NULL);
+ omp_set_lock(&lock.lock);
+ OFFLOAD_TARGET_LEAVE(ofld);
+}
+
+void omp_unset_lock_lrb(
+ void *ofld_
+)
+{
+ OFFLOAD ofld = (OFFLOAD) ofld_;
+ VarDesc vars[1] = {0};
+ omp_lock_target_t lock;
+
+ vars[0].type.src = c_data;
+ vars[0].type.dst = c_data;
+ vars[0].direction.bits = c_parameter_inout;
+ vars[0].ptr = &lock;
+
+ OFFLOAD_TARGET_ENTER(ofld, 1, vars, NULL);
+ omp_unset_lock(&lock.lock);
+ OFFLOAD_TARGET_LEAVE(ofld);
+}
+
+void omp_test_lock_lrb(
+ void *ofld_
+)
+{
+ OFFLOAD ofld = (OFFLOAD) ofld_;
+ VarDesc vars[2] = {0};
+ omp_lock_target_t lock;
+ int result;
+
+ vars[0].type.src = c_data;
+ vars[0].type.dst = c_data;
+ vars[0].direction.bits = c_parameter_inout;
+ vars[0].ptr = &lock;
+
+ vars[1].type.src = c_data;
+ vars[1].type.dst = c_data;
+ vars[1].direction.bits = c_parameter_out;
+ vars[1].ptr = &result;
+
+ OFFLOAD_TARGET_ENTER(ofld, 2, vars, NULL);
+ result = omp_test_lock(&lock.lock);
+ OFFLOAD_TARGET_LEAVE(ofld);
+}
+
+// nested lock API functions
+
+void omp_init_nest_lock_lrb(
+ void *ofld_
+)
+{
+ OFFLOAD ofld = (OFFLOAD) ofld_;
+ VarDesc vars[1] = {0};
+ omp_nest_lock_target_t lock;
+
+ vars[0].type.src = c_data;
+ vars[0].type.dst = c_data;
+ vars[0].direction.bits = c_parameter_out;
+ vars[0].ptr = &lock;
+
+ OFFLOAD_TARGET_ENTER(ofld, 1, vars, NULL);
+ omp_init_nest_lock(&lock.lock);
+ OFFLOAD_TARGET_LEAVE(ofld);
+}
+
+void omp_destroy_nest_lock_lrb(
+ void *ofld_
+)
+{
+ OFFLOAD ofld = (OFFLOAD) ofld_;
+ VarDesc vars[1] = {0};
+ omp_nest_lock_target_t lock;
+
+ vars[0].type.src = c_data;
+ vars[0].type.dst = c_data;
+ vars[0].direction.bits = c_parameter_in;
+ vars[0].ptr = &lock;
+
+ OFFLOAD_TARGET_ENTER(ofld, 1, vars, NULL);
+ omp_destroy_nest_lock(&lock.lock);
+ OFFLOAD_TARGET_LEAVE(ofld);
+}
+
+void omp_set_nest_lock_lrb(
+ void *ofld_
+)
+{
+ OFFLOAD ofld = (OFFLOAD) ofld_;
+ VarDesc vars[1] = {0};
+ omp_nest_lock_target_t lock;
+
+ vars[0].type.src = c_data;
+ vars[0].type.dst = c_data;
+ vars[0].direction.bits = c_parameter_inout;
+ vars[0].ptr = &lock;
+
+ OFFLOAD_TARGET_ENTER(ofld, 1, vars, NULL);
+ omp_set_nest_lock(&lock.lock);
+ OFFLOAD_TARGET_LEAVE(ofld);
+}
+
+void omp_unset_nest_lock_lrb(
+ void *ofld_
+)
+{
+ OFFLOAD ofld = (OFFLOAD) ofld_;
+ VarDesc vars[1] = {0};
+ omp_nest_lock_target_t lock;
+
+ vars[0].type.src = c_data;
+ vars[0].type.dst = c_data;
+ vars[0].direction.bits = c_parameter_inout;
+ vars[0].ptr = &lock;
+
+ OFFLOAD_TARGET_ENTER(ofld, 1, vars, NULL);
+ omp_unset_nest_lock(&lock.lock);
+ OFFLOAD_TARGET_LEAVE(ofld);
+}
+
+void omp_test_nest_lock_lrb(
+ void *ofld_
+)
+{
+ OFFLOAD ofld = (OFFLOAD) ofld_;
+ VarDesc vars[2] = {0};
+ omp_nest_lock_target_t lock;
+ int result;
+
+ vars[0].type.src = c_data;
+ vars[0].type.dst = c_data;
+ vars[0].direction.bits = c_parameter_inout;
+ vars[0].ptr = &lock;
+
+ vars[1].type.src = c_data;
+ vars[1].type.dst = c_data;
+ vars[1].direction.bits = c_parameter_out;
+ vars[1].ptr = &result;
+
+ OFFLOAD_TARGET_ENTER(ofld, 2, vars, NULL);
+ result = omp_test_nest_lock(&lock.lock);
+ OFFLOAD_TARGET_LEAVE(ofld);
+}
+
+// Target-side stubs for the host functions (to avoid unresolveds)
+// These are needed for the offloadm table
+
+void omp_set_num_threads_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ int num_threads
+)
+{
+}
+
+int omp_get_max_threads_target(
+ TARGET_TYPE target_type,
+ int target_number
+)
+{
+ return 0;
+}
+
+int omp_get_num_procs_target(
+ TARGET_TYPE target_type,
+ int target_number
+)
+{
+ return 0;
+}
+
+void omp_set_dynamic_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ int num_threads
+)
+{
+}
+
+int omp_get_dynamic_target(
+ TARGET_TYPE target_type,
+ int target_number
+)
+{
+ return 0;
+}
+
+void omp_set_nested_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ int num_threads
+)
+{
+}
+
+int omp_get_nested_target(
+ TARGET_TYPE target_type,
+ int target_number
+)
+{
+ return 0;
+}
+
+void omp_set_schedule_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_sched_t kind,
+ int modifier
+)
+{
+}
+
+void omp_get_schedule_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_sched_t *kind,
+ int *modifier
+)
+{
+}
+
+void omp_init_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_lock_target_t *lock
+)
+{
+}
+
+void omp_destroy_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_lock_target_t *lock
+)
+{
+}
+
+void omp_set_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_lock_target_t *lock
+)
+{
+}
+
+void omp_unset_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_lock_target_t *lock
+)
+{
+}
+
+int omp_test_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_lock_target_t *lock
+)
+{
+ return 0;
+}
+
+void omp_init_nest_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_nest_lock_target_t *lock
+)
+{
+}
+
+void omp_destroy_nest_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_nest_lock_target_t *lock
+)
+{
+}
+
+void omp_set_nest_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_nest_lock_target_t *lock
+)
+{
+}
+
+void omp_unset_nest_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_nest_lock_target_t *lock
+)
+{
+}
+
+int omp_test_nest_lock_target(
+ TARGET_TYPE target_type,
+ int target_number,
+ omp_nest_lock_target_t *lock
+)
+{
+ return 0;
+}
diff --git a/liboffloadmic/runtime/offload_orsl.cpp b/liboffloadmic/runtime/offload_orsl.cpp
new file mode 100644
index 00000000000..aa3edc36e03
--- /dev/null
+++ b/liboffloadmic/runtime/offload_orsl.cpp
@@ -0,0 +1,104 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "offload_orsl.h"
+#include <stdlib.h>
+#include "offload_host.h"
+#include "orsl-lite/include/orsl-lite.h"
+
+namespace ORSL {
+
+static bool is_enabled = false;
+static const ORSLTag my_tag = "Offload";
+
+void init()
+{
+ const char *env_var = getenv("OFFLOAD_ENABLE_ORSL");
+ if (env_var != 0 && *env_var != '\0') {
+ int64_t new_val;
+ if (__offload_parse_int_string(env_var, new_val)) {
+ is_enabled = new_val;
+ }
+ else {
+ LIBOFFLOAD_ERROR(c_invalid_env_var_int_value,
+ "OFFLOAD_ENABLE_ORSL");
+ }
+ }
+
+ if (is_enabled) {
+ OFFLOAD_DEBUG_TRACE(2, "ORSL is enabled\n");
+ }
+ else {
+ OFFLOAD_DEBUG_TRACE(2, "ORSL is disabled\n");
+ }
+}
+
+bool reserve(int device)
+{
+ if (is_enabled) {
+ int pnum = mic_engines[device].get_physical_index();
+ ORSLBusySet bset;
+
+ bset.type = BUSY_SET_FULL;
+ if (ORSLReserve(1, &pnum, &bset, my_tag) != 0) {
+ return false;
+ }
+ }
+ return true;
+}
+
+bool try_reserve(int device)
+{
+ if (is_enabled) {
+ int pnum = mic_engines[device].get_physical_index();
+ ORSLBusySet bset;
+
+ bset.type = BUSY_SET_FULL;
+ if (ORSLTryReserve(1, &pnum, &bset, my_tag) != 0) {
+ return false;
+ }
+ }
+ return true;
+}
+
+void release(int device)
+{
+ if (is_enabled) {
+ int pnum = mic_engines[device].get_physical_index();
+ ORSLBusySet bset;
+
+ bset.type = BUSY_SET_FULL;
+ if (ORSLRelease(1, &pnum, &bset, my_tag) != 0) {
+ // should never get here
+ }
+ }
+}
+
+} // namespace ORSL
diff --git a/liboffloadmic/runtime/offload_orsl.h b/liboffloadmic/runtime/offload_orsl.h
new file mode 100644
index 00000000000..8bdbf1abb50
--- /dev/null
+++ b/liboffloadmic/runtime/offload_orsl.h
@@ -0,0 +1,45 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#ifndef OFFLOAD_ORSL_H_INCLUDED
+#define OFFLOAD_ORSL_H_INCLUDED
+
+// ORSL interface
+namespace ORSL {
+
+extern void init();
+
+extern bool reserve(int device);
+extern bool try_reserve(int device);
+extern void release(int device);
+
+} // namespace ORSL
+
+#endif // OFFLOAD_ORSL_H_INCLUDED
diff --git a/liboffloadmic/runtime/offload_table.cpp b/liboffloadmic/runtime/offload_table.cpp
new file mode 100644
index 00000000000..d73def16e70
--- /dev/null
+++ b/liboffloadmic/runtime/offload_table.cpp
@@ -0,0 +1,331 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "offload_table.h"
+#include "offload_common.h"
+
+#if !HOST_LIBRARY
+// Predefined offload entries
+extern void omp_set_num_threads_lrb(void*);
+extern void omp_get_max_threads_lrb(void*);
+extern void omp_get_num_procs_lrb(void*);
+extern void omp_set_dynamic_lrb(void*);
+extern void omp_get_dynamic_lrb(void*);
+extern void omp_set_nested_lrb(void*);
+extern void omp_get_nested_lrb(void*);
+extern void omp_set_schedule_lrb(void*);
+extern void omp_get_schedule_lrb(void*);
+
+extern void omp_init_lock_lrb(void*);
+extern void omp_destroy_lock_lrb(void*);
+extern void omp_set_lock_lrb(void*);
+extern void omp_unset_lock_lrb(void*);
+extern void omp_test_lock_lrb(void*);
+
+extern void omp_init_nest_lock_lrb(void*);
+extern void omp_destroy_nest_lock_lrb(void*);
+extern void omp_set_nest_lock_lrb(void*);
+extern void omp_unset_nest_lock_lrb(void*);
+extern void omp_test_nest_lock_lrb(void*);
+
+// Predefined entries on the target side
+static FuncTable::Entry predefined_entries[] = {
+ "omp_set_num_threads_target",
+ (void*) &omp_set_num_threads_lrb,
+ "omp_get_max_threads_target",
+ (void*) &omp_get_max_threads_lrb,
+ "omp_get_num_procs_target",
+ (void*) &omp_get_num_procs_lrb,
+ "omp_set_dynamic_target",
+ (void*) &omp_set_dynamic_lrb,
+ "omp_get_dynamic_target",
+ (void*) &omp_get_dynamic_lrb,
+ "omp_set_nested_target",
+ (void*) &omp_set_nested_lrb,
+ "omp_get_nested_target",
+ (void*) &omp_get_nested_lrb,
+ "omp_set_schedule_target",
+ (void*) &omp_set_schedule_lrb,
+ "omp_get_schedule_target",
+ (void*) &omp_get_schedule_lrb,
+
+ "omp_init_lock_target",
+ (void*) &omp_init_lock_lrb,
+ "omp_destroy_lock_target",
+ (void*) &omp_destroy_lock_lrb,
+ "omp_set_lock_target",
+ (void*) &omp_set_lock_lrb,
+ "omp_unset_lock_target",
+ (void*) &omp_unset_lock_lrb,
+ "omp_test_lock_target",
+ (void*) &omp_test_lock_lrb,
+
+ "omp_init_nest_lock_target",
+ (void*) &omp_init_nest_lock_lrb,
+ "omp_destroy_nest_lock_target",
+ (void*) &omp_destroy_nest_lock_lrb,
+ "omp_set_nest_lock_target",
+ (void*) &omp_set_nest_lock_lrb,
+ "omp_unset_nest_lock_target",
+ (void*) &omp_unset_nest_lock_lrb,
+ "omp_test_nest_lock_target",
+ (void*) &omp_test_nest_lock_lrb,
+
+ (const char*) -1,
+ (void*) -1
+};
+
+static FuncList::Node predefined_table = {
+ { predefined_entries, -1 },
+ 0, 0
+};
+
+// Entry table
+FuncList __offload_entries(&predefined_table);
+#else
+FuncList __offload_entries;
+#endif // !HOST_LIBRARY
+
+// Function table. No predefined entries.
+FuncList __offload_funcs;
+
+// Var table
+VarList __offload_vars;
+
+// Given the function name returns the associtated function pointer
+const void* FuncList::find_addr(const char *name)
+{
+ const void* func = 0;
+
+ m_lock.lock();
+
+ for (Node *n = m_head; n != 0; n = n->next) {
+ for (const Table::Entry *e = n->table.entries;
+ e->name != (const char*) -1; e++) {
+ if (e->name != 0 && strcmp(e->name, name) == 0) {
+ func = e->func;
+ break;
+ }
+ }
+ }
+
+ m_lock.unlock();
+
+ return func;
+}
+
+// Given the function pointer returns the associtated function name
+const char* FuncList::find_name(const void *func)
+{
+ const char* name = 0;
+
+ m_lock.lock();
+
+ for (Node *n = m_head; n != 0; n = n->next) {
+ for (const Table::Entry *e = n->table.entries;
+ e->name != (const char*) -1; e++) {
+ if (e->func == func) {
+ name = e->name;
+ break;
+ }
+ }
+ }
+
+ m_lock.unlock();
+
+ return name;
+}
+
+// Returns max name length from all tables
+int64_t FuncList::max_name_length(void)
+{
+ if (m_max_name_len < 0) {
+ m_lock.lock();
+
+ m_max_name_len = 0;
+ for (Node *n = m_head; n != 0; n = n->next) {
+ if (n->table.max_name_len < 0) {
+ n->table.max_name_len = 0;
+
+ // calculate max name length in a single table
+ for (const Table::Entry *e = n->table.entries;
+ e->name != (const char*) -1; e++) {
+ if (e->name != 0) {
+ size_t len = strlen(e->name) + 1;
+ if (n->table.max_name_len < len) {
+ n->table.max_name_len = len;
+ }
+ }
+ }
+ }
+
+ // select max from all tables
+ if (m_max_name_len < n->table.max_name_len) {
+ m_max_name_len = n->table.max_name_len;
+ }
+ }
+
+ m_lock.unlock();
+ }
+ return m_max_name_len;
+}
+
+// Debugging dump
+void FuncList::dump(void)
+{
+ OFFLOAD_DEBUG_TRACE(2, "Function table:\n");
+
+ m_lock.lock();
+
+ for (Node *n = m_head; n != 0; n = n->next) {
+ for (const Table::Entry *e = n->table.entries;
+ e->name != (const char*) -1; e++) {
+ if (e->name != 0) {
+ OFFLOAD_DEBUG_TRACE(2, "%p %s\n", e->func, e->name);
+ }
+ }
+ }
+
+ m_lock.unlock();
+}
+
+// Debugging dump
+void VarList::dump(void)
+{
+ OFFLOAD_DEBUG_TRACE(2, "Var table:\n");
+
+ m_lock.lock();
+
+ for (Node *n = m_head; n != 0; n = n->next) {
+ for (const Table::Entry *e = n->table.entries;
+ e->name != (const char*) -1; e++) {
+ if (e->name != 0) {
+#if HOST_LIBRARY
+ OFFLOAD_DEBUG_TRACE(2, "%s %p %ld\n", e->name, e->addr,
+ e->size);
+#else // HOST_LIBRARY
+ OFFLOAD_DEBUG_TRACE(2, "%s %p\n", e->name, e->addr);
+#endif // HOST_LIBRARY
+ }
+ }
+ }
+
+ m_lock.unlock();
+}
+
+//
+int64_t VarList::table_size(int64_t &nelems)
+{
+ int64_t length = 0;
+
+ nelems = 0;
+
+ // calculate string table size and number of elements
+ for (Node *n = m_head; n != 0; n = n->next) {
+ for (const Table::Entry *e = n->table.entries;
+ e->name != (const char*) -1; e++) {
+ if (e->name != 0) {
+ length += strlen(e->name) + 1;
+ nelems++;
+ }
+ }
+ }
+
+ return nelems * sizeof(BufEntry) + length;
+}
+
+// copy table to the gven buffer
+void VarList::table_copy(void *buf, int64_t nelems)
+{
+ BufEntry* elems = static_cast<BufEntry*>(buf);
+ char* names = reinterpret_cast<char*>(elems + nelems);
+
+ // copy entries to buffer
+ for (Node *n = m_head; n != 0; n = n->next) {
+ for (const Table::Entry *e = n->table.entries;
+ e->name != (const char*) -1; e++) {
+ if (e->name != 0) {
+ // name field contains offset to the name from the beginning
+ // of the buffer
+ elems->name = names - static_cast<char*>(buf);
+ elems->addr = reinterpret_cast<intptr_t>(e->addr);
+
+ // copy name to string table
+ const char *name = e->name;
+ while ((*names++ = *name++) != '\0');
+
+ elems++;
+ }
+ }
+ }
+}
+
+// patch name offsets in a buffer
+void VarList::table_patch_names(void *buf, int64_t nelems)
+{
+ BufEntry* elems = static_cast<BufEntry*>(buf);
+ for (int i = 0; i < nelems; i++) {
+ elems[i].name += reinterpret_cast<intptr_t>(buf);
+ }
+}
+
+// Adds given list element to the global lookup table list
+extern "C" void __offload_register_tables(
+ FuncList::Node *entry_table,
+ FuncList::Node *func_table,
+ VarList::Node *var_table
+)
+{
+ OFFLOAD_DEBUG_TRACE(2, "Registering offload function entry table %p\n",
+ entry_table);
+ __offload_entries.add_table(entry_table);
+
+ OFFLOAD_DEBUG_TRACE(2, "Registering function table %p\n", func_table);
+ __offload_funcs.add_table(func_table);
+
+ OFFLOAD_DEBUG_TRACE(2, "Registering var table %p\n", var_table);
+ __offload_vars.add_table(var_table);
+}
+
+// Removes given list element from the global lookup table list
+extern "C" void __offload_unregister_tables(
+ FuncList::Node *entry_table,
+ FuncList::Node *func_table,
+ VarList::Node *var_table
+)
+{
+ __offload_entries.remove_table(entry_table);
+
+ OFFLOAD_DEBUG_TRACE(2, "Unregistering function table %p\n", func_table);
+ __offload_funcs.remove_table(func_table);
+
+ OFFLOAD_DEBUG_TRACE(2, "Unregistering var table %p\n", var_table);
+ __offload_vars.remove_table(var_table);
+}
diff --git a/liboffloadmic/runtime/offload_table.h b/liboffloadmic/runtime/offload_table.h
new file mode 100644
index 00000000000..cc4caad47a1
--- /dev/null
+++ b/liboffloadmic/runtime/offload_table.h
@@ -0,0 +1,321 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+/*! \file
+ \brief Function and Variable tables used by the runtime library
+*/
+
+#ifndef OFFLOAD_TABLE_H_INCLUDED
+#define OFFLOAD_TABLE_H_INCLUDED
+
+#include <iterator>
+#include "offload_util.h"
+
+// Template representing double linked list of tables
+template <typename T> class TableList {
+public:
+ // table type
+ typedef T Table;
+
+ // List node
+ struct Node {
+ Table table;
+ Node* prev;
+ Node* next;
+ };
+
+public:
+ explicit TableList(Node *node = 0) : m_head(node) {}
+
+ void add_table(Node *node) {
+ m_lock.lock();
+
+ if (m_head != 0) {
+ node->next = m_head;
+ m_head->prev = node;
+ }
+ m_head = node;
+
+ m_lock.unlock();
+ }
+
+ void remove_table(Node *node) {
+ m_lock.lock();
+
+ if (node->next != 0) {
+ node->next->prev = node->prev;
+ }
+ if (node->prev != 0) {
+ node->prev->next = node->next;
+ }
+ if (m_head == node) {
+ m_head = node->next;
+ }
+
+ m_lock.unlock();
+ }
+
+protected:
+ Node* m_head;
+ mutex_t m_lock;
+};
+
+// Function lookup table.
+struct FuncTable {
+ //! Function table entry
+ /*! This table contains functions created from offload regions. */
+ /*! Each entry consists of a pointer to the function's "key"
+ and the function address. */
+ /*! Each shared library or executable may contain one such table. */
+ /*! The end of the table is marked with an entry whose name field
+ has value -1. */
+ struct Entry {
+ const char* name; //!< Name of the function
+ void* func; //!< Address of the function
+ };
+
+ // entries
+ const Entry *entries;
+
+ // max name length
+ int64_t max_name_len;
+};
+
+// Function table
+class FuncList : public TableList<FuncTable> {
+public:
+ explicit FuncList(Node *node = 0) : TableList<Table>(node),
+ m_max_name_len(-1)
+ {}
+
+ // add table to the list
+ void add_table(Node *node) {
+ // recalculate max function name length
+ m_max_name_len = -1;
+
+ // add table
+ TableList<Table>::add_table(node);
+ }
+
+ // find function address for the given name
+ const void* find_addr(const char *name);
+
+ // find function name for the given address
+ const char* find_name(const void *addr);
+
+ // max name length from all tables in the list
+ int64_t max_name_length(void);
+
+ // debug dump
+ void dump(void);
+
+private:
+ // max name length within from all tables
+ int64_t m_max_name_len;
+};
+
+// Table entry for static variables
+struct VarTable {
+ //! Variable table entry
+ /*! This table contains statically allocated variables marked with
+ __declspec(target(mic) or #pragma omp declare target. */
+ /*! Each entry consists of a pointer to the variable's "key",
+ the variable address and its size in bytes. */
+ /*! Because memory allocation is done from the host,
+ the MIC table does not need the size of the variable. */
+ /*! Padding to make the table entry size a power of 2 is necessary
+ to avoid "holes" between table contributions from different object
+ files on Windows when debug information is specified with /Zi. */
+ struct Entry {
+ const char* name; //!< Name of the variable
+ void* addr; //!< Address of the variable
+
+#if HOST_LIBRARY
+ uint64_t size;
+
+#ifdef TARGET_WINNT
+ // padding to make entry size a power of 2
+ uint64_t padding;
+#endif // TARGET_WINNT
+#endif
+ };
+
+ // Table terminated by an entry with name == -1
+ const Entry *entries;
+};
+
+// List of var tables
+class VarList : public TableList<VarTable> {
+public:
+ VarList() : TableList<Table>()
+ {}
+
+ // debug dump
+ void dump();
+
+public:
+ // var table list iterator
+ class Iterator : public std::iterator<std::input_iterator_tag,
+ Table::Entry> {
+ public:
+ Iterator() : m_node(0), m_entry(0) {}
+
+ explicit Iterator(Node *node) {
+ new_node(node);
+ }
+
+ Iterator& operator++() {
+ if (m_entry != 0) {
+ m_entry++;
+ while (m_entry->name == 0) {
+ m_entry++;
+ }
+ if (m_entry->name == reinterpret_cast<const char*>(-1)) {
+ new_node(m_node->next);
+ }
+ }
+ return *this;
+ }
+
+ bool operator==(const Iterator &other) const {
+ return m_entry == other.m_entry;
+ }
+
+ bool operator!=(const Iterator &other) const {
+ return m_entry != other.m_entry;
+ }
+
+ const Table::Entry* operator*() const {
+ return m_entry;
+ }
+
+ private:
+ void new_node(Node *node) {
+ m_node = node;
+ m_entry = 0;
+ while (m_node != 0) {
+ m_entry = m_node->table.entries;
+ while (m_entry->name == 0) {
+ m_entry++;
+ }
+ if (m_entry->name != reinterpret_cast<const char*>(-1)) {
+ break;
+ }
+ m_node = m_node->next;
+ m_entry = 0;
+ }
+ }
+
+ private:
+ Node *m_node;
+ const Table::Entry *m_entry;
+ };
+
+ Iterator begin() const {
+ return Iterator(m_head);
+ }
+
+ Iterator end() const {
+ return Iterator();
+ }
+
+public:
+ // Entry representation in a copy buffer
+ struct BufEntry {
+ intptr_t name;
+ intptr_t addr;
+ };
+
+ // Calculate the number of elements in the table and
+ // returns the size of buffer for the table
+ int64_t table_size(int64_t &nelems);
+
+ // Copy table contents to given buffer. It is supposed to be large
+ // enough to hold all elements as string table.
+ void table_copy(void *buf, int64_t nelems);
+
+ // Patch name offsets in a table after it's been copied to other side
+ static void table_patch_names(void *buf, int64_t nelems);
+};
+
+extern FuncList __offload_entries;
+extern FuncList __offload_funcs;
+extern VarList __offload_vars;
+
+// Section names where the lookup tables are stored
+#ifdef TARGET_WINNT
+#define OFFLOAD_ENTRY_TABLE_SECTION_START ".OffloadEntryTable$a"
+#define OFFLOAD_ENTRY_TABLE_SECTION_END ".OffloadEntryTable$z"
+
+#define OFFLOAD_FUNC_TABLE_SECTION_START ".OffloadFuncTable$a"
+#define OFFLOAD_FUNC_TABLE_SECTION_END ".OffloadFuncTable$z"
+
+#define OFFLOAD_VAR_TABLE_SECTION_START ".OffloadVarTable$a"
+#define OFFLOAD_VAR_TABLE_SECTION_END ".OffloadVarTable$z"
+
+#define OFFLOAD_CRTINIT_SECTION_START ".CRT$XCT"
+
+#pragma section(OFFLOAD_CRTINIT_SECTION_START, read)
+
+#else // TARGET_WINNT
+
+#define OFFLOAD_ENTRY_TABLE_SECTION_START ".OffloadEntryTable."
+#define OFFLOAD_ENTRY_TABLE_SECTION_END ".OffloadEntryTable."
+
+#define OFFLOAD_FUNC_TABLE_SECTION_START ".OffloadFuncTable."
+#define OFFLOAD_FUNC_TABLE_SECTION_END ".OffloadFuncTable."
+
+#define OFFLOAD_VAR_TABLE_SECTION_START ".OffloadVarTable."
+#define OFFLOAD_VAR_TABLE_SECTION_END ".OffloadVarTable."
+#endif // TARGET_WINNT
+
+#pragma section(OFFLOAD_ENTRY_TABLE_SECTION_START, read, write)
+#pragma section(OFFLOAD_ENTRY_TABLE_SECTION_END, read, write)
+
+#pragma section(OFFLOAD_FUNC_TABLE_SECTION_START, read, write)
+#pragma section(OFFLOAD_FUNC_TABLE_SECTION_END, read, write)
+
+#pragma section(OFFLOAD_VAR_TABLE_SECTION_START, read, write)
+#pragma section(OFFLOAD_VAR_TABLE_SECTION_END, read, write)
+
+
+// register/unregister given tables
+extern "C" void __offload_register_tables(
+ FuncList::Node *entry_table,
+ FuncList::Node *func_table,
+ VarList::Node *var_table
+);
+
+extern "C" void __offload_unregister_tables(
+ FuncList::Node *entry_table,
+ FuncList::Node *func_table,
+ VarList::Node *var_table
+);
+#endif // OFFLOAD_TABLE_H_INCLUDED
diff --git a/liboffloadmic/runtime/offload_target.cpp b/liboffloadmic/runtime/offload_target.cpp
new file mode 100644
index 00000000000..2e5f91e8c0b
--- /dev/null
+++ b/liboffloadmic/runtime/offload_target.cpp
@@ -0,0 +1,776 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "offload_target.h"
+#include <stdlib.h>
+#include <unistd.h>
+#ifdef SEP_SUPPORT
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#endif // SEP_SUPPORT
+#include <omp.h>
+#include <map>
+
+// typedef offload_func_with_parms.
+// Pointer to function that represents an offloaded entry point.
+// The parameters are a temporary fix for parameters on the stack.
+typedef void (*offload_func_with_parms)(void *);
+
+// Target console and file logging
+const char *prefix;
+int console_enabled = 0;
+int offload_report_level = 0;
+
+// Trace information
+static const char* vardesc_direction_as_string[] = {
+ "NOCOPY",
+ "IN",
+ "OUT",
+ "INOUT"
+};
+static const char* vardesc_type_as_string[] = {
+ "unknown",
+ "data",
+ "data_ptr",
+ "func_ptr",
+ "void_ptr",
+ "string_ptr",
+ "dv",
+ "dv_data",
+ "dv_data_slice",
+ "dv_ptr",
+ "dv_ptr_data",
+ "dv_ptr_data_slice",
+ "cean_var",
+ "cean_var_ptr",
+ "c_data_ptr_array"
+};
+
+int mic_index = -1;
+int mic_engines_total = -1;
+uint64_t mic_frequency = 0;
+int offload_number = 0;
+static std::map<void*, RefInfo*> ref_data;
+static mutex_t add_ref_lock;
+
+#ifdef SEP_SUPPORT
+static const char* sep_monitor_env = "SEP_MONITOR";
+static bool sep_monitor = false;
+static const char* sep_device_env = "SEP_DEVICE";
+static const char* sep_device = "/dev/sep3.8/c";
+static int sep_counter = 0;
+
+#define SEP_API_IOC_MAGIC 99
+#define SEP_IOCTL_PAUSE _IO (SEP_API_IOC_MAGIC, 31)
+#define SEP_IOCTL_RESUME _IO (SEP_API_IOC_MAGIC, 32)
+
+static void add_ref_count(void * buf, bool created)
+{
+ mutex_locker_t locker(add_ref_lock);
+ RefInfo * info = ref_data[buf];
+
+ if (info) {
+ info->count++;
+ }
+ else {
+ info = new RefInfo((int)created,(long)1);
+ }
+ info->is_added |= created;
+ ref_data[buf] = info;
+}
+
+static void BufReleaseRef(void * buf)
+{
+ mutex_locker_t locker(add_ref_lock);
+ RefInfo * info = ref_data[buf];
+
+ if (info) {
+ --info->count;
+ if (info->count == 0 && info->is_added) {
+ BufferReleaseRef(buf);
+ info->is_added = 0;
+ }
+ }
+}
+
+static int VTPauseSampling(void)
+{
+ int ret = -1;
+ int handle = open(sep_device, O_RDWR);
+ if (handle > 0) {
+ ret = ioctl(handle, SEP_IOCTL_PAUSE);
+ close(handle);
+ }
+ return ret;
+}
+
+static int VTResumeSampling(void)
+{
+ int ret = -1;
+ int handle = open(sep_device, O_RDWR);
+ if (handle > 0) {
+ ret = ioctl(handle, SEP_IOCTL_RESUME);
+ close(handle);
+ }
+ return ret;
+}
+#endif // SEP_SUPPORT
+
+void OffloadDescriptor::offload(
+ uint32_t buffer_count,
+ void** buffers,
+ void* misc_data,
+ uint16_t misc_data_len,
+ void* return_data,
+ uint16_t return_data_len
+)
+{
+ FunctionDescriptor *func = (FunctionDescriptor*) misc_data;
+ const char *name = func->data;
+ OffloadDescriptor ofld;
+ char *in_data = 0;
+ char *out_data = 0;
+ char *timer_data = 0;
+
+ console_enabled = func->console_enabled;
+ timer_enabled = func->timer_enabled;
+ offload_report_level = func->offload_report_level;
+ offload_number = func->offload_number;
+ ofld.set_offload_number(func->offload_number);
+
+#ifdef SEP_SUPPORT
+ if (sep_monitor) {
+ if (__sync_fetch_and_add(&sep_counter, 1) == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "VTResumeSampling\n");
+ VTResumeSampling();
+ }
+ }
+#endif // SEP_SUPPORT
+
+ OFFLOAD_DEBUG_TRACE_1(2, ofld.get_offload_number(),
+ c_offload_start_target_func,
+ "Offload \"%s\" started\n", name);
+
+ // initialize timer data
+ OFFLOAD_TIMER_INIT();
+
+ OFFLOAD_TIMER_START(c_offload_target_total_time);
+
+ OFFLOAD_TIMER_START(c_offload_target_descriptor_setup);
+
+ // get input/output buffer addresses
+ if (func->in_datalen > 0 || func->out_datalen > 0) {
+ if (func->data_offset != 0) {
+ in_data = (char*) misc_data + func->data_offset;
+ out_data = (char*) return_data;
+ }
+ else {
+ char *inout_buf = (char*) buffers[--buffer_count];
+ in_data = inout_buf;
+ out_data = inout_buf;
+ }
+ }
+
+ // assign variable descriptors
+ ofld.m_vars_total = func->vars_num;
+ if (ofld.m_vars_total > 0) {
+ uint64_t var_data_len = ofld.m_vars_total * sizeof(VarDesc);
+
+ ofld.m_vars = (VarDesc*) malloc(var_data_len);
+ if (ofld.m_vars == NULL)
+ LIBOFFLOAD_ERROR(c_malloc);
+ memcpy(ofld.m_vars, in_data, var_data_len);
+
+ in_data += var_data_len;
+ func->in_datalen -= var_data_len;
+ }
+
+ // timer data
+ if (func->timer_enabled) {
+ uint64_t timer_data_len = OFFLOAD_TIMER_DATALEN();
+
+ timer_data = out_data;
+ out_data += timer_data_len;
+ func->out_datalen -= timer_data_len;
+ }
+
+ // init Marshallers
+ ofld.m_in.init_buffer(in_data, func->in_datalen);
+ ofld.m_out.init_buffer(out_data, func->out_datalen);
+
+ // copy buffers to offload descriptor
+ std::copy(buffers, buffers + buffer_count,
+ std::back_inserter(ofld.m_buffers));
+
+ OFFLOAD_TIMER_STOP(c_offload_target_descriptor_setup);
+
+ // find offload entry address
+ OFFLOAD_TIMER_START(c_offload_target_func_lookup);
+
+ offload_func_with_parms entry = (offload_func_with_parms)
+ __offload_entries.find_addr(name);
+
+ if (entry == NULL) {
+#if OFFLOAD_DEBUG > 0
+ if (console_enabled > 2) {
+ __offload_entries.dump();
+ }
+#endif
+ LIBOFFLOAD_ERROR(c_offload_descriptor_offload, name);
+ exit(1);
+ }
+
+ OFFLOAD_TIMER_STOP(c_offload_target_func_lookup);
+
+ OFFLOAD_TIMER_START(c_offload_target_func_time);
+
+ // execute offload entry
+ entry(&ofld);
+
+ OFFLOAD_TIMER_STOP(c_offload_target_func_time);
+
+ OFFLOAD_TIMER_STOP(c_offload_target_total_time);
+
+ // copy timer data to the buffer
+ OFFLOAD_TIMER_TARGET_DATA(timer_data);
+
+ OFFLOAD_DEBUG_TRACE(2, "Offload \"%s\" finished\n", name);
+
+#ifdef SEP_SUPPORT
+ if (sep_monitor) {
+ if (__sync_sub_and_fetch(&sep_counter, 1) == 0) {
+ OFFLOAD_DEBUG_TRACE(2, "VTPauseSampling\n");
+ VTPauseSampling();
+ }
+ }
+#endif // SEP_SUPPORT
+}
+
+void OffloadDescriptor::merge_var_descs(
+ VarDesc *vars,
+ VarDesc2 *vars2,
+ int vars_total
+)
+{
+ // number of variable descriptors received from host and generated
+ // locally should match
+ if (m_vars_total < vars_total) {
+ LIBOFFLOAD_ERROR(c_merge_var_descs1);
+ exit(1);
+ }
+
+ for (int i = 0; i < m_vars_total; i++) {
+ if (i < vars_total) {
+ // variable type must match
+ if (m_vars[i].type.bits != vars[i].type.bits) {
+ LIBOFFLOAD_ERROR(c_merge_var_descs2);
+ exit(1);
+ }
+
+ m_vars[i].ptr = vars[i].ptr;
+ m_vars[i].into = vars[i].into;
+
+ const char *var_sname = "";
+ if (vars2 != NULL) {
+ if (vars2[i].sname != NULL) {
+ var_sname = vars2[i].sname;
+ }
+ }
+ OFFLOAD_DEBUG_TRACE_1(2, get_offload_number(), c_offload_var,
+ " VarDesc %d, var=%s, %s, %s\n",
+ i, var_sname,
+ vardesc_direction_as_string[m_vars[i].direction.bits],
+ vardesc_type_as_string[m_vars[i].type.src]);
+ if (vars2 != NULL && vars2[i].dname != NULL) {
+ OFFLOAD_TRACE(2, " into=%s, %s\n", vars2[i].dname,
+ vardesc_type_as_string[m_vars[i].type.dst]);
+ }
+ }
+ OFFLOAD_TRACE(2,
+ " type_src=%d, type_dstn=%d, direction=%d, "
+ "alloc_if=%d, free_if=%d, align=%d, mic_offset=%d, flags=0x%x, "
+ "offset=%lld, size=%lld, count/disp=%lld, ptr=%p into=%p\n",
+ m_vars[i].type.src,
+ m_vars[i].type.dst,
+ m_vars[i].direction.bits,
+ m_vars[i].alloc_if,
+ m_vars[i].free_if,
+ m_vars[i].align,
+ m_vars[i].mic_offset,
+ m_vars[i].flags.bits,
+ m_vars[i].offset,
+ m_vars[i].size,
+ m_vars[i].count,
+ m_vars[i].ptr,
+ m_vars[i].into);
+ }
+}
+
+void OffloadDescriptor::scatter_copyin_data()
+{
+ OFFLOAD_TIMER_START(c_offload_target_scatter_inputs);
+
+ OFFLOAD_DEBUG_TRACE(2, "IN buffer @ %p size %lld\n",
+ m_in.get_buffer_start(),
+ m_in.get_buffer_size());
+ OFFLOAD_DEBUG_DUMP_BYTES(2, m_in.get_buffer_start(),
+ m_in.get_buffer_size());
+
+ // receive data
+ for (int i = 0; i < m_vars_total; i++) {
+ bool src_is_for_mic = (m_vars[i].direction.out ||
+ m_vars[i].into == NULL);
+ void** ptr_addr = src_is_for_mic ?
+ static_cast<void**>(m_vars[i].ptr) :
+ static_cast<void**>(m_vars[i].into);
+ int type = src_is_for_mic ? m_vars[i].type.src :
+ m_vars[i].type.dst;
+ bool is_static = src_is_for_mic ?
+ m_vars[i].flags.is_static :
+ m_vars[i].flags.is_static_dstn;
+ void *ptr = NULL;
+
+ if (m_vars[i].flags.alloc_disp) {
+ int64_t offset = 0;
+ m_in.receive_data(&offset, sizeof(offset));
+ m_vars[i].offset = -offset;
+ }
+ if (VAR_TYPE_IS_DV_DATA_SLICE(type) ||
+ VAR_TYPE_IS_DV_DATA(type)) {
+ ArrDesc *dvp = (type == c_dv_data_slice || type == c_dv_data)?
+ reinterpret_cast<ArrDesc*>(ptr_addr) :
+ *reinterpret_cast<ArrDesc**>(ptr_addr);
+ ptr_addr = reinterpret_cast<void**>(&dvp->Base);
+ }
+
+ // Set pointer values
+ switch (type) {
+ case c_data_ptr_array:
+ {
+ int j = m_vars[i].ptr_arr_offset;
+ int max_el = j + m_vars[i].count;
+ char *dst_arr_ptr = (src_is_for_mic)?
+ *(reinterpret_cast<char**>(m_vars[i].ptr)) :
+ reinterpret_cast<char*>(m_vars[i].into);
+
+ for (; j < max_el; j++) {
+ if (src_is_for_mic) {
+ m_vars[j].ptr =
+ dst_arr_ptr + m_vars[j].ptr_arr_offset;
+ }
+ else {
+ m_vars[j].into =
+ dst_arr_ptr + m_vars[j].ptr_arr_offset;
+ }
+ }
+ }
+ break;
+ case c_data:
+ case c_void_ptr:
+ case c_cean_var:
+ case c_dv:
+ break;
+
+ case c_string_ptr:
+ case c_data_ptr:
+ case c_cean_var_ptr:
+ case c_dv_ptr:
+ if (m_vars[i].alloc_if) {
+ void *buf;
+ if (m_vars[i].flags.sink_addr) {
+ m_in.receive_data(&buf, sizeof(buf));
+ }
+ else {
+ buf = m_buffers.front();
+ m_buffers.pop_front();
+ }
+ if (buf) {
+ if (!is_static) {
+ if (!m_vars[i].flags.sink_addr) {
+ // increment buffer reference
+ OFFLOAD_TIMER_START(c_offload_target_add_buffer_refs);
+ BufferAddRef(buf);
+ OFFLOAD_TIMER_STOP(c_offload_target_add_buffer_refs);
+ }
+ add_ref_count(buf, 0 == m_vars[i].flags.sink_addr);
+ }
+ ptr = static_cast<char*>(buf) +
+ m_vars[i].mic_offset +
+ (m_vars[i].flags.is_stack_buf ?
+ 0 : m_vars[i].offset);
+ }
+ *ptr_addr = ptr;
+ }
+ else if (m_vars[i].flags.sink_addr) {
+ void *buf;
+ m_in.receive_data(&buf, sizeof(buf));
+ void *ptr = static_cast<char*>(buf) +
+ m_vars[i].mic_offset +
+ (m_vars[i].flags.is_stack_buf ?
+ 0 : m_vars[i].offset);
+ *ptr_addr = ptr;
+ }
+ break;
+
+ case c_func_ptr:
+ break;
+
+ case c_dv_data:
+ case c_dv_ptr_data:
+ case c_dv_data_slice:
+ case c_dv_ptr_data_slice:
+ if (m_vars[i].alloc_if) {
+ void *buf;
+ if (m_vars[i].flags.sink_addr) {
+ m_in.receive_data(&buf, sizeof(buf));
+ }
+ else {
+ buf = m_buffers.front();
+ m_buffers.pop_front();
+ }
+ if (buf) {
+ if (!is_static) {
+ if (!m_vars[i].flags.sink_addr) {
+ // increment buffer reference
+ OFFLOAD_TIMER_START(c_offload_target_add_buffer_refs);
+ BufferAddRef(buf);
+ OFFLOAD_TIMER_STOP(c_offload_target_add_buffer_refs);
+ }
+ add_ref_count(buf, 0 == m_vars[i].flags.sink_addr);
+ }
+ ptr = static_cast<char*>(buf) +
+ m_vars[i].mic_offset + m_vars[i].offset;
+ }
+ *ptr_addr = ptr;
+ }
+ else if (m_vars[i].flags.sink_addr) {
+ void *buf;
+ m_in.receive_data(&buf, sizeof(buf));
+ ptr = static_cast<char*>(buf) +
+ m_vars[i].mic_offset + m_vars[i].offset;
+ *ptr_addr = ptr;
+ }
+ break;
+
+ default:
+ LIBOFFLOAD_ERROR(c_unknown_var_type, type);
+ abort();
+ }
+ // Release obsolete buffers for stack of persistent objects
+ if (type = c_data_ptr &&
+ m_vars[i].flags.is_stack_buf &&
+ !m_vars[i].direction.bits &&
+ m_vars[i].alloc_if &&
+ m_vars[i].size != 0) {
+ for (int j=0; j < m_vars[i].size; j++) {
+ void *buf;
+ m_in.receive_data(&buf, sizeof(buf));
+ BufferReleaseRef(buf);
+ ref_data.erase(buf);
+ }
+ }
+ // Do copyin
+ switch (m_vars[i].type.dst) {
+ case c_data_ptr_array:
+ break;
+ case c_data:
+ case c_void_ptr:
+ case c_cean_var:
+ if (m_vars[i].direction.in &&
+ !m_vars[i].flags.is_static_dstn) {
+ int64_t size;
+ int64_t disp;
+ char* ptr = m_vars[i].into ?
+ static_cast<char*>(m_vars[i].into) :
+ static_cast<char*>(m_vars[i].ptr);
+ if (m_vars[i].type.dst == c_cean_var) {
+ m_in.receive_data((&size), sizeof(int64_t));
+ m_in.receive_data((&disp), sizeof(int64_t));
+ }
+ else {
+ size = m_vars[i].size;
+ disp = 0;
+ }
+ m_in.receive_data(ptr + disp, size);
+ }
+ break;
+
+ case c_dv:
+ if (m_vars[i].direction.bits ||
+ m_vars[i].alloc_if ||
+ m_vars[i].free_if) {
+ char* ptr = m_vars[i].into ?
+ static_cast<char*>(m_vars[i].into) :
+ static_cast<char*>(m_vars[i].ptr);
+ m_in.receive_data(ptr + sizeof(uint64_t),
+ m_vars[i].size - sizeof(uint64_t));
+ }
+ break;
+
+ case c_string_ptr:
+ case c_data_ptr:
+ case c_cean_var_ptr:
+ case c_dv_ptr:
+ case c_dv_data:
+ case c_dv_ptr_data:
+ case c_dv_data_slice:
+ case c_dv_ptr_data_slice:
+ break;
+
+ case c_func_ptr:
+ if (m_vars[i].direction.in) {
+ m_in.receive_func_ptr((const void**) m_vars[i].ptr);
+ }
+ break;
+
+ default:
+ LIBOFFLOAD_ERROR(c_unknown_var_type, m_vars[i].type.dst);
+ abort();
+ }
+ }
+
+ OFFLOAD_TRACE(1, "Total copyin data received from host: [%lld] bytes\n",
+ m_in.get_tfr_size());
+
+ OFFLOAD_TIMER_STOP(c_offload_target_scatter_inputs);
+
+ OFFLOAD_TIMER_START(c_offload_target_compute);
+}
+
+void OffloadDescriptor::gather_copyout_data()
+{
+ OFFLOAD_TIMER_STOP(c_offload_target_compute);
+
+ OFFLOAD_TIMER_START(c_offload_target_gather_outputs);
+
+ for (int i = 0; i < m_vars_total; i++) {
+ bool src_is_for_mic = (m_vars[i].direction.out ||
+ m_vars[i].into == NULL);
+
+ switch (m_vars[i].type.src) {
+ case c_data_ptr_array:
+ break;
+ case c_data:
+ case c_void_ptr:
+ case c_cean_var:
+ if (m_vars[i].direction.out &&
+ !m_vars[i].flags.is_static) {
+ m_out.send_data(
+ static_cast<char*>(m_vars[i].ptr) + m_vars[i].disp,
+ m_vars[i].size);
+ }
+ break;
+
+ case c_dv:
+ break;
+
+ case c_string_ptr:
+ case c_data_ptr:
+ case c_cean_var_ptr:
+ case c_dv_ptr:
+ if (m_vars[i].free_if &&
+ src_is_for_mic &&
+ !m_vars[i].flags.is_static) {
+ void *buf = *static_cast<char**>(m_vars[i].ptr) -
+ m_vars[i].mic_offset -
+ (m_vars[i].flags.is_stack_buf?
+ 0 : m_vars[i].offset);
+ if (buf == NULL) {
+ break;
+ }
+ // decrement buffer reference count
+ OFFLOAD_TIMER_START(c_offload_target_release_buffer_refs);
+ BufReleaseRef(buf);
+ OFFLOAD_TIMER_STOP(c_offload_target_release_buffer_refs);
+ }
+ break;
+
+ case c_func_ptr:
+ if (m_vars[i].direction.out) {
+ m_out.send_func_ptr(*((void**) m_vars[i].ptr));
+ }
+ break;
+
+ case c_dv_data:
+ case c_dv_ptr_data:
+ case c_dv_data_slice:
+ case c_dv_ptr_data_slice:
+ if (src_is_for_mic &&
+ m_vars[i].free_if &&
+ !m_vars[i].flags.is_static) {
+ ArrDesc *dvp = (m_vars[i].type.src == c_dv_data ||
+ m_vars[i].type.src == c_dv_data_slice) ?
+ static_cast<ArrDesc*>(m_vars[i].ptr) :
+ *static_cast<ArrDesc**>(m_vars[i].ptr);
+
+ void *buf = reinterpret_cast<char*>(dvp->Base) -
+ m_vars[i].mic_offset -
+ m_vars[i].offset;
+
+ if (buf == NULL) {
+ break;
+ }
+
+ // decrement buffer reference count
+ OFFLOAD_TIMER_START(c_offload_target_release_buffer_refs);
+ BufReleaseRef(buf);
+ OFFLOAD_TIMER_STOP(c_offload_target_release_buffer_refs);
+ }
+ break;
+
+ default:
+ LIBOFFLOAD_ERROR(c_unknown_var_type, m_vars[i].type.dst);
+ abort();
+ }
+
+ if (m_vars[i].into) {
+ switch (m_vars[i].type.dst) {
+ case c_data_ptr_array:
+ break;
+ case c_data:
+ case c_void_ptr:
+ case c_cean_var:
+ case c_dv:
+ break;
+
+ case c_string_ptr:
+ case c_data_ptr:
+ case c_cean_var_ptr:
+ case c_dv_ptr:
+ if (m_vars[i].direction.in &&
+ m_vars[i].free_if &&
+ !m_vars[i].flags.is_static_dstn) {
+ void *buf = *static_cast<char**>(m_vars[i].into) -
+ m_vars[i].mic_offset -
+ (m_vars[i].flags.is_stack_buf?
+ 0 : m_vars[i].offset);
+
+ if (buf == NULL) {
+ break;
+ }
+ // decrement buffer reference count
+ OFFLOAD_TIMER_START(
+ c_offload_target_release_buffer_refs);
+ BufReleaseRef(buf);
+ OFFLOAD_TIMER_STOP(
+ c_offload_target_release_buffer_refs);
+ }
+ break;
+
+ case c_func_ptr:
+ break;
+
+ case c_dv_data:
+ case c_dv_ptr_data:
+ case c_dv_data_slice:
+ case c_dv_ptr_data_slice:
+ if (m_vars[i].free_if &&
+ m_vars[i].direction.in &&
+ !m_vars[i].flags.is_static_dstn) {
+ ArrDesc *dvp =
+ (m_vars[i].type.dst == c_dv_data_slice ||
+ m_vars[i].type.dst == c_dv_data) ?
+ static_cast<ArrDesc*>(m_vars[i].into) :
+ *static_cast<ArrDesc**>(m_vars[i].into);
+ void *buf = reinterpret_cast<char*>(dvp->Base) -
+ m_vars[i].mic_offset -
+ m_vars[i].offset;
+
+ if (buf == NULL) {
+ break;
+ }
+ // decrement buffer reference count
+ OFFLOAD_TIMER_START(
+ c_offload_target_release_buffer_refs);
+ BufReleaseRef(buf);
+ OFFLOAD_TIMER_STOP(
+ c_offload_target_release_buffer_refs);
+ }
+ break;
+
+ default:
+ LIBOFFLOAD_ERROR(c_unknown_var_type, m_vars[i].type.dst);
+ abort();
+ }
+ }
+ }
+
+ OFFLOAD_DEBUG_TRACE(2, "OUT buffer @ p %p size %lld\n",
+ m_out.get_buffer_start(),
+ m_out.get_buffer_size());
+
+ OFFLOAD_DEBUG_DUMP_BYTES(2,
+ m_out.get_buffer_start(),
+ m_out.get_buffer_size());
+
+ OFFLOAD_DEBUG_TRACE_1(1, get_offload_number(), c_offload_copyout_data,
+ "Total copyout data sent to host: [%lld] bytes\n",
+ m_out.get_tfr_size());
+
+ OFFLOAD_TIMER_STOP(c_offload_target_gather_outputs);
+}
+
+void __offload_target_init(void)
+{
+#ifdef SEP_SUPPORT
+ const char* env_var = getenv(sep_monitor_env);
+ if (env_var != 0 && *env_var != '\0') {
+ sep_monitor = atoi(env_var);
+ }
+ env_var = getenv(sep_device_env);
+ if (env_var != 0 && *env_var != '\0') {
+ sep_device = env_var;
+ }
+#endif // SEP_SUPPORT
+
+ prefix = report_get_message_str(c_report_mic);
+
+ // init frequency
+ mic_frequency = COIPerfGetCycleFrequency();
+}
+
+// User-visible offload API
+
+int _Offload_number_of_devices(void)
+{
+ return mic_engines_total;
+}
+
+int _Offload_get_device_number(void)
+{
+ return mic_index;
+}
+
+int _Offload_get_physical_device_number(void)
+{
+ uint32_t index;
+ EngineGetIndex(&index);
+ return index;
+}
diff --git a/liboffloadmic/runtime/offload_target.h b/liboffloadmic/runtime/offload_target.h
new file mode 100644
index 00000000000..f3a42f982c8
--- /dev/null
+++ b/liboffloadmic/runtime/offload_target.h
@@ -0,0 +1,120 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+// The parts of the offload library used only on the target
+
+#ifndef OFFLOAD_TARGET_H_INCLUDED
+#define OFFLOAD_TARGET_H_INCLUDED
+
+#include "offload_common.h"
+#include "coi/coi_server.h"
+
+// The offload descriptor.
+class OffloadDescriptor
+{
+public:
+ ~OffloadDescriptor() {
+ if (m_vars != 0) {
+ free(m_vars);
+ }
+ }
+
+ // Entry point for COI. Synchronously execute offloaded region given
+ // the provided buffers, misc and return data.
+ static void offload(
+ uint32_t buffer_count,
+ void** buffers,
+ void* misc_data,
+ uint16_t misc_data_len,
+ void* return_data,
+ uint16_t return_data_len
+ );
+
+ // scatters input data from in buffer to target variables
+ void scatter_copyin_data();
+
+ // gathers output data to the buffer
+ void gather_copyout_data();
+
+ // merges local variable descriptors with the descriptors received from
+ // host
+ void merge_var_descs(VarDesc *vars, VarDesc2 *vars2, int vars_total);
+
+ int get_offload_number() const {
+ return m_offload_number;
+ }
+
+ void set_offload_number(int number) {
+ m_offload_number = number;
+ }
+
+private:
+ // Constructor
+ OffloadDescriptor() : m_vars(0)
+ {}
+
+private:
+ typedef std::list<void*> BufferList;
+
+ // The Marshaller for the inputs of the offloaded region.
+ Marshaller m_in;
+
+ // The Marshaller for the outputs of the offloaded region.
+ Marshaller m_out;
+
+ // List of buffers that are passed to dispatch call
+ BufferList m_buffers;
+
+ // Variable descriptors received from host
+ VarDesc* m_vars;
+ int m_vars_total;
+ int m_offload_number;
+};
+
+// one time target initialization in main
+extern void __offload_target_init(void);
+
+// logical device index
+extern int mic_index;
+
+// total number of available logical devices
+extern int mic_engines_total;
+
+// device frequency (from COI)
+extern uint64_t mic_frequency;
+
+struct RefInfo {
+ RefInfo(bool is_add, long amount):is_added(is_add),count(amount)
+ {}
+ bool is_added;
+ long count;
+};
+
+#endif // OFFLOAD_TARGET_H_INCLUDED
diff --git a/liboffloadmic/runtime/offload_target_main.cpp b/liboffloadmic/runtime/offload_target_main.cpp
new file mode 100644
index 00000000000..90aca8f0812
--- /dev/null
+++ b/liboffloadmic/runtime/offload_target_main.cpp
@@ -0,0 +1,37 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+extern "C" void __offload_target_main(void);
+
+int main(int argc, char ** argv)
+{
+ __offload_target_main();
+ return 0;
+}
diff --git a/liboffloadmic/runtime/offload_timer.h b/liboffloadmic/runtime/offload_timer.h
new file mode 100644
index 00000000000..847f9d15eda
--- /dev/null
+++ b/liboffloadmic/runtime/offload_timer.h
@@ -0,0 +1,192 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#ifndef OFFLOAD_TIMER_H_INCLUDED
+#define OFFLOAD_TIMER_H_INCLUDED
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdint.h>
+#include "liboffload_error_codes.h"
+
+extern int timer_enabled;
+
+#ifdef TIMING_SUPPORT
+
+struct OffloadTargetTimerData {
+ uint64_t frequency;
+ struct {
+ uint64_t start;
+ uint64_t total;
+ } phases[c_offload_target_max_phase];
+};
+
+struct OffloadHostTimerData {
+ // source file name and line number
+ const char* file;
+ int line;
+
+ // host timer data
+ struct {
+ uint64_t start;
+ uint64_t total;
+ } phases[c_offload_host_max_phase];
+
+ uint64_t sent_bytes;
+ uint64_t received_bytes;
+ int card_number;
+ int offload_number;
+
+ // target timer data
+ OffloadTargetTimerData target;
+
+ // next element
+ OffloadHostTimerData *next;
+};
+
+#if HOST_LIBRARY
+
+extern int offload_report_level;
+extern int offload_report_enabled;
+#define OFFLOAD_REPORT_1 1
+#define OFFLOAD_REPORT_2 2
+#define OFFLOAD_REPORT_3 3
+#define OFFLOAD_REPORT_ON 1
+#define OFFLOAD_REPORT_OFF 0
+
+#define OFFLOAD_TIMER_DATALEN() \
+ ((timer_enabled || (offload_report_level && offload_report_enabled)) ? \
+ ((1 + c_offload_target_max_phase) * sizeof(uint64_t)) : 0)
+
+#define OFFLOAD_TIMER_START(timer_data, pnode) \
+ if (timer_enabled || \
+ (offload_report_level && offload_report_enabled)) { \
+ offload_timer_start(timer_data, pnode); \
+ }
+
+#define OFFLOAD_TIMER_STOP(timer_data, pnode) \
+ if (timer_enabled || \
+ (offload_report_level && offload_report_enabled)) { \
+ offload_timer_stop(timer_data, pnode); \
+ }
+
+#define OFFLOAD_TIMER_INIT(file, line) \
+ offload_timer_init(file, line);
+
+#define OFFLOAD_TIMER_TARGET_DATA(timer_data, data) \
+ if (timer_enabled || \
+ (offload_report_level && offload_report_enabled)) { \
+ offload_timer_fill_target_data(timer_data, data); \
+ }
+
+#define OFFLOAD_TIMER_HOST_SDATA(timer_data, data) \
+ if (offload_report_level && offload_report_enabled) { \
+ offload_timer_fill_host_sdata(timer_data, data); \
+ }
+
+#define OFFLOAD_TIMER_HOST_RDATA(timer_data, data) \
+ if (offload_report_level && offload_report_enabled) { \
+ offload_timer_fill_host_rdata(timer_data, data); \
+ }
+
+#define OFFLOAD_TIMER_HOST_MIC_NUM(timer_data, data) \
+ if (offload_report_level && offload_report_enabled) { \
+ offload_timer_fill_host_mic_num(timer_data, data); \
+ }
+
+extern void offload_timer_start(OffloadHostTimerData *,
+ OffloadHostPhase t_node);
+extern void offload_timer_stop(OffloadHostTimerData *,
+ OffloadHostPhase t_node);
+extern OffloadHostTimerData * offload_timer_init(const char *file, int line);
+extern void offload_timer_fill_target_data(OffloadHostTimerData *,
+ void *data);
+extern void offload_timer_fill_host_sdata(OffloadHostTimerData *,
+ uint64_t sent_bytes);
+extern void offload_timer_fill_host_rdata(OffloadHostTimerData *,
+ uint64_t sent_bytes);
+extern void offload_timer_fill_host_mic_num(OffloadHostTimerData *,
+ int card_number);
+
+// Utility structure for starting/stopping timer
+struct OffloadTimer {
+ OffloadTimer(OffloadHostTimerData *data, OffloadHostPhase phase) :
+ m_data(data),
+ m_phase(phase)
+ {
+ OFFLOAD_TIMER_START(m_data, m_phase);
+ }
+
+ ~OffloadTimer()
+ {
+ OFFLOAD_TIMER_STOP(m_data, m_phase);
+ }
+
+private:
+ OffloadHostTimerData* m_data;
+ OffloadHostPhase m_phase;
+};
+
+#else
+
+#define OFFLOAD_TIMER_DATALEN() \
+ ((timer_enabled) ? \
+ ((1 + c_offload_target_max_phase) * sizeof(uint64_t)) : 0)
+
+#define OFFLOAD_TIMER_START(pnode) \
+ if (timer_enabled) offload_timer_start(pnode);
+
+#define OFFLOAD_TIMER_STOP(pnode) \
+ if (timer_enabled) offload_timer_stop(pnode);
+
+#define OFFLOAD_TIMER_INIT() \
+ if (timer_enabled) offload_timer_init();
+
+#define OFFLOAD_TIMER_TARGET_DATA(data) \
+ if (timer_enabled) offload_timer_fill_target_data(data);
+
+extern void offload_timer_start(OffloadTargetPhase t_node);
+extern void offload_timer_stop(OffloadTargetPhase t_node);
+extern void offload_timer_init(void);
+extern void offload_timer_fill_target_data(void *data);
+
+#endif // HOST_LIBRARY
+
+#else // TIMING_SUPPORT
+
+#define OFFLOAD_TIMER_START(...)
+#define OFFLOAD_TIMER_STOP(...)
+#define OFFLOAD_TIMER_INIT(...)
+#define OFFLOAD_TIMER_TARGET_DATA(...)
+#define OFFLOAD_TIMER_DATALEN(...) (0)
+
+#endif // TIMING_SUPPORT
+
+#endif // OFFLOAD_TIMER_H_INCLUDED
diff --git a/liboffloadmic/runtime/offload_timer_host.cpp b/liboffloadmic/runtime/offload_timer_host.cpp
new file mode 100644
index 00000000000..719af887abc
--- /dev/null
+++ b/liboffloadmic/runtime/offload_timer_host.cpp
@@ -0,0 +1,379 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "offload_timer.h"
+
+#ifdef __INTEL_COMPILER
+#include <ia32intrin.h>
+#else // __INTEL_COMPILER
+#include <x86intrin.h>
+#endif // __INTEL_COMPILER
+
+#include "offload_host.h"
+#include <sstream>
+#include <iostream>
+#include <iomanip>
+
+int timer_enabled = 0;
+
+#ifdef TIMING_SUPPORT
+
+int offload_report_level = 0;
+int offload_report_enabled = 1;
+
+static const int host_timer_prefix_spaces[] = {
+ /*c_offload_host_setup_buffers*/ 0,
+ /*c_offload_host_initialize*/ 2,
+ /*c_offload_host_target_acquire*/ 2,
+ /*c_offload_host_wait_deps*/ 2,
+ /*c_offload_host_setup_buffers*/ 2,
+ /*c_offload_host_alloc_buffers*/ 4,
+ /*c_offload_host_setup_misc_data*/ 2,
+ /*c_offload_host_alloc_data_buffer*/ 4,
+ /*c_offload_host_send_pointers*/ 2,
+ /*c_offload_host_gather_inputs*/ 2,
+ /*c_offload_host_map_in_data_buffer*/ 4,
+ /*c_offload_host_unmap_in_data_buffer*/ 4,
+ /*c_offload_host_start_compute*/ 2,
+ /*c_offload_host_wait_compute*/ 2,
+ /*c_offload_host_start_buffers_reads*/ 2,
+ /*c_offload_host_scatter_outputs*/ 2,
+ /*c_offload_host_map_out_data_buffer*/ 4,
+ /*c_offload_host_unmap_out_data_buffer*/ 4,
+ /*c_offload_host_wait_buffers_reads*/ 2,
+ /*c_offload_host_destroy_buffers*/ 2
+};
+
+const static int target_timer_prefix_spaces[] = {
+/*c_offload_target_total_time*/ 0,
+/*c_offload_target_descriptor_setup*/ 2,
+/*c_offload_target_func_lookup*/ 2,
+/*c_offload_target_func_time*/ 2,
+/*c_offload_target_scatter_inputs*/ 4,
+/*c_offload_target_add_buffer_refs*/ 6,
+/*c_offload_target_compute*/ 4,
+/*c_offload_target_gather_outputs*/ 4,
+/*c_offload_target_release_buffer_refs*/ 6
+};
+
+static OffloadHostTimerData* timer_data_head;
+static OffloadHostTimerData* timer_data_tail;
+static mutex_t timer_data_mutex;
+
+static void offload_host_phase_name(std::stringstream &ss, int p_node);
+static void offload_target_phase_name(std::stringstream &ss, int p_node);
+
+extern void Offload_Timer_Print(void)
+{
+ std::string buf;
+ std::stringstream ss;
+ const char *stars =
+ "**************************************************************";
+
+ ss << "\n\n" << stars << "\n";
+ ss << " ";
+ ss << report_get_message_str(c_report_title) << "\n";
+ ss << stars << "\n";
+ double frequency = cpu_frequency;
+
+ for (OffloadHostTimerData *pnode = timer_data_head;
+ pnode != 0; pnode = pnode->next) {
+ ss << " ";
+ ss << report_get_message_str(c_report_from_file) << " "<< pnode->file;
+ ss << report_get_message_str(c_report_line) << " " << pnode->line;
+ ss << "\n";
+ for (int i = 0; i < c_offload_host_max_phase ; i++) {
+ ss << " ";
+ offload_host_phase_name(ss, i);
+ ss << " " << std::fixed << std::setprecision(5);
+ ss << (double)pnode->phases[i].total / frequency << "\n";
+ }
+
+ for (int i = 0; i < c_offload_target_max_phase ; i++) {
+ double time = 0;
+ if (pnode->target.frequency != 0) {
+ time = (double) pnode->target.phases[i].total /
+ (double) pnode->target.frequency;
+ }
+ ss << " ";
+ offload_target_phase_name(ss, i);
+ ss << " " << std::fixed << std::setprecision(5);
+ ss << time << "\n";
+ }
+ }
+
+ buf = ss.str();
+ fprintf(stdout, buf.data());
+ fflush(stdout);
+}
+
+extern void Offload_Report_Prolog(OffloadHostTimerData *pnode)
+{
+ double frequency = cpu_frequency;
+ std::string buf;
+ std::stringstream ss;
+
+ if (pnode) {
+ // [Offload] [Mic 0] [File] file.c
+ ss << "[" << report_get_message_str(c_report_offload) << "] [";
+ ss << report_get_message_str(c_report_mic) << " ";
+ ss << pnode->card_number << "] [";
+ ss << report_get_message_str(c_report_file);
+ ss << "] " << pnode->file << "\n";
+
+ // [Offload] [Mic 0] [Line] 1234
+ ss << "[" << report_get_message_str(c_report_offload) << "] [";
+ ss << report_get_message_str(c_report_mic) << " ";
+ ss << pnode->card_number << "] [";
+ ss << report_get_message_str(c_report_line);
+ ss << "] " << pnode->line << "\n";
+
+ // [Offload] [Mic 0] [Tag] Tag 1
+ ss << "[" << report_get_message_str(c_report_offload) << "] [";
+ ss << report_get_message_str(c_report_mic) << " ";
+ ss << pnode->card_number << "] [";
+ ss << report_get_message_str(c_report_tag);
+ ss << "] " << report_get_message_str(c_report_tag);
+ ss << " " << pnode->offload_number << "\n";
+
+ buf = ss.str();
+ fprintf(stdout, buf.data());
+ fflush(stdout);
+ }
+}
+
+extern void Offload_Report_Epilog(OffloadHostTimerData * timer_data)
+{
+ double frequency = cpu_frequency;
+ std::string buf;
+ std::stringstream ss;
+
+ OffloadHostTimerData *pnode = timer_data;
+
+ if (!pnode) {
+ return;
+ }
+ ss << "[" << report_get_message_str(c_report_offload) << "] [";
+ ss << report_get_message_str(c_report_host) << "] [";
+ ss << report_get_message_str(c_report_tag) << " ";
+ ss << pnode->offload_number << "] [";
+ ss << report_get_message_str(c_report_cpu_time) << "] ";
+ ss << std::fixed << std::setprecision(6);
+ ss << (double) pnode->phases[0].total / frequency;
+ ss << report_get_message_str(c_report_seconds) << "\n";
+
+ if (offload_report_level >= OFFLOAD_REPORT_2) {
+ ss << "[" << report_get_message_str(c_report_offload) << "] [";
+ ss << report_get_message_str(c_report_mic);
+ ss << " " << pnode->card_number;
+ ss << "] [" << report_get_message_str(c_report_tag) << " ";
+ ss << pnode->offload_number << "] [";
+ ss << report_get_message_str(c_report_cpu_to_mic_data) << "] ";
+ ss << pnode->sent_bytes << " ";
+ ss << report_get_message_str(c_report_bytes) << "\n";
+ }
+
+ double time = 0;
+ if (pnode->target.frequency != 0) {
+ time = (double) pnode->target.phases[0].total /
+ (double) pnode->target.frequency;
+ }
+ ss << "[" << report_get_message_str(c_report_offload) << "] [";
+ ss << report_get_message_str(c_report_mic) << " ";
+ ss << pnode->card_number<< "] [";
+ ss << report_get_message_str(c_report_tag) << " ";
+ ss << pnode->offload_number << "] [";
+ ss << report_get_message_str(c_report_mic_time) << "] ";
+ ss << std::fixed << std::setprecision(6) << time;
+ ss << report_get_message_str(c_report_seconds) << "\n";
+
+ if (offload_report_level >= OFFLOAD_REPORT_2) {
+ ss << "[" << report_get_message_str(c_report_offload) << "] [";
+ ss << report_get_message_str(c_report_mic);
+ ss << " " << pnode->card_number;
+ ss << "] [" << report_get_message_str(c_report_tag) << " ";
+ ss << pnode->offload_number << "] [";
+ ss << report_get_message_str(c_report_mic_to_cpu_data) << "] ";
+ ss << pnode->received_bytes << " ";
+ ss << report_get_message_str(c_report_bytes) << "\n";
+ }
+ ss << "\n";
+
+ buf = ss.str();
+ fprintf(stdout, buf.data());
+ fflush(stdout);
+
+ offload_report_free_data(timer_data);
+}
+
+extern void offload_report_free_data(OffloadHostTimerData * timer_data)
+{
+ OffloadHostTimerData *pnode_last = NULL;
+
+ for (OffloadHostTimerData *pnode = timer_data_head;
+ pnode != 0; pnode = pnode->next) {
+ if (timer_data == pnode) {
+ if (pnode_last) {
+ pnode_last->next = pnode->next;
+ }
+ else {
+ timer_data_head = pnode->next;
+ }
+ OFFLOAD_FREE(pnode);
+ break;
+ }
+ pnode_last = pnode;
+ }
+}
+
+static void fill_buf_with_spaces(std::stringstream &ss, int num)
+{
+ for (; num > 0; num--) {
+ ss << " ";
+ }
+}
+
+static void offload_host_phase_name(std::stringstream &ss, int p_node)
+{
+ int prefix_spaces;
+ int str_length;
+ int tail_length;
+ const int message_length = 40;
+ char const *str;
+
+ str = report_get_host_stage_str(p_node);
+ prefix_spaces = host_timer_prefix_spaces[p_node];
+ fill_buf_with_spaces(ss, prefix_spaces);
+ str_length = strlen(str);
+ ss << str;
+ tail_length = message_length - prefix_spaces - str_length;
+ tail_length = tail_length > 0? tail_length : 1;
+ fill_buf_with_spaces(ss, tail_length);
+}
+
+static void offload_target_phase_name(std::stringstream &ss, int p_node)
+{
+ int prefix_spaces;
+ int str_length;
+ const int message_length = 40;
+ int tail_length;
+ char const *str;
+
+ str = report_get_target_stage_str(p_node);
+ prefix_spaces = target_timer_prefix_spaces[p_node];
+ fill_buf_with_spaces(ss, prefix_spaces);
+ str_length = strlen(str);
+ ss << str;
+ tail_length = message_length - prefix_spaces - str_length;
+ tail_length = (tail_length > 0)? tail_length : 1;
+ fill_buf_with_spaces(ss, tail_length);
+}
+
+void offload_timer_start(OffloadHostTimerData * timer_data,
+ OffloadHostPhase p_type)
+{
+ timer_data->phases[p_type].start = _rdtsc();
+}
+
+void offload_timer_stop(OffloadHostTimerData * timer_data,
+ OffloadHostPhase p_type)
+{
+ timer_data->phases[p_type].total += _rdtsc() -
+ timer_data->phases[p_type].start;
+}
+
+void offload_timer_fill_target_data(OffloadHostTimerData * timer_data,
+ void *buf)
+{
+ uint64_t *data = (uint64_t*) buf;
+
+ timer_data->target.frequency = *data++;
+ for (int i = 0; i < c_offload_target_max_phase; i++) {
+ timer_data->target.phases[i].total = *data++;
+ }
+}
+
+void offload_timer_fill_host_sdata(OffloadHostTimerData * timer_data,
+ uint64_t sent_bytes)
+{
+ if (timer_data) {
+ timer_data->sent_bytes += sent_bytes;
+ }
+}
+
+void offload_timer_fill_host_rdata(OffloadHostTimerData * timer_data,
+ uint64_t received_bytes)
+{
+ if (timer_data) {
+ timer_data->received_bytes += received_bytes;
+ }
+}
+
+void offload_timer_fill_host_mic_num(OffloadHostTimerData * timer_data,
+ int card_number)
+{
+ if (timer_data) {
+ timer_data->card_number = card_number;
+ }
+}
+
+OffloadHostTimerData* offload_timer_init(const char *file, int line)
+{
+ static bool first_time = true;
+ OffloadHostTimerData* timer_data = NULL;
+
+ timer_data_mutex.lock();
+ {
+ if (timer_enabled ||
+ (offload_report_level && offload_report_enabled)) {
+ timer_data = (OffloadHostTimerData*)
+ OFFLOAD_MALLOC(sizeof(OffloadHostTimerData), 0);
+ memset(timer_data, 0, sizeof(OffloadHostTimerData));
+
+ timer_data->offload_number = OFFLOAD_DEBUG_INCR_OFLD_NUM() - 1;
+
+ if (timer_data_head == 0) {
+ timer_data_head = timer_data;
+ timer_data_tail = timer_data;
+ }
+ else {
+ timer_data_tail->next = timer_data;
+ timer_data_tail = timer_data;
+ }
+
+ timer_data->file = file;
+ timer_data->line = line;
+ }
+ }
+ timer_data_mutex.unlock();
+ return timer_data;
+}
+
+#endif // TIMING_SUPPORT
diff --git a/liboffloadmic/runtime/offload_timer_target.cpp b/liboffloadmic/runtime/offload_timer_target.cpp
new file mode 100644
index 00000000000..8dc4bbcc81d
--- /dev/null
+++ b/liboffloadmic/runtime/offload_timer_target.cpp
@@ -0,0 +1,87 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "offload_timer.h"
+#include "offload_target.h"
+
+#ifdef __INTEL_COMPILER
+#include <ia32intrin.h>
+#else // __INTEL_COMPILER
+#include <x86intrin.h>
+#endif // __INTEL_COMPILER
+
+
+
+int timer_enabled = 0;
+
+#ifdef TIMING_SUPPORT
+
+#if defined(LINUX) || defined(FREEBSD)
+static __thread OffloadTargetTimerData timer_data;
+#else // WINNT
+static __declspec(thread) OffloadTargetTimerData timer_data;
+#endif // defined(LINUX) || defined(FREEBSD)
+
+
+void offload_timer_start(
+ OffloadTargetPhase p_type
+)
+{
+ timer_data.phases[p_type].start = _rdtsc();
+}
+
+void offload_timer_stop(
+ OffloadTargetPhase p_type
+)
+{
+ timer_data.phases[p_type].total += _rdtsc() -
+ timer_data.phases[p_type].start;
+}
+
+void offload_timer_init()
+{
+ memset(&timer_data, 0, sizeof(OffloadTargetTimerData));
+}
+
+void offload_timer_fill_target_data(
+ void *buf
+)
+{
+ uint64_t *data = (uint64_t*) buf;
+
+ timer_data.frequency = mic_frequency;
+ memcpy(data++, &(timer_data.frequency), sizeof(uint64_t));
+
+ for (int i = 0; i < c_offload_target_max_phase; i++) {
+ memcpy(data++, &(timer_data.phases[i].total), sizeof(uint64_t));
+ }
+}
+
+#endif // TIMING_SUPPORT
diff --git a/liboffloadmic/runtime/offload_trace.cpp b/liboffloadmic/runtime/offload_trace.cpp
new file mode 100644
index 00000000000..4ba678cee37
--- /dev/null
+++ b/liboffloadmic/runtime/offload_trace.cpp
@@ -0,0 +1,329 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "offload_trace.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <sstream>
+#include "liboffload_error_codes.h"
+
+extern const char *prefix;
+
+#if !HOST_LIBRARY
+extern int mic_index;
+#endif
+
+// The debug routines
+
+static const char * offload_stage(std::stringstream &ss,
+ int offload_number,
+ const char *tag,
+ const char *text,
+ bool print_tag)
+{
+ ss << "[" << report_get_message_str(c_report_offload) << "]";
+#if HOST_LIBRARY
+ ss << " [" << prefix << "]";
+ if (print_tag) {
+ ss << " [" << report_get_message_str(c_report_tag);
+ ss << " " << offload_number << "]";
+ }
+ else {
+ ss << " ";
+ }
+ ss << " [" << tag << "]";
+ ss << " " << text;
+#else
+ ss << " [" << prefix << " " << mic_index << "]";
+ if (print_tag) {
+ ss << " [" << report_get_message_str(c_report_tag);
+ ss << " " << offload_number << "]";
+ }
+ ss << " [" << tag << "]";
+ ss << " " << text;
+#endif
+ return 0;
+}
+
+static const char * offload_signal(std::stringstream &ss,
+ int offload_number,
+ const char *tag,
+ const char *text)
+{
+ ss << "[" << report_get_message_str(c_report_offload) << "]";
+ ss << " [" << prefix << "]";
+ ss << " [" << report_get_message_str(c_report_tag);
+ ss << " " << offload_number << "]";
+ ss << " [" << tag << "]";
+ ss << " " << text;
+ return 0;
+}
+
+void offload_stage_print(int stage, int offload_number, ...)
+{
+ std::string buf;
+ std::stringstream ss;
+ char const *str1;
+ char const *str2;
+ va_list va_args;
+ va_start(va_args, offload_number);
+ va_arg(va_args, char*);
+
+ switch (stage) {
+ case c_offload_start:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_start);
+ offload_stage(ss, offload_number, str1, str2, true);
+ break;
+ case c_offload_init:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_init);
+ offload_stage(ss, offload_number, str1, str2, false);
+ ss << " " << report_get_message_str(c_report_logical_card);
+ ss << " " << va_arg(va_args, int);
+ ss << " = " << report_get_message_str(c_report_physical_card);
+ ss << " " << va_arg(va_args, int);
+ break;
+ case c_offload_register:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_register);
+ offload_stage(ss, offload_number, str1, str2, true);
+ break;
+ case c_offload_init_func:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_init_func);
+ offload_stage(ss, offload_number, str1, str2, true);
+ ss << ": " << va_arg(va_args, char*);
+ break;
+ case c_offload_create_buf_host:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_create_buf_host);
+ offload_stage(ss, offload_number, str1, str2, true);
+ ss << ": base=0x" << std::hex << va_arg(va_args, uint64_t);
+ ss << " length=" << std::dec << va_arg(va_args, uint64_t);
+ break;
+ case c_offload_create_buf_mic:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_create_buf_mic);
+ offload_stage(ss, offload_number, str1, str2, true);
+ ss << ": size=" << va_arg(va_args, uint64_t);
+ ss << " offset=" << va_arg(va_args, int);
+ if (va_arg(va_args,int))
+ ss << " (2M page)";
+ break;
+ case c_offload_send_pointer_data:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_send_pointer_data);
+ offload_stage(ss, offload_number, str1, str2, true);
+ break;
+ case c_offload_sent_pointer_data:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_sent_pointer_data);
+ offload_stage(ss, offload_number, str1, str2, true);
+ ss << " " << va_arg(va_args, uint64_t);
+ break;
+ case c_offload_gather_copyin_data:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_gather_copyin_data);
+ offload_stage(ss, offload_number, str1, str2, true);
+ break;
+ case c_offload_copyin_data:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_copyin_data);
+ offload_stage(ss, offload_number, str1, str2, true);
+ ss << " " << va_arg(va_args, uint64_t) << " ";
+ break;
+ case c_offload_compute:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_compute);
+ offload_stage(ss, offload_number, str1, str2, true);
+ break;
+ case c_offload_receive_pointer_data:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_receive_pointer_data);
+ offload_stage(ss, offload_number, str1, str2, true);
+ break;
+ case c_offload_received_pointer_data:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_received_pointer_data);
+ offload_stage(ss, offload_number, str1, str2, true);
+ ss << " " << va_arg(va_args, uint64_t);
+ break;
+ case c_offload_start_target_func:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_start_target_func);
+ offload_stage(ss, offload_number, str1, str2, true);
+ ss << ": " << va_arg(va_args, char*);
+ break;
+ case c_offload_var:
+ str1 = report_get_message_str(c_report_var);
+ offload_stage(ss, offload_number, str1, " ", true);
+ va_arg(va_args, int);
+ ss << va_arg(va_args, char*);
+ ss << " " << " " << va_arg(va_args, char*);
+ break;
+ case c_offload_scatter_copyin_data:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_scatter_copyin_data);
+ offload_stage(ss, offload_number, str1, str2, true);
+ break;
+ case c_offload_gather_copyout_data:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_gather_copyout_data);
+ offload_stage(ss, offload_number, str1, str2, true);
+ break;
+ case c_offload_scatter_copyout_data:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_scatter_copyout_data);
+ offload_stage(ss, offload_number, str1, str2, true);
+ break;
+ case c_offload_copyout_data:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_copyout_data);
+ offload_stage(ss, offload_number, str1, str2, true);
+ ss << " " << va_arg(va_args, uint64_t);
+ break;
+ case c_offload_signal:
+ {
+ uint64_t *signal;
+ str1 = report_get_message_str(c_report_state_signal);
+ str2 = report_get_message_str(c_report_signal);
+ offload_signal(ss, offload_number, str1, str2);
+ signal = va_arg(va_args, uint64_t*);
+ if (signal)
+ ss << " 0x" << std::hex << *signal;
+ else
+ ss << " none";
+ }
+ break;
+ case c_offload_wait:
+ {
+ int count;
+ uint64_t **signal;
+ str1 = report_get_message_str(c_report_state_signal);
+ str2 = report_get_message_str(c_report_wait);
+ offload_signal(ss, offload_number, str1, str2);
+ count = va_arg(va_args, int);
+ signal = va_arg(va_args, uint64_t**);
+ if (count) {
+ while (count) {
+ ss << " " << std::hex << signal[count-1];
+ count--;
+ }
+ }
+ else
+ ss << " none";
+ }
+ break;
+ case c_offload_unregister:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_unregister);
+ offload_stage(ss, offload_number, str1, str2, false);
+ break;
+ case c_offload_destroy:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_destroy);
+ offload_stage(ss, offload_number, str1, str2, true);
+ break;
+ case c_offload_myoinit:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_myoinit);
+ offload_stage(ss, offload_number, str1, str2, false);
+ break;
+ case c_offload_myoregister:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_myoregister);
+ offload_stage(ss, offload_number, str1, str2, false);
+ break;
+ case c_offload_myofini:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_myofini);
+ offload_stage(ss, offload_number, str1, str2, false);
+ break;
+ case c_offload_mic_myo_shared:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_mic_myo_shared);
+ offload_stage(ss, offload_number, str1, str2, false);
+ ss << " " << va_arg(va_args, char*);
+ break;
+ case c_offload_mic_myo_fptr:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_mic_myo_fptr);
+ offload_stage(ss, offload_number, str1, str2, false);
+ ss << " " << va_arg(va_args, char*);
+ break;
+ case c_offload_myosharedmalloc:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_myosharedmalloc);
+ offload_stage(ss, offload_number, str1, str2, false);
+ va_arg(va_args, char*);
+ ss << " " << va_arg(va_args, size_t);
+ break;
+ case c_offload_myosharedfree:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_myosharedfree);
+ offload_stage(ss, offload_number, str1, str2, false);
+ break;
+ case c_offload_myosharedalignedmalloc:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_myosharedalignedmalloc);
+ offload_stage(ss, offload_number, str1, str2, false);
+ va_arg(va_args, char*);
+ ss << " " << va_arg(va_args, size_t);
+ ss << " " << va_arg(va_args, size_t);
+ break;
+ case c_offload_myosharedalignedfree:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_myosharedalignedfree);
+ offload_stage(ss, offload_number, str1, str2, false);
+ break;
+ case c_offload_myoacquire:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_myoacquire);
+ offload_stage(ss, offload_number, str1, str2, false);
+ break;
+ case c_offload_myorelease:
+ str1 = report_get_message_str(c_report_state);
+ str2 = report_get_message_str(c_report_myorelease);
+ offload_stage(ss, offload_number, str1, str2, false);
+ break;
+ default:
+ LIBOFFLOAD_ERROR(c_report_unknown_trace_node);
+ abort();
+ }
+ ss << "\n";
+ buf = ss.str();
+ fprintf(stdout, buf.data());
+ fflush(stdout);
+
+ va_end(va_args);
+ return;
+}
diff --git a/liboffloadmic/runtime/offload_trace.h b/liboffloadmic/runtime/offload_trace.h
new file mode 100644
index 00000000000..02a0c8794db
--- /dev/null
+++ b/liboffloadmic/runtime/offload_trace.h
@@ -0,0 +1,72 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+// The parts of the offload library common to host and target
+
+void offload_stage_print(int stage, int offload_number, ...);
+
+enum OffloadTraceStage {
+ // Total time spent on the target
+ c_offload_start = 0,
+ c_offload_init,
+ c_offload_register,
+ c_offload_init_func,
+ c_offload_create_buf_host,
+ c_offload_create_buf_mic,
+ c_offload_send_pointer_data,
+ c_offload_sent_pointer_data,
+ c_offload_gather_copyin_data,
+ c_offload_copyin_data,
+ c_offload_compute,
+ c_offload_receive_pointer_data,
+ c_offload_received_pointer_data,
+ c_offload_start_target_func,
+ c_offload_var,
+ c_offload_scatter_copyin_data,
+ c_offload_gather_copyout_data,
+ c_offload_scatter_copyout_data,
+ c_offload_copyout_data,
+ c_offload_signal,
+ c_offload_wait,
+ c_offload_unregister,
+ c_offload_destroy,
+ c_offload_finish,
+ c_offload_myoinit,
+ c_offload_myoregister,
+ c_offload_mic_myo_shared,
+ c_offload_mic_myo_fptr,
+ c_offload_myosharedmalloc,
+ c_offload_myosharedfree,
+ c_offload_myosharedalignedmalloc,
+ c_offload_myosharedalignedfree,
+ c_offload_myoacquire,
+ c_offload_myorelease,
+ c_offload_myofini
+};
diff --git a/liboffloadmic/runtime/offload_util.cpp b/liboffloadmic/runtime/offload_util.cpp
new file mode 100644
index 00000000000..ae6a75916d4
--- /dev/null
+++ b/liboffloadmic/runtime/offload_util.cpp
@@ -0,0 +1,226 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include "offload_util.h"
+#include <errno.h>
+#include "liboffload_error_codes.h"
+
+#ifdef TARGET_WINNT
+void *thread_getspecific(pthread_key_t key)
+{
+ if (key == 0) {
+ return NULL;
+ }
+ else {
+ return TlsGetValue(key);
+ }
+}
+
+int thread_setspecific(pthread_key_t key, const void *value)
+{
+ return (TlsSetValue(key, (LPVOID)value)) ? 0 : GetLastError();
+}
+#endif // TARGET_WINNT
+
+bool __offload_parse_size_string(const char *str, uint64_t &new_size)
+{
+ uint64_t val;
+ char *suffix;
+
+ errno = 0;
+#ifdef TARGET_WINNT
+ val = strtoul(str, &suffix, 10);
+#else // TARGET_WINNT
+ val = strtoull(str, &suffix, 10);
+#endif // TARGET_WINNT
+ if (errno != 0 || suffix == str) {
+ return false;
+ }
+
+ if (suffix[0] == '\0') {
+ // default is Kilobytes
+ new_size = val * 1024;
+ return true;
+ }
+ else if (suffix[1] == '\0') {
+ // Optional suffixes: B (bytes), K (Kilobytes), M (Megabytes),
+ // G (Gigabytes), or T (Terabytes) specify the units.
+ switch (suffix[0]) {
+ case 'b':
+ case 'B':
+ new_size = val;
+ break;
+
+ case 'k':
+ case 'K':
+ new_size = val * 1024;
+ break;
+
+ case 'm':
+ case 'M':
+ new_size = val * 1024 * 1024;
+ break;
+
+ case 'g':
+ case 'G':
+ new_size = val * 1024 * 1024 * 1024;
+ break;
+
+ case 't':
+ case 'T':
+ new_size = val * 1024 * 1024 * 1024 * 1024;
+ break;
+
+ default:
+ return false;
+ }
+ return true;
+ }
+
+ return false;
+}
+
+bool __offload_parse_int_string(const char *str, int64_t &value)
+{
+ int64_t val;
+ char *suffix;
+
+ errno = 0;
+#ifdef TARGET_WINNT
+ val = strtol(str, &suffix, 0);
+#else
+ val = strtoll(str, &suffix, 0);
+#endif
+ if (errno == 0 && suffix != str && *suffix == '\0') {
+ value = val;
+ return true;
+ }
+ return false;
+}
+
+#ifdef TARGET_WINNT
+extern void* DL_open(const char *path)
+{
+ void *handle;
+ int error_mode;
+
+ /*
+ * do not display message box with error if it the call below fails to
+ * load dynamic library.
+ */
+ error_mode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
+
+ /* load dynamic library */
+ handle = (void*) LoadLibrary(path);
+
+ /* restore error mode */
+ SetErrorMode(error_mode);
+
+ return handle;
+}
+
+extern int DL_addr(const void *addr, Dl_info *dl_info)
+{
+ MEMORY_BASIC_INFORMATION mem_info;
+ char mod_name[MAX_PATH];
+ HMODULE mod_handle;
+
+ /* Fill MEMORY_BASIC_INFORMATION struct */
+ if (!VirtualQuery(addr, &mem_info, sizeof(mem_info))) {
+ return 0;
+ }
+ mod_handle = (HMODULE)mem_info.AllocationBase;
+
+ /* ANSI file name for module */
+ if (!GetModuleFileNameA(mod_handle, (char*) mod_name, sizeof(mod_name))) {
+ return 0;
+ }
+ strcpy(dl_info->dli_fname, mod_name);
+ dl_info->dli_fbase = mem_info.BaseAddress;
+ dl_info->dli_saddr = addr;
+ strcpy(dl_info->dli_sname, mod_name);
+ return 1;
+}
+
+// Run once
+static BOOL CALLBACK __offload_run_once_wrapper(
+ PINIT_ONCE initOnce,
+ PVOID parameter,
+ PVOID *context
+)
+{
+ void (*init_routine)(void) = (void(*)(void)) parameter;
+ init_routine();
+ return true;
+}
+
+void __offload_run_once(OffloadOnceControl *ctrl, void (*func)(void))
+{
+ InitOnceExecuteOnce(ctrl, __offload_run_once_wrapper, (void*) func, 0);
+}
+#endif // TARGET_WINNT
+
+/* ARGSUSED */ // version is not used on windows
+void* DL_sym(void *handle, const char *name, const char *version)
+{
+#ifdef TARGET_WINNT
+ return GetProcAddress((HMODULE) handle, name);
+#else // TARGET_WINNT
+ if (version == 0) {
+ return dlsym(handle, name);
+ }
+ else {
+ return dlvsym(handle, name, version);
+ }
+#endif // TARGET_WINNT
+}
+
+int64_t get_el_value(
+ char *base,
+ int64_t offset,
+ int64_t size)
+{
+ int64_t val = 0;
+ switch (size) {
+ case 1:
+ val = static_cast<int64_t>(*((char *)(base + offset)));
+ break;
+ case 2:
+ val = static_cast<int64_t>(*((short *)(base + offset)));
+ break;
+ case 4:
+ val = static_cast<int64_t>(*((int *)(base + offset)));
+ break;
+ default:
+ val = *((int64_t *)(base + offset));
+ break;
+ }
+ return val;
+}
diff --git a/liboffloadmic/runtime/offload_util.h b/liboffloadmic/runtime/offload_util.h
new file mode 100644
index 00000000000..2cffd82f70a
--- /dev/null
+++ b/liboffloadmic/runtime/offload_util.h
@@ -0,0 +1,173 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#ifndef OFFLOAD_UTIL_H_INCLUDED
+#define OFFLOAD_UTIL_H_INCLUDED
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+
+#ifdef TARGET_WINNT
+#include <windows.h>
+#include <process.h>
+#else // TARGET_WINNT
+#include <dlfcn.h>
+#include <pthread.h>
+#endif // TARGET_WINNT
+
+#ifdef TARGET_WINNT
+typedef unsigned pthread_key_t;
+typedef int pid_t;
+
+#define __func__ __FUNCTION__
+#define strtok_r(s,d,p) strtok_s(s,d,p)
+#define strcasecmp(a,b) stricmp(a,b)
+
+#define thread_key_create(key, destructor) \
+ (((*key = TlsAlloc()) > 0) ? 0 : GetLastError())
+#define thread_key_delete(key) TlsFree(key)
+
+#ifndef S_ISREG
+#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
+#endif
+
+void* thread_getspecific(pthread_key_t key);
+int thread_setspecific(pthread_key_t key, const void *value);
+#else
+#define thread_key_create(key, destructor) \
+ pthread_key_create((key), (destructor))
+#define thread_key_delete(key) pthread_key_delete(key)
+#define thread_getspecific(key) pthread_getspecific(key)
+#define thread_setspecific(key, value) pthread_setspecific(key, value)
+#endif // TARGET_WINNT
+
+// Mutex implementation
+struct mutex_t {
+ mutex_t() {
+#ifdef TARGET_WINNT
+ InitializeCriticalSection(&m_lock);
+#else // TARGET_WINNT
+ pthread_mutex_init(&m_lock, 0);
+#endif // TARGET_WINNT
+ }
+
+ ~mutex_t() {
+#ifdef TARGET_WINNT
+ DeleteCriticalSection(&m_lock);
+#else // TARGET_WINNT
+ pthread_mutex_destroy(&m_lock);
+#endif // TARGET_WINNT
+ }
+
+ void lock() {
+#ifdef TARGET_WINNT
+ EnterCriticalSection(&m_lock);
+#else // TARGET_WINNT
+ pthread_mutex_lock(&m_lock);
+#endif // TARGET_WINNT
+ }
+
+ void unlock() {
+#ifdef TARGET_WINNT
+ LeaveCriticalSection(&m_lock);
+#else // TARGET_WINNT
+ pthread_mutex_unlock(&m_lock);
+#endif // TARGET_WINNT
+ }
+
+private:
+#ifdef TARGET_WINNT
+ CRITICAL_SECTION m_lock;
+#else
+ pthread_mutex_t m_lock;
+#endif
+};
+
+struct mutex_locker_t {
+ mutex_locker_t(mutex_t &mutex) : m_mutex(mutex) {
+ m_mutex.lock();
+ }
+
+ ~mutex_locker_t() {
+ m_mutex.unlock();
+ }
+
+private:
+ mutex_t &m_mutex;
+};
+
+// Dynamic loader interface
+#ifdef TARGET_WINNT
+struct Dl_info
+{
+ char dli_fname[MAX_PATH];
+ void *dli_fbase;
+ char dli_sname[MAX_PATH];
+ const void *dli_saddr;
+};
+
+void* DL_open(const char *path);
+#define DL_close(handle) FreeLibrary((HMODULE) (handle))
+int DL_addr(const void *addr, Dl_info *info);
+#else
+#define DL_open(path) dlopen((path), RTLD_NOW)
+#define DL_close(handle) dlclose(handle)
+#define DL_addr(addr, info) dladdr((addr), (info))
+#endif // TARGET_WINNT
+
+extern void* DL_sym(void *handle, const char *name, const char *version);
+
+// One-time initialization API
+#ifdef TARGET_WINNT
+typedef INIT_ONCE OffloadOnceControl;
+#define OFFLOAD_ONCE_CONTROL_INIT INIT_ONCE_STATIC_INIT
+
+extern void __offload_run_once(OffloadOnceControl *ctrl, void (*func)(void));
+#else
+typedef pthread_once_t OffloadOnceControl;
+#define OFFLOAD_ONCE_CONTROL_INIT PTHREAD_ONCE_INIT
+
+#define __offload_run_once(ctrl, func) pthread_once(ctrl, func)
+#endif // TARGET_WINNT
+
+// Parses size specification string.
+extern bool __offload_parse_size_string(const char *str, uint64_t &new_size);
+
+// Parses string with integer value
+extern bool __offload_parse_int_string(const char *str, int64_t &value);
+
+// get value by its base, offset and size
+int64_t get_el_value(
+ char *base,
+ int64_t offset,
+ int64_t size
+);
+#endif // OFFLOAD_UTIL_H_INCLUDED
diff --git a/liboffloadmic/runtime/ofldbegin.cpp b/liboffloadmic/runtime/ofldbegin.cpp
new file mode 100644
index 00000000000..6f4b536f5b7
--- /dev/null
+++ b/liboffloadmic/runtime/ofldbegin.cpp
@@ -0,0 +1,184 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#if HOST_LIBRARY
+#include "offload_host.h"
+#include "offload_myo_host.h"
+#else
+#include "compiler_if_target.h"
+#include "offload_target.h"
+#include "offload_myo_target.h"
+#endif
+
+#ifdef TARGET_WINNT
+#define ALLOCATE(name) __declspec(allocate(name))
+#define DLL_LOCAL
+#else // TARGET_WINNT
+#define ALLOCATE(name) __attribute__((section(name)))
+#define DLL_LOCAL __attribute__((visibility("hidden")))
+#endif // TARGET_WINNT
+
+#if HOST_LIBRARY
+// the host program/shared library should always have __offload_target_image
+// symbol defined. This symbol specifies the beginning of the target program
+// image.
+extern "C" DLL_LOCAL const void* __offload_target_image;
+#else // HOST_LIBRARY
+// Define a weak main which would be used on target side in case usere's
+// source file containing main does not have offload code.
+#pragma weak main
+int main(void)
+{
+ OFFLOAD_TARGET_MAIN();
+ return 0;
+}
+
+#pragma weak MAIN__
+extern "C" int MAIN__(void)
+{
+ OFFLOAD_TARGET_MAIN();
+ return 0;
+}
+#endif // HOST_LIBRARY
+
+// offload section prolog
+ALLOCATE(OFFLOAD_ENTRY_TABLE_SECTION_START)
+#ifdef TARGET_WINNT
+__declspec(align(sizeof(FuncTable::Entry)))
+#endif // TARGET_WINNT
+static FuncTable::Entry __offload_entry_table_start = { 0 };
+
+// list element for the current module
+static FuncList::Node __offload_entry_node = {
+ { &__offload_entry_table_start + 1, -1 },
+ 0, 0
+};
+
+// offload fp section prolog
+ALLOCATE(OFFLOAD_FUNC_TABLE_SECTION_START)
+#ifdef TARGET_WINNT
+__declspec(align(sizeof(FuncTable::Entry)))
+#endif // TARGET_WINNT
+static FuncTable::Entry __offload_func_table_start = { 0 };
+
+// list element for the current module
+static FuncList::Node __offload_func_node = {
+ { &__offload_func_table_start + 1, -1 },
+ 0, 0
+};
+
+// offload fp section prolog
+ALLOCATE(OFFLOAD_VAR_TABLE_SECTION_START)
+#ifdef TARGET_WINNT
+__declspec(align(sizeof(VarTable::Entry)))
+#endif // TARGET_WINNT
+static VarTable::Entry __offload_var_table_start = { 0 };
+
+// list element for the current module
+static VarList::Node __offload_var_node = {
+ { &__offload_var_table_start + 1 },
+ 0, 0
+};
+
+#ifdef MYO_SUPPORT
+
+// offload myo shared var section prolog
+ALLOCATE(OFFLOAD_MYO_SHARED_TABLE_SECTION_START)
+#ifdef TARGET_WINNT
+__declspec(align(sizeof(SharedTableEntry)))
+#endif // TARGET_WINNT
+static SharedTableEntry __offload_myo_shared_table_start = { 0 };
+
+#if HOST_LIBRARY
+// offload myo shared var init section prolog
+ALLOCATE(OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_START)
+#ifdef TARGET_WINNT
+__declspec(align(sizeof(InitTableEntry)))
+#endif // TARGET_WINNT
+static InitTableEntry __offload_myo_shared_init_table_start = { 0 };
+#endif
+
+// offload myo fptr section prolog
+ALLOCATE(OFFLOAD_MYO_FPTR_TABLE_SECTION_START)
+#ifdef TARGET_WINNT
+__declspec(align(sizeof(FptrTableEntry)))
+#endif // TARGET_WINNT
+static FptrTableEntry __offload_myo_fptr_table_start = { 0 };
+
+#endif // MYO_SUPPORT
+
+// init/fini code which adds/removes local lookup data to/from the global list
+
+static void offload_fini();
+
+#ifndef TARGET_WINNT
+static void offload_init() __attribute__((constructor(101)));
+#else // TARGET_WINNT
+static void offload_init();
+
+// Place offload initialization before user constructors
+ALLOCATE(OFFLOAD_CRTINIT_SECTION_START)
+static void (*addressof_offload_init)() = offload_init;
+#endif // TARGET_WINNT
+
+static void offload_init()
+{
+ // register offload tables
+ __offload_register_tables(&__offload_entry_node,
+ &__offload_func_node,
+ &__offload_var_node);
+
+#if HOST_LIBRARY
+ __offload_register_image(&__offload_target_image);
+ atexit(offload_fini);
+#endif // HOST_LIBRARY
+
+#ifdef MYO_SUPPORT
+ __offload_myoRegisterTables(
+#if HOST_LIBRARY
+ &__offload_myo_shared_init_table_start + 1,
+#endif // HOST_LIBRARY
+ &__offload_myo_shared_table_start + 1,
+ &__offload_myo_fptr_table_start + 1
+ );
+#endif // MYO_SUPPORT
+}
+
+static void offload_fini()
+{
+#if HOST_LIBRARY
+ __offload_unregister_image(&__offload_target_image);
+#endif // HOST_LIBRARY
+
+ // unregister offload tables
+ __offload_unregister_tables(&__offload_entry_node,
+ &__offload_func_node,
+ &__offload_var_node);
+}
diff --git a/liboffloadmic/runtime/ofldend.cpp b/liboffloadmic/runtime/ofldend.cpp
new file mode 100644
index 00000000000..0256c5a0f20
--- /dev/null
+++ b/liboffloadmic/runtime/ofldend.cpp
@@ -0,0 +1,97 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#if HOST_LIBRARY
+#include "offload_host.h"
+#include "offload_myo_host.h"
+#else
+#include "offload_target.h"
+#include "offload_myo_target.h"
+#endif
+
+#ifdef TARGET_WINNT
+#define ALLOCATE(name) __declspec(allocate(name))
+#else // TARGET_WINNT
+#define ALLOCATE(name) __attribute__((section(name)))
+#endif // TARGET_WINNT
+
+// offload entry table
+ALLOCATE(OFFLOAD_ENTRY_TABLE_SECTION_END)
+#ifdef TARGET_WINNT
+__declspec(align(sizeof(FuncTable::Entry)))
+#endif // TARGET_WINNT
+static FuncTable::Entry __offload_entry_table_end = { (const char*)-1 };
+
+// offload function table
+ALLOCATE(OFFLOAD_FUNC_TABLE_SECTION_END)
+#ifdef TARGET_WINNT
+__declspec(align(sizeof(FuncTable::Entry)))
+#endif // TARGET_WINNT
+static FuncTable::Entry __offload_func_table_end = { (const char*)-1 };
+
+// data table
+ALLOCATE(OFFLOAD_VAR_TABLE_SECTION_END)
+#ifdef TARGET_WINNT
+__declspec(align(sizeof(VarTable::Entry)))
+#endif // TARGET_WINNT
+static VarTable::Entry __offload_var_table_end = { (const char*)-1 };
+
+#ifdef MYO_SUPPORT
+
+// offload myo shared var section epilog
+ALLOCATE(OFFLOAD_MYO_SHARED_TABLE_SECTION_END)
+#ifdef TARGET_WINNT
+__declspec(align(sizeof(SharedTableEntry)))
+static SharedTableEntry __offload_myo_shared_table_end = { (const char*)-1, 0 };
+#else // TARGET_WINNT
+static SharedTableEntry __offload_myo_shared_table_end = { 0 };
+#endif // TARGET_WINNT
+
+#if HOST_LIBRARY
+// offload myo shared var init section epilog
+ALLOCATE(OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_END)
+#ifdef TARGET_WINNT
+__declspec(align(sizeof(InitTableEntry)))
+static InitTableEntry __offload_myo_shared_init_table_end = { (const char*)-1, 0 };
+#else // TARGET_WINNT
+static InitTableEntry __offload_myo_shared_init_table_end = { 0 };
+#endif // TARGET_WINNT
+#endif // HOST_LIBRARY
+
+// offload myo fptr section epilog
+ALLOCATE(OFFLOAD_MYO_FPTR_TABLE_SECTION_END)
+#ifdef TARGET_WINNT
+__declspec(align(sizeof(FptrTableEntry)))
+static FptrTableEntry __offload_myo_fptr_table_end = { (const char*)-1, 0, 0 };
+#else // TARGET_WINNT
+static FptrTableEntry __offload_myo_fptr_table_end = { 0 };
+#endif // TARGET_WINNT
+
+#endif // MYO_SUPPORT
diff --git a/liboffloadmic/runtime/orsl-lite/include/orsl-lite.h b/liboffloadmic/runtime/orsl-lite/include/orsl-lite.h
new file mode 100644
index 00000000000..b629a1a91b5
--- /dev/null
+++ b/liboffloadmic/runtime/orsl-lite/include/orsl-lite.h
@@ -0,0 +1,241 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#ifndef _ORSL_LITE_H_
+#define _ORSL_LITE_H_
+
+#ifndef TARGET_WINNT
+#include <sched.h>
+#else
+#define cpu_set_t int
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Type of a ORSLBusySet */
+typedef enum ORSLBusySetType {
+ BUSY_SET_EMPTY = 0, /**< Empty set */
+ BUSY_SET_PARTIAL = 1, /**< Non-empty set that omits some threads */
+ BUSY_SET_FULL = 2 /**< A set that includes all threads on the card */
+} BusySetType;
+
+/** ORSLBusySet encapsulation */
+typedef struct ORSLBusySet {
+ BusySetType type; /**< Set type */
+#ifdef __linux__
+ cpu_set_t cpu_set; /**< CPU mask (unused for BUSY_SET_EMPTY and
+ BUSY_SET_PARTIAL sets) represented by the standard
+ Linux CPU set type -- cpu_set_t. Threads are numbered
+ starting from 0. The maximal possible thread number
+ is system-specific. See CPU_SET(3) family of macros
+ for more details. Unused in ORSL Lite. */
+#endif
+} ORSLBusySet;
+
+/** Client tag */
+typedef char* ORSLTag;
+
+/** Maximal length of tag in characters */
+#define ORSL_MAX_TAG_LEN 128
+
+/** Maximal number of cards that can be managed by ORSL */
+#define ORSL_MAX_CARDS 32
+
+/** Reserves computational resources on a set of cards. Blocks.
+ *
+ * If any of the resources cannot be reserved, this function will block until
+ * they become available. Reservation can be recursive if performed by the
+ * same tag. A recursively reserved resource must be released the same number
+ * of times it was reserved.
+ *
+ * @see ORSLTryReserve
+ *
+ * @param[in] n Number of cards to reserve resources on. Cannot be < 0
+ * or > ORSL_MAX_CARDS.
+ *
+ * @param[in] inds Indices of the cards: an integer array with n elements.
+ * Cannot be NULL if n > 0. Valid card indices are from 0
+ * to ORSL_MAX_CARDS-1. Cannot contain duplicate elements.
+ *
+ * @param[in] bsets Requested resources on each of the card. Cannot be NULL
+ * if n > 0.
+ *
+ * @param[in] tag ORSLTag of the calling client. Cannot be NULL. Length
+ * must not exeed ORSL_MAX_TAG_LEN.
+ *
+ * @returns 0 if the resources were successfully reserved
+ *
+ * @returns EINVAL if any of the arguments is invalid
+ *
+ * @returns EAGAIN limit of recursive reservations reached
+ * (not in ORSL Lite)
+ *
+ * @returns ENOSYS (in ORSL Lite) if type of any of the busy sets is
+ * equal to BUSY_SET_PARTIAL
+ */
+int ORSLReserve(const int n, const int *__restrict inds,
+ const ORSLBusySet *__restrict bsets,
+ const ORSLTag __restrict tag);
+
+/** Reserves computational resources on a set of cards. Does not block.
+ *
+ * If any of the resources cannot be reserved, this function will return
+ * immediately. Reservation can be recursive if performed by the same tag.
+ * A recursively reserved resource must be released the same number of times
+ * it was reserved.
+ *
+ * @see ORSLReserve
+ *
+ * @param[in] n Number of cards to reserve resources on. Cannot be < 0
+ * or > ORSL_MAX_CARDS.
+ *
+ * @param[in] inds Indices of the cards: an integer array with n elements.
+ * Cannot be NULL if n > 0. Valid card indices are from 0
+ * to ORSL_MAX_CARDS-1. Cannot contain duplicate elements.
+ *
+ * @param[inout] bsets Requested resources on each of the card. Cannot be
+ * NULL if n > 0.
+ *
+ * @param[in] tag ORSLTag of the calling client. Cannot be NULL. Length
+ * must not exceed ORSL_MAX_TAG_LEN.
+ *
+ * @returns 0 if the resources were successfully reserved
+ *
+ * @returns EBUSY if some of the requested resources are busy
+ *
+ * @returns EINVAL if any of the arguments is invalid
+ *
+ * @returns EAGAIN limit of recursive reservations reached
+ * (not in ORSL Lite)
+ *
+ * @returns ENOSYS (in ORSL Lite) if type of any of the busy sets is
+ * equal to BUSY_SET_PARTIAL
+ */
+int ORSLTryReserve(const int n, const int *__restrict inds,
+ const ORSLBusySet *__restrict bsets,
+ const ORSLTag __restrict tag);
+
+/** Granularify of partial reservation */
+typedef enum ORSLPartialGranularity {
+ GRAN_CARD = 0, /**< Card granularity */
+ GRAN_THREAD = 1 /**< Thread granularity */
+} ORSLPartialGranularity;
+
+/** Requests reservation of some of computational resources on a set of cards.
+ * Does not block. Updates user-provided bsets to indicate which resources
+ * were reserved.
+ *
+ * If any of the resources cannot be reserved, this function will update busy
+ * sets provided by the caller to reflect what resources were actually
+ * reserved. This function supports two granularity modes: 'card' and
+ * 'thread'. When granularity is set to 'card', a failure to reserve a thread
+ * on the card will imply that reservation has failed for the whole card. When
+ * granularity is set to 'thread', reservation on a card will be considered
+ * successful as long as at least one thread on the card was successfully
+ * reserved. Reservation can be recursive if performed by the same tag. A
+ * recursively reserved resource must be released the same number of times it
+ * was reserved.
+ *
+ * @param[in] gran Reservation granularity
+ *
+ * @param[in] n Number of cards to reserve resources on. Cannot be < 0
+ * or > ORSL_MAX_CARDS.
+ *
+ * @param[in] inds Indices of the cards: an integer array with n elements.
+ * Cannot be NULL if n > 0. Valid card indices are from 0
+ * to ORSL_MAX_CARDS-1. Cannot contain duplicate elements.
+ *
+ * @param[in] bsets Requested resources on each of the card. Cannot be NULL
+ * if n > 0.
+ *
+ * @param[in] tag ORSLTag of the calling client. Cannot be NULL. Length
+ * must not exceed ORSL_MAX_TAG_LEN.
+ *
+ * @returns 0 if at least some of the resources were successfully
+ * reserved
+ *
+ * @returns EBUSY if all of the requested resources are busy
+ *
+ * @returns EINVAL if any of the arguments is invalid
+ *
+ * @returns EAGAIN limit of recursive reservations reached
+ * (not in ORSL Lite)
+ *
+ * @returns ENOSYS (in ORSL Lite) if type of any of the busy sets is
+ * equal to BUSY_SET_PARTIAL
+ */
+int ORSLReservePartial(const ORSLPartialGranularity gran, const int n,
+ const int *__restrict inds,
+ ORSLBusySet *__restrict bsets,
+ const ORSLTag __restrict tag);
+
+/** Releases previously reserved computational resources on a set of cards.
+ *
+ * This function will fail if any of the resources to be released were not
+ * reserved by the calling client.
+ *
+ * @see ORSLReserve
+ * @see ORSLTryReserve
+ * @see ORSLReservePartial
+ *
+ * @param[in] n Number of cards to reserve resources on. Cannot be < 0
+ * or > ORSL_MAX_CARDS.
+ *
+ * @param[in] inds Indices of the cards: an integer array with n elements.
+ * Cannot be NULL if n > 0. Valid card indices are from 0
+ * to ORSL_MAX_CARDS-1. Cannot contain duplicate elements.
+ *
+ * @param[in] bsets Requested resources on each of the card. Cannot be NULL
+ * if n > 0.
+ *
+ * @param[in] tag ORSLTag of the calling client. Cannot be NULL. Length
+ * must not exceed ORSL_MAX_TAG_LEN.
+ *
+ * @returns 0 if the resources were successfully released
+ *
+ * @returns EINVAL if any of the arguments is invalid
+ *
+ * @returns EPERM the calling client did not reserve some of the
+ * resources it is trying to release.
+ *
+ * @returns ENOSYS (in ORSL Lite) if type of any of the busy sets is
+ * equal to BUSY_SET_PARTIAL
+ */
+int ORSLRelease(const int n, const int *__restrict inds,
+ const ORSLBusySet *__restrict bsets,
+ const ORSLTag __restrict tag);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/liboffloadmic/runtime/orsl-lite/lib/orsl-lite.c b/liboffloadmic/runtime/orsl-lite/lib/orsl-lite.c
new file mode 100644
index 00000000000..af01c119c35
--- /dev/null
+++ b/liboffloadmic/runtime/orsl-lite/lib/orsl-lite.c
@@ -0,0 +1,357 @@
+/*
+ Copyright (c) 2014 Intel Corporation. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#include <errno.h>
+#include <string.h>
+#include <limits.h>
+#include <assert.h>
+
+#include "orsl-lite/include/orsl-lite.h"
+
+#define DISABLE_SYMBOL_VERSIONING
+
+#if defined(__linux__) && !defined(DISABLE_SYMBOL_VERSIONING)
+#define symver(src, tgt, verstr) __asm__(".symver " #src "," #tgt verstr)
+symver(ORSLReserve0, ORSLReserve, "@@ORSL_0.0");
+symver(ORSLTryReserve0, ORSLTryReserve, "@@ORSL_0.0");
+symver(ORSLReservePartial0, ORSLReservePartial, "@@ORSL_0.0");
+symver(ORSLRelease0, ORSLRelease, "@@ORSL_0.0");
+#else
+#define ORSLReserve0 ORSLReserve
+#define ORSLTryReserve0 ORSLTryReserve
+#define ORSLReservePartial0 ORSLReservePartial
+#define ORSLRelease0 ORSLRelease
+#endif
+
+#ifdef __linux__
+#include <pthread.h>
+static pthread_mutex_t global_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_cond_t release_cond = PTHREAD_COND_INITIALIZER;
+#endif
+
+#ifdef _WIN32
+#include <windows.h>
+#pragma intrinsic(_ReadWriteBarrier)
+static SRWLOCK global_mutex = SRWLOCK_INIT;
+static volatile int release_cond_initialized = 0;
+static CONDITION_VARIABLE release_cond;
+
+static void state_lazy_init_sync()
+{
+ if (!release_cond_initialized) {
+ AcquireSRWLockExclusive(&global_mutex);
+ _ReadWriteBarrier();
+ if (!release_cond_initialized) {
+ InitializeConditionVariable(&release_cond);
+ release_cond_initialized = 1;
+ }
+ ReleaseSRWLockExclusive(&global_mutex);
+ }
+}
+#endif
+
+static int state_lock()
+{
+#ifdef __linux__
+ return pthread_mutex_lock(&global_mutex);
+#endif
+
+#ifdef _WIN32
+ AcquireSRWLockExclusive(&global_mutex);
+ return 0;
+#endif
+}
+
+static int state_unlock()
+{
+#ifdef __linux__
+ return pthread_mutex_unlock(&global_mutex);
+#endif
+
+#ifdef _WIN32
+ ReleaseSRWLockExclusive(&global_mutex);
+ return 0;
+#endif
+}
+
+static int state_wait_for_release()
+{
+#ifdef __linux__
+ return pthread_cond_wait(&release_cond, &global_mutex);
+#endif
+
+#ifdef _WIN32
+ return SleepConditionVariableSRW(&release_cond,
+ &global_mutex, INFINITE, 0) == 0 ? 1 : 0;
+#endif
+}
+
+static int state_signal_release()
+{
+#ifdef __linux__
+ return pthread_cond_signal(&release_cond);
+#endif
+
+#ifdef _WIN32
+ WakeConditionVariable(&release_cond);
+ return 0;
+#endif
+}
+
+static struct {
+ char owner[ORSL_MAX_TAG_LEN + 1];
+ unsigned long rsrv_cnt;
+} rsrv_data[ORSL_MAX_CARDS];
+
+static int check_args(const int n, const int *__restrict inds,
+ const ORSLBusySet *__restrict bsets,
+ const ORSLTag __restrict tag)
+{
+ int i;
+ int card_specified[ORSL_MAX_CARDS];
+ if (tag == NULL) return -1;
+ if (strlen((char *)tag) > ORSL_MAX_TAG_LEN) return -1;
+ if (n < 0 || n >= ORSL_MAX_CARDS) return -1;
+ if (n != 0 && (inds == NULL || bsets == NULL)) return -1;
+ for (i = 0; i < ORSL_MAX_CARDS; i++)
+ card_specified[i] = 0;
+ for (i = 0; i < n; i++) {
+ int ind = inds[i];
+ if (ind < 0 || ind >= ORSL_MAX_CARDS) return -1;
+ if (card_specified[ind]) return -1;
+ card_specified[ind] = 1;
+ }
+ return 0;
+}
+
+static int check_bsets(const int n, const ORSLBusySet *bsets)
+{
+ int i;
+ for (i = 0; i < n; i++)
+ if (bsets[i].type == BUSY_SET_PARTIAL) return -1;
+ return 0;
+}
+
+static int can_reserve_card(int card, const ORSLBusySet *__restrict bset,
+ const ORSLTag __restrict tag)
+{
+ assert(tag != NULL);
+ assert(bset != NULL);
+ assert(strlen((char *)tag) < ORSL_MAX_TAG_LEN);
+ assert(bset->type != BUSY_SET_PARTIAL);
+
+ return (bset->type == BUSY_SET_EMPTY ||
+ ((rsrv_data[card].rsrv_cnt == 0 ||
+ strncmp((char *)tag,
+ rsrv_data[card].owner, ORSL_MAX_TAG_LEN) == 0) &&
+ rsrv_data[card].rsrv_cnt < ULONG_MAX)) ? 0 : - 1;
+}
+
+static void reserve_card(int card, const ORSLBusySet *__restrict bset,
+ const ORSLTag __restrict tag)
+{
+ assert(tag != NULL);
+ assert(bset != NULL);
+ assert(strlen((char *)tag) < ORSL_MAX_TAG_LEN);
+ assert(bset->type != BUSY_SET_PARTIAL);
+
+ if (bset->type == BUSY_SET_EMPTY)
+ return;
+
+ assert(rsrv_data[card].rsrv_cnt == 0 ||
+ strncmp((char *)tag,
+ rsrv_data[card].owner, ORSL_MAX_TAG_LEN) == 0);
+ assert(rsrv_data[card].rsrv_cnt < ULONG_MAX);
+
+ if (rsrv_data[card].rsrv_cnt == 0)
+ strncpy(rsrv_data[card].owner, (char *)tag, ORSL_MAX_TAG_LEN);
+ rsrv_data[card].owner[ORSL_MAX_TAG_LEN] = '\0';
+ rsrv_data[card].rsrv_cnt++;
+}
+
+static int can_release_card(int card, const ORSLBusySet *__restrict bset,
+ const ORSLTag __restrict tag)
+{
+ assert(tag != NULL);
+ assert(bset != NULL);
+ assert(strlen((char *)tag) < ORSL_MAX_TAG_LEN);
+ assert(bset->type != BUSY_SET_PARTIAL);
+
+ return (bset->type == BUSY_SET_EMPTY || (rsrv_data[card].rsrv_cnt > 0 &&
+ strncmp((char *)tag,
+ rsrv_data[card].owner, ORSL_MAX_TAG_LEN) == 0)) ? 0 : 1;
+}
+
+static void release_card(int card, const ORSLBusySet *__restrict bset,
+ const ORSLTag __restrict tag)
+{
+ assert(tag != NULL);
+ assert(bset != NULL);
+ assert(strlen((char *)tag) < ORSL_MAX_TAG_LEN);
+ assert(bset->type != BUSY_SET_PARTIAL);
+
+ if (bset->type == BUSY_SET_EMPTY)
+ return;
+
+ assert(strncmp((char *)tag,
+ rsrv_data[card].owner, ORSL_MAX_TAG_LEN) == 0);
+ assert(rsrv_data[card].rsrv_cnt > 0);
+
+ rsrv_data[card].rsrv_cnt--;
+}
+
+int ORSLReserve0(const int n, const int *__restrict inds,
+ const ORSLBusySet *__restrict bsets,
+ const ORSLTag __restrict tag)
+{
+ int i, ok;
+
+ if (n == 0) return 0;
+ if (check_args(n, inds, bsets, tag) != 0) return EINVAL;
+ if (check_bsets(n, bsets) != 0) return ENOSYS;
+
+ state_lock();
+
+ /* Loop until we find that all the resources we want are available */
+ do {
+ ok = 1;
+ for (i = 0; i < n; i++)
+ if (can_reserve_card(inds[i], &bsets[i], tag) != 0) {
+ ok = 0;
+ /* Wait for someone to release some resources */
+ state_wait_for_release();
+ break;
+ }
+ } while (!ok);
+
+ /* At this point we are good to reserve_card the resources we want */
+ for (i = 0; i < n; i++)
+ reserve_card(inds[i], &bsets[i], tag);
+
+ state_unlock();
+ return 0;
+}
+
+int ORSLTryReserve0(const int n, const int *__restrict inds,
+ const ORSLBusySet *__restrict bsets,
+ const ORSLTag __restrict tag)
+{
+ int i, rc = EBUSY;
+
+ if (n == 0) return 0;
+ if (check_args(n, inds, bsets, tag) != 0) return EINVAL;
+ if (check_bsets(n, bsets) != 0) return ENOSYS;
+
+ state_lock();
+
+ /* Check resource availability once */
+ for (i = 0; i < n; i++)
+ if (can_reserve_card(inds[i], &bsets[i], tag) != 0)
+ goto bail_out;
+
+ /* At this point we are good to reserve the resources we want */
+ for (i = 0; i < n; i++)
+ reserve_card(inds[i], &bsets[i], tag);
+
+ rc = 0;
+
+bail_out:
+ state_unlock();
+ return rc;
+}
+
+int ORSLReservePartial0(const ORSLPartialGranularity gran, const int n,
+ const int *__restrict inds, ORSLBusySet *__restrict bsets,
+ const ORSLTag __restrict tag)
+{
+ int rc = EBUSY;
+ int i, num_avail = n;
+
+ if (n == 0) return 0;
+ if (gran != GRAN_CARD && gran != GRAN_THREAD) return EINVAL;
+ if (gran != GRAN_CARD) return EINVAL;
+ if (check_args(n, inds, bsets, tag) != 0) return EINVAL;
+ if (check_bsets(n, bsets) != 0) return ENOSYS;
+
+ state_lock();
+
+ /* Check resource availability once; remove unavailable resources from the
+ * user-provided list */
+ for (i = 0; i < n; i++)
+ if (can_reserve_card(inds[i], &bsets[i], tag) != 0) {
+ num_avail--;
+ bsets[i].type = BUSY_SET_EMPTY;
+ }
+
+ if (num_avail == 0)
+ goto bail_out;
+
+ /* At this point we are good to reserve the resources we want */
+ for (i = 0; i < n; i++)
+ reserve_card(inds[i], &bsets[i], tag);
+
+ rc = 0;
+
+bail_out:
+ state_unlock();
+ return rc;
+}
+
+int ORSLRelease0(const int n, const int *__restrict inds,
+ const ORSLBusySet *__restrict bsets,
+ const ORSLTag __restrict tag)
+{
+ int i, rc = EPERM;
+
+ if (n == 0) return 0;
+ if (check_args(n, inds, bsets, tag) != 0) return EINVAL;
+ if (check_bsets(n, bsets) != 0) return ENOSYS;
+
+ state_lock();
+
+ /* Check that we can release all the resources */
+ for (i = 0; i < n; i++)
+ if (can_release_card(inds[i], &bsets[i], tag) != 0)
+ goto bail_out;
+
+ /* At this point we are good to release the resources we want */
+ for (i = 0; i < n; i++)
+ release_card(inds[i], &bsets[i], tag);
+
+ state_signal_release();
+
+ rc = 0;
+
+bail_out:
+ state_unlock();
+ return rc;
+}
+
+/* vim:set et: */
diff --git a/liboffloadmic/runtime/orsl-lite/version.txt b/liboffloadmic/runtime/orsl-lite/version.txt
new file mode 100644
index 00000000000..ab5f59930fc
--- /dev/null
+++ b/liboffloadmic/runtime/orsl-lite/version.txt
@@ -0,0 +1 @@
+ORSL-lite 0.7
diff --git a/liboffloadmic/runtime/use_mpss2.txt b/liboffloadmic/runtime/use_mpss2.txt
new file mode 100644
index 00000000000..948f4838fbf
--- /dev/null
+++ b/liboffloadmic/runtime/use_mpss2.txt
@@ -0,0 +1 @@
+2.1.6720-13
diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog
index 0df34af898f..e3aab56e00b 100644
--- a/libsanitizer/ChangeLog
+++ b/libsanitizer/ChangeLog
@@ -1,3 +1,43 @@
+2014-11-14 Uros Bizjak <ubizjak@gmail.com>
+
+ * sanitizer_common/Makefile.am (AM_CXXFLAGS): Use -std=gnu++11.
+ * asan/Makefile.am (AM_CXXFLAGS): Ditto.
+ * lsan/Makefile.am (AM_CXXFLAGS): Ditto.
+ * interception/Makefile.am (AM_CXXFLAGS): Ditto.
+ * tsan/Makefile.am (AM_CXXFLAGS): Ditto.
+ * libbacktrace/Makefile.am (AM_CXXFLAGS): Ditto.
+ * ubsan/Makefile.am (AM_CXXFLAGS): Ditto.
+ * sanitizer_common/Makefile.in: Regenerate.
+ * asan/Makefile.in: Ditto.
+ * lsan/Makefile.in: Ditto.
+ * interception/Makefile.in: Ditto.
+ * tsan/Makefile.in: Ditto.
+ * libbacktrace/Makefile.in: Ditto.
+ * ubsan/Makefile.in: Ditto.
+
+2014-11-13 Kostya Serebryany <kcc@google.com>
+
+ * All source files: Merge from upstream r221802.
+ * sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
+ (LibbacktraceSymbolizer::SymbolizeData): Replace 'address'
+ with 'start' to follow the new interface.
+ * asan/Makefile.am (AM_CXXFLAGS): Added -std=c++11.
+ * interception/Makefile.am (AM_CXXFLAGS): Added -std=c++11.
+ * libbacktrace/Makefile.am (AM_CXXFLAGS): Added -std=c++11.
+ * lsan/Makefile.am (AM_CXXFLAGS): Added -std=c++11.
+ * sanitizer_common/Makefile.am (sanitizer_common_files): Added new
+ files.
+ (AM_CXXFLAGS): Added -std=c++11.
+ * tsan/Makefile.am (AM_CXXFLAGS): Added -std=c++11.
+ * ubsan/Makefile.am (AM_CXXFLAGS): Added -std=c++11.
+ * asan/Makefile.in: Regenerate.
+ * interception/Makefile.in: Regenerate.
+ * libbacktrace/Makefile.in: Regenerate.
+ * lsan/Makefile.in: Regenerate.
+ * sanitizer_common/Makefile.in: Regenerate.
+ * tsan/Makefile.in: Regenerate.
+ * ubsan/Makefile.in: Regenerate.
+
2014-11-11 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR target/63610
diff --git a/libsanitizer/MERGE b/libsanitizer/MERGE
index 48a7f26d32d..ef893cb306e 100644
--- a/libsanitizer/MERGE
+++ b/libsanitizer/MERGE
@@ -1,4 +1,4 @@
-218156
+221802
The first line of this file holds the svn revision number of the
last merge done from the master library sources.
diff --git a/libsanitizer/asan/Makefile.am b/libsanitizer/asan/Makefile.am
index d499c725242..54c74ce3e42 100644
--- a/libsanitizer/asan/Makefile.am
+++ b/libsanitizer/asan/Makefile.am
@@ -9,6 +9,7 @@ DEFS += -DMAC_INTERPOSE_FUNCTIONS -DMISSING_BLOCKS_SUPPORT
endif
AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -fno-ipa-icf
AM_CXXFLAGS += $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
+AM_CXXFLAGS += -std=gnu++11
ACLOCAL_AMFLAGS = -I $(top_srcdir) -I $(top_srcdir)/config
toolexeclib_LTLIBRARIES = libasan.la
diff --git a/libsanitizer/asan/Makefile.in b/libsanitizer/asan/Makefile.in
index 00a614b3d69..1a65944b559 100644
--- a/libsanitizer/asan/Makefile.in
+++ b/libsanitizer/asan/Makefile.in
@@ -270,7 +270,7 @@ AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic \
-Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti \
-fomit-frame-pointer -funwind-tables -fvisibility=hidden \
-Wno-variadic-macros -fno-ipa-icf \
- $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
+ $(LIBSTDCXX_RAW_CXX_CXXFLAGS) -std=gnu++11
ACLOCAL_AMFLAGS = -I $(top_srcdir) -I $(top_srcdir)/config
toolexeclib_LTLIBRARIES = libasan.la
nodist_toolexeclib_HEADERS = libasan_preinit.o
diff --git a/libsanitizer/asan/asan_allocator.h b/libsanitizer/asan/asan_allocator.h
index 567b36867ab..d2f30af30d6 100644
--- a/libsanitizer/asan/asan_allocator.h
+++ b/libsanitizer/asan/asan_allocator.h
@@ -43,8 +43,8 @@ class AsanChunkView {
uptr AllocTid();
uptr FreeTid();
bool Eq(const AsanChunkView &c) const { return chunk_ == c.chunk_; }
- void GetAllocStack(StackTrace *stack);
- void GetFreeStack(StackTrace *stack);
+ StackTrace GetAllocStack();
+ StackTrace GetFreeStack();
bool AddrIsInside(uptr addr, uptr access_size, sptr *offset) {
if (addr >= Beg() && (addr + access_size) <= End()) {
*offset = addr - Beg();
@@ -137,20 +137,20 @@ struct AsanThreadLocalMallocStorage {
AsanThreadLocalMallocStorage() {}
};
-void *asan_memalign(uptr alignment, uptr size, StackTrace *stack,
+void *asan_memalign(uptr alignment, uptr size, BufferedStackTrace *stack,
AllocType alloc_type);
-void asan_free(void *ptr, StackTrace *stack, AllocType alloc_type);
-void asan_sized_free(void *ptr, uptr size, StackTrace *stack,
+void asan_free(void *ptr, BufferedStackTrace *stack, AllocType alloc_type);
+void asan_sized_free(void *ptr, uptr size, BufferedStackTrace *stack,
AllocType alloc_type);
-void *asan_malloc(uptr size, StackTrace *stack);
-void *asan_calloc(uptr nmemb, uptr size, StackTrace *stack);
-void *asan_realloc(void *p, uptr size, StackTrace *stack);
-void *asan_valloc(uptr size, StackTrace *stack);
-void *asan_pvalloc(uptr size, StackTrace *stack);
+void *asan_malloc(uptr size, BufferedStackTrace *stack);
+void *asan_calloc(uptr nmemb, uptr size, BufferedStackTrace *stack);
+void *asan_realloc(void *p, uptr size, BufferedStackTrace *stack);
+void *asan_valloc(uptr size, BufferedStackTrace *stack);
+void *asan_pvalloc(uptr size, BufferedStackTrace *stack);
int asan_posix_memalign(void **memptr, uptr alignment, uptr size,
- StackTrace *stack);
+ BufferedStackTrace *stack);
uptr asan_malloc_usable_size(void *ptr, uptr pc, uptr bp);
uptr asan_mz_size(const void *ptr);
diff --git a/libsanitizer/asan/asan_allocator2.cc b/libsanitizer/asan/asan_allocator2.cc
index 78c1ec113a6..33d9fea70cb 100644
--- a/libsanitizer/asan/asan_allocator2.cc
+++ b/libsanitizer/asan/asan_allocator2.cc
@@ -180,20 +180,19 @@ uptr AsanChunkView::UsedSize() { return chunk_->UsedSize(); }
uptr AsanChunkView::AllocTid() { return chunk_->alloc_tid; }
uptr AsanChunkView::FreeTid() { return chunk_->free_tid; }
-static void GetStackTraceFromId(u32 id, StackTrace *stack) {
+static StackTrace GetStackTraceFromId(u32 id) {
CHECK(id);
- uptr size = 0;
- const uptr *trace = StackDepotGet(id, &size);
- CHECK(trace);
- stack->CopyFrom(trace, size);
+ StackTrace res = StackDepotGet(id);
+ CHECK(res.trace);
+ return res;
}
-void AsanChunkView::GetAllocStack(StackTrace *stack) {
- GetStackTraceFromId(chunk_->alloc_context_id, stack);
+StackTrace AsanChunkView::GetAllocStack() {
+ return GetStackTraceFromId(chunk_->alloc_context_id);
}
-void AsanChunkView::GetFreeStack(StackTrace *stack) {
- GetStackTraceFromId(chunk_->free_context_id, stack);
+StackTrace AsanChunkView::GetFreeStack() {
+ return GetStackTraceFromId(chunk_->free_context_id);
}
struct QuarantineCallback;
@@ -261,7 +260,7 @@ void ReInitializeAllocator() {
quarantine.Init((uptr)flags()->quarantine_size, kMaxThreadLocalQuarantine);
}
-static void *Allocate(uptr size, uptr alignment, StackTrace *stack,
+static void *Allocate(uptr size, uptr alignment, BufferedStackTrace *stack,
AllocType alloc_type, bool can_fill) {
if (UNLIKELY(!asan_inited))
AsanInitFromRtl();
@@ -353,7 +352,7 @@ static void *Allocate(uptr size, uptr alignment, StackTrace *stack,
meta[1] = chunk_beg;
}
- m->alloc_context_id = StackDepotPut(stack->trace, stack->size);
+ m->alloc_context_id = StackDepotPut(*stack);
uptr size_rounded_down_to_granularity = RoundDownTo(size, SHADOW_GRANULARITY);
// Unpoison the bulk of the memory region.
@@ -389,15 +388,16 @@ static void *Allocate(uptr size, uptr alignment, StackTrace *stack,
return res;
}
-static void ReportInvalidFree(void *ptr, u8 chunk_state, StackTrace *stack) {
+static void ReportInvalidFree(void *ptr, u8 chunk_state,
+ BufferedStackTrace *stack) {
if (chunk_state == CHUNK_QUARANTINE)
ReportDoubleFree((uptr)ptr, stack);
else
ReportFreeNotMalloced((uptr)ptr, stack);
}
-static void AtomicallySetQuarantineFlag(AsanChunk *m,
- void *ptr, StackTrace *stack) {
+static void AtomicallySetQuarantineFlag(AsanChunk *m, void *ptr,
+ BufferedStackTrace *stack) {
u8 old_chunk_state = CHUNK_ALLOCATED;
// Flip the chunk_state atomically to avoid race on double-free.
if (!atomic_compare_exchange_strong((atomic_uint8_t*)m, &old_chunk_state,
@@ -408,8 +408,8 @@ static void AtomicallySetQuarantineFlag(AsanChunk *m,
// Expects the chunk to already be marked as quarantined by using
// AtomicallySetQuarantineFlag.
-static void QuarantineChunk(AsanChunk *m, void *ptr,
- StackTrace *stack, AllocType alloc_type) {
+static void QuarantineChunk(AsanChunk *m, void *ptr, BufferedStackTrace *stack,
+ AllocType alloc_type) {
CHECK_EQ(m->chunk_state, CHUNK_QUARANTINE);
if (m->alloc_type != alloc_type && flags()->alloc_dealloc_mismatch)
@@ -421,7 +421,7 @@ static void QuarantineChunk(AsanChunk *m, void *ptr,
CHECK_EQ(m->free_tid, kInvalidTid);
AsanThread *t = GetCurrentThread();
m->free_tid = t ? t->tid() : 0;
- m->free_context_id = StackDepotPut(stack->trace, stack->size);
+ m->free_context_id = StackDepotPut(*stack);
// Poison the region.
PoisonShadow(m->Beg(),
RoundUpTo(m->UsedSize(), SHADOW_GRANULARITY),
@@ -445,7 +445,7 @@ static void QuarantineChunk(AsanChunk *m, void *ptr,
}
}
-static void Deallocate(void *ptr, uptr delete_size, StackTrace *stack,
+static void Deallocate(void *ptr, uptr delete_size, BufferedStackTrace *stack,
AllocType alloc_type) {
uptr p = reinterpret_cast<uptr>(ptr);
if (p == 0) return;
@@ -462,7 +462,8 @@ static void Deallocate(void *ptr, uptr delete_size, StackTrace *stack,
QuarantineChunk(m, ptr, stack, alloc_type);
}
-static void *Reallocate(void *old_ptr, uptr new_size, StackTrace *stack) {
+static void *Reallocate(void *old_ptr, uptr new_size,
+ BufferedStackTrace *stack) {
CHECK(old_ptr && new_size);
uptr p = reinterpret_cast<uptr>(old_ptr);
uptr chunk_beg = p - kChunkHeaderSize;
@@ -575,25 +576,25 @@ void PrintInternalAllocatorStats() {
allocator.PrintStats();
}
-void *asan_memalign(uptr alignment, uptr size, StackTrace *stack,
+void *asan_memalign(uptr alignment, uptr size, BufferedStackTrace *stack,
AllocType alloc_type) {
return Allocate(size, alignment, stack, alloc_type, true);
}
-void asan_free(void *ptr, StackTrace *stack, AllocType alloc_type) {
+void asan_free(void *ptr, BufferedStackTrace *stack, AllocType alloc_type) {
Deallocate(ptr, 0, stack, alloc_type);
}
-void asan_sized_free(void *ptr, uptr size, StackTrace *stack,
+void asan_sized_free(void *ptr, uptr size, BufferedStackTrace *stack,
AllocType alloc_type) {
Deallocate(ptr, size, stack, alloc_type);
}
-void *asan_malloc(uptr size, StackTrace *stack) {
+void *asan_malloc(uptr size, BufferedStackTrace *stack) {
return Allocate(size, 8, stack, FROM_MALLOC, true);
}
-void *asan_calloc(uptr nmemb, uptr size, StackTrace *stack) {
+void *asan_calloc(uptr nmemb, uptr size, BufferedStackTrace *stack) {
if (CallocShouldReturnNullDueToOverflow(size, nmemb))
return AllocatorReturnNull();
void *ptr = Allocate(nmemb * size, 8, stack, FROM_MALLOC, false);
@@ -604,7 +605,7 @@ void *asan_calloc(uptr nmemb, uptr size, StackTrace *stack) {
return ptr;
}
-void *asan_realloc(void *p, uptr size, StackTrace *stack) {
+void *asan_realloc(void *p, uptr size, BufferedStackTrace *stack) {
if (p == 0)
return Allocate(size, 8, stack, FROM_MALLOC, true);
if (size == 0) {
@@ -614,11 +615,11 @@ void *asan_realloc(void *p, uptr size, StackTrace *stack) {
return Reallocate(p, size, stack);
}
-void *asan_valloc(uptr size, StackTrace *stack) {
+void *asan_valloc(uptr size, BufferedStackTrace *stack) {
return Allocate(size, GetPageSizeCached(), stack, FROM_MALLOC, true);
}
-void *asan_pvalloc(uptr size, StackTrace *stack) {
+void *asan_pvalloc(uptr size, BufferedStackTrace *stack) {
uptr PageSize = GetPageSizeCached();
size = RoundUpTo(size, PageSize);
if (size == 0) {
@@ -629,7 +630,7 @@ void *asan_pvalloc(uptr size, StackTrace *stack) {
}
int asan_posix_memalign(void **memptr, uptr alignment, uptr size,
- StackTrace *stack) {
+ BufferedStackTrace *stack) {
void *ptr = Allocate(size, alignment, stack, FROM_MALLOC, true);
CHECK(IsAligned((uptr)ptr, alignment));
*memptr = ptr;
diff --git a/libsanitizer/asan/asan_debugging.cc b/libsanitizer/asan/asan_debugging.cc
index 302574d9dd8..3efad658a4c 100644
--- a/libsanitizer/asan/asan_debugging.cc
+++ b/libsanitizer/asan/asan_debugging.cc
@@ -15,31 +15,88 @@
#include "asan_flags.h"
#include "asan_internal.h"
#include "asan_mapping.h"
+#include "asan_report.h"
#include "asan_thread.h"
namespace __asan {
+void GetInfoForStackVar(uptr addr, AddressDescription *descr, AsanThread *t) {
+ descr->name[0] = 0;
+ descr->region_address = 0;
+ descr->region_size = 0;
+ descr->region_kind = "stack";
+
+ AsanThread::StackFrameAccess access;
+ if (!t->GetStackFrameAccessByAddr(addr, &access))
+ return;
+ InternalMmapVector<StackVarDescr> vars(16);
+ if (!ParseFrameDescription(access.frame_descr, &vars)) {
+ return;
+ }
+
+ for (uptr i = 0; i < vars.size(); i++) {
+ if (access.offset <= vars[i].beg + vars[i].size) {
+ internal_strncat(descr->name, vars[i].name_pos,
+ Min(descr->name_size, vars[i].name_len));
+ descr->region_address = addr - (access.offset - vars[i].beg);
+ descr->region_size = vars[i].size;
+ return;
+ }
+ }
+}
+
+void GetInfoForHeapAddress(uptr addr, AddressDescription *descr) {
+ AsanChunkView chunk = FindHeapChunkByAddress(addr);
+
+ descr->name[0] = 0;
+ descr->region_address = 0;
+ descr->region_size = 0;
+
+ if (!chunk.IsValid()) {
+ descr->region_kind = "heap-invalid";
+ return;
+ }
+
+ descr->region_address = chunk.Beg();
+ descr->region_size = chunk.UsedSize();
+ descr->region_kind = "heap";
+}
+
+void AsanLocateAddress(uptr addr, AddressDescription *descr) {
+ if (DescribeAddressIfShadow(addr, descr, /* print */ false)) {
+ return;
+ }
+ if (GetInfoForAddressIfGlobal(addr, descr)) {
+ return;
+ }
+ asanThreadRegistry().Lock();
+ AsanThread *thread = FindThreadByStackAddress(addr);
+ asanThreadRegistry().Unlock();
+ if (thread) {
+ GetInfoForStackVar(addr, descr, thread);
+ return;
+ }
+ GetInfoForHeapAddress(addr, descr);
+}
+
uptr AsanGetStack(uptr addr, uptr *trace, uptr size, u32 *thread_id,
bool alloc_stack) {
AsanChunkView chunk = FindHeapChunkByAddress(addr);
if (!chunk.IsValid()) return 0;
- StackTrace stack;
+ StackTrace stack(nullptr, 0);
if (alloc_stack) {
if (chunk.AllocTid() == kInvalidTid) return 0;
- chunk.GetAllocStack(&stack);
+ stack = chunk.GetAllocStack();
if (thread_id) *thread_id = chunk.AllocTid();
} else {
if (chunk.FreeTid() == kInvalidTid) return 0;
- chunk.GetFreeStack(&stack);
+ stack = chunk.GetFreeStack();
if (thread_id) *thread_id = chunk.FreeTid();
}
if (trace && size) {
- if (size > kStackTraceMax)
- size = kStackTraceMax;
- if (size > stack.size)
- size = stack.size;
+ size = Min(size, Min(stack.size, kStackTraceMax));
for (uptr i = 0; i < size; i++)
trace[i] = StackTrace::GetPreviousInstructionPc(stack.trace[i]);
@@ -54,6 +111,16 @@ uptr AsanGetStack(uptr addr, uptr *trace, uptr size, u32 *thread_id,
using namespace __asan;
SANITIZER_INTERFACE_ATTRIBUTE
+const char *__asan_locate_address(uptr addr, char *name, uptr name_size,
+ uptr *region_address, uptr *region_size) {
+ AddressDescription descr = { name, name_size, 0, 0, 0 };
+ AsanLocateAddress(addr, &descr);
+ if (region_address) *region_address = descr.region_address;
+ if (region_size) *region_size = descr.region_size;
+ return descr.region_kind;
+}
+
+SANITIZER_INTERFACE_ATTRIBUTE
uptr __asan_get_alloc_stack(uptr addr, uptr *trace, uptr size, u32 *thread_id) {
return AsanGetStack(addr, trace, size, thread_id, /* alloc_stack */ true);
}
diff --git a/libsanitizer/asan/asan_flags.h b/libsanitizer/asan/asan_flags.h
index 2f155eb5cbc..0b6a9857be0 100644
--- a/libsanitizer/asan/asan_flags.h
+++ b/libsanitizer/asan/asan_flags.h
@@ -63,6 +63,7 @@ struct Flags {
int detect_invalid_pointer_pairs;
bool detect_container_overflow;
int detect_odr_violation;
+ bool dump_instruction_bytes;
};
extern Flags asan_flags_dont_use_directly;
diff --git a/libsanitizer/asan/asan_globals.cc b/libsanitizer/asan/asan_globals.cc
index 15c1886af0e..ee2ecdcc957 100644
--- a/libsanitizer/asan/asan_globals.cc
+++ b/libsanitizer/asan/asan_globals.cc
@@ -69,6 +69,14 @@ ALWAYS_INLINE void PoisonRedZones(const Global &g) {
}
}
+const uptr kMinimalDistanceFromAnotherGlobal = 64;
+
+bool IsAddressNearGlobal(uptr addr, const __asan_global &g) {
+ if (addr <= g.beg - kMinimalDistanceFromAnotherGlobal) return false;
+ if (addr >= g.beg + g.size_with_redzone) return false;
+ return true;
+}
+
static void ReportGlobal(const Global &g, const char *prefix) {
Report("%s Global[%p]: beg=%p size=%zu/%zu name=%s module=%s dyn_init=%zu\n",
prefix, &g, (void *)g.beg, g.size, g.size_with_redzone, g.name,
@@ -80,19 +88,45 @@ static void ReportGlobal(const Global &g, const char *prefix) {
}
}
-bool DescribeAddressIfGlobal(uptr addr, uptr size) {
+static bool DescribeOrGetInfoIfGlobal(uptr addr, uptr size, bool print,
+ Global *output_global) {
if (!flags()->report_globals) return false;
BlockingMutexLock lock(&mu_for_globals);
bool res = false;
for (ListOfGlobals *l = list_of_all_globals; l; l = l->next) {
const Global &g = *l->g;
- if (flags()->report_globals >= 2)
- ReportGlobal(g, "Search");
- res |= DescribeAddressRelativeToGlobal(addr, size, g);
+ if (print) {
+ if (flags()->report_globals >= 2)
+ ReportGlobal(g, "Search");
+ res |= DescribeAddressRelativeToGlobal(addr, size, g);
+ } else {
+ if (IsAddressNearGlobal(addr, g)) {
+ CHECK(output_global);
+ *output_global = g;
+ return true;
+ }
+ }
}
return res;
}
+bool DescribeAddressIfGlobal(uptr addr, uptr size) {
+ return DescribeOrGetInfoIfGlobal(addr, size, /* print */ true,
+ /* output_global */ nullptr);
+}
+
+bool GetInfoForAddressIfGlobal(uptr addr, AddressDescription *descr) {
+ Global g = {};
+ if (DescribeOrGetInfoIfGlobal(addr, /* size */ 1, /* print */ false, &g)) {
+ internal_strncpy(descr->name, g.name, descr->name_size);
+ descr->region_address = g.beg;
+ descr->region_size = g.size;
+ descr->region_kind = "global";
+ return true;
+ }
+ return false;
+}
+
u32 FindRegistrationSite(const Global *g) {
CHECK(global_registration_site_vector);
for (uptr i = 0, n = global_registration_site_vector->size(); i < n; i++) {
@@ -181,7 +215,7 @@ using namespace __asan; // NOLINT
void __asan_register_globals(__asan_global *globals, uptr n) {
if (!flags()->report_globals) return;
GET_STACK_TRACE_FATAL_HERE;
- u32 stack_id = StackDepotPut(stack.trace, stack.size);
+ u32 stack_id = StackDepotPut(stack);
BlockingMutexLock lock(&mu_for_globals);
if (!global_registration_site_vector)
global_registration_site_vector =
diff --git a/libsanitizer/asan/asan_interface_internal.h b/libsanitizer/asan/asan_interface_internal.h
index 1a3b33fed0b..939327eb8a4 100644
--- a/libsanitizer/asan/asan_interface_internal.h
+++ b/libsanitizer/asan/asan_interface_internal.h
@@ -89,6 +89,28 @@ extern "C" {
void __asan_describe_address(uptr addr);
SANITIZER_INTERFACE_ATTRIBUTE
+ int __asan_report_present();
+
+ SANITIZER_INTERFACE_ATTRIBUTE
+ uptr __asan_get_report_pc();
+ SANITIZER_INTERFACE_ATTRIBUTE
+ uptr __asan_get_report_bp();
+ SANITIZER_INTERFACE_ATTRIBUTE
+ uptr __asan_get_report_sp();
+ SANITIZER_INTERFACE_ATTRIBUTE
+ uptr __asan_get_report_address();
+ SANITIZER_INTERFACE_ATTRIBUTE
+ int __asan_get_report_access_type();
+ SANITIZER_INTERFACE_ATTRIBUTE
+ uptr __asan_get_report_access_size();
+ SANITIZER_INTERFACE_ATTRIBUTE
+ const char * __asan_get_report_description();
+
+ SANITIZER_INTERFACE_ATTRIBUTE
+ const char * __asan_locate_address(uptr addr, char *name, uptr name_size,
+ uptr *region_address, uptr *region_size);
+
+ SANITIZER_INTERFACE_ATTRIBUTE
uptr __asan_get_alloc_stack(uptr addr, uptr *trace, uptr size,
u32 *thread_id);
@@ -149,6 +171,10 @@ extern "C" {
void __asan_poison_cxx_array_cookie(uptr p);
SANITIZER_INTERFACE_ATTRIBUTE
uptr __asan_load_cxx_array_cookie(uptr *p);
+ SANITIZER_INTERFACE_ATTRIBUTE
+ void __asan_poison_intra_object_redzone(uptr p, uptr size);
+ SANITIZER_INTERFACE_ATTRIBUTE
+ void __asan_unpoison_intra_object_redzone(uptr p, uptr size);
} // extern "C"
#endif // ASAN_INTERFACE_INTERNAL_H
diff --git a/libsanitizer/asan/asan_internal.h b/libsanitizer/asan/asan_internal.h
index 9473bf6a2ca..8911575d84a 100644
--- a/libsanitizer/asan/asan_internal.h
+++ b/libsanitizer/asan/asan_internal.h
@@ -133,6 +133,7 @@ const int kAsanStackUseAfterScopeMagic = 0xf8;
const int kAsanGlobalRedzoneMagic = 0xf9;
const int kAsanInternalHeapMagic = 0xfe;
const int kAsanArrayCookieMagic = 0xac;
+const int kAsanIntraObjectRedzone = 0xbb;
static const uptr kCurrentStackFrameMagic = 0x41B58AB3;
static const uptr kRetiredStackFrameMagic = 0x45E0360E;
diff --git a/libsanitizer/asan/asan_mac.cc b/libsanitizer/asan/asan_mac.cc
index e4c71cedd31..70823bdef92 100644
--- a/libsanitizer/asan/asan_mac.cc
+++ b/libsanitizer/asan/asan_mac.cc
@@ -295,7 +295,7 @@ using namespace __asan; // NOLINT
// The caller retains control of the allocated context.
extern "C"
asan_block_context_t *alloc_asan_context(void *ctxt, dispatch_function_t func,
- StackTrace *stack) {
+ BufferedStackTrace *stack) {
asan_block_context_t *asan_ctxt =
(asan_block_context_t*) asan_malloc(sizeof(asan_block_context_t), stack);
asan_ctxt->block = ctxt;
diff --git a/libsanitizer/asan/asan_mapping.h b/libsanitizer/asan/asan_mapping.h
index a1f84e24c46..907704d7fc9 100644
--- a/libsanitizer/asan/asan_mapping.h
+++ b/libsanitizer/asan/asan_mapping.h
@@ -58,11 +58,11 @@
// || `[0x00000000, 0x1fffffff]` || LowMem ||
//
// Default Linux/MIPS mapping:
-// || `[0x2aaa8000, 0xffffffff]` || HighMem ||
-// || `[0x0fffd000, 0x2aaa7fff]` || HighShadow ||
-// || `[0x0bffd000, 0x0fffcfff]` || ShadowGap ||
-// || `[0x0aaa8000, 0x0bffcfff]` || LowShadow ||
-// || `[0x00000000, 0x0aaa7fff]` || LowMem ||
+// || `[0x2aaa0000, 0xffffffff]` || HighMem ||
+// || `[0x0fff4000, 0x2aa9ffff]` || HighShadow ||
+// || `[0x0bff4000, 0x0fff3fff]` || ShadowGap ||
+// || `[0x0aaa0000, 0x0bff3fff]` || LowShadow ||
+// || `[0x00000000, 0x0aa9ffff]` || LowMem ||
//
// Shadow mapping on FreeBSD/x86-64 with SHADOW_OFFSET == 0x400000000000:
// || `[0x500000000000, 0x7fffffffffff]` || HighMem ||
@@ -84,7 +84,8 @@ static const u64 kIosShadowOffset32 = 1ULL << 30; // 0x40000000
static const u64 kDefaultShadowOffset64 = 1ULL << 44;
static const u64 kDefaultShort64bitShadowOffset = 0x7FFF8000; // < 2G.
static const u64 kAArch64_ShadowOffset64 = 1ULL << 36;
-static const u64 kMIPS32_ShadowOffset32 = 0x0aaa8000;
+static const u64 kMIPS32_ShadowOffset32 = 0x0aaa0000;
+static const u64 kMIPS64_ShadowOffset64 = 1ULL << 36;
static const u64 kPPC64_ShadowOffset64 = 1ULL << 41;
static const u64 kFreeBSD_ShadowOffset32 = 1ULL << 30; // 0x40000000
static const u64 kFreeBSD_ShadowOffset64 = 1ULL << 46; // 0x400000000000
@@ -114,6 +115,8 @@ static const u64 kFreeBSD_ShadowOffset64 = 1ULL << 46; // 0x400000000000
# define SHADOW_OFFSET kFreeBSD_ShadowOffset64
# elif SANITIZER_MAC
# define SHADOW_OFFSET kDefaultShadowOffset64
+# elif defined(__mips64)
+# define SHADOW_OFFSET kMIPS64_ShadowOffset64
# else
# define SHADOW_OFFSET kDefaultShort64bitShadowOffset
# endif
diff --git a/libsanitizer/asan/asan_poisoning.cc b/libsanitizer/asan/asan_poisoning.cc
index 65f6cf0046e..c0f3991c1f3 100644
--- a/libsanitizer/asan/asan_poisoning.cc
+++ b/libsanitizer/asan/asan_poisoning.cc
@@ -59,6 +59,27 @@ void FlushUnneededASanShadowMemory(uptr p, uptr size) {
FlushUnneededShadowMemory(shadow_beg, shadow_end - shadow_beg);
}
+void AsanPoisonOrUnpoisonIntraObjectRedzone(uptr ptr, uptr size, bool poison) {
+ uptr end = ptr + size;
+ if (common_flags()->verbosity) {
+ Printf("__asan_%spoison_intra_object_redzone [%p,%p) %zd\n",
+ poison ? "" : "un", ptr, end, size);
+ if (common_flags()->verbosity >= 2)
+ PRINT_CURRENT_STACK();
+ }
+ CHECK(size);
+ CHECK_LE(size, 4096);
+ CHECK(IsAligned(end, SHADOW_GRANULARITY));
+ if (!IsAligned(ptr, SHADOW_GRANULARITY)) {
+ *(u8 *)MemToShadow(ptr) =
+ poison ? static_cast<u8>(ptr % SHADOW_GRANULARITY) : 0;
+ ptr |= SHADOW_GRANULARITY - 1;
+ ptr++;
+ }
+ for (; ptr < end; ptr += SHADOW_GRANULARITY)
+ *(u8*)MemToShadow(ptr) = poison ? kAsanIntraObjectRedzone : 0;
+}
+
} // namespace __asan
// ---------------------- Interface ---------------- {{{1
@@ -250,7 +271,8 @@ uptr __asan_load_cxx_array_cookie(uptr *p) {
"expect a double-free report\n");
return 0;
}
- // FIXME: apparently it can be something else; need to find a reproducer.
+ // The cookie may remain unpoisoned if e.g. it comes from a custom
+ // operator new defined inside a class.
return *p;
}
@@ -372,6 +394,17 @@ int __sanitizer_verify_contiguous_container(const void *beg_p,
return 0;
return 1;
}
+
+extern "C" SANITIZER_INTERFACE_ATTRIBUTE
+void __asan_poison_intra_object_redzone(uptr ptr, uptr size) {
+ AsanPoisonOrUnpoisonIntraObjectRedzone(ptr, size, true);
+}
+
+extern "C" SANITIZER_INTERFACE_ATTRIBUTE
+void __asan_unpoison_intra_object_redzone(uptr ptr, uptr size) {
+ AsanPoisonOrUnpoisonIntraObjectRedzone(ptr, size, false);
+}
+
// --- Implementation of LSan-specific functions --- {{{1
namespace __lsan {
bool WordIsPoisoned(uptr addr) {
diff --git a/libsanitizer/asan/asan_posix.cc b/libsanitizer/asan/asan_posix.cc
index 4eabb74ba80..06d24d4e0ee 100644
--- a/libsanitizer/asan/asan_posix.cc
+++ b/libsanitizer/asan/asan_posix.cc
@@ -31,6 +31,7 @@
namespace __asan {
void AsanOnSIGSEGV(int, void *siginfo, void *context) {
+ ScopedDeadlySignal signal_scope(GetCurrentThread());
uptr addr = (uptr)((siginfo_t*)siginfo)->si_addr;
int code = (int)((siginfo_t*)siginfo)->si_code;
// Write the first message using the bullet-proof write.
@@ -39,12 +40,12 @@ void AsanOnSIGSEGV(int, void *siginfo, void *context) {
GetPcSpBp(context, &pc, &sp, &bp);
// Access at a reasonable offset above SP, or slightly below it (to account
- // for x86_64 redzone, ARM push of multiple registers, etc) is probably a
- // stack overflow.
+ // for x86_64 or PowerPC redzone, ARM push of multiple registers, etc) is
+ // probably a stack overflow.
// We also check si_code to filter out SEGV caused by something else other
// then hitting the guard page or unmapped memory, like, for example,
// unaligned memory access.
- if (addr + 128 > sp && addr < sp + 0xFFFF &&
+ if (addr + 512 > sp && addr < sp + 0xFFFF &&
(code == si_SEGV_MAPERR || code == si_SEGV_ACCERR))
ReportStackOverflow(pc, sp, bp, context, addr);
else
diff --git a/libsanitizer/asan/asan_report.cc b/libsanitizer/asan/asan_report.cc
index 05622a12518..fcccb70ff8b 100644
--- a/libsanitizer/asan/asan_report.cc
+++ b/libsanitizer/asan/asan_report.cc
@@ -29,6 +29,19 @@ static char *error_message_buffer = 0;
static uptr error_message_buffer_pos = 0;
static uptr error_message_buffer_size = 0;
+struct ReportData {
+ uptr pc;
+ uptr sp;
+ uptr bp;
+ uptr addr;
+ bool is_write;
+ uptr access_size;
+ const char *description;
+};
+
+static bool report_happened = false;
+static ReportData report_data = {};
+
void AppendToErrorMessageBuffer(const char *buffer) {
if (error_message_buffer) {
uptr length = internal_strlen(buffer);
@@ -79,20 +92,31 @@ class Decorator: public __sanitizer::SanitizerCommonDecorator {
return Red();
case kAsanInternalHeapMagic:
return Yellow();
+ case kAsanIntraObjectRedzone:
+ return Yellow();
default:
return Default();
}
}
const char *EndShadowByte() { return Default(); }
+ const char *MemoryByte() { return Magenta(); }
+ const char *EndMemoryByte() { return Default(); }
};
// ---------------------- Helper functions ----------------------- {{{1
-static void PrintShadowByte(InternalScopedString *str, const char *before,
- u8 byte, const char *after = "\n") {
+static void PrintMemoryByte(InternalScopedString *str, const char *before,
+ u8 byte, bool in_shadow, const char *after = "\n") {
Decorator d;
- str->append("%s%s%x%x%s%s", before, d.ShadowByte(byte), byte >> 4, byte & 15,
- d.EndShadowByte(), after);
+ str->append("%s%s%x%x%s%s", before,
+ in_shadow ? d.ShadowByte(byte) : d.MemoryByte(),
+ byte >> 4, byte & 15,
+ in_shadow ? d.EndShadowByte() : d.EndMemoryByte(), after);
+}
+
+static void PrintShadowByte(InternalScopedString *str, const char *before,
+ u8 byte, const char *after = "\n") {
+ PrintMemoryByte(str, before, byte, /*in_shadow*/true, after);
}
static void PrintShadowBytes(InternalScopedString *str, const char *before,
@@ -144,9 +168,27 @@ static void PrintLegend(InternalScopedString *str) {
kAsanContiguousContainerOOBMagic);
PrintShadowByte(str, " Array cookie: ",
kAsanArrayCookieMagic);
+ PrintShadowByte(str, " Intra object redzone: ",
+ kAsanIntraObjectRedzone);
PrintShadowByte(str, " ASan internal: ", kAsanInternalHeapMagic);
}
+void MaybeDumpInstructionBytes(uptr pc) {
+ if (!flags()->dump_instruction_bytes || (pc < GetPageSizeCached()))
+ return;
+ InternalScopedString str(1024);
+ str.append("First 16 instruction bytes at pc: ");
+ if (IsAccessibleMemoryRange(pc, 16)) {
+ for (int i = 0; i < 16; ++i) {
+ PrintMemoryByte(&str, "", ((u8 *)pc)[i], /*in_shadow*/false, " ");
+ }
+ str.append("\n");
+ } else {
+ str.append("unaccessible\n");
+ }
+ Report("%s", str.data());
+}
+
static void PrintShadowMemoryForAddress(uptr addr) {
if (!AddrIsInMem(addr)) return;
uptr shadow_addr = MemToShadow(addr);
@@ -235,9 +277,7 @@ static void PrintGlobalLocation(InternalScopedString *str,
bool DescribeAddressRelativeToGlobal(uptr addr, uptr size,
const __asan_global &g) {
- static const uptr kMinimalDistanceFromAnotherGlobal = 64;
- if (addr <= g.beg - kMinimalDistanceFromAnotherGlobal) return false;
- if (addr >= g.beg + g.size_with_redzone) return false;
+ if (!IsAddressNearGlobal(addr, g)) return false;
InternalScopedString str(4096);
Decorator d;
str.append("%s", d.Location());
@@ -263,21 +303,20 @@ bool DescribeAddressRelativeToGlobal(uptr addr, uptr size,
return true;
}
-bool DescribeAddressIfShadow(uptr addr) {
+bool DescribeAddressIfShadow(uptr addr, AddressDescription *descr, bool print) {
if (AddrIsInMem(addr))
return false;
- static const char kAddrInShadowReport[] =
- "Address %p is located in the %s.\n";
- if (AddrIsInShadowGap(addr)) {
- Printf(kAddrInShadowReport, addr, "shadow gap area");
- return true;
- }
- if (AddrIsInHighShadow(addr)) {
- Printf(kAddrInShadowReport, addr, "high shadow area");
- return true;
- }
- if (AddrIsInLowShadow(addr)) {
- Printf(kAddrInShadowReport, addr, "low shadow area");
+ const char *area_type = nullptr;
+ if (AddrIsInShadowGap(addr)) area_type = "shadow gap";
+ else if (AddrIsInHighShadow(addr)) area_type = "high shadow";
+ else if (AddrIsInLowShadow(addr)) area_type = "low shadow";
+ if (area_type != nullptr) {
+ if (print) {
+ Printf("Address %p is located in the %s area.\n", addr, area_type);
+ } else {
+ CHECK(descr);
+ descr->region_kind = area_type;
+ }
return true;
}
CHECK(0 && "Address is not in memory and not in shadow?");
@@ -304,16 +343,15 @@ const char *ThreadNameWithParenthesis(u32 tid, char buff[],
return ThreadNameWithParenthesis(t, buff, buff_len);
}
-void PrintAccessAndVarIntersection(const char *var_name,
- uptr var_beg, uptr var_size,
- uptr addr, uptr access_size,
- uptr prev_var_end, uptr next_var_beg) {
- uptr var_end = var_beg + var_size;
+static void PrintAccessAndVarIntersection(const StackVarDescr &var, uptr addr,
+ uptr access_size, uptr prev_var_end,
+ uptr next_var_beg) {
+ uptr var_end = var.beg + var.size;
uptr addr_end = addr + access_size;
const char *pos_descr = 0;
- // If the variable [var_beg, var_end) is the nearest variable to the
+ // If the variable [var.beg, var_end) is the nearest variable to the
// current memory access, indicate it in the log.
- if (addr >= var_beg) {
+ if (addr >= var.beg) {
if (addr_end <= var_end)
pos_descr = "is inside"; // May happen if this is a use-after-return.
else if (addr < var_end)
@@ -322,14 +360,20 @@ void PrintAccessAndVarIntersection(const char *var_name,
next_var_beg - addr_end >= addr - var_end)
pos_descr = "overflows";
} else {
- if (addr_end > var_beg)
+ if (addr_end > var.beg)
pos_descr = "partially underflows";
else if (addr >= prev_var_end &&
- addr - prev_var_end >= var_beg - addr_end)
+ addr - prev_var_end >= var.beg - addr_end)
pos_descr = "underflows";
}
InternalScopedString str(1024);
- str.append(" [%zd, %zd) '%s'", var_beg, var_beg + var_size, var_name);
+ str.append(" [%zd, %zd)", var.beg, var_end);
+ // Render variable name.
+ str.append(" '");
+ for (uptr i = 0; i < var.name_len; ++i) {
+ str.append("%c", var.name_pos[i]);
+ }
+ str.append("'");
if (pos_descr) {
Decorator d;
// FIXME: we may want to also print the size of the access here,
@@ -344,9 +388,14 @@ void PrintAccessAndVarIntersection(const char *var_name,
bool ParseFrameDescription(const char *frame_descr,
InternalMmapVector<StackVarDescr> *vars) {
+ CHECK(frame_descr);
char *p;
+ // This string is created by the compiler and has the following form:
+ // "n alloc_1 alloc_2 ... alloc_n"
+ // where alloc_i looks like "offset size len ObjectName".
uptr n_objects = (uptr)internal_simple_strtoll(frame_descr, &p, 10);
- CHECK_GT(n_objects, 0);
+ if (n_objects == 0)
+ return false;
for (uptr i = 0; i < n_objects; i++) {
uptr beg = (uptr)internal_simple_strtoll(p, &p, 10);
@@ -367,31 +416,21 @@ bool ParseFrameDescription(const char *frame_descr,
bool DescribeAddressIfStack(uptr addr, uptr access_size) {
AsanThread *t = FindThreadByStackAddress(addr);
if (!t) return false;
- const uptr kBufSize = 4095;
- char buf[kBufSize];
- uptr offset = 0;
- uptr frame_pc = 0;
- char tname[128];
- const char *frame_descr = t->GetFrameNameByAddr(addr, &offset, &frame_pc);
-
-#ifdef __powerpc64__
- // On PowerPC64, the address of a function actually points to a
- // three-doubleword data structure with the first field containing
- // the address of the function's code.
- frame_pc = *reinterpret_cast<uptr *>(frame_pc);
-#endif
- // This string is created by the compiler and has the following form:
- // "n alloc_1 alloc_2 ... alloc_n"
- // where alloc_i looks like "offset size len ObjectName ".
- CHECK(frame_descr);
Decorator d;
+ char tname[128];
Printf("%s", d.Location());
- Printf("Address %p is located in stack of thread T%d%s "
- "at offset %zu in frame\n",
- addr, t->tid(),
- ThreadNameWithParenthesis(t->tid(), tname, sizeof(tname)),
- offset);
+ Printf("Address %p is located in stack of thread T%d%s", addr, t->tid(),
+ ThreadNameWithParenthesis(t->tid(), tname, sizeof(tname)));
+
+ // Try to fetch precise stack frame for this access.
+ AsanThread::StackFrameAccess access;
+ if (!t->GetStackFrameAccessByAddr(addr, &access)) {
+ Printf("%s\n", d.EndLocation());
+ return true;
+ }
+ Printf(" at offset %zu in frame%s\n", access.offset, d.EndLocation());
+
// Now we print the frame where the alloca has happened.
// We print this frame as a stack trace with one element.
// The symbolizer may print more than one frame if inlining was involved.
@@ -399,16 +438,21 @@ bool DescribeAddressIfStack(uptr addr, uptr access_size) {
// previously. That's unfortunate, but I have no better solution,
// especially given that the alloca may be from entirely different place
// (e.g. use-after-scope, or different thread's stack).
- StackTrace alloca_stack;
- alloca_stack.trace[0] = frame_pc + 16;
- alloca_stack.size = 1;
+#if defined(__powerpc64__) && defined(__BIG_ENDIAN__)
+ // On PowerPC64 ELFv1, the address of a function actually points to a
+ // three-doubleword data structure with the first field containing
+ // the address of the function's code.
+ access.frame_pc = *reinterpret_cast<uptr *>(access.frame_pc);
+#endif
+ access.frame_pc += 16;
Printf("%s", d.EndLocation());
+ StackTrace alloca_stack(&access.frame_pc, 1);
alloca_stack.Print();
InternalMmapVector<StackVarDescr> vars(16);
- if (!ParseFrameDescription(frame_descr, &vars)) {
+ if (!ParseFrameDescription(access.frame_descr, &vars)) {
Printf("AddressSanitizer can't parse the stack frame "
- "descriptor: |%s|\n", frame_descr);
+ "descriptor: |%s|\n", access.frame_descr);
// 'addr' is a stack address, so return true even if we can't parse frame
return true;
}
@@ -418,13 +462,9 @@ bool DescribeAddressIfStack(uptr addr, uptr access_size) {
// Report all objects in this frame.
for (uptr i = 0; i < n_objects; i++) {
- buf[0] = 0;
- internal_strncat(buf, vars[i].name_pos,
- static_cast<uptr>(Min(kBufSize, vars[i].name_len)));
uptr prev_var_end = i ? vars[i - 1].beg + vars[i - 1].size : 0;
uptr next_var_beg = i + 1 < n_objects ? vars[i + 1].beg : ~(0UL);
- PrintAccessAndVarIntersection(buf, vars[i].beg, vars[i].size,
- offset, access_size,
+ PrintAccessAndVarIntersection(vars[i], access.offset, access_size,
prev_var_end, next_var_beg);
}
Printf("HINT: this may be a false positive if your program uses "
@@ -476,8 +516,7 @@ void DescribeHeapAddress(uptr addr, uptr access_size) {
asanThreadRegistry().CheckLocked();
AsanThreadContext *alloc_thread =
GetThreadContextByTidLocked(chunk.AllocTid());
- StackTrace alloc_stack;
- chunk.GetAllocStack(&alloc_stack);
+ StackTrace alloc_stack = chunk.GetAllocStack();
char tname[128];
Decorator d;
AsanThreadContext *free_thread = 0;
@@ -487,8 +526,7 @@ void DescribeHeapAddress(uptr addr, uptr access_size) {
free_thread->tid,
ThreadNameWithParenthesis(free_thread, tname, sizeof(tname)),
d.EndAllocation());
- StackTrace free_stack;
- chunk.GetFreeStack(&free_stack);
+ StackTrace free_stack = chunk.GetFreeStack();
free_stack.Print();
Printf("%spreviously allocated by thread T%d%s here:%s\n",
d.Allocation(), alloc_thread->tid,
@@ -538,9 +576,7 @@ void DescribeThread(AsanThreadContext *context) {
" created by T%d%s here:\n", context->parent_tid,
ThreadNameWithParenthesis(context->parent_tid, tname, sizeof(tname)));
Printf("%s", str.data());
- uptr stack_size;
- const uptr *stack_trace = StackDepotGet(context->stack_id, &stack_size);
- StackTrace::PrintStack(stack_trace, stack_size);
+ StackDepotGet(context->stack_id).Print();
// Recursively described parent thread if needed.
if (flags()->print_full_thread_history) {
AsanThreadContext *parent_context =
@@ -555,7 +591,7 @@ void DescribeThread(AsanThreadContext *context) {
// immediately after printing error report.
class ScopedInErrorReport {
public:
- ScopedInErrorReport() {
+ explicit ScopedInErrorReport(ReportData *report = nullptr) {
static atomic_uint32_t num_calls;
static u32 reporting_thread_tid;
if (atomic_fetch_add(&num_calls, 1, memory_order_relaxed) != 0) {
@@ -575,6 +611,8 @@ class ScopedInErrorReport {
// Die() to bypass any additional checks.
internal__exit(flags()->exitcode);
}
+ if (report) report_data = *report;
+ report_happened = true;
ASAN_ON_ERROR();
// Make sure the registry and sanitizer report mutexes are locked while
// we're printing an error report.
@@ -634,11 +672,12 @@ void ReportSIGSEGV(const char *description, uptr pc, uptr sp, uptr bp,
Printf("%s", d.EndWarning());
GET_STACK_TRACE_SIGNAL(pc, bp, context);
stack.Print();
+ MaybeDumpInstructionBytes(pc);
Printf("AddressSanitizer can not provide additional info.\n");
ReportErrorSummary("SEGV", &stack);
}
-void ReportDoubleFree(uptr addr, StackTrace *free_stack) {
+void ReportDoubleFree(uptr addr, BufferedStackTrace *free_stack) {
ScopedInErrorReport in_report;
Decorator d;
Printf("%s", d.Warning());
@@ -657,7 +696,7 @@ void ReportDoubleFree(uptr addr, StackTrace *free_stack) {
}
void ReportNewDeleteSizeMismatch(uptr addr, uptr delete_size,
- StackTrace *free_stack) {
+ BufferedStackTrace *free_stack) {
ScopedInErrorReport in_report;
Decorator d;
Printf("%s", d.Warning());
@@ -680,7 +719,7 @@ void ReportNewDeleteSizeMismatch(uptr addr, uptr delete_size,
"ASAN_OPTIONS=new_delete_type_mismatch=0\n");
}
-void ReportFreeNotMalloced(uptr addr, StackTrace *free_stack) {
+void ReportFreeNotMalloced(uptr addr, BufferedStackTrace *free_stack) {
ScopedInErrorReport in_report;
Decorator d;
Printf("%s", d.Warning());
@@ -697,7 +736,7 @@ void ReportFreeNotMalloced(uptr addr, StackTrace *free_stack) {
ReportErrorSummary("bad-free", &stack);
}
-void ReportAllocTypeMismatch(uptr addr, StackTrace *free_stack,
+void ReportAllocTypeMismatch(uptr addr, BufferedStackTrace *free_stack,
AllocType alloc_type,
AllocType dealloc_type) {
static const char *alloc_names[] =
@@ -720,7 +759,7 @@ void ReportAllocTypeMismatch(uptr addr, StackTrace *free_stack,
"ASAN_OPTIONS=alloc_dealloc_mismatch=0\n");
}
-void ReportMallocUsableSizeNotOwned(uptr addr, StackTrace *stack) {
+void ReportMallocUsableSizeNotOwned(uptr addr, BufferedStackTrace *stack) {
ScopedInErrorReport in_report;
Decorator d;
Printf("%s", d.Warning());
@@ -733,7 +772,8 @@ void ReportMallocUsableSizeNotOwned(uptr addr, StackTrace *stack) {
ReportErrorSummary("bad-malloc_usable_size", stack);
}
-void ReportSanitizerGetAllocatedSizeNotOwned(uptr addr, StackTrace *stack) {
+void ReportSanitizerGetAllocatedSizeNotOwned(uptr addr,
+ BufferedStackTrace *stack) {
ScopedInErrorReport in_report;
Decorator d;
Printf("%s", d.Warning());
@@ -746,9 +786,10 @@ void ReportSanitizerGetAllocatedSizeNotOwned(uptr addr, StackTrace *stack) {
ReportErrorSummary("bad-__sanitizer_get_allocated_size", stack);
}
-void ReportStringFunctionMemoryRangesOverlap(
- const char *function, const char *offset1, uptr length1,
- const char *offset2, uptr length2, StackTrace *stack) {
+void ReportStringFunctionMemoryRangesOverlap(const char *function,
+ const char *offset1, uptr length1,
+ const char *offset2, uptr length2,
+ BufferedStackTrace *stack) {
ScopedInErrorReport in_report;
Decorator d;
char bug_type[100];
@@ -765,7 +806,7 @@ void ReportStringFunctionMemoryRangesOverlap(
}
void ReportStringFunctionSizeOverflow(uptr offset, uptr size,
- StackTrace *stack) {
+ BufferedStackTrace *stack) {
ScopedInErrorReport in_report;
Decorator d;
const char *bug_type = "negative-size-param";
@@ -779,7 +820,7 @@ void ReportStringFunctionSizeOverflow(uptr offset, uptr size,
void ReportBadParamsToAnnotateContiguousContainer(uptr beg, uptr end,
uptr old_mid, uptr new_mid,
- StackTrace *stack) {
+ BufferedStackTrace *stack) {
ScopedInErrorReport in_report;
Report("ERROR: AddressSanitizer: bad parameters to "
"__sanitizer_annotate_contiguous_container:\n"
@@ -809,12 +850,9 @@ void ReportODRViolation(const __asan_global *g1, u32 stack_id1,
if (stack_id1 && stack_id2) {
Printf("These globals were registered at these points:\n");
Printf(" [1]:\n");
- uptr stack_size;
- const uptr *stack_trace = StackDepotGet(stack_id1, &stack_size);
- StackTrace::PrintStack(stack_trace, stack_size);
+ StackDepotGet(stack_id1).Print();
Printf(" [2]:\n");
- stack_trace = StackDepotGet(stack_id2, &stack_size);
- StackTrace::PrintStack(stack_trace, stack_size);
+ StackDepotGet(stack_id2).Print();
}
Report("HINT: if you don't care about these warnings you may set "
"ASAN_OPTIONS=detect_odr_violation=0\n");
@@ -854,8 +892,8 @@ static INLINE void CheckForInvalidPointerPair(void *p1, void *p2) {
}
// ----------------------- Mac-specific reports ----------------- {{{1
-void WarnMacFreeUnallocated(
- uptr addr, uptr zone_ptr, const char *zone_name, StackTrace *stack) {
+void WarnMacFreeUnallocated(uptr addr, uptr zone_ptr, const char *zone_name,
+ BufferedStackTrace *stack) {
// Just print a warning here.
Printf("free_common(%p) -- attempting to free unallocated memory.\n"
"AddressSanitizer is ignoring this error on Mac OS now.\n",
@@ -865,8 +903,8 @@ void WarnMacFreeUnallocated(
DescribeHeapAddress(addr, 1);
}
-void ReportMacMzReallocUnknown(
- uptr addr, uptr zone_ptr, const char *zone_name, StackTrace *stack) {
+void ReportMacMzReallocUnknown(uptr addr, uptr zone_ptr, const char *zone_name,
+ BufferedStackTrace *stack) {
ScopedInErrorReport in_report;
Printf("mz_realloc(%p) -- attempting to realloc unallocated memory.\n"
"This is an unrecoverable problem, exiting now.\n",
@@ -876,8 +914,8 @@ void ReportMacMzReallocUnknown(
DescribeHeapAddress(addr, 1);
}
-void ReportMacCfReallocUnknown(
- uptr addr, uptr zone_ptr, const char *zone_name, StackTrace *stack) {
+void ReportMacCfReallocUnknown(uptr addr, uptr zone_ptr, const char *zone_name,
+ BufferedStackTrace *stack) {
ScopedInErrorReport in_report;
Printf("cf_realloc(%p) -- attempting to realloc unallocated memory.\n"
"This is an unrecoverable problem, exiting now.\n",
@@ -894,8 +932,6 @@ using namespace __asan; // NOLINT
void __asan_report_error(uptr pc, uptr bp, uptr sp, uptr addr, int is_write,
uptr access_size) {
- ScopedInErrorReport in_report;
-
// Determine the error type.
const char *bug_descr = "unknown-crash";
if (AddrIsInMem(addr)) {
@@ -941,8 +977,16 @@ void __asan_report_error(uptr pc, uptr bp, uptr sp, uptr addr, int is_write,
case kAsanGlobalRedzoneMagic:
bug_descr = "global-buffer-overflow";
break;
+ case kAsanIntraObjectRedzone:
+ bug_descr = "intra-object-overflow";
+ break;
}
}
+
+ ReportData report = { pc, sp, bp, addr, (bool)is_write, access_size,
+ bug_descr };
+ ScopedInErrorReport in_report(&report);
+
Decorator d;
Printf("%s", d.Warning());
Report("ERROR: AddressSanitizer: %s on address "
@@ -984,6 +1028,38 @@ void __asan_describe_address(uptr addr) {
asanThreadRegistry().Unlock();
}
+int __asan_report_present() {
+ return report_happened ? 1 : 0;
+}
+
+uptr __asan_get_report_pc() {
+ return report_data.pc;
+}
+
+uptr __asan_get_report_bp() {
+ return report_data.bp;
+}
+
+uptr __asan_get_report_sp() {
+ return report_data.sp;
+}
+
+uptr __asan_get_report_address() {
+ return report_data.addr;
+}
+
+int __asan_get_report_access_type() {
+ return report_data.is_write ? 1 : 0;
+}
+
+uptr __asan_get_report_access_size() {
+ return report_data.access_size;
+}
+
+const char *__asan_get_report_description() {
+ return report_data.description;
+}
+
extern "C" {
SANITIZER_INTERFACE_ATTRIBUTE
void __sanitizer_ptr_sub(void *a, void *b) {
diff --git a/libsanitizer/asan/asan_report.h b/libsanitizer/asan/asan_report.h
index 4e81b9ca3a8..b31b86dd08b 100644
--- a/libsanitizer/asan/asan_report.h
+++ b/libsanitizer/asan/asan_report.h
@@ -23,13 +23,24 @@ struct StackVarDescr {
uptr name_len;
};
+struct AddressDescription {
+ char *name;
+ uptr name_size;
+ uptr region_address;
+ uptr region_size;
+ const char *region_kind;
+};
+
// The following functions prints address description depending
// on the memory type (shadow/heap/stack/global).
void DescribeHeapAddress(uptr addr, uptr access_size);
bool DescribeAddressIfGlobal(uptr addr, uptr access_size);
bool DescribeAddressRelativeToGlobal(uptr addr, uptr access_size,
const __asan_global &g);
-bool DescribeAddressIfShadow(uptr addr);
+bool IsAddressNearGlobal(uptr addr, const __asan_global &g);
+bool GetInfoForAddressIfGlobal(uptr addr, AddressDescription *descr);
+bool DescribeAddressIfShadow(uptr addr, AddressDescription *descr = nullptr,
+ bool print = true);
bool ParseFrameDescription(const char *frame_descr,
InternalMmapVector<StackVarDescr> *vars);
bool DescribeAddressIfStack(uptr addr, uptr access_size);
@@ -44,35 +55,41 @@ void NORETURN
void NORETURN ReportSIGSEGV(const char *description, uptr pc, uptr sp, uptr bp,
void *context, uptr addr);
void NORETURN ReportNewDeleteSizeMismatch(uptr addr, uptr delete_size,
- StackTrace *free_stack);
-void NORETURN ReportDoubleFree(uptr addr, StackTrace *free_stack);
-void NORETURN ReportFreeNotMalloced(uptr addr, StackTrace *free_stack);
-void NORETURN ReportAllocTypeMismatch(uptr addr, StackTrace *free_stack,
+ BufferedStackTrace *free_stack);
+void NORETURN ReportDoubleFree(uptr addr, BufferedStackTrace *free_stack);
+void NORETURN ReportFreeNotMalloced(uptr addr, BufferedStackTrace *free_stack);
+void NORETURN ReportAllocTypeMismatch(uptr addr, BufferedStackTrace *free_stack,
AllocType alloc_type,
AllocType dealloc_type);
-void NORETURN ReportMallocUsableSizeNotOwned(uptr addr,
- StackTrace *stack);
void NORETURN
-ReportSanitizerGetAllocatedSizeNotOwned(uptr addr, StackTrace *stack);
-void NORETURN ReportStringFunctionMemoryRangesOverlap(
- const char *function, const char *offset1, uptr length1,
- const char *offset2, uptr length2, StackTrace *stack);
+ ReportMallocUsableSizeNotOwned(uptr addr, BufferedStackTrace *stack);
+void NORETURN
+ ReportSanitizerGetAllocatedSizeNotOwned(uptr addr,
+ BufferedStackTrace *stack);
void NORETURN
-ReportStringFunctionSizeOverflow(uptr offset, uptr size, StackTrace *stack);
+ ReportStringFunctionMemoryRangesOverlap(const char *function,
+ const char *offset1, uptr length1,
+ const char *offset2, uptr length2,
+ BufferedStackTrace *stack);
+void NORETURN ReportStringFunctionSizeOverflow(uptr offset, uptr size,
+ BufferedStackTrace *stack);
void NORETURN
-ReportBadParamsToAnnotateContiguousContainer(uptr beg, uptr end, uptr old_mid,
- uptr new_mid, StackTrace *stack);
+ ReportBadParamsToAnnotateContiguousContainer(uptr beg, uptr end,
+ uptr old_mid, uptr new_mid,
+ BufferedStackTrace *stack);
void NORETURN
ReportODRViolation(const __asan_global *g1, u32 stack_id1,
const __asan_global *g2, u32 stack_id2);
// Mac-specific errors and warnings.
-void WarnMacFreeUnallocated(
- uptr addr, uptr zone_ptr, const char *zone_name, StackTrace *stack);
-void NORETURN ReportMacMzReallocUnknown(
- uptr addr, uptr zone_ptr, const char *zone_name, StackTrace *stack);
-void NORETURN ReportMacCfReallocUnknown(
- uptr addr, uptr zone_ptr, const char *zone_name, StackTrace *stack);
+void WarnMacFreeUnallocated(uptr addr, uptr zone_ptr, const char *zone_name,
+ BufferedStackTrace *stack);
+void NORETURN ReportMacMzReallocUnknown(uptr addr, uptr zone_ptr,
+ const char *zone_name,
+ BufferedStackTrace *stack);
+void NORETURN ReportMacCfReallocUnknown(uptr addr, uptr zone_ptr,
+ const char *zone_name,
+ BufferedStackTrace *stack);
} // namespace __asan
diff --git a/libsanitizer/asan/asan_rtl.cc b/libsanitizer/asan/asan_rtl.cc
index 8fccc8da967..2c599047dac 100644
--- a/libsanitizer/asan/asan_rtl.cc
+++ b/libsanitizer/asan/asan_rtl.cc
@@ -65,7 +65,7 @@ static void AsanCheckFailed(const char *file, int line, const char *cond,
Report("AddressSanitizer CHECK failed: %s:%d \"%s\" (0x%zx, 0x%zx)\n", file,
line, cond, (uptr)v1, (uptr)v2);
// FIXME: check for infinite recursion without a thread-local counter here.
- PRINT_CURRENT_STACK();
+ PRINT_CURRENT_STACK_CHECK();
Die();
}
@@ -228,6 +228,9 @@ static void ParseFlagsFromString(Flags *f, const char *str) {
"If >=2, detect violation of One-Definition-Rule (ODR); "
"If ==1, detect ODR-violation only if the two variables "
"have different sizes");
+
+ ParseFlag(str, &f->dump_instruction_bytes, "dump_instruction_bytes",
+ "If true, dump 16 bytes starting at the instruction that caused SEGV");
}
void InitializeFlags(Flags *f, const char *env) {
@@ -281,6 +284,7 @@ void InitializeFlags(Flags *f, const char *env) {
f->detect_invalid_pointer_pairs = 0;
f->detect_container_overflow = true;
f->detect_odr_violation = 2;
+ f->dump_instruction_bytes = false;
// Override from compile definition.
ParseFlagsFromString(f, MaybeUseAsanDefaultOptionsCompileDefinition());
diff --git a/libsanitizer/asan/asan_stack.h b/libsanitizer/asan/asan_stack.h
index d31c0afa83b..640c4cf4f7b 100644
--- a/libsanitizer/asan/asan_stack.h
+++ b/libsanitizer/asan/asan_stack.h
@@ -23,8 +23,9 @@ namespace __asan {
// The pc will be in the position 0 of the resulting stack trace.
// The bp may refer to the current frame or to the caller's frame.
ALWAYS_INLINE
-void GetStackTraceWithPcBpAndContext(StackTrace *stack, uptr max_depth, uptr pc,
- uptr bp, void *context, bool fast) {
+void GetStackTraceWithPcBpAndContext(BufferedStackTrace *stack, uptr max_depth,
+ uptr pc, uptr bp, void *context,
+ bool fast) {
#if SANITIZER_WINDOWS
stack->Unwind(max_depth, pc, bp, context, 0, 0, fast);
#else
@@ -32,6 +33,10 @@ void GetStackTraceWithPcBpAndContext(StackTrace *stack, uptr max_depth, uptr pc,
stack->size = 0;
if (LIKELY(asan_inited)) {
if ((t = GetCurrentThread()) && !t->isUnwinding()) {
+ // On FreeBSD the slow unwinding that leverages _Unwind_Backtrace()
+ // yields the call stack of the signal's handler and not of the code
+ // that raised the signal (as it does on Linux).
+ if (SANITIZER_FREEBSD && t->isInDeadlySignal()) fast = true;
uptr stack_top = t->stack_top();
uptr stack_bottom = t->stack_bottom();
ScopedUnwinding unwind_scope(t);
@@ -51,14 +56,14 @@ void GetStackTraceWithPcBpAndContext(StackTrace *stack, uptr max_depth, uptr pc,
// don't want stack trace to contain functions from ASan internals.
#define GET_STACK_TRACE(max_size, fast) \
- StackTrace stack; \
+ BufferedStackTrace stack; \
if (max_size <= 2) { \
stack.size = max_size; \
if (max_size > 0) { \
stack.top_frame_bp = GET_CURRENT_FRAME(); \
- stack.trace[0] = StackTrace::GetCurrentPc(); \
+ stack.trace_buffer[0] = StackTrace::GetCurrentPc(); \
if (max_size > 1) \
- stack.trace[1] = GET_CALLER_PC(); \
+ stack.trace_buffer[1] = GET_CALLER_PC(); \
} \
} else { \
GetStackTraceWithPcBpAndContext(&stack, max_size, \
@@ -67,18 +72,21 @@ void GetStackTraceWithPcBpAndContext(StackTrace *stack, uptr max_depth, uptr pc,
}
#define GET_STACK_TRACE_FATAL(pc, bp) \
- StackTrace stack; \
+ BufferedStackTrace stack; \
GetStackTraceWithPcBpAndContext(&stack, kStackTraceMax, pc, bp, 0, \
common_flags()->fast_unwind_on_fatal)
#define GET_STACK_TRACE_SIGNAL(pc, bp, context) \
- StackTrace stack; \
+ BufferedStackTrace stack; \
GetStackTraceWithPcBpAndContext(&stack, kStackTraceMax, pc, bp, context, \
common_flags()->fast_unwind_on_fatal)
#define GET_STACK_TRACE_FATAL_HERE \
GET_STACK_TRACE(kStackTraceMax, common_flags()->fast_unwind_on_fatal)
+#define GET_STACK_TRACE_CHECK_HERE \
+ GET_STACK_TRACE(kStackTraceMax, common_flags()->fast_unwind_on_check)
+
#define GET_STACK_TRACE_THREAD \
GET_STACK_TRACE(kStackTraceMax, true)
@@ -94,4 +102,10 @@ void GetStackTraceWithPcBpAndContext(StackTrace *stack, uptr max_depth, uptr pc,
stack.Print(); \
}
+#define PRINT_CURRENT_STACK_CHECK() \
+ { \
+ GET_STACK_TRACE_CHECK_HERE; \
+ stack.Print(); \
+ }
+
#endif // ASAN_STACK_H
diff --git a/libsanitizer/asan/asan_thread.cc b/libsanitizer/asan/asan_thread.cc
index 87074065633..95ca6720090 100644
--- a/libsanitizer/asan/asan_thread.cc
+++ b/libsanitizer/asan/asan_thread.cc
@@ -28,7 +28,7 @@ namespace __asan {
void AsanThreadContext::OnCreated(void *arg) {
CreateThreadContextArgs *args = static_cast<CreateThreadContextArgs*>(arg);
if (args->stack)
- stack_id = StackDepotPut(args->stack->trace, args->stack->size);
+ stack_id = StackDepotPut(*args->stack);
thread = args->thread;
thread->set_context(this);
}
@@ -196,17 +196,18 @@ void AsanThread::ClearShadowForThreadStackAndTLS() {
PoisonShadow(tls_begin_, tls_end_ - tls_begin_, 0);
}
-const char *AsanThread::GetFrameNameByAddr(uptr addr, uptr *offset,
- uptr *frame_pc) {
+bool AsanThread::GetStackFrameAccessByAddr(uptr addr,
+ StackFrameAccess *access) {
uptr bottom = 0;
if (AddrIsInStack(addr)) {
bottom = stack_bottom();
} else if (has_fake_stack()) {
bottom = fake_stack()->AddrIsInFakeStack(addr);
CHECK(bottom);
- *offset = addr - bottom;
- *frame_pc = ((uptr*)bottom)[2];
- return (const char *)((uptr*)bottom)[1];
+ access->offset = addr - bottom;
+ access->frame_pc = ((uptr*)bottom)[2];
+ access->frame_descr = (const char *)((uptr*)bottom)[1];
+ return true;
}
uptr aligned_addr = addr & ~(SANITIZER_WORDSIZE/8 - 1); // align addr.
u8 *shadow_ptr = (u8*)MemToShadow(aligned_addr);
@@ -223,15 +224,15 @@ const char *AsanThread::GetFrameNameByAddr(uptr addr, uptr *offset,
}
if (shadow_ptr < shadow_bottom) {
- *offset = 0;
- return "UNKNOWN";
+ return false;
}
uptr* ptr = (uptr*)SHADOW_TO_MEM((uptr)(shadow_ptr + 1));
CHECK(ptr[0] == kCurrentStackFrameMagic);
- *offset = addr - (uptr)ptr;
- *frame_pc = ptr[2];
- return (const char*)ptr[1];
+ access->offset = addr - (uptr)ptr;
+ access->frame_pc = ptr[2];
+ access->frame_descr = (const char*)ptr[1];
+ return true;
}
static bool ThreadStackContainsAddress(ThreadContextBase *tctx_base,
diff --git a/libsanitizer/asan/asan_thread.h b/libsanitizer/asan/asan_thread.h
index 33242efabaa..f5ea53d051f 100644
--- a/libsanitizer/asan/asan_thread.h
+++ b/libsanitizer/asan/asan_thread.h
@@ -69,7 +69,12 @@ class AsanThread {
AsanThreadContext *context() { return context_; }
void set_context(AsanThreadContext *context) { context_ = context; }
- const char *GetFrameNameByAddr(uptr addr, uptr *offset, uptr *frame_pc);
+ struct StackFrameAccess {
+ uptr offset;
+ uptr frame_pc;
+ const char *frame_descr;
+ };
+ bool GetStackFrameAccessByAddr(uptr addr, StackFrameAccess *access);
bool AddrIsInStack(uptr addr) {
return addr >= stack_bottom_ && addr < stack_top_;
@@ -101,6 +106,10 @@ class AsanThread {
bool isUnwinding() const { return unwinding_; }
void setUnwinding(bool b) { unwinding_ = b; }
+ // True if we are in a deadly signal handler.
+ bool isInDeadlySignal() const { return in_deadly_signal_; }
+ void setInDeadlySignal(bool b) { in_deadly_signal_ = b; }
+
AsanThreadLocalMallocStorage &malloc_storage() { return malloc_storage_; }
AsanStats &stats() { return stats_; }
@@ -126,6 +135,7 @@ class AsanThread {
AsanThreadLocalMallocStorage malloc_storage_;
AsanStats stats_;
bool unwinding_;
+ bool in_deadly_signal_;
};
// ScopedUnwinding is a scope for stacktracing member of a context
@@ -140,6 +150,20 @@ class ScopedUnwinding {
AsanThread *thread;
};
+// ScopedDeadlySignal is a scope for handling deadly signals.
+class ScopedDeadlySignal {
+ public:
+ explicit ScopedDeadlySignal(AsanThread *t) : thread(t) {
+ if (thread) thread->setInDeadlySignal(true);
+ }
+ ~ScopedDeadlySignal() {
+ if (thread) thread->setInDeadlySignal(false);
+ }
+
+ private:
+ AsanThread *thread;
+};
+
struct CreateThreadContextArgs {
AsanThread *thread;
StackTrace *stack;
diff --git a/libsanitizer/include/sanitizer/asan_interface.h b/libsanitizer/include/sanitizer/asan_interface.h
index d1d452991b0..023fa29c60f 100644
--- a/libsanitizer/include/sanitizer/asan_interface.h
+++ b/libsanitizer/include/sanitizer/asan_interface.h
@@ -53,13 +53,39 @@ extern "C" {
// Otherwise returns 0.
int __asan_address_is_poisoned(void const volatile *addr);
- // If at least on byte in [beg, beg+size) is poisoned, return the address
+ // If at least one byte in [beg, beg+size) is poisoned, return the address
// of the first such byte. Otherwise return 0.
void *__asan_region_is_poisoned(void *beg, size_t size);
// Print the description of addr (useful when debugging in gdb).
void __asan_describe_address(void *addr);
+ // Useful for calling from a debugger to get information about an ASan error.
+ // Returns 1 if an error has been (or is being) reported, otherwise returns 0.
+ int __asan_report_present();
+
+ // Useful for calling from a debugger to get information about an ASan error.
+ // If an error has been (or is being) reported, the following functions return
+ // the pc, bp, sp, address, access type (0 = read, 1 = write), access size and
+ // bug description (e.g. "heap-use-after-free"). Otherwise they return 0.
+ void *__asan_get_report_pc();
+ void *__asan_get_report_bp();
+ void *__asan_get_report_sp();
+ void *__asan_get_report_address();
+ int __asan_get_report_access_type();
+ size_t __asan_get_report_access_size();
+ const char *__asan_get_report_description();
+
+ // Useful for calling from the debugger to get information about a pointer.
+ // Returns the category of the given pointer as a constant string.
+ // Possible return values are "global", "stack", "stack-fake", "heap",
+ // "heap-invalid", "shadow-low", "shadow-gap", "shadow-high", "unknown".
+ // If global or stack, tries to also return the variable name, address and
+ // size. If heap, tries to return the chunk address and size. 'name' should
+ // point to an allocated buffer of size 'name_size'.
+ const char *__asan_locate_address(void *addr, char *name, size_t name_size,
+ void **region_address, size_t *region_size);
+
// Useful for calling from the debugger to get the allocation stack trace
// and thread ID for a heap address. Stores up to 'size' frames into 'trace',
// returns the number of stored frames or 0 on error.
diff --git a/libsanitizer/include/sanitizer/common_interface_defs.h b/libsanitizer/include/sanitizer/common_interface_defs.h
index 43e0c30ee8a..3aba519327e 100644
--- a/libsanitizer/include/sanitizer/common_interface_defs.h
+++ b/libsanitizer/include/sanitizer/common_interface_defs.h
@@ -103,7 +103,7 @@ extern "C" {
const void *end,
const void *old_mid,
const void *new_mid);
- // Returns true if the contiguous container [beg, end) ir properly poisoned
+ // Returns true if the contiguous container [beg, end) is properly poisoned
// (e.g. with __sanitizer_annotate_contiguous_container), i.e. if
// - [beg, mid) is addressable,
// - [mid, end) is unaddressable.
diff --git a/libsanitizer/interception/Makefile.am b/libsanitizer/interception/Makefile.am
index e9fbe6a467d..4fb69a963d3 100644
--- a/libsanitizer/interception/Makefile.am
+++ b/libsanitizer/interception/Makefile.am
@@ -6,6 +6,7 @@ gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
DEFS = -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros
AM_CXXFLAGS += $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
+AM_CXXFLAGS += -std=gnu++11
ACLOCAL_AMFLAGS = -I m4
noinst_LTLIBRARIES = libinterception.la
diff --git a/libsanitizer/interception/Makefile.in b/libsanitizer/interception/Makefile.in
index 5ac217dcc4b..8ce4fd065e4 100644
--- a/libsanitizer/interception/Makefile.in
+++ b/libsanitizer/interception/Makefile.in
@@ -225,7 +225,8 @@ gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic \
-Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti \
-fomit-frame-pointer -funwind-tables -fvisibility=hidden \
- -Wno-variadic-macros $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
+ -Wno-variadic-macros $(LIBSTDCXX_RAW_CXX_CXXFLAGS) \
+ -std=gnu++11
ACLOCAL_AMFLAGS = -I m4
noinst_LTLIBRARIES = libinterception.la
interception_files = \
diff --git a/libsanitizer/interception/interception_win.cc b/libsanitizer/interception/interception_win.cc
index 1642bd116cf..f9c2e9b3ad8 100644
--- a/libsanitizer/interception/interception_win.cc
+++ b/libsanitizer/interception/interception_win.cc
@@ -180,7 +180,10 @@ bool OverrideFunction(uptr old_func, uptr new_func, uptr *orig_old_func) {
}
static const void **InterestingDLLsAvailable() {
- const char *InterestingDLLs[] = { "kernel32.dll", "msvcr120.dll", NULL };
+ const char *InterestingDLLs[] = {"kernel32.dll",
+ "msvcr110.dll", // VS2012
+ "msvcr120.dll", // VS2013
+ NULL};
static void *result[ARRAY_SIZE(InterestingDLLs)] = { 0 };
if (!result[0]) {
for (size_t i = 0, j = 0; InterestingDLLs[i]; ++i) {
diff --git a/libsanitizer/libbacktrace/Makefile.am b/libsanitizer/libbacktrace/Makefile.am
index fd9eb65f7eb..34bfb1eef27 100644
--- a/libsanitizer/libbacktrace/Makefile.am
+++ b/libsanitizer/libbacktrace/Makefile.am
@@ -40,6 +40,7 @@ C_WARN_FLAGS = $(WARN_FLAGS) -Wstrict-prototypes -Wmissing-prototypes -Wold-styl
CXX_WARN_FLAGS = $(WARN_FLAGS) -Wno-unused-parameter
AM_CFLAGS = $(C_WARN_FLAGS)
AM_CXXFLAGS = $(CXX_WARN_FLAGS) -fno-rtti -fno-exceptions
+AM_CXXFLAGS += -std=gnu++11
noinst_LTLIBRARIES = libsanitizer_libbacktrace.la
diff --git a/libsanitizer/libbacktrace/Makefile.in b/libsanitizer/libbacktrace/Makefile.in
index 0dfb53d2c93..a4f9912ad21 100644
--- a/libsanitizer/libbacktrace/Makefile.in
+++ b/libsanitizer/libbacktrace/Makefile.in
@@ -270,7 +270,7 @@ WARN_FLAGS = -W -Wall -Wwrite-strings -Wmissing-format-attribute \
C_WARN_FLAGS = $(WARN_FLAGS) -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition
CXX_WARN_FLAGS = $(WARN_FLAGS) -Wno-unused-parameter
AM_CFLAGS = $(C_WARN_FLAGS)
-AM_CXXFLAGS = $(CXX_WARN_FLAGS) -fno-rtti -fno-exceptions
+AM_CXXFLAGS = $(CXX_WARN_FLAGS) -fno-rtti -fno-exceptions -std=gnu++11
noinst_LTLIBRARIES = libsanitizer_libbacktrace.la
libsanitizer_libbacktrace_la_SOURCES = \
../../libbacktrace/backtrace.h \
diff --git a/libsanitizer/lsan/Makefile.am b/libsanitizer/lsan/Makefile.am
index 7a508c12686..03ec4fe91fe 100644
--- a/libsanitizer/lsan/Makefile.am
+++ b/libsanitizer/lsan/Makefile.am
@@ -6,6 +6,7 @@ gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
DEFS = -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros
AM_CXXFLAGS += $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
+AM_CXXFLAGS += -std=gnu++11
ACLOCAL_AMFLAGS = -I m4
noinst_LTLIBRARIES = libsanitizer_lsan.la
diff --git a/libsanitizer/lsan/Makefile.in b/libsanitizer/lsan/Makefile.in
index 47caebc09f8..bb6f95f4394 100644
--- a/libsanitizer/lsan/Makefile.in
+++ b/libsanitizer/lsan/Makefile.in
@@ -260,7 +260,8 @@ gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic \
-Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti \
-fomit-frame-pointer -funwind-tables -fvisibility=hidden \
- -Wno-variadic-macros $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
+ -Wno-variadic-macros $(LIBSTDCXX_RAW_CXX_CXXFLAGS) \
+ -std=gnu++11
ACLOCAL_AMFLAGS = -I m4
noinst_LTLIBRARIES = libsanitizer_lsan.la
@LSAN_SUPPORTED_TRUE@toolexeclib_LTLIBRARIES = liblsan.la
diff --git a/libsanitizer/lsan/lsan.h b/libsanitizer/lsan/lsan.h
index 57888e3421d..ee2fc02cf08 100644
--- a/libsanitizer/lsan/lsan.h
+++ b/libsanitizer/lsan/lsan.h
@@ -13,17 +13,17 @@
#include "sanitizer_common/sanitizer_flags.h"
#include "sanitizer_common/sanitizer_stacktrace.h"
-#define GET_STACK_TRACE(max_size, fast) \
- StackTrace stack; \
- { \
- uptr stack_top = 0, stack_bottom = 0; \
- ThreadContext *t; \
- if (fast && (t = CurrentThreadContext())) { \
- stack_top = t->stack_end(); \
- stack_bottom = t->stack_begin(); \
- } \
- stack.Unwind(max_size, StackTrace::GetCurrentPc(), GET_CURRENT_FRAME(), \
- /* context */ 0, stack_top, stack_bottom, fast); \
+#define GET_STACK_TRACE(max_size, fast) \
+ BufferedStackTrace stack; \
+ { \
+ uptr stack_top = 0, stack_bottom = 0; \
+ ThreadContext *t; \
+ if (fast && (t = CurrentThreadContext())) { \
+ stack_top = t->stack_end(); \
+ stack_bottom = t->stack_begin(); \
+ } \
+ stack.Unwind(max_size, StackTrace::GetCurrentPc(), GET_CURRENT_FRAME(), \
+ /* context */ 0, stack_top, stack_bottom, fast); \
}
#define GET_STACK_TRACE_FATAL \
diff --git a/libsanitizer/lsan/lsan_allocator.cc b/libsanitizer/lsan/lsan_allocator.cc
index cda2b86ef67..2d406a0f852 100644
--- a/libsanitizer/lsan/lsan_allocator.cc
+++ b/libsanitizer/lsan/lsan_allocator.cc
@@ -61,7 +61,7 @@ static void RegisterAllocation(const StackTrace &stack, void *p, uptr size) {
ChunkMetadata *m = Metadata(p);
CHECK(m);
m->tag = DisabledInThisThread() ? kIgnored : kDirectlyLeaked;
- m->stack_trace_id = StackDepotPut(stack.trace, stack.size);
+ m->stack_trace_id = StackDepotPut(stack);
m->requested_size = size;
atomic_store(reinterpret_cast<atomic_uint8_t *>(m), 1, memory_order_relaxed);
}
diff --git a/libsanitizer/lsan/lsan_common.cc b/libsanitizer/lsan/lsan_common.cc
index e340b8953e1..aa79a7e41c6 100644
--- a/libsanitizer/lsan/lsan_common.cc
+++ b/libsanitizer/lsan/lsan_common.cc
@@ -353,9 +353,7 @@ static void ClassifyAllChunks(SuspendedThreadsList const &suspended_threads) {
static void PrintStackTraceById(u32 stack_trace_id) {
CHECK(stack_trace_id);
- uptr size = 0;
- const uptr *trace = StackDepotGet(stack_trace_id, &size);
- StackTrace::PrintStack(trace, size);
+ StackDepotGet(stack_trace_id).Print();
}
// ForEachChunk callback. Aggregates information about unreachable chunks into
@@ -370,10 +368,9 @@ static void CollectLeaksCb(uptr chunk, void *arg) {
uptr resolution = flags()->resolution;
u32 stack_trace_id = 0;
if (resolution > 0) {
- uptr size = 0;
- const uptr *trace = StackDepotGet(m.stack_trace_id(), &size);
- size = Min(size, resolution);
- stack_trace_id = StackDepotPut(trace, size);
+ StackTrace stack = StackDepotGet(m.stack_trace_id());
+ stack.size = Min(stack.size, resolution);
+ stack_trace_id = StackDepotPut(stack);
} else {
stack_trace_id = m.stack_trace_id();
}
@@ -449,8 +446,11 @@ void DoLeakCheck() {
PrintMatchedSuppressions();
if (unsuppressed_count > 0) {
param.leak_report.PrintSummary();
- if (flags()->exitcode)
+ if (flags()->exitcode) {
+ if (common_flags()->coverage)
+ __sanitizer_cov_dump();
internal__exit(flags()->exitcode);
+ }
}
}
@@ -482,11 +482,10 @@ static Suppression *GetSuppressionForAddr(uptr addr) {
}
static Suppression *GetSuppressionForStack(u32 stack_trace_id) {
- uptr size = 0;
- const uptr *trace = StackDepotGet(stack_trace_id, &size);
- for (uptr i = 0; i < size; i++) {
- Suppression *s =
- GetSuppressionForAddr(StackTrace::GetPreviousInstructionPc(trace[i]));
+ StackTrace stack = StackDepotGet(stack_trace_id);
+ for (uptr i = 0; i < stack.size; i++) {
+ Suppression *s = GetSuppressionForAddr(
+ StackTrace::GetPreviousInstructionPc(stack.trace[i]));
if (s) return s;
}
return 0;
diff --git a/libsanitizer/lsan/lsan_common_linux.cc b/libsanitizer/lsan/lsan_common_linux.cc
index c318fbc4c3b..b17156ce6bb 100644
--- a/libsanitizer/lsan/lsan_common_linux.cc
+++ b/libsanitizer/lsan/lsan_common_linux.cc
@@ -92,11 +92,10 @@ void ProcessGlobalRegions(Frontier *frontier) {
static uptr GetCallerPC(u32 stack_id, StackDepotReverseMap *map) {
CHECK(stack_id);
- uptr size = 0;
- const uptr *trace = map->Get(stack_id, &size);
+ StackTrace stack = map->Get(stack_id);
// The top frame is our malloc/calloc/etc. The next frame is the caller.
- if (size >= 2)
- return trace[1];
+ if (stack.size >= 2)
+ return stack.trace[1];
return 0;
}
diff --git a/libsanitizer/sanitizer_common/Makefile.am b/libsanitizer/sanitizer_common/Makefile.am
index bc1f18c2a18..28ce39b64c2 100644
--- a/libsanitizer/sanitizer_common/Makefile.am
+++ b/libsanitizer/sanitizer_common/Makefile.am
@@ -6,6 +6,7 @@ gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
DEFS = -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros
AM_CXXFLAGS += $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
+AM_CXXFLAGS += -std=gnu++11
if LIBBACKTRACE_SUPPORTED
AM_CXXFLAGS += -DSANITIZER_LIBBACKTRACE -DSANITIZER_CP_DEMANGLE \
-I $(top_srcdir)/../libbacktrace \
@@ -44,6 +45,7 @@ sanitizer_common_files = \
sanitizer_stackdepot.cc \
sanitizer_stacktrace.cc \
sanitizer_stacktrace_libcdep.cc \
+ sanitizer_stacktrace_printer.cc \
sanitizer_stoptheworld_linux_libcdep.cc \
sanitizer_suppressions.cc \
sanitizer_symbolizer.cc \
diff --git a/libsanitizer/sanitizer_common/Makefile.in b/libsanitizer/sanitizer_common/Makefile.in
index d82b4834efc..86bf787c7bd 100644
--- a/libsanitizer/sanitizer_common/Makefile.in
+++ b/libsanitizer/sanitizer_common/Makefile.in
@@ -78,6 +78,7 @@ am__objects_1 = sanitizer_allocator.lo sanitizer_common.lo \
sanitizer_procmaps_linux.lo sanitizer_procmaps_mac.lo \
sanitizer_stackdepot.lo sanitizer_stacktrace.lo \
sanitizer_stacktrace_libcdep.lo \
+ sanitizer_stacktrace_printer.lo \
sanitizer_stoptheworld_linux_libcdep.lo \
sanitizer_suppressions.lo sanitizer_symbolizer.lo \
sanitizer_symbolizer_libbacktrace.lo \
@@ -253,7 +254,7 @@ AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic \
-Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti \
-fomit-frame-pointer -funwind-tables -fvisibility=hidden \
-Wno-variadic-macros $(LIBSTDCXX_RAW_CXX_CXXFLAGS) \
- $(am__append_1)
+ -std=gnu++11 $(am__append_1)
ACLOCAL_AMFLAGS = -I m4
noinst_LTLIBRARIES = libsanitizer_common.la
sanitizer_common_files = \
@@ -283,6 +284,7 @@ sanitizer_common_files = \
sanitizer_stackdepot.cc \
sanitizer_stacktrace.cc \
sanitizer_stacktrace_libcdep.cc \
+ sanitizer_stacktrace_printer.cc \
sanitizer_stoptheworld_linux_libcdep.cc \
sanitizer_suppressions.cc \
sanitizer_symbolizer.cc \
@@ -414,6 +416,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sanitizer_stackdepot.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sanitizer_stacktrace.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sanitizer_stacktrace_libcdep.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sanitizer_stacktrace_printer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sanitizer_stoptheworld_linux_libcdep.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sanitizer_suppressions.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sanitizer_symbolizer.Plo@am__quote@
diff --git a/libsanitizer/sanitizer_common/sanitizer_allocator.h b/libsanitizer/sanitizer_common/sanitizer_allocator.h
index fb394129202..dd5539a2087 100644
--- a/libsanitizer/sanitizer_common/sanitizer_allocator.h
+++ b/libsanitizer/sanitizer_common/sanitizer_allocator.h
@@ -459,6 +459,11 @@ class SizeClassAllocator64 {
}
}
+ static uptr AdditionalSize() {
+ return RoundUpTo(sizeof(RegionInfo) * kNumClassesRounded,
+ GetPageSizeCached());
+ }
+
typedef SizeClassMap SizeClassMapT;
static const uptr kNumClasses = SizeClassMap::kNumClasses;
static const uptr kNumClassesRounded = SizeClassMap::kNumClassesRounded;
@@ -488,11 +493,6 @@ class SizeClassAllocator64 {
};
COMPILER_CHECK(sizeof(RegionInfo) >= kCacheLineSize);
- static uptr AdditionalSize() {
- return RoundUpTo(sizeof(RegionInfo) * kNumClassesRounded,
- GetPageSizeCached());
- }
-
RegionInfo *GetRegionInfo(uptr class_id) {
CHECK_LT(class_id, kNumClasses);
RegionInfo *regions = reinterpret_cast<RegionInfo*>(kSpaceBeg + kSpaceSize);
@@ -1013,12 +1013,15 @@ class LargeMmapAllocator {
if (map_size < size) return AllocatorReturnNull(); // Overflow.
uptr map_beg = reinterpret_cast<uptr>(
MmapOrDie(map_size, "LargeMmapAllocator"));
+ CHECK(IsAligned(map_beg, page_size_));
MapUnmapCallback().OnMap(map_beg, map_size);
uptr map_end = map_beg + map_size;
uptr res = map_beg + page_size_;
if (res & (alignment - 1)) // Align.
res += alignment - (res & (alignment - 1));
- CHECK_EQ(0, res & (alignment - 1));
+ CHECK(IsAligned(res, alignment));
+ CHECK(IsAligned(res, page_size_));
+ CHECK_GE(res + size, map_beg);
CHECK_LE(res + size, map_end);
Header *h = GetHeader(res);
h->size = size;
diff --git a/libsanitizer/sanitizer_common/sanitizer_common.cc b/libsanitizer/sanitizer_common/sanitizer_common.cc
index d4da3206e13..f06efffb325 100644
--- a/libsanitizer/sanitizer_common/sanitizer_common.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_common.cc
@@ -153,23 +153,12 @@ const char *StripPathPrefix(const char *filepath,
return pos;
}
-void PrintSourceLocation(InternalScopedString *buffer, const char *file,
- int line, int column) {
- CHECK(file);
- buffer->append("%s",
- StripPathPrefix(file, common_flags()->strip_path_prefix));
- if (line > 0) {
- buffer->append(":%d", line);
- if (column > 0)
- buffer->append(":%d", column);
- }
-}
-
-void PrintModuleAndOffset(InternalScopedString *buffer, const char *module,
- uptr offset) {
- buffer->append("(%s+0x%zx)",
- StripPathPrefix(module, common_flags()->strip_path_prefix),
- offset);
+const char *StripModuleName(const char *module) {
+ if (module == 0)
+ return 0;
+ if (const char *slash_pos = internal_strrchr(module, '/'))
+ return slash_pos + 1;
+ return module;
}
void ReportErrorSummary(const char *error_message) {
@@ -215,17 +204,6 @@ bool LoadedModule::containsAddress(uptr address) const {
return false;
}
-char *StripModuleName(const char *module) {
- if (module == 0)
- return 0;
- const char *short_module_name = internal_strrchr(module, '/');
- if (short_module_name)
- short_module_name += 1;
- else
- short_module_name = module;
- return internal_strdup(short_module_name);
-}
-
static atomic_uintptr_t g_total_mmaped;
void IncreaseTotalMmap(uptr size) {
diff --git a/libsanitizer/sanitizer_common/sanitizer_common.h b/libsanitizer/sanitizer_common/sanitizer_common.h
index a9db1082f48..a8924913872 100644
--- a/libsanitizer/sanitizer_common/sanitizer_common.h
+++ b/libsanitizer/sanitizer_common/sanitizer_common.h
@@ -170,10 +170,8 @@ bool IsAccessibleMemoryRange(uptr beg, uptr size);
// Error report formatting.
const char *StripPathPrefix(const char *filepath,
const char *strip_file_prefix);
-void PrintSourceLocation(InternalScopedString *buffer, const char *file,
- int line, int column);
-void PrintModuleAndOffset(InternalScopedString *buffer,
- const char *module, uptr offset);
+// Strip the directories from the module name.
+const char *StripModuleName(const char *module);
// OS
void DisableCoreDumperIfNecessary();
@@ -207,9 +205,6 @@ void SleepForMillis(int millis);
u64 NanoTime();
int Atexit(void (*function)(void));
void SortArray(uptr *array, uptr size);
-// Strip the directories from the module name, return a new string allocated
-// with internal_strdup.
-char *StripModuleName(const char *module);
// Exit
void NORETURN Abort();
diff --git a/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc b/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc
index f55a31de77e..10f321838e8 100644
--- a/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc
+++ b/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc
@@ -39,6 +39,10 @@
#define va_copy(dst, src) ((dst) = (src))
#endif // _WIN32
+#if SANITIZER_FREEBSD
+#define pthread_setname_np pthread_set_name_np
+#endif
+
#ifndef COMMON_INTERCEPTOR_INITIALIZE_RANGE
#define COMMON_INTERCEPTOR_INITIALIZE_RANGE(p, size) {}
#endif
diff --git a/libsanitizer/sanitizer_common/sanitizer_coverage_libcdep.cc b/libsanitizer/sanitizer_common/sanitizer_coverage_libcdep.cc
index 9b02cd75017..214e8a98d0f 100644
--- a/libsanitizer/sanitizer_common/sanitizer_coverage_libcdep.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_coverage_libcdep.cc
@@ -36,6 +36,7 @@
#include "sanitizer_mutex.h"
#include "sanitizer_procmaps.h"
#include "sanitizer_stacktrace.h"
+#include "sanitizer_symbolizer.h"
#include "sanitizer_flags.h"
atomic_uint32_t dump_once_guard; // Ensure that CovDump runs only once.
@@ -61,6 +62,9 @@ class CoverageData {
void AfterFork(int child_pid);
void Extend(uptr npcs);
void Add(uptr pc);
+ void IndirCall(uptr caller, uptr callee, uptr callee_cache[],
+ uptr cache_size);
+ void DumpCallerCalleePairs();
uptr *data();
uptr size();
@@ -83,6 +87,14 @@ class CoverageData {
uptr pc_array_mapped_size;
// Descriptor of the file mapped pc array.
int pc_fd;
+
+ // Caller-Callee (cc) array, size and current index.
+ static const uptr kCcArrayMaxSize = FIRST_32_SECOND_64(1 << 18, 1 << 24);
+ uptr **cc_array;
+ atomic_uintptr_t cc_array_index;
+ atomic_uintptr_t cc_array_size;
+
+
StaticSpinMutex mu;
void DirectOpen();
@@ -116,6 +128,11 @@ void CoverageData::Init() {
atomic_store(&pc_array_size, kPcArrayMaxSize, memory_order_relaxed);
atomic_store(&pc_array_index, 0, memory_order_relaxed);
}
+
+ cc_array = reinterpret_cast<uptr **>(MmapNoReserveOrDie(
+ sizeof(uptr *) * kCcArrayMaxSize, "CovInit::cc_array"));
+ atomic_store(&cc_array_size, kCcArrayMaxSize, memory_order_relaxed);
+ atomic_store(&cc_array_index, 0, memory_order_relaxed);
}
void CoverageData::ReInit() {
@@ -184,6 +201,38 @@ void CoverageData::Add(uptr pc) {
pc_array[idx] = pc;
}
+// Registers a pair caller=>callee.
+// When a given caller is seen for the first time, the callee_cache is added
+// to the global array cc_array, callee_cache[0] is set to caller and
+// callee_cache[1] is set to cache_size.
+// Then we are trying to add callee to callee_cache [2,cache_size) if it is
+// not there yet.
+// If the cache is full we drop the callee (may want to fix this later).
+void CoverageData::IndirCall(uptr caller, uptr callee, uptr callee_cache[],
+ uptr cache_size) {
+ if (!cc_array) return;
+ atomic_uintptr_t *atomic_callee_cache =
+ reinterpret_cast<atomic_uintptr_t *>(callee_cache);
+ uptr zero = 0;
+ if (atomic_compare_exchange_strong(&atomic_callee_cache[0], &zero, caller,
+ memory_order_seq_cst)) {
+ uptr idx = atomic_fetch_add(&cc_array_index, 1, memory_order_relaxed);
+ CHECK_LT(idx * sizeof(uptr),
+ atomic_load(&cc_array_size, memory_order_acquire));
+ callee_cache[1] = cache_size;
+ cc_array[idx] = callee_cache;
+ }
+ CHECK_EQ(atomic_load(&atomic_callee_cache[0], memory_order_relaxed), caller);
+ for (uptr i = 2; i < cache_size; i++) {
+ uptr was = 0;
+ if (atomic_compare_exchange_strong(&atomic_callee_cache[i], &was, callee,
+ memory_order_seq_cst))
+ return;
+ if (was == callee) // Already have this callee.
+ return;
+ }
+}
+
uptr *CoverageData::data() {
return pc_array;
}
@@ -266,6 +315,45 @@ static int CovOpenFile(bool packed, const char* name) {
return fd;
}
+// This function dumps the caller=>callee pairs into a file as a sequence of
+// lines like "module_name offset".
+void CoverageData::DumpCallerCalleePairs() {
+ uptr max_idx = atomic_load(&cc_array_index, memory_order_relaxed);
+ if (!max_idx) return;
+ auto sym = Symbolizer::GetOrInit();
+ if (!sym)
+ return;
+ InternalScopedString out(32 << 20);
+ uptr total = 0;
+ for (uptr i = 0; i < max_idx; i++) {
+ uptr *cc_cache = cc_array[i];
+ CHECK(cc_cache);
+ uptr caller = cc_cache[0];
+ uptr n_callees = cc_cache[1];
+ const char *caller_module_name = "<unknown>";
+ uptr caller_module_address = 0;
+ sym->GetModuleNameAndOffsetForPC(caller, &caller_module_name,
+ &caller_module_address);
+ for (uptr j = 2; j < n_callees; j++) {
+ uptr callee = cc_cache[j];
+ if (!callee) break;
+ total++;
+ const char *callee_module_name = "<unknown>";
+ uptr callee_module_address = 0;
+ sym->GetModuleNameAndOffsetForPC(callee, &callee_module_name,
+ &callee_module_address);
+ out.append("%s 0x%zx\n%s 0x%zx\n", caller_module_name,
+ caller_module_address, callee_module_name,
+ callee_module_address);
+ }
+ }
+ int fd = CovOpenFile(false, "caller-callee");
+ if (fd < 0) return;
+ internal_write(fd, out.data(), out.length());
+ internal_close(fd);
+ VReport(1, " CovDump: %zd caller-callee pairs written\n", total);
+}
+
// Dump the coverage on disk.
static void CovDump() {
if (!common_flags()->coverage || common_flags()->coverage_direct) return;
@@ -297,7 +385,7 @@ static void CovDump() {
CHECK_LE(diff, 0xffffffffU);
offsets.push_back(static_cast<u32>(diff));
}
- char *module_name = StripModuleName(module.data());
+ const char *module_name = StripModuleName(module.data());
if (cov_sandboxed) {
if (cov_fd >= 0) {
CovWritePacked(internal_getpid(), module_name, offsets.data(),
@@ -317,11 +405,11 @@ static void CovDump() {
vb - old_vb);
}
}
- InternalFree(module_name);
}
}
if (cov_fd >= 0)
internal_close(cov_fd);
+ coverage_data.DumpCallerCalleePairs();
#endif // !SANITIZER_WINDOWS
}
@@ -357,6 +445,11 @@ extern "C" {
SANITIZER_INTERFACE_ATTRIBUTE void __sanitizer_cov() {
coverage_data.Add(StackTrace::GetPreviousInstructionPc(GET_CALLER_PC()));
}
+SANITIZER_INTERFACE_ATTRIBUTE void
+__sanitizer_cov_indir_call16(uptr callee, uptr callee_cache16[]) {
+ coverage_data.IndirCall(StackTrace::GetPreviousInstructionPc(GET_CALLER_PC()),
+ callee, callee_cache16, 16);
+}
SANITIZER_INTERFACE_ATTRIBUTE void __sanitizer_cov_dump() { CovDump(); }
SANITIZER_INTERFACE_ATTRIBUTE void __sanitizer_cov_init() {
coverage_data.Init();
diff --git a/libsanitizer/sanitizer_common/sanitizer_coverage_mapping_libcdep.cc b/libsanitizer/sanitizer_common/sanitizer_coverage_mapping_libcdep.cc
index a134053a719..b88814b8167 100644
--- a/libsanitizer/sanitizer_common/sanitizer_coverage_mapping_libcdep.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_coverage_mapping_libcdep.cc
@@ -78,7 +78,7 @@ void CovUpdateMapping(uptr caller_pc) {
text.append("%d\n", sizeof(uptr) * 8);
for (int i = 0; i < n_modules; ++i) {
- char *module_name = StripModuleName(modules[i].full_name());
+ const char *module_name = StripModuleName(modules[i].full_name());
for (unsigned j = 0; j < modules[i].n_ranges(); ++j) {
if (modules[i].address_range_executable(j)) {
uptr start = modules[i].address_range_start(j);
@@ -89,7 +89,6 @@ void CovUpdateMapping(uptr caller_pc) {
cached_mapping.SetModuleRange(start, end);
}
}
- InternalFree(module_name);
}
int err;
diff --git a/libsanitizer/sanitizer_common/sanitizer_flags.cc b/libsanitizer/sanitizer_common/sanitizer_flags.cc
index 476f793c27d..d7e7118212e 100644
--- a/libsanitizer/sanitizer_common/sanitizer_flags.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_flags.cc
@@ -37,6 +37,7 @@ void SetCommonFlagsDefaults(CommonFlags *f) {
f->external_symbolizer_path = 0;
f->allow_addr2line = false;
f->strip_path_prefix = "";
+ f->fast_unwind_on_check = false;
f->fast_unwind_on_fatal = false;
f->fast_unwind_on_malloc = true;
f->handle_ioctl = false;
@@ -64,6 +65,8 @@ void SetCommonFlagsDefaults(CommonFlags *f) {
f->suppressions = "";
f->print_suppressions = true;
f->disable_coredump = (SANITIZER_WORDSIZE == 64);
+ f->symbolize_inline_frames = true;
+ f->stack_trace_format = "DEFAULT";
}
void ParseCommonFlagsFromString(CommonFlags *f, const char *str) {
@@ -79,6 +82,9 @@ void ParseCommonFlagsFromString(CommonFlags *f, const char *str) {
"unavailable.");
ParseFlag(str, &f->strip_path_prefix, "strip_path_prefix",
"Strips this prefix from file paths in error reports.");
+ ParseFlag(str, &f->fast_unwind_on_check, "fast_unwind_on_check",
+ "If available, use the fast frame-pointer-based unwinder on "
+ "internal CHECK failures.");
ParseFlag(str, &f->fast_unwind_on_fatal, "fast_unwind_on_fatal",
"If available, use the fast frame-pointer-based unwinder on fatal "
"errors.");
@@ -152,6 +158,12 @@ void ParseCommonFlagsFromString(CommonFlags *f, const char *str) {
"Disable core dumping. By default, disable_core=1 on 64-bit to avoid "
"dumping a 16T+ core file. Ignored on OSes that don't dump core by"
"default and for sanitizers that don't reserve lots of virtual memory.");
+ ParseFlag(str, &f->symbolize_inline_frames, "symbolize_inline_frames",
+ "Print inlined frames in stacktraces. Defaults to true.");
+ ParseFlag(str, &f->stack_trace_format, "stack_trace_format",
+ "Format string used to render stack frames. "
+ "See sanitizer_stacktrace_printer.h for the format description. "
+ "Use DEFAULT to get default format.");
// Do a sanity check for certain flags.
if (f->malloc_context_size < 1)
diff --git a/libsanitizer/sanitizer_common/sanitizer_flags.h b/libsanitizer/sanitizer_common/sanitizer_flags.h
index a906c9e4535..b7a50131811 100644
--- a/libsanitizer/sanitizer_common/sanitizer_flags.h
+++ b/libsanitizer/sanitizer_common/sanitizer_flags.h
@@ -30,6 +30,7 @@ struct CommonFlags {
const char *external_symbolizer_path;
bool allow_addr2line;
const char *strip_path_prefix;
+ bool fast_unwind_on_check;
bool fast_unwind_on_fatal;
bool fast_unwind_on_malloc;
bool handle_ioctl;
@@ -58,6 +59,8 @@ struct CommonFlags {
const char *suppressions;
bool print_suppressions;
bool disable_coredump;
+ bool symbolize_inline_frames;
+ const char *stack_trace_format;
};
inline CommonFlags *common_flags() {
diff --git a/libsanitizer/sanitizer_common/sanitizer_mac.cc b/libsanitizer/sanitizer_common/sanitizer_mac.cc
index 2c2a1d74be7..17b931cb535 100644
--- a/libsanitizer/sanitizer_common/sanitizer_mac.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_mac.cc
@@ -158,7 +158,7 @@ void GetThreadStackTopAndBottom(bool at_initialization, uptr *stack_top,
// pthread_get_stacksize_np() returns an incorrect stack size for the main
// thread on Mavericks. See
// https://code.google.com/p/address-sanitizer/issues/detail?id=261
- if ((GetMacosVersion() == MACOS_VERSION_MAVERICKS) && at_initialization &&
+ if ((GetMacosVersion() >= MACOS_VERSION_MAVERICKS) && at_initialization &&
stacksize == (1 << 19)) {
struct rlimit rl;
CHECK_EQ(getrlimit(RLIMIT_STACK, &rl), 0);
@@ -295,6 +295,7 @@ MacosVersion GetMacosVersionInternal() {
case '1': return MACOS_VERSION_LION;
case '2': return MACOS_VERSION_MOUNTAIN_LION;
case '3': return MACOS_VERSION_MAVERICKS;
+ case '4': return MACOS_VERSION_YOSEMITE;
default: return MACOS_VERSION_UNKNOWN;
}
}
diff --git a/libsanitizer/sanitizer_common/sanitizer_mac.h b/libsanitizer/sanitizer_common/sanitizer_mac.h
index 63055297fef..47739f71c3c 100644
--- a/libsanitizer/sanitizer_common/sanitizer_mac.h
+++ b/libsanitizer/sanitizer_common/sanitizer_mac.h
@@ -23,7 +23,8 @@ enum MacosVersion {
MACOS_VERSION_SNOW_LEOPARD,
MACOS_VERSION_LION,
MACOS_VERSION_MOUNTAIN_LION,
- MACOS_VERSION_MAVERICKS
+ MACOS_VERSION_MAVERICKS,
+ MACOS_VERSION_YOSEMITE,
};
MacosVersion GetMacosVersion();
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform.h b/libsanitizer/sanitizer_common/sanitizer_platform.h
index 14594d5ce55..7064b7166b0 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform.h
+++ b/libsanitizer/sanitizer_common/sanitizer_platform.h
@@ -47,7 +47,7 @@
# define SANITIZER_WINDOWS 0
#endif
-#if defined(__ANDROID__) || defined(ANDROID)
+#if defined(__ANDROID__)
# define SANITIZER_ANDROID 1
#else
# define SANITIZER_ANDROID 0
@@ -79,7 +79,7 @@
// For such platforms build this code with -DSANITIZER_CAN_USE_ALLOCATOR64=0 or
// change the definition of SANITIZER_CAN_USE_ALLOCATOR64 here.
#ifndef SANITIZER_CAN_USE_ALLOCATOR64
-# if defined(__aarch64__)
+# if defined(__aarch64__) || defined(__mips64)
# define SANITIZER_CAN_USE_ALLOCATOR64 0
# else
# define SANITIZER_CAN_USE_ALLOCATOR64 (SANITIZER_WORDSIZE == 64)
@@ -107,4 +107,10 @@
# endif
#endif
+#ifdef __mips__
+# define SANITIZER_POINTER_FORMAT_LENGTH FIRST_32_SECOND_64(8, 10)
+#else
+# define SANITIZER_POINTER_FORMAT_LENGTH FIRST_32_SECOND_64(8, 12)
+#endif
+
#endif // SANITIZER_PLATFORM_H
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_interceptors.h b/libsanitizer/sanitizer_common/sanitizer_platform_interceptors.h
index 81a09927d79..fc2d7ba990c 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_interceptors.h
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_interceptors.h
@@ -204,7 +204,8 @@
#define SANITIZER_INTERCEPT__EXIT SI_LINUX || SI_FREEBSD
#define SANITIZER_INTERCEPT_PHTREAD_MUTEX SI_NOT_WINDOWS
-#define SANITIZER_INTERCEPT_PTHREAD_SETNAME_NP SI_LINUX_NOT_ANDROID
+#define SANITIZER_INTERCEPT_PTHREAD_SETNAME_NP \
+ SI_FREEBSD || SI_LINUX_NOT_ANDROID
#define SANITIZER_INTERCEPT_TLS_GET_ADDR SI_LINUX_NOT_ANDROID
@@ -226,7 +227,8 @@
#define SANITIZER_INTERCEPT_OBSTACK SI_LINUX_NOT_ANDROID
#define SANITIZER_INTERCEPT_FFLUSH SI_NOT_WINDOWS
#define SANITIZER_INTERCEPT_FCLOSE SI_NOT_WINDOWS
-#define SANITIZER_INTERCEPT_DLOPEN_DLCLOSE SI_LINUX_NOT_ANDROID || SI_MAC
+#define SANITIZER_INTERCEPT_DLOPEN_DLCLOSE \
+ SI_FREEBSD || SI_LINUX_NOT_ANDROID || SI_MAC
#define SANITIZER_INTERCEPT_GETPASS SI_LINUX_NOT_ANDROID || SI_MAC
#define SANITIZER_INTERCEPT_TIMERFD SI_LINUX_NOT_ANDROID
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc
index a1f04325033..8779d8adf72 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc
@@ -36,7 +36,6 @@
#define uid_t __kernel_uid_t
#define gid_t __kernel_gid_t
#define off_t __kernel_off_t
-#define time_t __kernel_time_t
// This header seems to contain the definitions of _kernel_ stat* structs.
#include <asm/stat.h>
#undef ino_t
@@ -61,7 +60,7 @@ namespace __sanitizer {
} // namespace __sanitizer
#if !defined(__powerpc64__) && !defined(__x86_64__) && !defined(__aarch64__)\
- && !defined(__mips__) && !defined(__sparc__)
+ && !defined(__mips__)
COMPILER_CHECK(struct___old_kernel_stat_sz == sizeof(struct __old_kernel_stat));
#endif
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
index f5678dceccc..13d908e9f8c 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -13,7 +13,19 @@
#include "sanitizer_platform.h"
#if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_MAC
-
+// Tests in this file assume that off_t-dependent data structures match the
+// libc ABI. For example, struct dirent here is what readdir() function (as
+// exported from libc) returns, and not the user-facing "dirent", which
+// depends on _FILE_OFFSET_BITS setting.
+// To get this "true" dirent definition, we undefine _FILE_OFFSET_BITS below.
+#ifdef _FILE_OFFSET_BITS
+#undef _FILE_OFFSET_BITS
+#endif
+#if SANITIZER_FREEBSD
+#define _WANT_RTENTRY
+#include <sys/param.h>
+#include <sys/socketvar.h>
+#endif
#include <arpa/inet.h>
#include <dirent.h>
#include <errno.h>
@@ -551,7 +563,9 @@ namespace __sanitizer {
unsigned IOCTL_PPPIOCSMAXCID = PPPIOCSMAXCID;
unsigned IOCTL_PPPIOCSMRU = PPPIOCSMRU;
unsigned IOCTL_PPPIOCSXASYNCMAP = PPPIOCSXASYNCMAP;
+ unsigned IOCTL_SIOCADDRT = SIOCADDRT;
unsigned IOCTL_SIOCDARP = SIOCDARP;
+ unsigned IOCTL_SIOCDELRT = SIOCDELRT;
unsigned IOCTL_SIOCDRARP = SIOCDRARP;
unsigned IOCTL_SIOCGARP = SIOCGARP;
unsigned IOCTL_SIOCGIFENCAP = SIOCGIFENCAP;
@@ -637,8 +651,6 @@ namespace __sanitizer {
#if SANITIZER_LINUX || SANITIZER_FREEBSD
unsigned IOCTL_MTIOCGET = MTIOCGET;
unsigned IOCTL_MTIOCTOP = MTIOCTOP;
- unsigned IOCTL_SIOCADDRT = SIOCADDRT;
- unsigned IOCTL_SIOCDELRT = SIOCDELRT;
unsigned IOCTL_SNDCTL_DSP_GETBLKSIZE = SNDCTL_DSP_GETBLKSIZE;
unsigned IOCTL_SNDCTL_DSP_GETFMTS = SNDCTL_DSP_GETFMTS;
unsigned IOCTL_SNDCTL_DSP_NONBLOCK = SNDCTL_DSP_NONBLOCK;
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
index 284be11cb5f..139fe0a1821 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -72,14 +72,6 @@ namespace __sanitizer {
const unsigned struct_kernel_stat_sz = 144;
#endif
const unsigned struct_kernel_stat64_sz = 104;
-#elif defined(__sparc__) && defined(__arch64__)
- const unsigned struct___old_kernel_stat_sz = 0;
- const unsigned struct_kernel_stat_sz = 104;
- const unsigned struct_kernel_stat64_sz = 144;
-#elif defined(__sparc__) && !defined(__arch64__)
- const unsigned struct___old_kernel_stat_sz = 0;
- const unsigned struct_kernel_stat_sz = 64;
- const unsigned struct_kernel_stat64_sz = 104;
#endif
struct __sanitizer_perf_event_attr {
unsigned type;
@@ -102,7 +94,7 @@ namespace __sanitizer {
#if defined(__powerpc64__)
const unsigned struct___old_kernel_stat_sz = 0;
-#elif !defined(__sparc__)
+#else
const unsigned struct___old_kernel_stat_sz = 32;
#endif
@@ -181,18 +173,6 @@ namespace __sanitizer {
unsigned short __pad1;
unsigned long __unused1;
unsigned long __unused2;
-#elif defined(__sparc__)
-# if defined(__arch64__)
- unsigned mode;
- unsigned short __pad1;
-# else
- unsigned short __pad1;
- unsigned short mode;
- unsigned short __pad2;
-# endif
- unsigned short __seq;
- unsigned long long __unused1;
- unsigned long long __unused2;
#else
unsigned short mode;
unsigned short __pad1;
@@ -210,26 +190,6 @@ namespace __sanitizer {
struct __sanitizer_shmid_ds {
__sanitizer_ipc_perm shm_perm;
- #if defined(__sparc__)
- # if !defined(__arch64__)
- u32 __pad1;
- # endif
- long shm_atime;
- # if !defined(__arch64__)
- u32 __pad2;
- # endif
- long shm_dtime;
- # if !defined(__arch64__)
- u32 __pad3;
- # endif
- long shm_ctime;
- uptr shm_segsz;
- int shm_cpid;
- int shm_lpid;
- unsigned long shm_nattch;
- unsigned long __glibc_reserved1;
- unsigned long __glibc_reserved2;
- #else
#ifndef __powerpc__
uptr shm_segsz;
#elif !defined(__powerpc64__)
@@ -267,7 +227,6 @@ namespace __sanitizer {
uptr __unused4;
uptr __unused5;
#endif
-#endif
};
#elif SANITIZER_FREEBSD
struct __sanitizer_ipc_perm {
@@ -511,7 +470,7 @@ namespace __sanitizer {
typedef long __sanitizer___kernel_off_t;
#endif
-#if defined(__powerpc__) || defined(__aarch64__) || defined(__mips__)
+#if defined(__powerpc__) || defined(__mips__)
typedef unsigned int __sanitizer___kernel_old_uid_t;
typedef unsigned int __sanitizer___kernel_old_gid_t;
#else
@@ -564,13 +523,9 @@ namespace __sanitizer {
#else
__sanitizer_sigset_t sa_mask;
#ifndef __mips__
-#if defined(__sparc__)
- unsigned long sa_flags;
-#else
int sa_flags;
#endif
#endif
-#endif
#if SANITIZER_LINUX
void (*sa_restorer)();
#endif
@@ -790,7 +745,7 @@ struct __sanitizer_obstack {
#define IOC_NRBITS 8
#define IOC_TYPEBITS 8
-#if defined(__powerpc__) || defined(__powerpc64__) || defined(__mips__) || defined(__sparc__)
+#if defined(__powerpc__) || defined(__powerpc64__) || defined(__mips__)
#define IOC_SIZEBITS 13
#define IOC_DIRBITS 3
#define IOC_NONE 1U
@@ -820,17 +775,7 @@ struct __sanitizer_obstack {
#define IOC_DIR(nr) (((nr) >> IOC_DIRSHIFT) & IOC_DIRMASK)
#define IOC_TYPE(nr) (((nr) >> IOC_TYPESHIFT) & IOC_TYPEMASK)
#define IOC_NR(nr) (((nr) >> IOC_NRSHIFT) & IOC_NRMASK)
-
-#if defined(__sparc__)
-// In sparc the 14 bits SIZE field overlaps with the
-// least significant bit of DIR, so either IOC_READ or
-// IOC_WRITE shall be 1 in order to get a non-zero SIZE.
-# define IOC_SIZE(nr) \
- ((((((nr) >> 29) & 0x7) & (4U|2U)) == 0)? \
- 0 : (((nr) >> 16) & 0x3fff))
-#else
#define IOC_SIZE(nr) (((nr) >> IOC_SIZESHIFT) & IOC_SIZEMASK)
-#endif
extern unsigned struct_arpreq_sz;
extern unsigned struct_ifreq_sz;
diff --git a/libsanitizer/sanitizer_common/sanitizer_posix.cc b/libsanitizer/sanitizer_common/sanitizer_posix.cc
index 24e99f9472d..229870e00dc 100644
--- a/libsanitizer/sanitizer_common/sanitizer_posix.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_posix.cc
@@ -82,9 +82,12 @@ uptr GetMaxVirtualAddress() {
// one of 0x00000fffffffffffUL and 0x00003fffffffffffUL.
// Note that with 'ulimit -s unlimited' the stack is moved away from the top
// of the address space, so simply checking the stack address is not enough.
- return (1ULL << 44) - 1; // 0x00000fffffffffffUL
+ // This should (does) work for both PowerPC64 Endian modes.
+ return (1ULL << (MostSignificantSetBitIndex(GET_CURRENT_FRAME()) + 1)) - 1;
# elif defined(__aarch64__)
return (1ULL << 39) - 1;
+# elif defined(__mips64)
+ return (1ULL << 40) - 1;
# else
return (1ULL << 47) - 1; // 0x00007fffffffffffUL;
# endif
diff --git a/libsanitizer/sanitizer_common/sanitizer_printf.cc b/libsanitizer/sanitizer_common/sanitizer_printf.cc
index fc0c357ba86..599f2c5d7c6 100644
--- a/libsanitizer/sanitizer_common/sanitizer_printf.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_printf.cc
@@ -111,7 +111,7 @@ static int AppendPointer(char **buff, const char *buff_end, u64 ptr_value) {
int result = 0;
result += AppendString(buff, buff_end, -1, "0x");
result += AppendUnsigned(buff, buff_end, ptr_value, 16,
- (SANITIZER_WORDSIZE == 64) ? 12 : 8, true);
+ SANITIZER_POINTER_FORMAT_LENGTH, true);
return result;
}
diff --git a/libsanitizer/sanitizer_common/sanitizer_stackdepot.cc b/libsanitizer/sanitizer_common/sanitizer_stackdepot.cc
index e1915cb808f..a3c9c0677e2 100644
--- a/libsanitizer/sanitizer_common/sanitizer_stackdepot.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_stackdepot.cc
@@ -16,31 +16,6 @@
namespace __sanitizer {
-struct StackDepotDesc {
- const uptr *stack;
- uptr size;
- u32 hash() const {
- // murmur2
- const u32 m = 0x5bd1e995;
- const u32 seed = 0x9747b28c;
- const u32 r = 24;
- u32 h = seed ^ (size * sizeof(uptr));
- for (uptr i = 0; i < size; i++) {
- u32 k = stack[i];
- k *= m;
- k ^= k >> r;
- k *= m;
- h *= m;
- h ^= k;
- }
- h ^= h >> 13;
- h *= m;
- h ^= h >> 15;
- return h;
- }
- bool is_valid() { return size > 0 && stack; }
-};
-
struct StackDepotNode {
StackDepotNode *link;
u32 id;
@@ -56,28 +31,49 @@ struct StackDepotNode {
static const u32 kUseCountMask = (1 << kUseCountBits) - 1;
static const u32 kHashMask = ~kUseCountMask;
- typedef StackDepotDesc args_type;
+ typedef StackTrace args_type;
bool eq(u32 hash, const args_type &args) const {
u32 hash_bits =
atomic_load(&hash_and_use_count, memory_order_relaxed) & kHashMask;
if ((hash & kHashMask) != hash_bits || args.size != size) return false;
uptr i = 0;
for (; i < size; i++) {
- if (stack[i] != args.stack[i]) return false;
+ if (stack[i] != args.trace[i]) return false;
}
return true;
}
static uptr storage_size(const args_type &args) {
return sizeof(StackDepotNode) + (args.size - 1) * sizeof(uptr);
}
+ static u32 hash(const args_type &args) {
+ // murmur2
+ const u32 m = 0x5bd1e995;
+ const u32 seed = 0x9747b28c;
+ const u32 r = 24;
+ u32 h = seed ^ (args.size * sizeof(uptr));
+ for (uptr i = 0; i < args.size; i++) {
+ u32 k = args.trace[i];
+ k *= m;
+ k ^= k >> r;
+ k *= m;
+ h *= m;
+ h ^= k;
+ }
+ h ^= h >> 13;
+ h *= m;
+ h ^= h >> 15;
+ return h;
+ }
+ static bool is_valid(const args_type &args) {
+ return args.size > 0 && args.trace;
+ }
void store(const args_type &args, u32 hash) {
atomic_store(&hash_and_use_count, hash & kHashMask, memory_order_relaxed);
size = args.size;
- internal_memcpy(stack, args.stack, size * sizeof(uptr));
+ internal_memcpy(stack, args.trace, size * sizeof(uptr));
}
args_type load() const {
- args_type ret = {&stack[0], size};
- return ret;
+ return args_type(&stack[0], size);
}
StackDepotHandle get_handle() { return StackDepotHandle(this); }
@@ -97,8 +93,6 @@ void StackDepotHandle::inc_use_count_unsafe() {
StackDepotNode::kUseCountMask;
CHECK_LT(prev + 1, StackDepotNode::kMaxUseCount);
}
-uptr StackDepotHandle::size() { return node_->size; }
-uptr *StackDepotHandle::stack() { return &node_->stack[0]; }
// FIXME(dvyukov): this single reserved bit is used in TSan.
typedef StackDepotBase<StackDepotNode, 1, StackDepotNode::kTabSizeLog>
@@ -109,21 +103,17 @@ StackDepotStats *StackDepotGetStats() {
return theDepot.GetStats();
}
-u32 StackDepotPut(const uptr *stack, uptr size) {
- StackDepotDesc desc = {stack, size};
- StackDepotHandle h = theDepot.Put(desc);
+u32 StackDepotPut(StackTrace stack) {
+ StackDepotHandle h = theDepot.Put(stack);
return h.valid() ? h.id() : 0;
}
-StackDepotHandle StackDepotPut_WithHandle(const uptr *stack, uptr size) {
- StackDepotDesc desc = {stack, size};
- return theDepot.Put(desc);
+StackDepotHandle StackDepotPut_WithHandle(StackTrace stack) {
+ return theDepot.Put(stack);
}
-const uptr *StackDepotGet(u32 id, uptr *size) {
- StackDepotDesc desc = theDepot.Get(id);
- *size = desc.size;
- return desc.stack;
+StackTrace StackDepotGet(u32 id) {
+ return theDepot.Get(id);
}
void StackDepotLockAll() {
@@ -154,18 +144,15 @@ StackDepotReverseMap::StackDepotReverseMap()
InternalSort(&map_, map_.size(), IdDescPair::IdComparator);
}
-const uptr *StackDepotReverseMap::Get(u32 id, uptr *size) {
- if (!map_.size()) return 0;
+StackTrace StackDepotReverseMap::Get(u32 id) {
+ if (!map_.size())
+ return StackTrace();
IdDescPair pair = {id, 0};
uptr idx = InternalBinarySearch(map_, 0, map_.size(), pair,
IdDescPair::IdComparator);
- if (idx > map_.size()) {
- *size = 0;
- return 0;
- }
- StackDepotNode *desc = map_[idx].desc;
- *size = desc->size;
- return desc->stack;
+ if (idx > map_.size())
+ return StackTrace();
+ return map_[idx].desc->load();
}
} // namespace __sanitizer
diff --git a/libsanitizer/sanitizer_common/sanitizer_stackdepot.h b/libsanitizer/sanitizer_common/sanitizer_stackdepot.h
index 2b1da4ee14f..aad9bfb8d35 100644
--- a/libsanitizer/sanitizer_common/sanitizer_stackdepot.h
+++ b/libsanitizer/sanitizer_common/sanitizer_stackdepot.h
@@ -13,6 +13,7 @@
#include "sanitizer_common.h"
#include "sanitizer_internal_defs.h"
+#include "sanitizer_stacktrace.h"
namespace __sanitizer {
@@ -26,17 +27,15 @@ struct StackDepotHandle {
u32 id();
int use_count();
void inc_use_count_unsafe();
- uptr size();
- uptr *stack();
};
const int kStackDepotMaxUseCount = 1U << 20;
StackDepotStats *StackDepotGetStats();
-u32 StackDepotPut(const uptr *stack, uptr size);
-StackDepotHandle StackDepotPut_WithHandle(const uptr *stack, uptr size);
+u32 StackDepotPut(StackTrace stack);
+StackDepotHandle StackDepotPut_WithHandle(StackTrace stack);
// Retrieves a stored stack trace by the id.
-const uptr *StackDepotGet(u32 id, uptr *size);
+StackTrace StackDepotGet(u32 id);
void StackDepotLockAll();
void StackDepotUnlockAll();
@@ -48,7 +47,7 @@ void StackDepotUnlockAll();
class StackDepotReverseMap {
public:
StackDepotReverseMap();
- const uptr *Get(u32 id, uptr *size);
+ StackTrace Get(u32 id);
private:
struct IdDescPair {
diff --git a/libsanitizer/sanitizer_common/sanitizer_stackdepotbase.h b/libsanitizer/sanitizer_common/sanitizer_stackdepotbase.h
index b9dedec2621..05b63092b80 100644
--- a/libsanitizer/sanitizer_common/sanitizer_stackdepotbase.h
+++ b/libsanitizer/sanitizer_common/sanitizer_stackdepotbase.h
@@ -95,8 +95,8 @@ typename StackDepotBase<Node, kReservedBits, kTabSizeLog>::handle_type
StackDepotBase<Node, kReservedBits, kTabSizeLog>::Put(args_type args,
bool *inserted) {
if (inserted) *inserted = false;
- if (!args.is_valid()) return handle_type();
- uptr h = args.hash();
+ if (!Node::is_valid(args)) return handle_type();
+ uptr h = Node::hash(args);
atomic_uintptr_t *p = &tab[h % kTabSize];
uptr v = atomic_load(p, memory_order_consume);
Node *s = (Node *)(v & ~1);
diff --git a/libsanitizer/sanitizer_common/sanitizer_stacktrace.cc b/libsanitizer/sanitizer_common/sanitizer_stacktrace.cc
index 0ce5ae475f6..9b99b5bb201 100644
--- a/libsanitizer/sanitizer_common/sanitizer_stacktrace.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_stacktrace.cc
@@ -23,7 +23,7 @@ uptr StackTrace::GetPreviousInstructionPc(uptr pc) {
#if defined(__powerpc__) || defined(__powerpc64__)
// PCs are always 4 byte aligned.
return pc - 4;
-#elif defined(__sparc__)
+#elif defined(__sparc__) || defined(__mips__)
return pc - 8;
#else
return pc - 1;
@@ -34,6 +34,15 @@ uptr StackTrace::GetCurrentPc() {
return GET_CALLER_PC();
}
+void BufferedStackTrace::Init(const uptr *pcs, uptr cnt, uptr extra_top_pc) {
+ size = cnt + !!extra_top_pc;
+ CHECK_LE(size, kStackTraceMax);
+ internal_memcpy(trace_buffer, pcs, cnt * sizeof(trace_buffer[0]));
+ if (extra_top_pc)
+ trace_buffer[cnt] = extra_top_pc;
+ top_frame_bp = 0;
+}
+
// Check if given pointer points into allocated stack area.
static inline bool IsValidFrame(uptr frame, uptr stack_top, uptr stack_bottom) {
return frame > stack_bottom && frame < stack_top - 2 * sizeof (uhwptr);
@@ -49,32 +58,40 @@ static inline uhwptr *GetCanonicFrame(uptr bp,
if (!IsValidFrame(bp, stack_top, stack_bottom)) return 0;
uhwptr *bp_prev = (uhwptr *)bp;
if (IsValidFrame((uptr)bp_prev[0], stack_top, stack_bottom)) return bp_prev;
- return bp_prev - 1;
+ // The next frame pointer does not look right. This could be a GCC frame, step
+ // back by 1 word and try again.
+ if (IsValidFrame((uptr)bp_prev[-1], stack_top, stack_bottom))
+ return bp_prev - 1;
+ // Nope, this does not look right either. This means the frame after next does
+ // not have a valid frame pointer, but we can still extract the caller PC.
+ // Unfortunately, there is no way to decide between GCC and LLVM frame
+ // layouts. Assume LLVM.
+ return bp_prev;
#else
return (uhwptr*)bp;
#endif
}
-void StackTrace::FastUnwindStack(uptr pc, uptr bp,
- uptr stack_top, uptr stack_bottom,
- uptr max_depth) {
+void BufferedStackTrace::FastUnwindStack(uptr pc, uptr bp, uptr stack_top,
+ uptr stack_bottom, uptr max_depth) {
CHECK_GE(max_depth, 2);
- trace[0] = pc;
+ trace_buffer[0] = pc;
size = 1;
if (stack_top < 4096) return; // Sanity check for stack top.
uhwptr *frame = GetCanonicFrame(bp, stack_top, stack_bottom);
- uhwptr *prev_frame = 0;
+ // Lowest possible address that makes sense as the next frame pointer.
+ // Goes up as we walk the stack.
+ uptr bottom = stack_bottom;
// Avoid infinite loop when frame == frame[0] by using frame > prev_frame.
- while (frame > prev_frame &&
- IsValidFrame((uptr)frame, stack_top, stack_bottom) &&
+ while (IsValidFrame((uptr)frame, stack_top, bottom) &&
IsAligned((uptr)frame, sizeof(*frame)) &&
size < max_depth) {
uhwptr pc1 = frame[1];
if (pc1 != pc) {
- trace[size++] = (uptr) pc1;
+ trace_buffer[size++] = (uptr) pc1;
}
- prev_frame = frame;
- frame = GetCanonicFrame((uptr)frame[0], stack_top, stack_bottom);
+ bottom = (uptr)frame;
+ frame = GetCanonicFrame((uptr)frame[0], stack_top, bottom);
}
}
@@ -82,15 +99,15 @@ static bool MatchPc(uptr cur_pc, uptr trace_pc, uptr threshold) {
return cur_pc - trace_pc <= threshold || trace_pc - cur_pc <= threshold;
}
-void StackTrace::PopStackFrames(uptr count) {
+void BufferedStackTrace::PopStackFrames(uptr count) {
CHECK_LT(count, size);
size -= count;
for (uptr i = 0; i < size; ++i) {
- trace[i] = trace[i + count];
+ trace_buffer[i] = trace_buffer[i + count];
}
}
-uptr StackTrace::LocatePcInTrace(uptr pc) {
+uptr BufferedStackTrace::LocatePcInTrace(uptr pc) {
// Use threshold to find PC in stack trace, as PC we want to unwind from may
// slightly differ from return address in the actual unwinded stack trace.
const int kPcThreshold = 288;
diff --git a/libsanitizer/sanitizer_common/sanitizer_stacktrace.h b/libsanitizer/sanitizer_common/sanitizer_stacktrace.h
index 0e0f1702228..31495cfc568 100644
--- a/libsanitizer/sanitizer_common/sanitizer_stacktrace.h
+++ b/libsanitizer/sanitizer_common/sanitizer_stacktrace.h
@@ -27,44 +27,49 @@ static const uptr kStackTraceMax = 256;
# define SANITIZER_CAN_FAST_UNWIND 1
#endif
+// Fast unwind is the only option on Mac for now; we will need to
+// revisit this macro when slow unwind works on Mac, see
+// https://code.google.com/p/address-sanitizer/issues/detail?id=137
+#if SANITIZER_MAC
+# define SANITIZER_CAN_SLOW_UNWIND 0
+#else
+# define SANITIZER_CAN_SLOW_UNWIND 1
+#endif
+
struct StackTrace {
- typedef bool (*SymbolizeCallback)(const void *pc, char *out_buffer,
- int out_size);
- uptr top_frame_bp;
+ const uptr *trace;
uptr size;
- uptr trace[kStackTraceMax];
- // Prints a symbolized stacktrace, followed by an empty line.
- static void PrintStack(const uptr *addr, uptr size);
- void Print() const {
- PrintStack(trace, size);
- }
+ StackTrace() : trace(nullptr), size(0) {}
+ StackTrace(const uptr *trace, uptr size) : trace(trace), size(size) {}
- void CopyFrom(const uptr *src, uptr src_size) {
- top_frame_bp = 0;
- size = src_size;
- if (size > kStackTraceMax) size = kStackTraceMax;
- for (uptr i = 0; i < size; i++)
- trace[i] = src[i];
- }
+ // Prints a symbolized stacktrace, followed by an empty line.
+ void Print() const;
static bool WillUseFastUnwind(bool request_fast_unwind) {
- // Check if fast unwind is available. Fast unwind is the only option on Mac.
- // It is also the only option on FreeBSD as the slow unwinding that
- // leverages _Unwind_Backtrace() yields the call stack of the signal's
- // handler and not of the code that raised the signal (as it does on Linux).
if (!SANITIZER_CAN_FAST_UNWIND)
return false;
- else if (SANITIZER_MAC != 0 || SANITIZER_FREEBSD != 0)
+ else if (!SANITIZER_CAN_SLOW_UNWIND)
return true;
return request_fast_unwind;
}
- void Unwind(uptr max_depth, uptr pc, uptr bp, void *context, uptr stack_top,
- uptr stack_bottom, bool request_fast_unwind);
-
static uptr GetCurrentPc();
static uptr GetPreviousInstructionPc(uptr pc);
+ typedef bool (*SymbolizeCallback)(const void *pc, char *out_buffer,
+ int out_size);
+};
+
+// StackTrace that owns the buffer used to store the addresses.
+struct BufferedStackTrace : public StackTrace {
+ uptr trace_buffer[kStackTraceMax];
+ uptr top_frame_bp; // Optional bp of a top frame.
+
+ BufferedStackTrace() : StackTrace(trace_buffer, 0), top_frame_bp(0) {}
+
+ void Init(const uptr *pcs, uptr cnt, uptr extra_top_pc = 0);
+ void Unwind(uptr max_depth, uptr pc, uptr bp, void *context, uptr stack_top,
+ uptr stack_bottom, bool request_fast_unwind);
private:
void FastUnwindStack(uptr pc, uptr bp, uptr stack_top, uptr stack_bottom,
@@ -74,6 +79,9 @@ struct StackTrace {
uptr max_depth);
void PopStackFrames(uptr count);
uptr LocatePcInTrace(uptr pc);
+
+ BufferedStackTrace(const BufferedStackTrace &);
+ void operator=(const BufferedStackTrace &);
};
} // namespace __sanitizer
diff --git a/libsanitizer/sanitizer_common/sanitizer_stacktrace_libcdep.cc b/libsanitizer/sanitizer_common/sanitizer_stacktrace_libcdep.cc
index 5dcc0e9ed15..2d55b73f03a 100644
--- a/libsanitizer/sanitizer_common/sanitizer_stacktrace_libcdep.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_stacktrace_libcdep.cc
@@ -10,58 +10,40 @@
//===----------------------------------------------------------------------===//
#include "sanitizer_common.h"
+#include "sanitizer_placement_new.h"
#include "sanitizer_stacktrace.h"
+#include "sanitizer_stacktrace_printer.h"
#include "sanitizer_symbolizer.h"
namespace __sanitizer {
-static void PrintStackFramePrefix(InternalScopedString *buffer, uptr frame_num,
- uptr pc) {
- buffer->append(" #%zu 0x%zx", frame_num, pc);
-}
-
-void StackTrace::PrintStack(const uptr *addr, uptr size) {
- if (addr == 0 || size == 0) {
+void StackTrace::Print() const {
+ if (trace == nullptr || size == 0) {
Printf(" <empty stack>\n\n");
return;
}
- InternalScopedBuffer<char> buff(GetPageSizeCached() * 2);
- InternalScopedBuffer<AddressInfo> addr_frames(64);
+ const int kMaxAddrFrames = 64;
+ InternalScopedBuffer<AddressInfo> addr_frames(kMaxAddrFrames);
+ for (uptr i = 0; i < kMaxAddrFrames; i++)
+ new(&addr_frames[i]) AddressInfo();
InternalScopedString frame_desc(GetPageSizeCached() * 2);
uptr frame_num = 0;
- for (uptr i = 0; i < size && addr[i]; i++) {
+ for (uptr i = 0; i < size && trace[i]; i++) {
// PCs in stack traces are actually the return addresses, that is,
// addresses of the next instructions after the call.
- uptr pc = GetPreviousInstructionPc(addr[i]);
+ uptr pc = GetPreviousInstructionPc(trace[i]);
uptr addr_frames_num = Symbolizer::GetOrInit()->SymbolizePC(
- pc, addr_frames.data(), addr_frames.size());
+ pc, addr_frames.data(), kMaxAddrFrames);
if (addr_frames_num == 0) {
- frame_desc.clear();
- PrintStackFramePrefix(&frame_desc, frame_num, pc);
- frame_desc.append(" (<unknown module>)");
- Printf("%s\n", frame_desc.data());
- frame_num++;
- continue;
+ addr_frames[0].address = pc;
+ addr_frames_num = 1;
}
for (uptr j = 0; j < addr_frames_num; j++) {
AddressInfo &info = addr_frames[j];
frame_desc.clear();
- PrintStackFramePrefix(&frame_desc, frame_num, pc);
- if (info.function) {
- frame_desc.append(" in %s", info.function);
- // Print offset in function if we don't know the source file.
- if (!info.file && info.function_offset != AddressInfo::kUnknown)
- frame_desc.append("+0x%zx", info.function_offset);
- }
- if (info.file) {
- frame_desc.append(" ");
- PrintSourceLocation(&frame_desc, info.file, info.line, info.column);
- } else if (info.module) {
- frame_desc.append(" ");
- PrintModuleAndOffset(&frame_desc, info.module, info.module_offset);
- }
+ RenderFrame(&frame_desc, common_flags()->stack_trace_format, frame_num++,
+ info, common_flags()->strip_path_prefix);
Printf("%s\n", frame_desc.data());
- frame_num++;
info.Clear();
}
}
@@ -69,9 +51,9 @@ void StackTrace::PrintStack(const uptr *addr, uptr size) {
Printf("\n");
}
-void StackTrace::Unwind(uptr max_depth, uptr pc, uptr bp, void *context,
- uptr stack_top, uptr stack_bottom,
- bool request_fast_unwind) {
+void BufferedStackTrace::Unwind(uptr max_depth, uptr pc, uptr bp, void *context,
+ uptr stack_top, uptr stack_bottom,
+ bool request_fast_unwind) {
top_frame_bp = (max_depth > 0) ? bp : 0;
// Avoid doing any work for small max_depth.
if (max_depth == 0) {
@@ -80,7 +62,7 @@ void StackTrace::Unwind(uptr max_depth, uptr pc, uptr bp, void *context,
}
if (max_depth == 1) {
size = 1;
- trace[0] = pc;
+ trace_buffer[0] = pc;
return;
}
if (!WillUseFastUnwind(request_fast_unwind)) {
diff --git a/libsanitizer/sanitizer_common/sanitizer_stacktrace_printer.cc b/libsanitizer/sanitizer_common/sanitizer_stacktrace_printer.cc
new file mode 100644
index 00000000000..300b4904c54
--- /dev/null
+++ b/libsanitizer/sanitizer_common/sanitizer_stacktrace_printer.cc
@@ -0,0 +1,130 @@
+//===-- sanitizer_common.cc -----------------------------------------------===//
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file is shared between sanitizers' run-time libraries.
+//
+//===----------------------------------------------------------------------===//
+#include "sanitizer_stacktrace_printer.h"
+
+namespace __sanitizer {
+
+static const char *StripFunctionName(const char *function, const char *prefix) {
+ if (function == 0) return 0;
+ if (prefix == 0) return function;
+ uptr prefix_len = internal_strlen(prefix);
+ if (0 == internal_strncmp(function, prefix, prefix_len))
+ return function + prefix_len;
+ return function;
+}
+
+static const char kDefaultFormat[] = " #%n %p %F %L";
+
+void RenderFrame(InternalScopedString *buffer, const char *format, int frame_no,
+ const AddressInfo &info, const char *strip_path_prefix,
+ const char *strip_func_prefix) {
+ if (0 == internal_strcmp(format, "DEFAULT"))
+ format = kDefaultFormat;
+ for (const char *p = format; *p != '\0'; p++) {
+ if (*p != '%') {
+ buffer->append("%c", *p);
+ continue;
+ }
+ p++;
+ switch (*p) {
+ case '%':
+ buffer->append("%%");
+ break;
+ // Frame number and all fields of AddressInfo structure.
+ case 'n':
+ buffer->append("%zu", frame_no);
+ break;
+ case 'p':
+ buffer->append("0x%zx", info.address);
+ break;
+ case 'm':
+ buffer->append("%s", StripPathPrefix(info.module, strip_path_prefix));
+ break;
+ case 'o':
+ buffer->append("0x%zx", info.module_offset);
+ break;
+ case 'f':
+ buffer->append("%s", StripFunctionName(info.function, strip_func_prefix));
+ break;
+ case 'q':
+ buffer->append("0x%zx", info.function_offset != AddressInfo::kUnknown
+ ? info.function_offset
+ : 0x0);
+ break;
+ case 's':
+ buffer->append("%s", StripPathPrefix(info.file, strip_path_prefix));
+ break;
+ case 'l':
+ buffer->append("%d", info.line);
+ break;
+ case 'c':
+ buffer->append("%d", info.column);
+ break;
+ // Smarter special cases.
+ case 'F':
+ // Function name and offset, if file is unknown.
+ if (info.function) {
+ buffer->append("in %s",
+ StripFunctionName(info.function, strip_func_prefix));
+ if (!info.file && info.function_offset != AddressInfo::kUnknown)
+ buffer->append("+0x%zx", info.function_offset);
+ }
+ break;
+ case 'S':
+ // File/line information.
+ RenderSourceLocation(buffer, info.file, info.line, info.column,
+ strip_path_prefix);
+ break;
+ case 'L':
+ // Source location, or module location.
+ if (info.file) {
+ RenderSourceLocation(buffer, info.file, info.line, info.column,
+ strip_path_prefix);
+ } else if (info.module) {
+ RenderModuleLocation(buffer, info.module, info.module_offset,
+ strip_path_prefix);
+ } else {
+ buffer->append("(<unknown module>)");
+ }
+ break;
+ case 'M':
+ // Module basename and offset, or PC.
+ if (info.module)
+ buffer->append("(%s+%p)", StripModuleName(info.module),
+ (void *)info.module_offset);
+ else
+ buffer->append("(%p)", (void *)info.address);
+ break;
+ default:
+ Report("Unsupported specifier in stack frame format: %c (0x%zx)!\n",
+ *p, *p);
+ Die();
+ }
+ }
+}
+
+void RenderSourceLocation(InternalScopedString *buffer, const char *file,
+ int line, int column, const char *strip_path_prefix) {
+ buffer->append("%s", StripPathPrefix(file, strip_path_prefix));
+ if (line > 0) {
+ buffer->append(":%d", line);
+ if (column > 0)
+ buffer->append(":%d", column);
+ }
+}
+
+void RenderModuleLocation(InternalScopedString *buffer, const char *module,
+ uptr offset, const char *strip_path_prefix) {
+ buffer->append("(%s+0x%zx)", StripPathPrefix(module, strip_path_prefix),
+ offset);
+}
+
+} // namespace __sanitizer
diff --git a/libsanitizer/sanitizer_common/sanitizer_stacktrace_printer.h b/libsanitizer/sanitizer_common/sanitizer_stacktrace_printer.h
new file mode 100644
index 00000000000..54e2fb024df
--- /dev/null
+++ b/libsanitizer/sanitizer_common/sanitizer_stacktrace_printer.h
@@ -0,0 +1,60 @@
+//===-- sanitizer_stacktrace_printer.h --------------------------*- C++ -*-===//
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file is shared between sanitizers' run-time libraries.
+//
+//===----------------------------------------------------------------------===//
+#ifndef SANITIZER_STACKTRACE_PRINTER_H
+#define SANITIZER_STACKTRACE_PRINTER_H
+
+#include "sanitizer_common.h"
+#include "sanitizer_symbolizer.h"
+
+namespace __sanitizer {
+
+// Render the contents of "info" structure, which represents the contents of
+// stack frame "frame_no" and appends it to the "buffer". "format" is a
+// string with placeholders, which is copied to the output with
+// placeholders substituted with the contents of "info". For example,
+// format string
+// " frame %n: function %F at %S"
+// will be turned into
+// " frame 10: function foo::bar() at my/file.cc:10"
+// You may additionally pass "strip_path_prefix" to strip prefixes of paths to
+// source files and modules, and "strip_func_prefix" to strip prefixes of
+// function names.
+// Here's the full list of available placeholders:
+// %% - represents a '%' character;
+// %n - frame number (copy of frame_no);
+// %p - PC in hex format;
+// %m - path to module (binary or shared object);
+// %o - offset in the module in hex format;
+// %f - function name;
+// %q - offset in the function in hex format (*if available*);
+// %s - path to source file;
+// %l - line in the source file;
+// %c - column in the source file;
+// %F - if function is known to be <foo>, prints "in <foo>", possibly
+// followed by the offset in this function, but only if source file
+// is unknown;
+// %S - prints file/line/column information;
+// %L - prints location information: file/line/column, if it is known, or
+// module+offset if it is known, or (<unknown module>) string.
+// %M - prints module basename and offset, if it is known, or PC.
+void RenderFrame(InternalScopedString *buffer, const char *format, int frame_no,
+ const AddressInfo &info, const char *strip_path_prefix = "",
+ const char *strip_func_prefix = "");
+
+void RenderSourceLocation(InternalScopedString *buffer, const char *file,
+ int line, int column, const char *strip_path_prefix);
+
+void RenderModuleLocation(InternalScopedString *buffer, const char *module,
+ uptr offset, const char *strip_path_prefix);
+
+} // namespace __sanitizer
+
+#endif // SANITIZER_STACKTRACE_PRINTER_H
diff --git a/libsanitizer/sanitizer_common/sanitizer_symbolizer.h b/libsanitizer/sanitizer_common/sanitizer_symbolizer.h
index 73a68b2ee11..2ff99372da9 100644
--- a/libsanitizer/sanitizer_common/sanitizer_symbolizer.h
+++ b/libsanitizer/sanitizer_common/sanitizer_symbolizer.h
@@ -59,13 +59,23 @@ struct AddressInfo {
}
};
+// For now, DataInfo is used to describe global variable.
struct DataInfo {
- uptr address;
char *module;
uptr module_offset;
char *name;
uptr start;
uptr size;
+
+ DataInfo() {
+ internal_memset(this, 0, sizeof(DataInfo));
+ }
+
+ void Clear() {
+ InternalFree(module);
+ InternalFree(name);
+ internal_memset(this, 0, sizeof(DataInfo));
+ }
};
class Symbolizer {
diff --git a/libsanitizer/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc b/libsanitizer/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
index 86d32e529ec..905079475b8 100644
--- a/libsanitizer/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
@@ -166,7 +166,7 @@ uptr LibbacktraceSymbolizer::SymbolizeCode(uptr addr, AddressInfo *frames,
}
bool LibbacktraceSymbolizer::SymbolizeData(DataInfo *info) {
- backtrace_syminfo((backtrace_state *)state_, info->address,
+ backtrace_syminfo((backtrace_state *)state_, info->start,
SymbolizeDataCallback, ErrorCallback, info);
return true;
}
diff --git a/libsanitizer/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc b/libsanitizer/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
index 4f30225a4c8..ccd2d70f0f0 100644
--- a/libsanitizer/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
@@ -339,12 +339,19 @@ class LLVMSymbolizerProcess : public SymbolizerProcess {
const char* const kSymbolizerArch = "--default-arch=x86_64";
#elif defined(__i386__)
const char* const kSymbolizerArch = "--default-arch=i386";
-#elif defined(__powerpc64__)
+#elif defined(__powerpc64__) && defined(__BIG_ENDIAN__)
const char* const kSymbolizerArch = "--default-arch=powerpc64";
+#elif defined(__powerpc64__) && defined(__LITTLE_ENDIAN__)
+ const char* const kSymbolizerArch = "--default-arch=powerpc64le";
#else
const char* const kSymbolizerArch = "--default-arch=unknown";
#endif
- execl(path_to_binary, path_to_binary, kSymbolizerArch, (char *)0);
+
+ const char *const inline_flag = common_flags()->symbolize_inline_frames
+ ? "--inlining=true"
+ : "--inlining=false";
+ execl(path_to_binary, path_to_binary, inline_flag, kSymbolizerArch,
+ (char *)0);
}
};
@@ -580,8 +587,7 @@ class POSIXSymbolizer : public Symbolizer {
return false;
const char *module_name = module->full_name();
uptr module_offset = addr - module->base_address();
- internal_memset(info, 0, sizeof(*info));
- info->address = addr;
+ info->Clear();
info->module = internal_strdup(module_name);
info->module_offset = module_offset;
// First, try to use libbacktrace symbolizer (if it's available).
diff --git a/libsanitizer/sanitizer_common/sanitizer_unwind_posix_libcdep.cc b/libsanitizer/sanitizer_common/sanitizer_unwind_posix_libcdep.cc
index c49113e1d0b..b2ca931e9d9 100644
--- a/libsanitizer/sanitizer_common/sanitizer_unwind_posix_libcdep.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_unwind_posix_libcdep.cc
@@ -93,7 +93,7 @@ uptr Unwind_GetIP(struct _Unwind_Context *ctx) {
}
struct UnwindTraceArg {
- StackTrace *stack;
+ BufferedStackTrace *stack;
uptr max_depth;
};
@@ -101,27 +101,27 @@ _Unwind_Reason_Code Unwind_Trace(struct _Unwind_Context *ctx, void *param) {
UnwindTraceArg *arg = (UnwindTraceArg*)param;
CHECK_LT(arg->stack->size, arg->max_depth);
uptr pc = Unwind_GetIP(ctx);
- arg->stack->trace[arg->stack->size++] = pc;
+ arg->stack->trace_buffer[arg->stack->size++] = pc;
if (arg->stack->size == arg->max_depth) return UNWIND_STOP;
return UNWIND_CONTINUE;
}
-void StackTrace::SlowUnwindStack(uptr pc, uptr max_depth) {
+void BufferedStackTrace::SlowUnwindStack(uptr pc, uptr max_depth) {
CHECK_GE(max_depth, 2);
size = 0;
UnwindTraceArg arg = {this, Min(max_depth + 1, kStackTraceMax)};
_Unwind_Backtrace(Unwind_Trace, &arg);
// We need to pop a few frames so that pc is on top.
uptr to_pop = LocatePcInTrace(pc);
- // trace[0] belongs to the current function so we always pop it.
- if (to_pop == 0)
+ // trace_buffer[0] belongs to the current function so we always pop it.
+ if (to_pop == 0 && size > 1)
to_pop = 1;
PopStackFrames(to_pop);
- trace[0] = pc;
+ trace_buffer[0] = pc;
}
-void StackTrace::SlowUnwindStackWithContext(uptr pc, void *context,
- uptr max_depth) {
+void BufferedStackTrace::SlowUnwindStackWithContext(uptr pc, void *context,
+ uptr max_depth) {
CHECK_GE(max_depth, 2);
if (!unwind_backtrace_signal_arch) {
SlowUnwindStack(pc, max_depth);
@@ -143,7 +143,7 @@ void StackTrace::SlowUnwindStackWithContext(uptr pc, void *context,
// +2 compensate for libcorkscrew unwinder returning addresses of call
// instructions instead of raw return addresses.
for (sptr i = 0; i < res; ++i)
- trace[size++] = frames[i].absolute_pc + 2;
+ trace_buffer[size++] = frames[i].absolute_pc + 2;
}
} // namespace __sanitizer
diff --git a/libsanitizer/sanitizer_common/sanitizer_win.cc b/libsanitizer/sanitizer_common/sanitizer_win.cc
index 9f24510dbd0..fbccef19cb1 100644
--- a/libsanitizer/sanitizer_common/sanitizer_win.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_win.cc
@@ -442,7 +442,7 @@ void GetThreadStackAndTls(bool main, uptr *stk_addr, uptr *stk_size,
}
#if !SANITIZER_GO
-void StackTrace::SlowUnwindStack(uptr pc, uptr max_depth) {
+void BufferedStackTrace::SlowUnwindStack(uptr pc, uptr max_depth) {
CHECK_GE(max_depth, 2);
// FIXME: CaptureStackBackTrace might be too slow for us.
// FIXME: Compare with StackWalk64.
@@ -457,8 +457,8 @@ void StackTrace::SlowUnwindStack(uptr pc, uptr max_depth) {
PopStackFrames(pc_location);
}
-void StackTrace::SlowUnwindStackWithContext(uptr pc, void *context,
- uptr max_depth) {
+void BufferedStackTrace::SlowUnwindStackWithContext(uptr pc, void *context,
+ uptr max_depth) {
CONTEXT ctx = *(CONTEXT *)context;
STACKFRAME64 stack_frame;
memset(&stack_frame, 0, sizeof(stack_frame));
@@ -481,7 +481,7 @@ void StackTrace::SlowUnwindStackWithContext(uptr pc, void *context,
&stack_frame, &ctx, NULL, &SymFunctionTableAccess64,
&SymGetModuleBase64, NULL) &&
size < Min(max_depth, kStackTraceMax)) {
- trace[size++] = (uptr)stack_frame.AddrPC.Offset;
+ trace_buffer[size++] = (uptr)stack_frame.AddrPC.Offset;
}
}
#endif // #if !SANITIZER_GO
diff --git a/libsanitizer/tsan/Makefile.am b/libsanitizer/tsan/Makefile.am
index ab4748e0878..c5325905154 100644
--- a/libsanitizer/tsan/Makefile.am
+++ b/libsanitizer/tsan/Makefile.am
@@ -6,6 +6,7 @@ gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
DEFS = -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros
AM_CXXFLAGS += $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
+AM_CXXFLAGS += -std=gnu++11
ACLOCAL_AMFLAGS = -I m4
toolexeclib_LTLIBRARIES = libtsan.la
diff --git a/libsanitizer/tsan/Makefile.in b/libsanitizer/tsan/Makefile.in
index c6f1ecffa75..93ffc9e82dc 100644
--- a/libsanitizer/tsan/Makefile.in
+++ b/libsanitizer/tsan/Makefile.in
@@ -276,7 +276,8 @@ gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic \
-Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti \
-fomit-frame-pointer -funwind-tables -fvisibility=hidden \
- -Wno-variadic-macros $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
+ -Wno-variadic-macros $(LIBSTDCXX_RAW_CXX_CXXFLAGS) \
+ -std=gnu++11
ACLOCAL_AMFLAGS = -I m4
toolexeclib_LTLIBRARIES = libtsan.la
tsan_files = \
diff --git a/libsanitizer/tsan/tsan_defs.h b/libsanitizer/tsan/tsan_defs.h
index a8528cbb44a..076de73c9be 100644
--- a/libsanitizer/tsan/tsan_defs.h
+++ b/libsanitizer/tsan/tsan_defs.h
@@ -41,7 +41,6 @@ const unsigned kMaxTidInClock = kMaxTid * 2; // This includes msb 'freed' bit.
const int kClkBits = 42;
const unsigned kMaxTidReuse = (1 << (64 - kClkBits)) - 1;
const uptr kShadowStackSize = 64 * 1024;
-const uptr kTraceStackSize = 256;
#ifdef TSAN_SHADOW_COUNT
# if TSAN_SHADOW_COUNT == 2 \
@@ -172,7 +171,6 @@ struct Context;
struct ReportStack;
class ReportDesc;
class RegionAlloc;
-class StackTrace;
// Descriptor of user's memory block.
struct MBlock {
diff --git a/libsanitizer/tsan/tsan_fd.cc b/libsanitizer/tsan/tsan_fd.cc
index a74a668c13b..10582035f24 100644
--- a/libsanitizer/tsan/tsan_fd.cc
+++ b/libsanitizer/tsan/tsan_fd.cc
@@ -46,7 +46,8 @@ static bool bogusfd(int fd) {
}
static FdSync *allocsync(ThreadState *thr, uptr pc) {
- FdSync *s = (FdSync*)user_alloc(thr, pc, sizeof(FdSync));
+ FdSync *s = (FdSync*)user_alloc(thr, pc, sizeof(FdSync), kDefaultAlignment,
+ false);
atomic_store(&s->rc, 1, memory_order_relaxed);
return s;
}
@@ -63,7 +64,7 @@ static void unref(ThreadState *thr, uptr pc, FdSync *s) {
CHECK_NE(s, &fdctx.globsync);
CHECK_NE(s, &fdctx.filesync);
CHECK_NE(s, &fdctx.socksync);
- user_free(thr, pc, s);
+ user_free(thr, pc, s, false);
}
}
}
@@ -76,13 +77,13 @@ static FdDesc *fddesc(ThreadState *thr, uptr pc, int fd) {
if (l1 == 0) {
uptr size = kTableSizeL2 * sizeof(FdDesc);
// We need this to reside in user memory to properly catch races on it.
- void *p = user_alloc(thr, pc, size);
+ void *p = user_alloc(thr, pc, size, kDefaultAlignment, false);
internal_memset(p, 0, size);
MemoryResetRange(thr, (uptr)&fddesc, (uptr)p, size);
if (atomic_compare_exchange_strong(pl1, &l1, (uptr)p, memory_order_acq_rel))
l1 = (uptr)p;
else
- user_free(thr, pc, p);
+ user_free(thr, pc, p, false);
}
return &((FdDesc*)l1)[fd % kTableSizeL2]; // NOLINT
}
diff --git a/libsanitizer/tsan/tsan_flags.cc b/libsanitizer/tsan/tsan_flags.cc
index 02bf6527e6a..6059f2771ba 100644
--- a/libsanitizer/tsan/tsan_flags.cc
+++ b/libsanitizer/tsan/tsan_flags.cc
@@ -97,6 +97,7 @@ void InitializeFlags(Flags *f, const char *env) {
cf->allow_addr2line = true;
cf->detect_deadlocks = true;
cf->print_suppressions = false;
+ cf->stack_trace_format = " #%n %f %S %M";
// Let a frontend override.
ParseFlags(f, __tsan_default_options());
diff --git a/libsanitizer/tsan/tsan_interceptors.cc b/libsanitizer/tsan/tsan_interceptors.cc
index b49622b3ad4..7f1b6e45a8d 100644
--- a/libsanitizer/tsan/tsan_interceptors.cc
+++ b/libsanitizer/tsan/tsan_interceptors.cc
@@ -27,6 +27,16 @@
using namespace __tsan; // NOLINT
+#if SANITIZER_FREEBSD
+#define __errno_location __error
+#define __libc_malloc __malloc
+#define __libc_realloc __realloc
+#define __libc_calloc __calloc
+#define __libc_free __free
+#define stdout __stdoutp
+#define stderr __stderrp
+#endif
+
const int kSigCount = 65;
struct my_siginfo_t {
@@ -60,7 +70,9 @@ extern "C" void *__libc_malloc(uptr size);
extern "C" void *__libc_calloc(uptr size, uptr n);
extern "C" void *__libc_realloc(void *ptr, uptr size);
extern "C" void __libc_free(void *ptr);
+#if !SANITIZER_FREEBSD
extern "C" int mallopt(int param, int value);
+#endif
extern __sanitizer_FILE *stdout, *stderr;
const int PTHREAD_MUTEX_RECURSIVE = 1;
const int PTHREAD_MUTEX_RECURSIVE_NP = 1;
@@ -91,19 +103,19 @@ typedef void (*sighandler_t)(int sig);
#define errno (*__errno_location())
-// 16K loaded modules should be enough for everyone.
-static const uptr kMaxModules = 1 << 14;
-static LoadedModule *modules;
-static uptr nmodules;
-
struct sigaction_t {
union {
sighandler_t sa_handler;
void (*sa_sigaction)(int sig, my_siginfo_t *siginfo, void *uctx);
};
+#if SANITIZER_FREEBSD
+ int sa_flags;
+ __sanitizer_sigset_t sa_mask;
+#else
__sanitizer_sigset_t sa_mask;
int sa_flags;
void (*sa_restorer)();
+#endif
};
const sighandler_t SIG_DFL = (sighandler_t)0;
@@ -202,7 +214,7 @@ ScopedInterceptor::~ScopedInterceptor() {
ThreadState *thr = cur_thread(); \
const uptr caller_pc = GET_CALLER_PC(); \
ScopedInterceptor si(thr, #func, caller_pc); \
- const uptr pc = __sanitizer::StackTrace::GetCurrentPc(); \
+ const uptr pc = StackTrace::GetCurrentPc(); \
(void)pc; \
/**/
@@ -218,7 +230,11 @@ ScopedInterceptor::~ScopedInterceptor() {
#define TSAN_INTERCEPTOR(ret, func, ...) INTERCEPTOR(ret, func, __VA_ARGS__)
#define TSAN_INTERCEPT(func) INTERCEPT_FUNCTION(func)
-#define TSAN_INTERCEPT_VER(func, ver) INTERCEPT_FUNCTION_VER(func, ver)
+#if SANITIZER_FREEBSD
+# define TSAN_INTERCEPT_VER(func, ver) INTERCEPT_FUNCTION(func)
+#else
+# define TSAN_INTERCEPT_VER(func, ver) INTERCEPT_FUNCTION_VER(func, ver)
+#endif
#define BLOCK_REAL(name) (BlockingCall(thr), REAL(name))
@@ -271,63 +287,24 @@ TSAN_INTERCEPTOR(int, nanosleep, void *req, void *rem) {
return res;
}
-class AtExitContext {
- public:
- AtExitContext()
- : mtx_(MutexTypeAtExit, StatMtxAtExit)
- , stack_(MBlockAtExit) {
- }
-
- typedef void(*atexit_cb_t)();
-
- int atexit(ThreadState *thr, uptr pc, bool is_on_exit,
- atexit_cb_t f, void *arg, void *dso) {
- Lock l(&mtx_);
- Release(thr, pc, (uptr)this);
- atexit_t *a = stack_.PushBack();
- a->cb = f;
- a->arg = arg;
- a->dso = dso;
- a->is_on_exit = is_on_exit;
- return 0;
- }
-
- void exit(ThreadState *thr, uptr pc) {
- for (;;) {
- atexit_t a = {};
- {
- Lock l(&mtx_);
- if (stack_.Size() != 0) {
- a = stack_[stack_.Size() - 1];
- stack_.PopBack();
- Acquire(thr, pc, (uptr)this);
- }
- }
- if (a.cb == 0)
- break;
- VPrintf(2, "#%d: executing atexit func %p(%p) dso=%p\n",
- thr->tid, a.cb, a.arg, a.dso);
- if (a.is_on_exit)
- ((void(*)(int status, void *arg))a.cb)(0, a.arg);
- else
- ((void(*)(void *arg, void *dso))a.cb)(a.arg, a.dso);
- }
- }
-
- private:
- struct atexit_t {
- atexit_cb_t cb;
- void *arg;
- void *dso;
- bool is_on_exit;
- };
-
- static const int kMaxAtExit = 1024;
- Mutex mtx_;
- Vector<atexit_t> stack_;
+// The sole reason tsan wraps atexit callbacks is to establish synchronization
+// between callback setup and callback execution.
+struct AtExitCtx {
+ void (*f)();
+ void *arg;
};
-static AtExitContext *atexit_ctx;
+static void at_exit_wrapper(void *arg) {
+ ThreadState *thr = cur_thread();
+ uptr pc = 0;
+ Acquire(thr, pc, (uptr)arg);
+ AtExitCtx *ctx = (AtExitCtx*)arg;
+ ((void(*)(void *arg))ctx->f)(ctx->arg);
+ __libc_free(ctx);
+}
+
+static int setup_at_exit_wrapper(ThreadState *thr, uptr pc, void(*f)(),
+ void *arg, void *dso);
TSAN_INTERCEPTOR(int, atexit, void (*f)()) {
if (cur_thread()->in_symbolizer)
@@ -335,40 +312,51 @@ TSAN_INTERCEPTOR(int, atexit, void (*f)()) {
// We want to setup the atexit callback even if we are in ignored lib
// or after fork.
SCOPED_INTERCEPTOR_RAW(atexit, f);
- return atexit_ctx->atexit(thr, pc, false, (void(*)())f, 0, 0);
+ return setup_at_exit_wrapper(thr, pc, (void(*)())f, 0, 0);
}
-TSAN_INTERCEPTOR(int, on_exit, void(*f)(int, void*), void *arg) {
+TSAN_INTERCEPTOR(int, __cxa_atexit, void (*f)(void *a), void *arg, void *dso) {
if (cur_thread()->in_symbolizer)
return 0;
- SCOPED_TSAN_INTERCEPTOR(on_exit, f, arg);
- return atexit_ctx->atexit(thr, pc, true, (void(*)())f, arg, 0);
+ SCOPED_TSAN_INTERCEPTOR(__cxa_atexit, f, arg, dso);
+ return setup_at_exit_wrapper(thr, pc, (void(*)())f, arg, dso);
}
-bool IsSaticModule(void *dso) {
- if (modules == 0)
- return false;
- for (uptr i = 0; i < nmodules; i++) {
- if (modules[i].containsAddress((uptr)dso))
- return true;
- }
- return false;
+static int setup_at_exit_wrapper(ThreadState *thr, uptr pc, void(*f)(),
+ void *arg, void *dso) {
+ AtExitCtx *ctx = (AtExitCtx*)__libc_malloc(sizeof(AtExitCtx));
+ ctx->f = f;
+ ctx->arg = arg;
+ Release(thr, pc, (uptr)ctx);
+ // Memory allocation in __cxa_atexit will race with free during exit,
+ // because we do not see synchronization around atexit callback list.
+ ThreadIgnoreBegin(thr, pc);
+ int res = REAL(__cxa_atexit)(at_exit_wrapper, ctx, dso);
+ ThreadIgnoreEnd(thr, pc);
+ return res;
}
-TSAN_INTERCEPTOR(int, __cxa_atexit, void (*f)(void *a), void *arg, void *dso) {
+static void on_exit_wrapper(int status, void *arg) {
+ ThreadState *thr = cur_thread();
+ uptr pc = 0;
+ Acquire(thr, pc, (uptr)arg);
+ AtExitCtx *ctx = (AtExitCtx*)arg;
+ ((void(*)(int status, void *arg))ctx->f)(status, ctx->arg);
+ __libc_free(ctx);
+}
+
+TSAN_INTERCEPTOR(int, on_exit, void(*f)(int, void*), void *arg) {
if (cur_thread()->in_symbolizer)
return 0;
- SCOPED_TSAN_INTERCEPTOR(__cxa_atexit, f, arg, dso);
- // If it's the main executable or a statically loaded library,
- // we will call the callback.
- if (dso == 0 || IsSaticModule(dso))
- return atexit_ctx->atexit(thr, pc, false, (void(*)())f, arg, dso);
-
- // Dynamically load module, don't know when to call the callback for it.
+ SCOPED_TSAN_INTERCEPTOR(on_exit, f, arg);
+ AtExitCtx *ctx = (AtExitCtx*)__libc_malloc(sizeof(AtExitCtx));
+ ctx->f = (void(*)())f;
+ ctx->arg = arg;
+ Release(thr, pc, (uptr)ctx);
// Memory allocation in __cxa_atexit will race with free during exit,
// because we do not see synchronization around atexit callback list.
ThreadIgnoreBegin(thr, pc);
- int res = REAL(__cxa_atexit)(f, arg, dso);
+ int res = REAL(on_exit)(on_exit_wrapper, ctx);
ThreadIgnoreEnd(thr, pc);
return res;
}
@@ -406,7 +394,11 @@ static void SetJmp(ThreadState *thr, uptr sp, uptr mangled_sp) {
}
static void LongJmp(ThreadState *thr, uptr *env) {
+#if SANITIZER_FREEBSD
+ uptr mangled_sp = env[2];
+#else
uptr mangled_sp = env[6];
+#endif // SANITIZER_FREEBSD
// Find the saved buf by mangled_sp.
for (uptr i = 0; i < thr->jmp_bufs.Size(); i++) {
JmpBuf *buf = &thr->jmp_bufs[i];
@@ -751,6 +743,7 @@ TSAN_INTERCEPTOR(void*, mmap, void *addr, long_t sz, int prot,
return res;
}
+#if !SANITIZER_FREEBSD
TSAN_INTERCEPTOR(void*, mmap64, void *addr, long_t sz, int prot,
int flags, int fd, u64 off) {
SCOPED_TSAN_INTERCEPTOR(mmap64, addr, sz, prot, flags, fd, off);
@@ -764,6 +757,10 @@ TSAN_INTERCEPTOR(void*, mmap64, void *addr, long_t sz, int prot,
}
return res;
}
+#define TSAN_MAYBE_INTERCEPT_MMAP64 TSAN_INTERCEPT(mmap64)
+#else
+#define TSAN_MAYBE_INTERCEPT_MMAP64
+#endif
TSAN_INTERCEPTOR(int, munmap, void *addr, long_t sz) {
SCOPED_TSAN_INTERCEPTOR(munmap, addr, sz);
@@ -772,10 +769,15 @@ TSAN_INTERCEPTOR(int, munmap, void *addr, long_t sz) {
return res;
}
+#if !SANITIZER_FREEBSD
TSAN_INTERCEPTOR(void*, memalign, uptr align, uptr sz) {
SCOPED_INTERCEPTOR_RAW(memalign, align, sz);
return user_alloc(thr, pc, sz, align);
}
+#define TSAN_MAYBE_INTERCEPT_MEMALIGN TSAN_INTERCEPT(memalign)
+#else
+#define TSAN_MAYBE_INTERCEPT_MEMALIGN
+#endif
TSAN_INTERCEPTOR(void*, aligned_alloc, uptr align, uptr sz) {
SCOPED_INTERCEPTOR_RAW(memalign, align, sz);
@@ -787,11 +789,16 @@ TSAN_INTERCEPTOR(void*, valloc, uptr sz) {
return user_alloc(thr, pc, sz, GetPageSizeCached());
}
+#if !SANITIZER_FREEBSD
TSAN_INTERCEPTOR(void*, pvalloc, uptr sz) {
SCOPED_INTERCEPTOR_RAW(pvalloc, sz);
sz = RoundUp(sz, GetPageSizeCached());
return user_alloc(thr, pc, sz, GetPageSizeCached());
}
+#define TSAN_MAYBE_INTERCEPT_PVALLOC TSAN_INTERCEPT(pvalloc)
+#else
+#define TSAN_MAYBE_INTERCEPT_PVALLOC
+#endif
TSAN_INTERCEPTOR(int, posix_memalign, void **memptr, uptr align, uptr sz) {
SCOPED_INTERCEPTOR_RAW(posix_memalign, memptr, align, sz);
@@ -863,11 +870,13 @@ extern "C" void *__tsan_thread_start_func(void *arg) {
ThreadState *thr = cur_thread();
// Thread-local state is not initialized yet.
ScopedIgnoreInterceptors ignore;
+ ThreadIgnoreBegin(thr, 0);
if (pthread_setspecific(g_thread_finalize_key,
(void *)kPthreadDestructorIterations)) {
Printf("ThreadSanitizer: failed to set thread key\n");
Die();
}
+ ThreadIgnoreEnd(thr, 0);
while ((tid = atomic_load(&p->tid, memory_order_acquire)) == 0)
pthread_yield();
atomic_store(&p->tid, 0, memory_order_release);
@@ -1336,73 +1345,135 @@ TSAN_INTERCEPTOR(int, sem_getvalue, void *s, int *sval) {
return res;
}
+#if !SANITIZER_FREEBSD
TSAN_INTERCEPTOR(int, __xstat, int version, const char *path, void *buf) {
SCOPED_TSAN_INTERCEPTOR(__xstat, version, path, buf);
return REAL(__xstat)(version, path, buf);
}
+#define TSAN_MAYBE_INTERCEPT___XSTAT TSAN_INTERCEPT(__xstat)
+#else
+#define TSAN_MAYBE_INTERCEPT___XSTAT
+#endif
TSAN_INTERCEPTOR(int, stat, const char *path, void *buf) {
+#if SANITIZER_FREEBSD
+ SCOPED_TSAN_INTERCEPTOR(stat, path, buf);
+ return REAL(stat)(path, buf);
+#else
SCOPED_TSAN_INTERCEPTOR(__xstat, 0, path, buf);
return REAL(__xstat)(0, path, buf);
+#endif
}
+#if !SANITIZER_FREEBSD
TSAN_INTERCEPTOR(int, __xstat64, int version, const char *path, void *buf) {
SCOPED_TSAN_INTERCEPTOR(__xstat64, version, path, buf);
return REAL(__xstat64)(version, path, buf);
}
+#define TSAN_MAYBE_INTERCEPT___XSTAT64 TSAN_INTERCEPT(__xstat64)
+#else
+#define TSAN_MAYBE_INTERCEPT___XSTAT64
+#endif
+#if !SANITIZER_FREEBSD
TSAN_INTERCEPTOR(int, stat64, const char *path, void *buf) {
SCOPED_TSAN_INTERCEPTOR(__xstat64, 0, path, buf);
return REAL(__xstat64)(0, path, buf);
}
+#define TSAN_MAYBE_INTERCEPT_STAT64 TSAN_INTERCEPT(stat64)
+#else
+#define TSAN_MAYBE_INTERCEPT_STAT64
+#endif
+#if !SANITIZER_FREEBSD
TSAN_INTERCEPTOR(int, __lxstat, int version, const char *path, void *buf) {
SCOPED_TSAN_INTERCEPTOR(__lxstat, version, path, buf);
return REAL(__lxstat)(version, path, buf);
}
+#define TSAN_MAYBE_INTERCEPT___LXSTAT TSAN_INTERCEPT(__lxstat)
+#else
+#define TSAN_MAYBE_INTERCEPT___LXSTAT
+#endif
TSAN_INTERCEPTOR(int, lstat, const char *path, void *buf) {
+#if SANITIZER_FREEBSD
+ SCOPED_TSAN_INTERCEPTOR(lstat, path, buf);
+ return REAL(lstat)(path, buf);
+#else
SCOPED_TSAN_INTERCEPTOR(__lxstat, 0, path, buf);
return REAL(__lxstat)(0, path, buf);
+#endif
}
+#if !SANITIZER_FREEBSD
TSAN_INTERCEPTOR(int, __lxstat64, int version, const char *path, void *buf) {
SCOPED_TSAN_INTERCEPTOR(__lxstat64, version, path, buf);
return REAL(__lxstat64)(version, path, buf);
}
+#define TSAN_MAYBE_INTERCEPT___LXSTAT64 TSAN_INTERCEPT(__lxstat64)
+#else
+#define TSAN_MAYBE_INTERCEPT___LXSTAT64
+#endif
+#if !SANITIZER_FREEBSD
TSAN_INTERCEPTOR(int, lstat64, const char *path, void *buf) {
SCOPED_TSAN_INTERCEPTOR(__lxstat64, 0, path, buf);
return REAL(__lxstat64)(0, path, buf);
}
+#define TSAN_MAYBE_INTERCEPT_LSTAT64 TSAN_INTERCEPT(lstat64)
+#else
+#define TSAN_MAYBE_INTERCEPT_LSTAT64
+#endif
+#if !SANITIZER_FREEBSD
TSAN_INTERCEPTOR(int, __fxstat, int version, int fd, void *buf) {
SCOPED_TSAN_INTERCEPTOR(__fxstat, version, fd, buf);
if (fd > 0)
FdAccess(thr, pc, fd);
return REAL(__fxstat)(version, fd, buf);
}
+#define TSAN_MAYBE_INTERCEPT___FXSTAT TSAN_INTERCEPT(__fxstat)
+#else
+#define TSAN_MAYBE_INTERCEPT___FXSTAT
+#endif
TSAN_INTERCEPTOR(int, fstat, int fd, void *buf) {
+#if SANITIZER_FREEBSD
+ SCOPED_TSAN_INTERCEPTOR(fstat, fd, buf);
+ if (fd > 0)
+ FdAccess(thr, pc, fd);
+ return REAL(fstat)(fd, buf);
+#else
SCOPED_TSAN_INTERCEPTOR(__fxstat, 0, fd, buf);
if (fd > 0)
FdAccess(thr, pc, fd);
return REAL(__fxstat)(0, fd, buf);
+#endif
}
+#if !SANITIZER_FREEBSD
TSAN_INTERCEPTOR(int, __fxstat64, int version, int fd, void *buf) {
SCOPED_TSAN_INTERCEPTOR(__fxstat64, version, fd, buf);
if (fd > 0)
FdAccess(thr, pc, fd);
return REAL(__fxstat64)(version, fd, buf);
}
+#define TSAN_MAYBE_INTERCEPT___FXSTAT64 TSAN_INTERCEPT(__fxstat64)
+#else
+#define TSAN_MAYBE_INTERCEPT___FXSTAT64
+#endif
+#if !SANITIZER_FREEBSD
TSAN_INTERCEPTOR(int, fstat64, int fd, void *buf) {
SCOPED_TSAN_INTERCEPTOR(__fxstat64, 0, fd, buf);
if (fd > 0)
FdAccess(thr, pc, fd);
return REAL(__fxstat64)(0, fd, buf);
}
+#define TSAN_MAYBE_INTERCEPT_FSTAT64 TSAN_INTERCEPT(fstat64)
+#else
+#define TSAN_MAYBE_INTERCEPT_FSTAT64
+#endif
TSAN_INTERCEPTOR(int, open, const char *name, int flags, int mode) {
SCOPED_TSAN_INTERCEPTOR(open, name, flags, mode);
@@ -1412,6 +1483,7 @@ TSAN_INTERCEPTOR(int, open, const char *name, int flags, int mode) {
return fd;
}
+#if !SANITIZER_FREEBSD
TSAN_INTERCEPTOR(int, open64, const char *name, int flags, int mode) {
SCOPED_TSAN_INTERCEPTOR(open64, name, flags, mode);
int fd = REAL(open64)(name, flags, mode);
@@ -1419,6 +1491,10 @@ TSAN_INTERCEPTOR(int, open64, const char *name, int flags, int mode) {
FdFileCreate(thr, pc, fd);
return fd;
}
+#define TSAN_MAYBE_INTERCEPT_OPEN64 TSAN_INTERCEPT(open64)
+#else
+#define TSAN_MAYBE_INTERCEPT_OPEN64
+#endif
TSAN_INTERCEPTOR(int, creat, const char *name, int mode) {
SCOPED_TSAN_INTERCEPTOR(creat, name, mode);
@@ -1428,6 +1504,7 @@ TSAN_INTERCEPTOR(int, creat, const char *name, int mode) {
return fd;
}
+#if !SANITIZER_FREEBSD
TSAN_INTERCEPTOR(int, creat64, const char *name, int mode) {
SCOPED_TSAN_INTERCEPTOR(creat64, name, mode);
int fd = REAL(creat64)(name, mode);
@@ -1435,6 +1512,10 @@ TSAN_INTERCEPTOR(int, creat64, const char *name, int mode) {
FdFileCreate(thr, pc, fd);
return fd;
}
+#define TSAN_MAYBE_INTERCEPT_CREAT64 TSAN_INTERCEPT(creat64)
+#else
+#define TSAN_MAYBE_INTERCEPT_CREAT64
+#endif
TSAN_INTERCEPTOR(int, dup, int oldfd) {
SCOPED_TSAN_INTERCEPTOR(dup, oldfd);
@@ -1460,6 +1541,7 @@ TSAN_INTERCEPTOR(int, dup3, int oldfd, int newfd, int flags) {
return newfd2;
}
+#if !SANITIZER_FREEBSD
TSAN_INTERCEPTOR(int, eventfd, unsigned initval, int flags) {
SCOPED_TSAN_INTERCEPTOR(eventfd, initval, flags);
int fd = REAL(eventfd)(initval, flags);
@@ -1467,7 +1549,12 @@ TSAN_INTERCEPTOR(int, eventfd, unsigned initval, int flags) {
FdEventCreate(thr, pc, fd);
return fd;
}
+#define TSAN_MAYBE_INTERCEPT_EVENTFD TSAN_INTERCEPT(eventfd)
+#else
+#define TSAN_MAYBE_INTERCEPT_EVENTFD
+#endif
+#if !SANITIZER_FREEBSD
TSAN_INTERCEPTOR(int, signalfd, int fd, void *mask, int flags) {
SCOPED_TSAN_INTERCEPTOR(signalfd, fd, mask, flags);
if (fd >= 0)
@@ -1477,7 +1564,12 @@ TSAN_INTERCEPTOR(int, signalfd, int fd, void *mask, int flags) {
FdSignalCreate(thr, pc, fd);
return fd;
}
+#define TSAN_MAYBE_INTERCEPT_SIGNALFD TSAN_INTERCEPT(signalfd)
+#else
+#define TSAN_MAYBE_INTERCEPT_SIGNALFD
+#endif
+#if !SANITIZER_FREEBSD
TSAN_INTERCEPTOR(int, inotify_init, int fake) {
SCOPED_TSAN_INTERCEPTOR(inotify_init, fake);
int fd = REAL(inotify_init)(fake);
@@ -1485,7 +1577,12 @@ TSAN_INTERCEPTOR(int, inotify_init, int fake) {
FdInotifyCreate(thr, pc, fd);
return fd;
}
+#define TSAN_MAYBE_INTERCEPT_INOTIFY_INIT TSAN_INTERCEPT(inotify_init)
+#else
+#define TSAN_MAYBE_INTERCEPT_INOTIFY_INIT
+#endif
+#if !SANITIZER_FREEBSD
TSAN_INTERCEPTOR(int, inotify_init1, int flags) {
SCOPED_TSAN_INTERCEPTOR(inotify_init1, flags);
int fd = REAL(inotify_init1)(flags);
@@ -1493,6 +1590,10 @@ TSAN_INTERCEPTOR(int, inotify_init1, int flags) {
FdInotifyCreate(thr, pc, fd);
return fd;
}
+#define TSAN_MAYBE_INTERCEPT_INOTIFY_INIT1 TSAN_INTERCEPT(inotify_init1)
+#else
+#define TSAN_MAYBE_INTERCEPT_INOTIFY_INIT1
+#endif
TSAN_INTERCEPTOR(int, socket, int domain, int type, int protocol) {
SCOPED_TSAN_INTERCEPTOR(socket, domain, type, protocol);
@@ -1535,6 +1636,7 @@ TSAN_INTERCEPTOR(int, listen, int fd, int backlog) {
return res;
}
+#if !SANITIZER_FREEBSD
TSAN_INTERCEPTOR(int, epoll_create, int size) {
SCOPED_TSAN_INTERCEPTOR(epoll_create, size);
int fd = REAL(epoll_create)(size);
@@ -1542,7 +1644,12 @@ TSAN_INTERCEPTOR(int, epoll_create, int size) {
FdPollCreate(thr, pc, fd);
return fd;
}
+#define TSAN_MAYBE_INTERCEPT_EPOLL_CREATE TSAN_INTERCEPT(epoll_create)
+#else
+#define TSAN_MAYBE_INTERCEPT_EPOLL_CREATE
+#endif
+#if !SANITIZER_FREEBSD
TSAN_INTERCEPTOR(int, epoll_create1, int flags) {
SCOPED_TSAN_INTERCEPTOR(epoll_create1, flags);
int fd = REAL(epoll_create1)(flags);
@@ -1550,6 +1657,10 @@ TSAN_INTERCEPTOR(int, epoll_create1, int flags) {
FdPollCreate(thr, pc, fd);
return fd;
}
+#define TSAN_MAYBE_INTERCEPT_EPOLL_CREATE1 TSAN_INTERCEPT(epoll_create1)
+#else
+#define TSAN_MAYBE_INTERCEPT_EPOLL_CREATE1
+#endif
TSAN_INTERCEPTOR(int, close, int fd) {
SCOPED_TSAN_INTERCEPTOR(close, fd);
@@ -1558,14 +1669,20 @@ TSAN_INTERCEPTOR(int, close, int fd) {
return REAL(close)(fd);
}
+#if !SANITIZER_FREEBSD
TSAN_INTERCEPTOR(int, __close, int fd) {
SCOPED_TSAN_INTERCEPTOR(__close, fd);
if (fd >= 0)
FdClose(thr, pc, fd);
return REAL(__close)(fd);
}
+#define TSAN_MAYBE_INTERCEPT___CLOSE TSAN_INTERCEPT(__close)
+#else
+#define TSAN_MAYBE_INTERCEPT___CLOSE
+#endif
// glibc guts
+#if !SANITIZER_FREEBSD
TSAN_INTERCEPTOR(void, __res_iclose, void *state, bool free_addr) {
SCOPED_TSAN_INTERCEPTOR(__res_iclose, state, free_addr);
int fds[64];
@@ -1576,6 +1693,10 @@ TSAN_INTERCEPTOR(void, __res_iclose, void *state, bool free_addr) {
}
REAL(__res_iclose)(state, free_addr);
}
+#define TSAN_MAYBE_INTERCEPT___RES_ICLOSE TSAN_INTERCEPT(__res_iclose)
+#else
+#define TSAN_MAYBE_INTERCEPT___RES_ICLOSE
+#endif
TSAN_INTERCEPTOR(int, pipe, int *pipefd) {
SCOPED_TSAN_INTERCEPTOR(pipe, pipefd);
@@ -1642,6 +1763,7 @@ TSAN_INTERCEPTOR(void*, tmpfile, int fake) {
return res;
}
+#if !SANITIZER_FREEBSD
TSAN_INTERCEPTOR(void*, tmpfile64, int fake) {
SCOPED_TSAN_INTERCEPTOR(tmpfile64, fake);
void *res = REAL(tmpfile64)(fake);
@@ -1652,6 +1774,10 @@ TSAN_INTERCEPTOR(void*, tmpfile64, int fake) {
}
return res;
}
+#define TSAN_MAYBE_INTERCEPT_TMPFILE64 TSAN_INTERCEPT(tmpfile64)
+#else
+#define TSAN_MAYBE_INTERCEPT_TMPFILE64
+#endif
TSAN_INTERCEPTOR(uptr, fread, void *ptr, uptr size, uptr nmemb, void *f) {
// libc file streams can call user-supplied functions, see fopencookie.
@@ -1698,6 +1824,7 @@ TSAN_INTERCEPTOR(void*, opendir, char *path) {
return res;
}
+#if !SANITIZER_FREEBSD
TSAN_INTERCEPTOR(int, epoll_ctl, int epfd, int op, int fd, void *ev) {
SCOPED_TSAN_INTERCEPTOR(epoll_ctl, epfd, op, fd, ev);
if (epfd >= 0)
@@ -1709,7 +1836,12 @@ TSAN_INTERCEPTOR(int, epoll_ctl, int epfd, int op, int fd, void *ev) {
int res = REAL(epoll_ctl)(epfd, op, fd, ev);
return res;
}
+#define TSAN_MAYBE_INTERCEPT_EPOLL_CTL TSAN_INTERCEPT(epoll_ctl)
+#else
+#define TSAN_MAYBE_INTERCEPT_EPOLL_CTL
+#endif
+#if !SANITIZER_FREEBSD
TSAN_INTERCEPTOR(int, epoll_wait, int epfd, void *ev, int cnt, int timeout) {
SCOPED_TSAN_INTERCEPTOR(epoll_wait, epfd, ev, cnt, timeout);
if (epfd >= 0)
@@ -1719,6 +1851,10 @@ TSAN_INTERCEPTOR(int, epoll_wait, int epfd, void *ev, int cnt, int timeout) {
FdAcquire(thr, pc, epfd);
return res;
}
+#define TSAN_MAYBE_INTERCEPT_EPOLL_WAIT TSAN_INTERCEPT(epoll_wait)
+#else
+#define TSAN_MAYBE_INTERCEPT_EPOLL_WAIT
+#endif
namespace __tsan {
@@ -1746,12 +1882,12 @@ static void CallUserSignalHandler(ThreadState *thr, bool sync, bool acquire,
// from rtl_generic_sighandler) we have not yet received the reraised
// signal; and it looks too fragile to intercept all ways to reraise a signal.
if (flags()->report_bugs && !sync && sig != SIGTERM && errno != 99) {
- __tsan::StackTrace stack;
- stack.ObtainCurrent(thr, pc);
+ VarSizeStackTrace stack;
+ ObtainCurrentStack(thr, pc, &stack);
ThreadRegistryLock l(ctx->thread_registry);
ScopedReport rep(ReportTypeErrnoInSignal);
if (!IsFiredSuppression(ctx, rep, stack)) {
- rep.AddStack(&stack, true);
+ rep.AddStack(stack, true);
OutputReport(thr, rep);
}
}
@@ -2226,8 +2362,6 @@ namespace __tsan {
static void finalize(void *arg) {
ThreadState *thr = cur_thread();
- uptr pc = 0;
- atexit_ctx->exit(thr, pc);
int status = Finalize(thr);
// Make sure the output is not lost.
// Flushing all the streams here may freeze the process if a child thread is
@@ -2250,8 +2384,10 @@ void InitializeInterceptors() {
REAL(memcmp) = internal_memcmp;
// Instruct libc malloc to consume less memory.
+#if !SANITIZER_FREEBSD
mallopt(1, 0); // M_MXFAST
mallopt(-3, 32*1024); // M_MMAP_THRESHOLD
+#endif
InitializeCommonInterceptors();
@@ -2273,11 +2409,11 @@ void InitializeInterceptors() {
TSAN_INTERCEPT(free);
TSAN_INTERCEPT(cfree);
TSAN_INTERCEPT(mmap);
- TSAN_INTERCEPT(mmap64);
+ TSAN_MAYBE_INTERCEPT_MMAP64;
TSAN_INTERCEPT(munmap);
- TSAN_INTERCEPT(memalign);
+ TSAN_MAYBE_INTERCEPT_MEMALIGN;
TSAN_INTERCEPT(valloc);
- TSAN_INTERCEPT(pvalloc);
+ TSAN_MAYBE_INTERCEPT_PVALLOC;
TSAN_INTERCEPT(posix_memalign);
TSAN_INTERCEPT(strlen);
@@ -2340,38 +2476,38 @@ void InitializeInterceptors() {
TSAN_INTERCEPT(sem_getvalue);
TSAN_INTERCEPT(stat);
- TSAN_INTERCEPT(__xstat);
- TSAN_INTERCEPT(stat64);
- TSAN_INTERCEPT(__xstat64);
+ TSAN_MAYBE_INTERCEPT___XSTAT;
+ TSAN_MAYBE_INTERCEPT_STAT64;
+ TSAN_MAYBE_INTERCEPT___XSTAT64;
TSAN_INTERCEPT(lstat);
- TSAN_INTERCEPT(__lxstat);
- TSAN_INTERCEPT(lstat64);
- TSAN_INTERCEPT(__lxstat64);
+ TSAN_MAYBE_INTERCEPT___LXSTAT;
+ TSAN_MAYBE_INTERCEPT_LSTAT64;
+ TSAN_MAYBE_INTERCEPT___LXSTAT64;
TSAN_INTERCEPT(fstat);
- TSAN_INTERCEPT(__fxstat);
- TSAN_INTERCEPT(fstat64);
- TSAN_INTERCEPT(__fxstat64);
+ TSAN_MAYBE_INTERCEPT___FXSTAT;
+ TSAN_MAYBE_INTERCEPT_FSTAT64;
+ TSAN_MAYBE_INTERCEPT___FXSTAT64;
TSAN_INTERCEPT(open);
- TSAN_INTERCEPT(open64);
+ TSAN_MAYBE_INTERCEPT_OPEN64;
TSAN_INTERCEPT(creat);
- TSAN_INTERCEPT(creat64);
+ TSAN_MAYBE_INTERCEPT_CREAT64;
TSAN_INTERCEPT(dup);
TSAN_INTERCEPT(dup2);
TSAN_INTERCEPT(dup3);
- TSAN_INTERCEPT(eventfd);
- TSAN_INTERCEPT(signalfd);
- TSAN_INTERCEPT(inotify_init);
- TSAN_INTERCEPT(inotify_init1);
+ TSAN_MAYBE_INTERCEPT_EVENTFD;
+ TSAN_MAYBE_INTERCEPT_SIGNALFD;
+ TSAN_MAYBE_INTERCEPT_INOTIFY_INIT;
+ TSAN_MAYBE_INTERCEPT_INOTIFY_INIT1;
TSAN_INTERCEPT(socket);
TSAN_INTERCEPT(socketpair);
TSAN_INTERCEPT(connect);
TSAN_INTERCEPT(bind);
TSAN_INTERCEPT(listen);
- TSAN_INTERCEPT(epoll_create);
- TSAN_INTERCEPT(epoll_create1);
+ TSAN_MAYBE_INTERCEPT_EPOLL_CREATE;
+ TSAN_MAYBE_INTERCEPT_EPOLL_CREATE1;
TSAN_INTERCEPT(close);
- TSAN_INTERCEPT(__close);
- TSAN_INTERCEPT(__res_iclose);
+ TSAN_MAYBE_INTERCEPT___CLOSE;
+ TSAN_MAYBE_INTERCEPT___RES_ICLOSE;
TSAN_INTERCEPT(pipe);
TSAN_INTERCEPT(pipe2);
@@ -2381,7 +2517,7 @@ void InitializeInterceptors() {
TSAN_INTERCEPT(unlink);
TSAN_INTERCEPT(tmpfile);
- TSAN_INTERCEPT(tmpfile64);
+ TSAN_MAYBE_INTERCEPT_TMPFILE64;
TSAN_INTERCEPT(fread);
TSAN_INTERCEPT(fwrite);
TSAN_INTERCEPT(abort);
@@ -2389,8 +2525,8 @@ void InitializeInterceptors() {
TSAN_INTERCEPT(rmdir);
TSAN_INTERCEPT(opendir);
- TSAN_INTERCEPT(epoll_ctl);
- TSAN_INTERCEPT(epoll_wait);
+ TSAN_MAYBE_INTERCEPT_EPOLL_CTL;
+ TSAN_MAYBE_INTERCEPT_EPOLL_WAIT;
TSAN_INTERCEPT(sigaction);
TSAN_INTERCEPT(signal);
@@ -2413,9 +2549,6 @@ void InitializeInterceptors() {
// Need to setup it, because interceptors check that the function is resolved.
// But atexit is emitted directly into the module, so can't be resolved.
REAL(atexit) = (int(*)(void(*)()))unreachable;
- atexit_ctx = new(internal_alloc(MBlockAtExit, sizeof(AtExitContext)))
- AtExitContext();
-
if (REAL(__cxa_atexit)(&finalize, 0, 0)) {
Printf("ThreadSanitizer: failed to setup atexit callback\n");
Die();
@@ -2427,11 +2560,6 @@ void InitializeInterceptors() {
}
FdInit();
-
- // Remember list of loaded libraries for atexit interceptors.
- modules = (LoadedModule*)MmapOrDie(sizeof(*modules)*kMaxModules,
- "LoadedModule");
- nmodules = GetListOfModules(modules, kMaxModules, 0);
}
void *internal_start_thread(void(*func)(void *arg), void *arg) {
diff --git a/libsanitizer/tsan/tsan_interface_ann.cc b/libsanitizer/tsan/tsan_interface_ann.cc
index 85de2e6221f..b44e56898d6 100644
--- a/libsanitizer/tsan/tsan_interface_ann.cc
+++ b/libsanitizer/tsan/tsan_interface_ann.cc
@@ -52,7 +52,7 @@ class ScopedAnnotation {
StatInc(thr, StatAnnotation); \
StatInc(thr, Stat##typ); \
ScopedAnnotation sa(thr, __func__, f, l, caller_pc); \
- const uptr pc = __sanitizer::StackTrace::GetCurrentPc(); \
+ const uptr pc = StackTrace::GetCurrentPc(); \
(void)pc; \
/**/
@@ -452,4 +452,6 @@ const char INTERFACE_ATTRIBUTE* ThreadSanitizerQuery(const char *query) {
void INTERFACE_ATTRIBUTE
AnnotateMemoryIsInitialized(char *f, int l, uptr mem, uptr sz) {}
+void INTERFACE_ATTRIBUTE
+AnnotateMemoryIsUninitialized(char *f, int l, uptr mem, uptr sz) {}
} // extern "C"
diff --git a/libsanitizer/tsan/tsan_interface_atomic.cc b/libsanitizer/tsan/tsan_interface_atomic.cc
index 316614dd486..15fc21c4627 100644
--- a/libsanitizer/tsan/tsan_interface_atomic.cc
+++ b/libsanitizer/tsan/tsan_interface_atomic.cc
@@ -472,7 +472,7 @@ static void AtomicFence(ThreadState *thr, uptr pc, morder mo) {
#define SCOPED_ATOMIC(func, ...) \
const uptr callpc = (uptr)__builtin_return_address(0); \
- uptr pc = __sanitizer::StackTrace::GetCurrentPc(); \
+ uptr pc = StackTrace::GetCurrentPc(); \
mo = flags()->force_seq_cst_atomics ? (morder)mo_seq_cst : mo; \
ThreadState *const thr = cur_thread(); \
if (thr->ignore_interceptors) \
diff --git a/libsanitizer/tsan/tsan_interface_java.cc b/libsanitizer/tsan/tsan_interface_java.cc
index 03a9e280ddc..6e1ec6de359 100644
--- a/libsanitizer/tsan/tsan_interface_java.cc
+++ b/libsanitizer/tsan/tsan_interface_java.cc
@@ -59,7 +59,7 @@ static JavaContext *jctx;
#define SCOPED_JAVA_FUNC(func) \
ThreadState *thr = cur_thread(); \
const uptr caller_pc = GET_CALLER_PC(); \
- const uptr pc = __sanitizer::StackTrace::GetCurrentPc(); \
+ const uptr pc = StackTrace::GetCurrentPc(); \
(void)pc; \
ScopedJavaFunc scoped(thr, caller_pc); \
/**/
diff --git a/libsanitizer/tsan/tsan_mman.cc b/libsanitizer/tsan/tsan_mman.cc
index 2eae60de512..d89610a2cc3 100644
--- a/libsanitizer/tsan/tsan_mman.cc
+++ b/libsanitizer/tsan/tsan_mman.cc
@@ -64,17 +64,17 @@ static void SignalUnsafeCall(ThreadState *thr, uptr pc) {
if (atomic_load(&thr->in_signal_handler, memory_order_relaxed) == 0 ||
!flags()->report_signal_unsafe)
return;
- StackTrace stack;
- stack.ObtainCurrent(thr, pc);
+ VarSizeStackTrace stack;
+ ObtainCurrentStack(thr, pc, &stack);
ThreadRegistryLock l(ctx->thread_registry);
ScopedReport rep(ReportTypeSignalUnsafe);
if (!IsFiredSuppression(ctx, rep, stack)) {
- rep.AddStack(&stack, true);
+ rep.AddStack(stack, true);
OutputReport(thr, rep);
}
}
-void *user_alloc(ThreadState *thr, uptr pc, uptr sz, uptr align) {
+void *user_alloc(ThreadState *thr, uptr pc, uptr sz, uptr align, bool signal) {
if ((sz >= (1ull << 40)) || (align >= (1ull << 40)))
return AllocatorReturnNull();
void *p = allocator()->Allocate(&thr->alloc_cache, sz, align);
@@ -82,15 +82,17 @@ void *user_alloc(ThreadState *thr, uptr pc, uptr sz, uptr align) {
return 0;
if (ctx && ctx->initialized)
OnUserAlloc(thr, pc, (uptr)p, sz, true);
- SignalUnsafeCall(thr, pc);
+ if (signal)
+ SignalUnsafeCall(thr, pc);
return p;
}
-void user_free(ThreadState *thr, uptr pc, void *p) {
+void user_free(ThreadState *thr, uptr pc, void *p, bool signal) {
if (ctx && ctx->initialized)
OnUserFree(thr, pc, (uptr)p, true);
allocator()->Deallocate(&thr->alloc_cache, p);
- SignalUnsafeCall(thr, pc);
+ if (signal)
+ SignalUnsafeCall(thr, pc);
}
void OnUserAlloc(ThreadState *thr, uptr pc, uptr p, uptr sz, bool write) {
diff --git a/libsanitizer/tsan/tsan_mman.h b/libsanitizer/tsan/tsan_mman.h
index ab8eb83f919..fe020af9d2d 100644
--- a/libsanitizer/tsan/tsan_mman.h
+++ b/libsanitizer/tsan/tsan_mman.h
@@ -24,9 +24,9 @@ void AllocatorPrintStats();
// For user allocations.
void *user_alloc(ThreadState *thr, uptr pc, uptr sz,
- uptr align = kDefaultAlignment);
+ uptr align = kDefaultAlignment, bool signal = true);
// Does not accept NULL.
-void user_free(ThreadState *thr, uptr pc, void *p);
+void user_free(ThreadState *thr, uptr pc, void *p, bool signal = true);
void *user_realloc(ThreadState *thr, uptr pc, void *p, uptr sz);
void *user_alloc_aligned(ThreadState *thr, uptr pc, uptr sz, uptr align);
uptr user_alloc_usable_size(const void *p);
diff --git a/libsanitizer/tsan/tsan_platform.h b/libsanitizer/tsan/tsan_platform.h
index b7a6376e8ed..35837d2132a 100644
--- a/libsanitizer/tsan/tsan_platform.h
+++ b/libsanitizer/tsan/tsan_platform.h
@@ -10,124 +10,223 @@
// Platform-specific code.
//===----------------------------------------------------------------------===//
+#ifndef TSAN_PLATFORM_H
+#define TSAN_PLATFORM_H
+
+#if !defined(__LP64__) && !defined(_WIN64)
+# error "Only 64-bit is supported"
+#endif
+
+#include "tsan_defs.h"
+#include "tsan_trace.h"
+
+namespace __tsan {
+
+#if !defined(TSAN_GO)
+
/*
-C++ linux memory layout:
-0000 0000 0000 - 03c0 0000 0000: protected
-03c0 0000 0000 - 1000 0000 0000: shadow
-1000 0000 0000 - 3000 0000 0000: protected
+C/C++ on linux and freebsd
+0000 0000 1000 - 0100 0000 0000: main binary and/or MAP_32BIT mappings
+0100 0000 0000 - 0200 0000 0000: -
+0200 0000 0000 - 1000 0000 0000: shadow
+1000 0000 0000 - 3000 0000 0000: -
3000 0000 0000 - 4000 0000 0000: metainfo (memory blocks and sync objects)
-4000 0000 0000 - 6000 0000 0000: protected
+4000 0000 0000 - 6000 0000 0000: -
6000 0000 0000 - 6200 0000 0000: traces
6200 0000 0000 - 7d00 0000 0000: -
7d00 0000 0000 - 7e00 0000 0000: heap
-7e00 0000 0000 - 7fff ffff ffff: modules and main thread stack
+7e00 0000 0000 - 7e80 0000 0000: -
+7e80 0000 0000 - 8000 0000 0000: modules and main thread stack
+*/
-Go linux and darwin memory layout:
-0000 0000 0000 - 0000 1000 0000: executable
-0000 1000 0000 - 00f8 0000 0000: -
+const uptr kMetaShadowBeg = 0x300000000000ull;
+const uptr kMetaShadowEnd = 0x400000000000ull;
+const uptr kTraceMemBeg = 0x600000000000ull;
+const uptr kTraceMemEnd = 0x620000000000ull;
+const uptr kShadowBeg = 0x020000000000ull;
+const uptr kShadowEnd = 0x100000000000ull;
+const uptr kHeapMemBeg = 0x7d0000000000ull;
+const uptr kHeapMemEnd = 0x7e0000000000ull;
+const uptr kLoAppMemBeg = 0x000000001000ull;
+const uptr kLoAppMemEnd = 0x010000000000ull;
+const uptr kHiAppMemBeg = 0x7e8000000000ull;
+const uptr kHiAppMemEnd = 0x800000000000ull;
+const uptr kAppMemMsk = 0x7c0000000000ull;
+const uptr kAppMemXor = 0x020000000000ull;
+
+ALWAYS_INLINE
+bool IsAppMem(uptr mem) {
+ return (mem >= kHeapMemBeg && mem < kHeapMemEnd) ||
+ (mem >= kLoAppMemBeg && mem < kLoAppMemEnd) ||
+ (mem >= kHiAppMemBeg && mem < kHiAppMemEnd);
+}
+
+ALWAYS_INLINE
+bool IsShadowMem(uptr mem) {
+ return mem >= kShadowBeg && mem <= kShadowEnd;
+}
+
+ALWAYS_INLINE
+bool IsMetaMem(uptr mem) {
+ return mem >= kMetaShadowBeg && mem <= kMetaShadowEnd;
+}
+
+ALWAYS_INLINE
+uptr MemToShadow(uptr x) {
+ DCHECK(IsAppMem(x));
+ return (((x) & ~(kAppMemMsk | (kShadowCell - 1)))
+ ^ kAppMemXor) * kShadowCnt;
+}
+
+ALWAYS_INLINE
+u32 *MemToMeta(uptr x) {
+ DCHECK(IsAppMem(x));
+ return (u32*)(((((x) & ~(kAppMemMsk | (kMetaShadowCell - 1)))
+ ^ kAppMemXor) / kMetaShadowCell * kMetaShadowSize) | kMetaShadowBeg);
+}
+
+ALWAYS_INLINE
+uptr ShadowToMem(uptr s) {
+ CHECK(IsShadowMem(s));
+ if (s >= MemToShadow(kLoAppMemBeg) && s <= MemToShadow(kLoAppMemEnd - 1))
+ return (s / kShadowCnt) ^ kAppMemXor;
+ else
+ return ((s / kShadowCnt) ^ kAppMemXor) | kAppMemMsk;
+}
+
+static USED uptr UserRegions[] = {
+ kLoAppMemBeg, kLoAppMemEnd,
+ kHiAppMemBeg, kHiAppMemEnd,
+ kHeapMemBeg, kHeapMemEnd,
+};
+
+#elif defined(TSAN_GO) && !SANITIZER_WINDOWS
+
+/* Go on linux, darwin and freebsd
+0000 0000 1000 - 0000 1000 0000: executable
+0000 1000 0000 - 00c0 0000 0000: -
00c0 0000 0000 - 00e0 0000 0000: heap
-00e0 0000 0000 - 1000 0000 0000: -
-1000 0000 0000 - 1380 0000 0000: shadow
-1460 0000 0000 - 2000 0000 0000: -
+00e0 0000 0000 - 2000 0000 0000: -
+2000 0000 0000 - 2380 0000 0000: shadow
+2380 0000 0000 - 3000 0000 0000: -
3000 0000 0000 - 4000 0000 0000: metainfo (memory blocks and sync objects)
4000 0000 0000 - 6000 0000 0000: -
6000 0000 0000 - 6200 0000 0000: traces
-6200 0000 0000 - 7fff ffff ffff: -
+6200 0000 0000 - 8000 0000 0000: -
+*/
+
+const uptr kMetaShadowBeg = 0x300000000000ull;
+const uptr kMetaShadowEnd = 0x400000000000ull;
+const uptr kTraceMemBeg = 0x600000000000ull;
+const uptr kTraceMemEnd = 0x620000000000ull;
+const uptr kShadowBeg = 0x200000000000ull;
+const uptr kShadowEnd = 0x238000000000ull;
+const uptr kAppMemBeg = 0x000000001000ull;
+const uptr kAppMemEnd = 0x00e000000000ull;
+
+ALWAYS_INLINE
+bool IsAppMem(uptr mem) {
+ return mem >= kAppMemBeg && mem < kAppMemEnd;
+}
+
+ALWAYS_INLINE
+bool IsShadowMem(uptr mem) {
+ return mem >= kShadowBeg && mem <= kShadowEnd;
+}
+
+ALWAYS_INLINE
+bool IsMetaMem(uptr mem) {
+ return mem >= kMetaShadowBeg && mem <= kMetaShadowEnd;
+}
+
+ALWAYS_INLINE
+uptr MemToShadow(uptr x) {
+ DCHECK(IsAppMem(x));
+ return ((x & ~(kShadowCell - 1)) * kShadowCnt) | kShadowBeg;
+}
-Go windows memory layout:
-0000 0000 0000 - 0000 1000 0000: executable
+ALWAYS_INLINE
+u32 *MemToMeta(uptr x) {
+ DCHECK(IsAppMem(x));
+ return (u32*)(((x & ~(kMetaShadowCell - 1)) / \
+ kMetaShadowCell * kMetaShadowSize) | kMetaShadowBeg);
+}
+
+ALWAYS_INLINE
+uptr ShadowToMem(uptr s) {
+ CHECK(IsShadowMem(s));
+ return (s & ~kShadowBeg) / kShadowCnt;
+}
+
+static USED uptr UserRegions[] = {
+ kAppMemBeg, kAppMemEnd,
+};
+
+#elif defined(TSAN_GO) && SANITIZER_WINDOWS
+
+/* Go on windows
+0000 0000 1000 - 0000 1000 0000: executable
0000 1000 0000 - 00f8 0000 0000: -
00c0 0000 0000 - 00e0 0000 0000: heap
00e0 0000 0000 - 0100 0000 0000: -
-0100 0000 0000 - 0560 0000 0000: shadow
+0100 0000 0000 - 0380 0000 0000: shadow
+0380 0000 0000 - 0560 0000 0000: -
0560 0000 0000 - 0760 0000 0000: traces
0760 0000 0000 - 07d0 0000 0000: metainfo (memory blocks and sync objects)
-07d0 0000 0000 - 07ff ffff ffff: -
+07d0 0000 0000 - 8000 0000 0000: -
*/
-#ifndef TSAN_PLATFORM_H
-#define TSAN_PLATFORM_H
-
-#include "tsan_defs.h"
-#include "tsan_trace.h"
-
-#if defined(__LP64__) || defined(_WIN64)
-namespace __tsan {
-
-#if defined(TSAN_GO)
-static const uptr kLinuxAppMemBeg = 0x000000000000ULL;
-static const uptr kLinuxAppMemEnd = 0x04dfffffffffULL;
-# if SANITIZER_WINDOWS
-static const uptr kLinuxShadowMsk = 0x010000000000ULL;
-static const uptr kMetaShadow = 0x076000000000ULL;
-static const uptr kMetaSize = 0x007000000000ULL;
-# else // if SANITIZER_WINDOWS
-static const uptr kLinuxShadowMsk = 0x200000000000ULL;
-static const uptr kMetaShadow = 0x300000000000ULL;
-static const uptr kMetaSize = 0x100000000000ULL;
-# endif // if SANITIZER_WINDOWS
-#else // defined(TSAN_GO)
-static const uptr kMetaShadow = 0x300000000000ULL;
-static const uptr kMetaSize = 0x100000000000ULL;
-static const uptr kLinuxAppMemBeg = 0x7cf000000000ULL;
-static const uptr kLinuxAppMemEnd = 0x7fffffffffffULL;
-#endif
+const uptr kMetaShadowBeg = 0x076000000000ull;
+const uptr kMetaShadowEnd = 0x07d000000000ull;
+const uptr kTraceMemBeg = 0x056000000000ull;
+const uptr kTraceMemEnd = 0x076000000000ull;
+const uptr kShadowBeg = 0x010000000000ull;
+const uptr kShadowEnd = 0x038000000000ull;
+const uptr kAppMemBeg = 0x000000001000ull;
+const uptr kAppMemEnd = 0x00e000000000ull;
-static const uptr kLinuxAppMemMsk = 0x7c0000000000ULL;
+ALWAYS_INLINE
+bool IsAppMem(uptr mem) {
+ return mem >= kAppMemBeg && mem < kAppMemEnd;
+}
-#if SANITIZER_WINDOWS
-const uptr kTraceMemBegin = 0x056000000000ULL;
-#else
-const uptr kTraceMemBegin = 0x600000000000ULL;
-#endif
-const uptr kTraceMemSize = 0x020000000000ULL;
-
-// This has to be a macro to allow constant initialization of constants below.
-#ifndef TSAN_GO
-#define MemToShadow(addr) \
- ((((uptr)addr) & ~(kLinuxAppMemMsk | (kShadowCell - 1))) * kShadowCnt)
-#define MemToMeta(addr) \
- (u32*)(((((uptr)addr) & ~(kLinuxAppMemMsk | (kMetaShadowCell - 1))) \
- / kMetaShadowCell * kMetaShadowSize) | kMetaShadow)
-#else
-#define MemToShadow(addr) \
- (((((uptr)addr) & ~(kShadowCell - 1)) * kShadowCnt) | kLinuxShadowMsk)
-#define MemToMeta(addr) \
- (u32*)(((((uptr)addr) & ~(kMetaShadowCell - 1)) \
- / kMetaShadowCell * kMetaShadowSize) | kMetaShadow)
-#endif
+ALWAYS_INLINE
+bool IsShadowMem(uptr mem) {
+ return mem >= kShadowBeg && mem <= kShadowEnd;
+}
-static const uptr kLinuxShadowBeg = MemToShadow(kLinuxAppMemBeg);
-static const uptr kLinuxShadowEnd =
- MemToShadow(kLinuxAppMemEnd) | 0xff;
+ALWAYS_INLINE
+bool IsMetaMem(uptr mem) {
+ return mem >= kMetaShadowBeg && mem <= kMetaShadowEnd;
+}
-static inline bool IsAppMem(uptr mem) {
-#if defined(TSAN_GO)
- return mem <= kLinuxAppMemEnd;
-#else
- return mem >= kLinuxAppMemBeg && mem <= kLinuxAppMemEnd;
-#endif
+ALWAYS_INLINE
+uptr MemToShadow(uptr x) {
+ DCHECK(IsAppMem(x));
+ return ((x & ~(kShadowCell - 1)) * kShadowCnt) | kShadowBeg;
}
-static inline bool IsShadowMem(uptr mem) {
- return mem >= kLinuxShadowBeg && mem <= kLinuxShadowEnd;
+ALWAYS_INLINE
+u32 *MemToMeta(uptr x) {
+ DCHECK(IsAppMem(x));
+ return (u32*)(((x & ~(kMetaShadowCell - 1)) / \
+ kMetaShadowCell * kMetaShadowSize) | kMetaShadowEnd);
}
-static inline uptr ShadowToMem(uptr shadow) {
- CHECK(IsShadowMem(shadow));
-#ifdef TSAN_GO
- return (shadow & ~kLinuxShadowMsk) / kShadowCnt;
-#else
- return (shadow / kShadowCnt) | kLinuxAppMemMsk;
-#endif
+ALWAYS_INLINE
+uptr ShadowToMem(uptr s) {
+ CHECK(IsShadowMem(s));
+ // FIXME(dvyukov): this is most likely wrong as the mapping is not bijection.
+ return (x & ~kShadowBeg) / kShadowCnt;
}
-void FlushShadowMemory();
-void WriteMemoryProfile(char *buf, uptr buf_size, uptr nthread, uptr nlive);
-uptr GetRSS();
+static USED uptr UserRegions[] = {
+ kAppMemBeg, kAppMemEnd,
+};
-void InitializePlatform();
-void FinalizePlatform();
+#else
+# error "Unknown platform"
+#endif
// The additional page is to catch shadow stack overflow as paging fault.
// Windows wants 64K alignment for mmaps.
@@ -135,18 +234,23 @@ const uptr kTotalTraceSize = (kTraceSize * sizeof(Event) + sizeof(Trace)
+ (64 << 10) + (64 << 10) - 1) & ~((64 << 10) - 1);
uptr ALWAYS_INLINE GetThreadTrace(int tid) {
- uptr p = kTraceMemBegin + (uptr)tid * kTotalTraceSize;
- DCHECK_LT(p, kTraceMemBegin + kTraceMemSize);
+ uptr p = kTraceMemBeg + (uptr)tid * kTotalTraceSize;
+ DCHECK_LT(p, kTraceMemEnd);
return p;
}
uptr ALWAYS_INLINE GetThreadTraceHeader(int tid) {
- uptr p = kTraceMemBegin + (uptr)tid * kTotalTraceSize
+ uptr p = kTraceMemBeg + (uptr)tid * kTotalTraceSize
+ kTraceSize * sizeof(Event);
- DCHECK_LT(p, kTraceMemBegin + kTraceMemSize);
+ DCHECK_LT(p, kTraceMemEnd);
return p;
}
+void InitializePlatform();
+void FlushShadowMemory();
+void WriteMemoryProfile(char *buf, uptr buf_size, uptr nthread, uptr nlive);
+uptr GetRSS();
+
void *internal_start_thread(void(*func)(void*), void *arg);
void internal_join_thread(void *th);
@@ -162,8 +266,4 @@ int call_pthread_cancel_with_cleanup(int(*fn)(void *c, void *m,
} // namespace __tsan
-#else // defined(__LP64__) || defined(_WIN64)
-# error "Only 64-bit is supported"
-#endif
-
#endif // TSAN_PLATFORM_H
diff --git a/libsanitizer/tsan/tsan_platform_linux.cc b/libsanitizer/tsan/tsan_platform_linux.cc
index ba81fd242e3..32591316ea2 100644
--- a/libsanitizer/tsan/tsan_platform_linux.cc
+++ b/libsanitizer/tsan/tsan_platform_linux.cc
@@ -7,7 +7,7 @@
//
// This file is a part of ThreadSanitizer (TSan), a race detector.
//
-// Linux-specific code.
+// Linux- and FreeBSD-specific code.
//===----------------------------------------------------------------------===//
@@ -18,6 +18,7 @@
#include "sanitizer_common/sanitizer_libc.h"
#include "sanitizer_common/sanitizer_procmaps.h"
#include "sanitizer_common/sanitizer_stoptheworld.h"
+#include "sanitizer_common/sanitizer_stackdepot.h"
#include "tsan_platform.h"
#include "tsan_rtl.h"
#include "tsan_flags.h"
@@ -60,6 +61,9 @@ void *__libc_stack_end = 0;
namespace __tsan {
+static uptr g_data_start;
+static uptr g_data_end;
+
const uptr kPageSize = 4096;
enum {
@@ -74,22 +78,26 @@ enum {
MemCount = 8,
};
-void FillProfileCallback(uptr start, uptr rss, bool file,
+void FillProfileCallback(uptr p, uptr rss, bool file,
uptr *mem, uptr stats_size) {
mem[MemTotal] += rss;
- start >>= 40;
- if (start < 0x10)
+ if (p >= kShadowBeg && p < kShadowEnd)
mem[MemShadow] += rss;
- else if (start >= 0x20 && start < 0x30)
- mem[file ? MemFile : MemMmap] += rss;
- else if (start >= 0x30 && start < 0x40)
+ else if (p >= kMetaShadowBeg && p < kMetaShadowEnd)
mem[MemMeta] += rss;
- else if (start >= 0x7e)
+#ifndef TSAN_GO
+ else if (p >= kHeapMemBeg && p < kHeapMemEnd)
+ mem[MemHeap] += rss;
+ else if (p >= kLoAppMemBeg && p < kLoAppMemEnd)
mem[file ? MemFile : MemMmap] += rss;
- else if (start >= 0x60 && start < 0x62)
+ else if (p >= kHiAppMemBeg && p < kHiAppMemEnd)
+ mem[file ? MemFile : MemMmap] += rss;
+#else
+ else if (p >= kAppMemBeg && p < kAppMemEnd)
+ mem[file ? MemFile : MemMmap] += rss;
+#endif
+ else if (p >= kTraceMemBeg && p < kTraceMemEnd)
mem[MemTrace] += rss;
- else if (start >= 0x7d && start < 0x7e)
- mem[MemHeap] += rss;
else
mem[MemOther] += rss;
}
@@ -97,12 +105,14 @@ void FillProfileCallback(uptr start, uptr rss, bool file,
void WriteMemoryProfile(char *buf, uptr buf_size, uptr nthread, uptr nlive) {
uptr mem[MemCount] = {};
__sanitizer::GetMemoryProfile(FillProfileCallback, mem, 7);
+ StackDepotStats *stacks = StackDepotGetStats();
internal_snprintf(buf, buf_size,
"RSS %zd MB: shadow:%zd meta:%zd file:%zd mmap:%zd"
- " trace:%zd heap:%zd other:%zd nthr=%zd/%zd\n",
+ " trace:%zd heap:%zd other:%zd stacks=%zd[%zd] nthr=%zd/%zd\n",
mem[MemTotal] >> 20, mem[MemShadow] >> 20, mem[MemMeta] >> 20,
mem[MemFile] >> 20, mem[MemMmap] >> 20, mem[MemTrace] >> 20,
mem[MemHeap] >> 20, mem[MemOther] >> 20,
+ stacks->allocated >> 20, stacks->n_uniq_ids,
nlive, nthread);
}
@@ -137,7 +147,7 @@ uptr GetRSS() {
void FlushShadowMemoryCallback(
const SuspendedThreadsList &suspended_threads_list,
void *argument) {
- FlushUnneededShadowMemory(kLinuxShadowBeg, kLinuxShadowEnd - kLinuxShadowBeg);
+ FlushUnneededShadowMemory(kShadowBeg, kShadowEnd - kShadowBeg);
}
#endif
@@ -218,12 +228,12 @@ static void MapRodata() {
void InitializeShadowMemory() {
// Map memory shadow.
- uptr shadow = (uptr)MmapFixedNoReserve(kLinuxShadowBeg,
- kLinuxShadowEnd - kLinuxShadowBeg);
- if (shadow != kLinuxShadowBeg) {
+ uptr shadow = (uptr)MmapFixedNoReserve(kShadowBeg,
+ kShadowEnd - kShadowBeg);
+ if (shadow != kShadowBeg) {
Printf("FATAL: ThreadSanitizer can not mmap the shadow memory\n");
Printf("FATAL: Make sure to compile with -fPIE and "
- "to link with -pie (%p, %p).\n", shadow, kLinuxShadowBeg);
+ "to link with -pie (%p, %p).\n", shadow, kShadowBeg);
Die();
}
// This memory range is used for thread stacks and large user mmaps.
@@ -235,78 +245,42 @@ void InitializeShadowMemory() {
0x10000000000ULL * kShadowMultiplier, MADV_NOHUGEPAGE);
#endif
DPrintf("memory shadow: %zx-%zx (%zuGB)\n",
- kLinuxShadowBeg, kLinuxShadowEnd,
- (kLinuxShadowEnd - kLinuxShadowBeg) >> 30);
+ kShadowBeg, kShadowEnd,
+ (kShadowEnd - kShadowBeg) >> 30);
// Map meta shadow.
- if (MemToMeta(kLinuxAppMemBeg) < (u32*)kMetaShadow) {
- Printf("ThreadSanitizer: bad meta shadow (%p -> %p < %p)\n",
- kLinuxAppMemBeg, MemToMeta(kLinuxAppMemBeg), kMetaShadow);
- Die();
- }
- if (MemToMeta(kLinuxAppMemEnd) >= (u32*)(kMetaShadow + kMetaSize)) {
- Printf("ThreadSanitizer: bad meta shadow (%p -> %p >= %p)\n",
- kLinuxAppMemEnd, MemToMeta(kLinuxAppMemEnd), kMetaShadow + kMetaSize);
- Die();
- }
- uptr meta = (uptr)MmapFixedNoReserve(kMetaShadow, kMetaSize);
- if (meta != kMetaShadow) {
+ uptr meta_size = kMetaShadowEnd - kMetaShadowBeg;
+ uptr meta = (uptr)MmapFixedNoReserve(kMetaShadowBeg, meta_size);
+ if (meta != kMetaShadowBeg) {
Printf("FATAL: ThreadSanitizer can not mmap the shadow memory\n");
Printf("FATAL: Make sure to compile with -fPIE and "
- "to link with -pie (%p, %p).\n", meta, kMetaShadow);
+ "to link with -pie (%p, %p).\n", meta, kMetaShadowBeg);
Die();
}
DPrintf("meta shadow: %zx-%zx (%zuGB)\n",
- kMetaShadow, kMetaShadow + kMetaSize, kMetaSize >> 30);
-
- // Protect gaps.
- const uptr kClosedLowBeg = 0x200000;
- const uptr kClosedLowEnd = kLinuxShadowBeg - 1;
- const uptr kClosedMidBeg = kLinuxShadowEnd + 1;
- const uptr kClosedMidEnd = min(min(kLinuxAppMemBeg, kTraceMemBegin),
- kMetaShadow);
-
- ProtectRange(kClosedLowBeg, kClosedLowEnd);
- ProtectRange(kClosedMidBeg, kClosedMidEnd);
- VPrintf(2, "kClosedLow %zx-%zx (%zuGB)\n",
- kClosedLowBeg, kClosedLowEnd, (kClosedLowEnd - kClosedLowBeg) >> 30);
- VPrintf(2, "kClosedMid %zx-%zx (%zuGB)\n",
- kClosedMidBeg, kClosedMidEnd, (kClosedMidEnd - kClosedMidBeg) >> 30);
- VPrintf(2, "app mem: %zx-%zx (%zuGB)\n",
- kLinuxAppMemBeg, kLinuxAppMemEnd,
- (kLinuxAppMemEnd - kLinuxAppMemBeg) >> 30);
- VPrintf(2, "stack: %zx\n", (uptr)&shadow);
+ meta, meta + meta_size, meta_size >> 30);
MapRodata();
}
-#endif
-
-static uptr g_data_start;
-static uptr g_data_end;
-
-#ifndef TSAN_GO
-static void CheckPIE() {
- // Ensure that the binary is indeed compiled with -pie.
- MemoryMappingLayout proc_maps(true);
- uptr start, end;
- if (proc_maps.Next(&start, &end,
- /*offset*/0, /*filename*/0, /*filename_size*/0,
- /*protection*/0)) {
- if ((u64)start < kLinuxAppMemBeg) {
- Printf("FATAL: ThreadSanitizer can not mmap the shadow memory ("
- "something is mapped at 0x%zx < 0x%zx)\n",
- start, kLinuxAppMemBeg);
- Printf("FATAL: Make sure to compile with -fPIE"
- " and to link with -pie.\n");
- Die();
- }
- }
-}
static void InitDataSeg() {
MemoryMappingLayout proc_maps(true);
uptr start, end, offset;
char name[128];
+#if SANITIZER_FREEBSD
+ // On FreeBSD BSS is usually the last block allocated within the
+ // low range and heap is the last block allocated within the range
+ // 0x800000000-0x8ffffffff.
+ while (proc_maps.Next(&start, &end, &offset, name, ARRAY_SIZE(name),
+ /*protection*/ 0)) {
+ DPrintf("%p-%p %p %s\n", start, end, offset, name);
+ if ((start & 0xffff00000000ULL) == 0 && (end & 0xffff00000000ULL) == 0 &&
+ name[0] == '\0') {
+ g_data_start = start;
+ g_data_end = end;
+ }
+ }
+#else
bool prev_is_data = false;
while (proc_maps.Next(&start, &end, &offset, name, ARRAY_SIZE(name),
/*protection*/ 0)) {
@@ -322,12 +296,35 @@ static void InitDataSeg() {
g_data_end = end;
prev_is_data = is_data;
}
+#endif
DPrintf("guessed data_start=%p data_end=%p\n", g_data_start, g_data_end);
CHECK_LT(g_data_start, g_data_end);
CHECK_GE((uptr)&g_data_start, g_data_start);
CHECK_LT((uptr)&g_data_start, g_data_end);
}
+static void CheckAndProtect() {
+ // Ensure that the binary is indeed compiled with -pie.
+ MemoryMappingLayout proc_maps(true);
+ uptr p, end;
+ while (proc_maps.Next(&p, &end, 0, 0, 0, 0)) {
+ if (IsAppMem(p))
+ continue;
+ if (p >= kHeapMemEnd &&
+ p < kHeapMemEnd + PrimaryAllocator::AdditionalSize())
+ continue;
+ if (p >= 0xf000000000000000ull) // vdso
+ break;
+ Printf("FATAL: ThreadSanitizer: unexpected memory mapping %p-%p\n", p, end);
+ Die();
+ }
+
+ ProtectRange(kLoAppMemEnd, kShadowBeg);
+ ProtectRange(kShadowEnd, kMetaShadowBeg);
+ ProtectRange(kMetaShadowEnd, kTraceMemBeg);
+ ProtectRange(kTraceMemEnd, kHeapMemBeg);
+ ProtectRange(kHeapMemEnd + PrimaryAllocator::AdditionalSize(), kHiAppMemBeg);
+}
#endif // #ifndef TSAN_GO
void InitializePlatform() {
@@ -363,7 +360,7 @@ void InitializePlatform() {
}
#ifndef TSAN_GO
- CheckPIE();
+ CheckAndProtect();
InitTlsSize();
InitDataSeg();
#endif
@@ -426,4 +423,4 @@ int call_pthread_cancel_with_cleanup(int(*fn)(void *c, void *m,
} // namespace __tsan
-#endif // SANITIZER_LINUX
+#endif // SANITIZER_LINUX || SANITIZER_FREEBSD
diff --git a/libsanitizer/tsan/tsan_platform_mac.cc b/libsanitizer/tsan/tsan_platform_mac.cc
index 95527c79431..2091318a674 100644
--- a/libsanitizer/tsan/tsan_platform_mac.cc
+++ b/libsanitizer/tsan/tsan_platform_mac.cc
@@ -54,20 +54,20 @@ uptr GetRSS() {
#ifndef TSAN_GO
void InitializeShadowMemory() {
- uptr shadow = (uptr)MmapFixedNoReserve(kLinuxShadowBeg,
- kLinuxShadowEnd - kLinuxShadowBeg);
- if (shadow != kLinuxShadowBeg) {
+ uptr shadow = (uptr)MmapFixedNoReserve(kShadowBeg,
+ kShadowEnd - kShadowBeg);
+ if (shadow != kShadowBeg) {
Printf("FATAL: ThreadSanitizer can not mmap the shadow memory\n");
Printf("FATAL: Make sure to compile with -fPIE and "
"to link with -pie.\n");
Die();
}
- DPrintf("kLinuxShadow %zx-%zx (%zuGB)\n",
- kLinuxShadowBeg, kLinuxShadowEnd,
- (kLinuxShadowEnd - kLinuxShadowBeg) >> 30);
- DPrintf("kLinuxAppMem %zx-%zx (%zuGB)\n",
- kLinuxAppMemBeg, kLinuxAppMemEnd,
- (kLinuxAppMemEnd - kLinuxAppMemBeg) >> 30);
+ DPrintf("kShadow %zx-%zx (%zuGB)\n",
+ kShadowBeg, kShadowEnd,
+ (kShadowEnd - kShadowBeg) >> 30);
+ DPrintf("kAppMem %zx-%zx (%zuGB)\n",
+ kAppMemBeg, kAppMemEnd,
+ (kAppMemEnd - kAppMemBeg) >> 30);
}
#endif
@@ -75,10 +75,6 @@ void InitializePlatform() {
DisableCoreDumperIfNecessary();
}
-void FinalizePlatform() {
- fflush(0);
-}
-
#ifndef TSAN_GO
int call_pthread_cancel_with_cleanup(int(*fn)(void *c, void *m,
void *abstime), void *c, void *m, void *abstime,
diff --git a/libsanitizer/tsan/tsan_platform_windows.cc b/libsanitizer/tsan/tsan_platform_windows.cc
index d6e9e6d33f4..3f81c54e3eb 100644
--- a/libsanitizer/tsan/tsan_platform_windows.cc
+++ b/libsanitizer/tsan/tsan_platform_windows.cc
@@ -36,10 +36,6 @@ uptr GetRSS() {
void InitializePlatform() {
}
-void FinalizePlatform() {
- fflush(0);
-}
-
} // namespace __tsan
#endif // SANITIZER_WINDOWS
diff --git a/libsanitizer/tsan/tsan_report.cc b/libsanitizer/tsan/tsan_report.cc
index b14856cd153..6feab81383f 100644
--- a/libsanitizer/tsan/tsan_report.cc
+++ b/libsanitizer/tsan/tsan_report.cc
@@ -11,10 +11,30 @@
#include "tsan_report.h"
#include "tsan_platform.h"
#include "tsan_rtl.h"
+#include "sanitizer_common/sanitizer_placement_new.h"
#include "sanitizer_common/sanitizer_report_decorator.h"
+#include "sanitizer_common/sanitizer_stacktrace_printer.h"
namespace __tsan {
+ReportStack::ReportStack() : next(nullptr), info(), suppressable(false) {}
+
+ReportStack *ReportStack::New(uptr addr) {
+ void *mem = internal_alloc(MBlockReportStack, sizeof(ReportStack));
+ ReportStack *res = new(mem) ReportStack();
+ res->info.address = addr;
+ return res;
+}
+
+ReportLocation::ReportLocation(ReportLocationType type)
+ : type(type), global(), heap_chunk_start(0), heap_chunk_size(0), tid(0),
+ fd(0), suppressable(false), stack(nullptr) {}
+
+ReportLocation *ReportLocation::New(ReportLocationType type) {
+ void *mem = internal_alloc(MBlockReportStack, sizeof(ReportLocation));
+ return new(mem) ReportLocation(type);
+}
+
class Decorator: public __sanitizer::SanitizerCommonDecorator {
public:
Decorator() : SanitizerCommonDecorator() { }
@@ -68,6 +88,8 @@ static const char *ReportTypeString(ReportType typ) {
return "data race on vptr (ctor/dtor vs virtual call)";
if (typ == ReportTypeUseAfterFree)
return "heap-use-after-free";
+ if (typ == ReportTypeVptrUseAfterFree)
+ return "heap-use-after-free (virtual call vs free)";
if (typ == ReportTypeThreadLeak)
return "thread leak";
if (typ == ReportTypeMutexDestroyLocked)
@@ -94,14 +116,11 @@ void PrintStack(const ReportStack *ent) {
Printf(" [failed to restore the stack]\n\n");
return;
}
- for (int i = 0; ent; ent = ent->next, i++) {
- Printf(" #%d %s %s:%d", i, ent->func, ent->file, ent->line);
- if (ent->col)
- Printf(":%d", ent->col);
- if (ent->module && ent->offset)
- Printf(" (%s+%p)\n", ent->module, (void*)ent->offset);
- else
- Printf(" (%p)\n", (void*)ent->pc);
+ for (int i = 0; ent && ent->info.address; ent = ent->next, i++) {
+ InternalScopedString res(2 * GetPageSizeCached());
+ RenderFrame(&res, common_flags()->stack_trace_format, i, ent->info,
+ common_flags()->strip_path_prefix, "__interceptor_");
+ Printf("%s\n", res.data());
}
Printf("\n");
}
@@ -143,12 +162,15 @@ static void PrintLocation(const ReportLocation *loc) {
bool print_stack = false;
Printf("%s", d.Location());
if (loc->type == ReportLocationGlobal) {
+ const DataInfo &global = loc->global;
Printf(" Location is global '%s' of size %zu at %p (%s+%p)\n\n",
- loc->name, loc->size, loc->addr, loc->module, loc->offset);
+ global.name, global.size, global.start,
+ StripModuleName(global.module), global.module_offset);
} else if (loc->type == ReportLocationHeap) {
char thrbuf[kThreadBufSize];
Printf(" Location is heap block of size %zu at %p allocated by %s:\n",
- loc->size, loc->addr, thread_name(thrbuf, loc->tid));
+ loc->heap_chunk_size, loc->heap_chunk_start,
+ thread_name(thrbuf, loc->tid));
print_stack = true;
} else if (loc->type == ReportLocationStack) {
Printf(" Location is stack of %s.\n\n", thread_name(thrbuf, loc->tid));
@@ -301,8 +323,10 @@ void PrintReport(const ReportDesc *rep) {
if (rep->typ == ReportTypeThreadLeak && rep->count > 1)
Printf(" And %d more similar thread leaks.\n\n", rep->count - 1);
- if (ReportStack *ent = SkipTsanInternalFrames(ChooseSummaryStack(rep)))
- ReportErrorSummary(rep_typ_str, ent->file, ent->line, ent->func);
+ if (ReportStack *ent = SkipTsanInternalFrames(ChooseSummaryStack(rep))) {
+ const AddressInfo &info = ent->info;
+ ReportErrorSummary(rep_typ_str, info.file, info.line, info.function);
+ }
Printf("==================\n");
}
@@ -317,8 +341,9 @@ void PrintStack(const ReportStack *ent) {
return;
}
for (int i = 0; ent; ent = ent->next, i++) {
- Printf(" %s()\n %s:%d +0x%zx\n",
- ent->func, ent->file, ent->line, (void*)ent->offset);
+ const AddressInfo &info = ent->info;
+ Printf(" %s()\n %s:%d +0x%zx\n", info.function, info.file, info.line,
+ (void *)info.module_offset);
}
}
diff --git a/libsanitizer/tsan/tsan_report.h b/libsanitizer/tsan/tsan_report.h
index 0bde59b1675..3d99c7a7c24 100644
--- a/libsanitizer/tsan/tsan_report.h
+++ b/libsanitizer/tsan/tsan_report.h
@@ -11,6 +11,7 @@
#ifndef TSAN_REPORT_H
#define TSAN_REPORT_H
+#include "sanitizer_common/sanitizer_symbolizer.h"
#include "tsan_defs.h"
#include "tsan_vector.h"
@@ -20,6 +21,7 @@ enum ReportType {
ReportTypeRace,
ReportTypeVptrRace,
ReportTypeUseAfterFree,
+ ReportTypeVptrUseAfterFree,
ReportTypeThreadLeak,
ReportTypeMutexDestroyLocked,
ReportTypeMutexDoubleLock,
@@ -33,14 +35,12 @@ enum ReportType {
struct ReportStack {
ReportStack *next;
- char *module;
- uptr offset;
- uptr pc;
- char *func;
- char *file;
- int line;
- int col;
+ AddressInfo info;
bool suppressable;
+ static ReportStack *New(uptr addr);
+
+ private:
+ ReportStack();
};
struct ReportMopMutex {
@@ -70,17 +70,17 @@ enum ReportLocationType {
struct ReportLocation {
ReportLocationType type;
- uptr addr;
- uptr size;
- char *module;
- uptr offset;
+ DataInfo global;
+ uptr heap_chunk_start;
+ uptr heap_chunk_size;
int tid;
int fd;
- char *name;
- char *file;
- int line;
bool suppressable;
ReportStack *stack;
+
+ static ReportLocation *New(ReportLocationType type);
+ private:
+ explicit ReportLocation(ReportLocationType type);
};
struct ReportThread {
diff --git a/libsanitizer/tsan/tsan_rtl.cc b/libsanitizer/tsan/tsan_rtl.cc
index f5942bcaa3e..bf971b62da4 100644
--- a/libsanitizer/tsan/tsan_rtl.cc
+++ b/libsanitizer/tsan/tsan_rtl.cc
@@ -259,8 +259,8 @@ void MapShadow(uptr addr, uptr size) {
void MapThreadTrace(uptr addr, uptr size) {
DPrintf("#0: Mapping trace at %p-%p(0x%zx)\n", addr, addr + size, size);
- CHECK_GE(addr, kTraceMemBegin);
- CHECK_LE(addr + size, kTraceMemBegin + kTraceMemSize);
+ CHECK_GE(addr, kTraceMemBeg);
+ CHECK_LE(addr + size, kTraceMemEnd);
CHECK_EQ(addr, addr & ~((64 << 10) - 1)); // windows wants 64K alignment
uptr addr1 = (uptr)MmapFixedNoReserve(addr, size);
if (addr1 != addr) {
@@ -270,6 +270,28 @@ void MapThreadTrace(uptr addr, uptr size) {
}
}
+static void CheckShadowMapping() {
+ for (uptr i = 0; i < ARRAY_SIZE(UserRegions); i += 2) {
+ const uptr beg = UserRegions[i];
+ const uptr end = UserRegions[i + 1];
+ VPrintf(3, "checking shadow region %p-%p\n", beg, end);
+ for (uptr p0 = beg; p0 <= end; p0 += (end - beg) / 4) {
+ for (int x = -1; x <= 1; x++) {
+ const uptr p = p0 + x;
+ if (p < beg || p >= end)
+ continue;
+ const uptr s = MemToShadow(p);
+ VPrintf(3, " checking pointer %p -> %p\n", p, s);
+ CHECK(IsAppMem(p));
+ CHECK(IsShadowMem(s));
+ CHECK_EQ(p & ~(kShadowCell - 1), ShadowToMem(s));
+ const uptr m = (uptr)MemToMeta(p);
+ CHECK(IsMetaMem(m));
+ }
+ }
+ }
+}
+
void Initialize(ThreadState *thr) {
// Thread safe because done before all threads exist.
static bool is_initialized = false;
@@ -289,6 +311,7 @@ void Initialize(ThreadState *thr) {
InitializeAllocator();
#endif
InitializeInterceptors();
+ CheckShadowMapping();
InitializePlatform();
InitializeMutex();
InitializeDynamicAnnotations();
@@ -437,8 +460,8 @@ u32 CurrentStackId(ThreadState *thr, uptr pc) {
thr->shadow_stack_pos[0] = pc;
thr->shadow_stack_pos++;
}
- u32 id = StackDepotPut(thr->shadow_stack,
- thr->shadow_stack_pos - thr->shadow_stack);
+ u32 id = StackDepotPut(
+ StackTrace(thr->shadow_stack, thr->shadow_stack_pos - thr->shadow_stack));
if (pc != 0)
thr->shadow_stack_pos--;
return id;
@@ -451,7 +474,7 @@ void TraceSwitch(ThreadState *thr) {
unsigned trace = (thr->fast_state.epoch() / kTracePartSize) % TraceParts();
TraceHeader *hdr = &thr_trace->headers[trace];
hdr->epoch0 = thr->fast_state.epoch();
- hdr->stack0.ObtainCurrent(thr, 0);
+ ObtainCurrentStack(thr, 0, &hdr->stack0);
hdr->mset0 = thr->mset;
thr->nomalloc--;
}
@@ -690,6 +713,8 @@ ALWAYS_INLINE
bool ContainsSameAccess(u64 *s, u64 a, u64 sync_epoch, bool is_write) {
#if defined(__SSE3__) && TSAN_SHADOW_COUNT == 4
bool res = ContainsSameAccessFast(s, a, sync_epoch, is_write);
+ // NOTE: this check can fail if the shadow is concurrently mutated
+ // by other threads.
DCHECK_EQ(res, ContainsSameAccessSlow(s, a, sync_epoch, is_write));
return res;
#else
diff --git a/libsanitizer/tsan/tsan_rtl.h b/libsanitizer/tsan/tsan_rtl.h
index c7ea94dfbde..3f7873165cd 100644
--- a/libsanitizer/tsan/tsan_rtl.h
+++ b/libsanitizer/tsan/tsan_rtl.h
@@ -51,11 +51,8 @@
namespace __tsan {
#ifndef TSAN_GO
-const uptr kAllocatorSpace = 0x7d0000000000ULL;
-const uptr kAllocatorSize = 0x10000000000ULL; // 1T.
-
struct MapUnmapCallback;
-typedef SizeClassAllocator64<kAllocatorSpace, kAllocatorSize, 0,
+typedef SizeClassAllocator64<kHeapMemBeg, kHeapMemEnd - kHeapMemBeg, 0,
DefaultSizeClassMap, MapUnmapCallback> PrimaryAllocator;
typedef SizeClassAllocatorLocalCache<PrimaryAllocator> AllocatorCache;
typedef LargeMmapAllocator<MapUnmapCallback> SecondaryAllocator;
@@ -499,9 +496,9 @@ class ScopedReport {
explicit ScopedReport(ReportType typ);
~ScopedReport();
- void AddMemoryAccess(uptr addr, Shadow s, const StackTrace *stack,
+ void AddMemoryAccess(uptr addr, Shadow s, StackTrace stack,
const MutexSet *mset);
- void AddStack(const StackTrace *stack, bool suppressable = false);
+ void AddStack(StackTrace stack, bool suppressable = false);
void AddThread(const ThreadContext *tctx, bool suppressable = false);
void AddThread(int unique_tid, bool suppressable = false);
void AddUniqueTid(int unique_tid);
@@ -525,7 +522,20 @@ class ScopedReport {
void operator = (const ScopedReport&);
};
-void RestoreStack(int tid, const u64 epoch, StackTrace *stk, MutexSet *mset);
+void RestoreStack(int tid, const u64 epoch, VarSizeStackTrace *stk,
+ MutexSet *mset);
+
+template<typename StackTraceTy>
+void ObtainCurrentStack(ThreadState *thr, uptr toppc, StackTraceTy *stack) {
+ uptr size = thr->shadow_stack_pos - thr->shadow_stack;
+ uptr start = 0;
+ if (size + !!toppc > kStackTraceMax) {
+ start = size + !!toppc - kStackTraceMax;
+ size = kStackTraceMax - !!toppc;
+ }
+ stack->Init(&thr->shadow_stack[start], size, toppc);
+}
+
void StatAggregate(u64 *dst, u64 *src);
void StatOutput(u64 *stat);
@@ -552,9 +562,8 @@ void ForkChildAfter(ThreadState *thr, uptr pc);
void ReportRace(ThreadState *thr);
bool OutputReport(ThreadState *thr, const ScopedReport &srep);
-bool IsFiredSuppression(Context *ctx,
- const ScopedReport &srep,
- const StackTrace &trace);
+bool IsFiredSuppression(Context *ctx, const ScopedReport &srep,
+ StackTrace trace);
bool IsExpectedReport(uptr addr, uptr size);
void PrintMatchedBenignRaces();
bool FrameIsInternal(const ReportStack *frame);
@@ -575,7 +584,7 @@ ReportStack *SkipTsanInternalFrames(ReportStack *ent);
u32 CurrentStackId(ThreadState *thr, uptr pc);
ReportStack *SymbolizeStackId(u32 stack_id);
void PrintCurrentStack(ThreadState *thr, uptr pc);
-void PrintCurrentStackSlow(); // uses libunwind
+void PrintCurrentStackSlow(uptr pc); // uses libunwind
void Initialize(ThreadState *thr);
int Finalize(ThreadState *thr);
diff --git a/libsanitizer/tsan/tsan_rtl_amd64.S b/libsanitizer/tsan/tsan_rtl_amd64.S
index 71a2ecda9dd..6df36a500a7 100644
--- a/libsanitizer/tsan/tsan_rtl_amd64.S
+++ b/libsanitizer/tsan/tsan_rtl_amd64.S
@@ -170,10 +170,15 @@ setjmp:
CFI_ADJUST_CFA_OFFSET(8)
CFI_REL_OFFSET(%rdi, 0)
// obtain %rsp
+#if defined(__FreeBSD__)
+ lea 8(%rsp), %rdi
+ mov %rdi, %rsi
+#else
lea 16(%rsp), %rdi
mov %rdi, %rsi
xor %fs:0x30, %rsi // magic mangling of rsp (see libc setjmp)
rol $0x11, %rsi
+#endif
// call tsan interceptor
call __tsan_setjmp
// restore env parameter
@@ -197,10 +202,15 @@ _setjmp:
CFI_ADJUST_CFA_OFFSET(8)
CFI_REL_OFFSET(%rdi, 0)
// obtain %rsp
+#if defined(__FreeBSD__)
+ lea 8(%rsp), %rdi
+ mov %rdi, %rsi
+#else
lea 16(%rsp), %rdi
mov %rdi, %rsi
xor %fs:0x30, %rsi // magic mangling of rsp (see libc setjmp)
rol $0x11, %rsi
+#endif
// call tsan interceptor
call __tsan_setjmp
// restore env parameter
@@ -231,10 +241,15 @@ sigsetjmp:
sub $8, %rsp
CFI_ADJUST_CFA_OFFSET(8)
// obtain %rsp
+#if defined(__FreeBSD__)
+ lea 24(%rsp), %rdi
+ mov %rdi, %rsi
+#else
lea 32(%rsp), %rdi
mov %rdi, %rsi
xor %fs:0x30, %rsi // magic mangling of rsp (see libc setjmp)
rol $0x11, %rsi
+#endif
// call tsan interceptor
call __tsan_setjmp
// unalign stack frame
@@ -272,10 +287,15 @@ __sigsetjmp:
sub $8, %rsp
CFI_ADJUST_CFA_OFFSET(8)
// obtain %rsp
+#if defined(__FreeBSD__)
+ lea 24(%rsp), %rdi
+ mov %rdi, %rsi
+#else
lea 32(%rsp), %rdi
mov %rdi, %rsi
xor %fs:0x30, %rsi // magic mangling of rsp (see libc setjmp)
rol $0x11, %rsi
+#endif
// call tsan interceptor
call __tsan_setjmp
// unalign stack frame
@@ -296,7 +316,7 @@ __sigsetjmp:
CFI_ENDPROC
.size __sigsetjmp, .-__sigsetjmp
-#ifdef __linux__
+#if defined(__FreeBSD__) || defined(__linux__)
/* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits
#endif
diff --git a/libsanitizer/tsan/tsan_rtl_mutex.cc b/libsanitizer/tsan/tsan_rtl_mutex.cc
index cc183138aba..d731b4bfb59 100644
--- a/libsanitizer/tsan/tsan_rtl_mutex.cc
+++ b/libsanitizer/tsan/tsan_rtl_mutex.cc
@@ -57,9 +57,9 @@ static void ReportMutexMisuse(ThreadState *thr, uptr pc, ReportType typ,
ThreadRegistryLock l(ctx->thread_registry);
ScopedReport rep(typ);
rep.AddMutex(mid);
- StackTrace trace;
- trace.ObtainCurrent(thr, pc);
- rep.AddStack(&trace, true);
+ VarSizeStackTrace trace;
+ ObtainCurrentStack(thr, pc, &trace);
+ rep.AddStack(trace, true);
rep.AddLocation(addr, 1);
OutputReport(thr, rep);
}
@@ -122,12 +122,12 @@ void MutexDestroy(ThreadState *thr, uptr pc, uptr addr) {
ThreadRegistryLock l(ctx->thread_registry);
ScopedReport rep(ReportTypeMutexDestroyLocked);
rep.AddMutex(mid);
- StackTrace trace;
- trace.ObtainCurrent(thr, pc);
- rep.AddStack(&trace);
+ VarSizeStackTrace trace;
+ ObtainCurrentStack(thr, pc, &trace);
+ rep.AddStack(trace);
FastState last(last_lock);
RestoreStack(last.tid(), last.epoch(), &trace, 0);
- rep.AddStack(&trace, true);
+ rep.AddStack(trace, true);
rep.AddLocation(addr, 1);
OutputReport(thr, rep);
}
@@ -470,21 +470,17 @@ void ReportDeadlock(ThreadState *thr, uptr pc, DDReport *r) {
rep.AddUniqueTid((int)r->loop[i].thr_ctx);
rep.AddThread((int)r->loop[i].thr_ctx);
}
- InternalScopedBuffer<StackTrace> stacks(2 * DDReport::kMaxLoopSize);
uptr dummy_pc = 0x42;
for (int i = 0; i < r->n; i++) {
- uptr size;
for (int j = 0; j < (flags()->second_deadlock_stack ? 2 : 1); j++) {
u32 stk = r->loop[i].stk[j];
if (stk) {
- const uptr *trace = StackDepotGet(stk, &size);
- stacks[i].Init(const_cast<uptr *>(trace), size);
+ rep.AddStack(StackDepotGet(stk), true);
} else {
// Sometimes we fail to extract the stack trace (FIXME: investigate),
// but we should still produce some stack trace in the report.
- stacks[i].Init(&dummy_pc, 1);
+ rep.AddStack(StackTrace(&dummy_pc, 1), true);
}
- rep.AddStack(&stacks[i], true);
}
}
OutputReport(thr, rep);
diff --git a/libsanitizer/tsan/tsan_rtl_report.cc b/libsanitizer/tsan/tsan_rtl_report.cc
index eafd1f4dfcd..11ec8381de6 100644
--- a/libsanitizer/tsan/tsan_rtl_report.cc
+++ b/libsanitizer/tsan/tsan_rtl_report.cc
@@ -28,7 +28,7 @@ namespace __tsan {
using namespace __sanitizer; // NOLINT
-static ReportStack *SymbolizeStack(const StackTrace& trace);
+static ReportStack *SymbolizeStack(StackTrace trace);
void TsanCheckFailed(const char *file, int line, const char *cond,
u64 v1, u64 v2) {
@@ -39,7 +39,7 @@ void TsanCheckFailed(const char *file, int line, const char *cond,
Printf("FATAL: ThreadSanitizer CHECK failed: "
"%s:%d \"%s\" (0x%zx, 0x%zx)\n",
file, line, cond, (uptr)v1, (uptr)v2);
- PrintCurrentStackSlow();
+ PrintCurrentStackSlow(StackTrace::GetCurrentPc());
Die();
}
@@ -57,27 +57,16 @@ bool WEAK OnReport(const ReportDesc *rep, bool suppressed) {
static void StackStripMain(ReportStack *stack) {
ReportStack *last_frame = 0;
ReportStack *last_frame2 = 0;
- const char *prefix = "__interceptor_";
- uptr prefix_len = internal_strlen(prefix);
- const char *path_prefix = common_flags()->strip_path_prefix;
- uptr path_prefix_len = internal_strlen(path_prefix);
- char *pos;
for (ReportStack *ent = stack; ent; ent = ent->next) {
- if (ent->func && 0 == internal_strncmp(ent->func, prefix, prefix_len))
- ent->func += prefix_len;
- if (ent->file && (pos = internal_strstr(ent->file, path_prefix)))
- ent->file = pos + path_prefix_len;
- if (ent->file && ent->file[0] == '.' && ent->file[1] == '/')
- ent->file += 2;
last_frame2 = last_frame;
last_frame = ent;
}
if (last_frame2 == 0)
return;
- const char *last = last_frame->func;
+ const char *last = last_frame->info.function;
#ifndef TSAN_GO
- const char *last2 = last_frame2->func;
+ const char *last2 = last_frame2->info.function;
// Strip frame above 'main'
if (last2 && 0 == internal_strcmp(last2, "main")) {
last_frame2->next = 0;
@@ -105,39 +94,36 @@ static void StackStripMain(ReportStack *stack) {
ReportStack *SymbolizeStackId(u32 stack_id) {
if (stack_id == 0)
return 0;
- uptr ssz = 0;
- const uptr *stack = StackDepotGet(stack_id, &ssz);
- if (stack == 0)
- return 0;
- StackTrace trace;
- trace.Init(stack, ssz);
- return SymbolizeStack(trace);
+ StackTrace stack = StackDepotGet(stack_id);
+ if (stack.trace == nullptr)
+ return nullptr;
+ return SymbolizeStack(stack);
}
-static ReportStack *SymbolizeStack(const StackTrace& trace) {
- if (trace.IsEmpty())
+static ReportStack *SymbolizeStack(StackTrace trace) {
+ if (trace.size == 0)
return 0;
ReportStack *stack = 0;
- for (uptr si = 0; si < trace.Size(); si++) {
- const uptr pc = trace.Get(si);
+ for (uptr si = 0; si < trace.size; si++) {
+ const uptr pc = trace.trace[si];
#ifndef TSAN_GO
// We obtain the return address, that is, address of the next instruction,
// so offset it by 1 byte.
- const uptr pc1 = __sanitizer::StackTrace::GetPreviousInstructionPc(pc);
+ const uptr pc1 = StackTrace::GetPreviousInstructionPc(pc);
#else
// FIXME(dvyukov): Go sometimes uses address of a function as top pc.
uptr pc1 = pc;
- if (si != trace.Size() - 1)
+ if (si != trace.size - 1)
pc1 -= 1;
#endif
ReportStack *ent = SymbolizeCode(pc1);
CHECK_NE(ent, 0);
ReportStack *last = ent;
while (last->next) {
- last->pc = pc; // restore original pc for report
+ last->info.address = pc; // restore original pc for report
last = last->next;
}
- last->pc = pc; // restore original pc for report
+ last->info.address = pc; // restore original pc for report
last->next = stack;
stack = ent;
}
@@ -160,14 +146,14 @@ ScopedReport::~ScopedReport() {
DestroyAndFree(rep_);
}
-void ScopedReport::AddStack(const StackTrace *stack, bool suppressable) {
+void ScopedReport::AddStack(StackTrace stack, bool suppressable) {
ReportStack **rs = rep_->stacks.PushBack();
- *rs = SymbolizeStack(*stack);
+ *rs = SymbolizeStack(stack);
(*rs)->suppressable = suppressable;
}
-void ScopedReport::AddMemoryAccess(uptr addr, Shadow s,
- const StackTrace *stack, const MutexSet *mset) {
+void ScopedReport::AddMemoryAccess(uptr addr, Shadow s, StackTrace stack,
+ const MutexSet *mset) {
void *mem = internal_alloc(MBlockReportMop, sizeof(ReportMop));
ReportMop *mop = new(mem) ReportMop;
rep_->mops.PushBack(mop);
@@ -176,7 +162,7 @@ void ScopedReport::AddMemoryAccess(uptr addr, Shadow s,
mop->size = s.size();
mop->write = s.IsWrite();
mop->atomic = s.IsAtomic();
- mop->stack = SymbolizeStack(*stack);
+ mop->stack = SymbolizeStack(stack);
if (mop->stack)
mop->stack->suppressable = true;
for (uptr i = 0; i < mset->Size(); i++) {
@@ -315,13 +301,11 @@ void ScopedReport::AddLocation(uptr addr, uptr size) {
int creat_tid = -1;
u32 creat_stack = 0;
if (FdLocation(addr, &fd, &creat_tid, &creat_stack)) {
- void *mem = internal_alloc(MBlockReportLoc, sizeof(ReportLocation));
- ReportLocation *loc = new(mem) ReportLocation();
- rep_->locs.PushBack(loc);
- loc->type = ReportLocationFD;
+ ReportLocation *loc = ReportLocation::New(ReportLocationFD);
loc->fd = fd;
loc->tid = creat_tid;
loc->stack = SymbolizeStackId(creat_stack);
+ rep_->locs.PushBack(loc);
ThreadContext *tctx = FindThreadByUidLocked(creat_tid);
if (tctx)
AddThread(tctx);
@@ -336,33 +320,25 @@ void ScopedReport::AddLocation(uptr addr, uptr size) {
}
if (b != 0) {
ThreadContext *tctx = FindThreadByTidLocked(b->tid);
- void *mem = internal_alloc(MBlockReportLoc, sizeof(ReportLocation));
- ReportLocation *loc = new(mem) ReportLocation();
- rep_->locs.PushBack(loc);
- loc->type = ReportLocationHeap;
- loc->addr = (uptr)allocator()->GetBlockBegin((void*)addr);
- loc->size = b->siz;
+ ReportLocation *loc = ReportLocation::New(ReportLocationHeap);
+ loc->heap_chunk_start = (uptr)allocator()->GetBlockBegin((void *)addr);
+ loc->heap_chunk_size = b->siz;
loc->tid = tctx ? tctx->tid : b->tid;
- loc->name = 0;
- loc->file = 0;
- loc->line = 0;
- loc->stack = 0;
loc->stack = SymbolizeStackId(b->stk);
+ rep_->locs.PushBack(loc);
if (tctx)
AddThread(tctx);
return;
}
bool is_stack = false;
if (ThreadContext *tctx = IsThreadStackOrTls(addr, &is_stack)) {
- void *mem = internal_alloc(MBlockReportLoc, sizeof(ReportLocation));
- ReportLocation *loc = new(mem) ReportLocation();
- rep_->locs.PushBack(loc);
- loc->type = is_stack ? ReportLocationStack : ReportLocationTLS;
+ ReportLocation *loc =
+ ReportLocation::New(is_stack ? ReportLocationStack : ReportLocationTLS);
loc->tid = tctx->tid;
+ rep_->locs.PushBack(loc);
AddThread(tctx);
}
- ReportLocation *loc = SymbolizeData(addr);
- if (loc) {
+ if (ReportLocation *loc = SymbolizeData(addr)) {
loc->suppressable = true;
rep_->locs.PushBack(loc);
return;
@@ -384,7 +360,8 @@ const ReportDesc *ScopedReport::GetReport() const {
return rep_;
}
-void RestoreStack(int tid, const u64 epoch, StackTrace *stk, MutexSet *mset) {
+void RestoreStack(int tid, const u64 epoch, VarSizeStackTrace *stk,
+ MutexSet *mset) {
// This function restores stack trace and mutex set for the thread/epoch.
// It does so by getting stack trace and mutex set at the beginning of
// trace part, and then replaying the trace till the given epoch.
@@ -409,13 +386,13 @@ void RestoreStack(int tid, const u64 epoch, StackTrace *stk, MutexSet *mset) {
DPrintf("#%d: RestoreStack epoch=%zu ebegin=%zu eend=%zu partidx=%d\n",
tid, (uptr)epoch, (uptr)ebegin, (uptr)eend, partidx);
InternalScopedBuffer<uptr> stack(kShadowStackSize);
- for (uptr i = 0; i < hdr->stack0.Size(); i++) {
- stack[i] = hdr->stack0.Get(i);
+ for (uptr i = 0; i < hdr->stack0.size; i++) {
+ stack[i] = hdr->stack0.trace[i];
DPrintf2(" #%02lu: pc=%zx\n", i, stack[i]);
}
if (mset)
*mset = hdr->mset0;
- uptr pos = hdr->stack0.Size();
+ uptr pos = hdr->stack0.size;
Event *events = (Event*)GetThreadTrace(tid);
for (uptr i = ebegin; i <= eend; i++) {
Event ev = events[i];
@@ -450,13 +427,13 @@ void RestoreStack(int tid, const u64 epoch, StackTrace *stk, MutexSet *mset) {
stk->Init(stack.data(), pos);
}
-static bool HandleRacyStacks(ThreadState *thr, const StackTrace (&traces)[2],
- uptr addr_min, uptr addr_max) {
+static bool HandleRacyStacks(ThreadState *thr, VarSizeStackTrace traces[2],
+ uptr addr_min, uptr addr_max) {
bool equal_stack = false;
RacyStacks hash;
if (flags()->suppress_equal_stacks) {
- hash.hash[0] = md5_hash(traces[0].Begin(), traces[0].Size() * sizeof(uptr));
- hash.hash[1] = md5_hash(traces[1].Begin(), traces[1].Size() * sizeof(uptr));
+ hash.hash[0] = md5_hash(traces[0].trace, traces[0].size * sizeof(uptr));
+ hash.hash[1] = md5_hash(traces[1].trace, traces[1].size * sizeof(uptr));
for (uptr i = 0; i < ctx->racy_stacks.Size(); i++) {
if (hash == ctx->racy_stacks[i]) {
DPrintf("ThreadSanitizer: suppressing report as doubled (stack)\n");
@@ -489,12 +466,12 @@ static bool HandleRacyStacks(ThreadState *thr, const StackTrace (&traces)[2],
return false;
}
-static void AddRacyStacks(ThreadState *thr, const StackTrace (&traces)[2],
- uptr addr_min, uptr addr_max) {
+static void AddRacyStacks(ThreadState *thr, VarSizeStackTrace traces[2],
+ uptr addr_min, uptr addr_max) {
if (flags()->suppress_equal_stacks) {
RacyStacks hash;
- hash.hash[0] = md5_hash(traces[0].Begin(), traces[0].Size() * sizeof(uptr));
- hash.hash[1] = md5_hash(traces[1].Begin(), traces[1].Size() * sizeof(uptr));
+ hash.hash[0] = md5_hash(traces[0].trace, traces[0].size * sizeof(uptr));
+ hash.hash[1] = md5_hash(traces[1].trace, traces[1].size * sizeof(uptr));
ctx->racy_stacks.PushBack(hash);
}
if (flags()->suppress_equal_addresses) {
@@ -535,15 +512,14 @@ bool OutputReport(ThreadState *thr, const ScopedReport &srep) {
return true;
}
-bool IsFiredSuppression(Context *ctx,
- const ScopedReport &srep,
- const StackTrace &trace) {
+bool IsFiredSuppression(Context *ctx, const ScopedReport &srep,
+ StackTrace trace) {
for (uptr k = 0; k < ctx->fired_suppressions.size(); k++) {
if (ctx->fired_suppressions[k].type != srep.GetReport()->typ)
continue;
- for (uptr j = 0; j < trace.Size(); j++) {
+ for (uptr j = 0; j < trace.size; j++) {
FiredSuppression *s = &ctx->fired_suppressions[k];
- if (trace.Get(j) == s->pc) {
+ if (trace.trace[j] == s->pc) {
if (s->supp)
s->supp->hit_count++;
return true;
@@ -570,10 +546,13 @@ static bool IsFiredSuppression(Context *ctx,
}
bool FrameIsInternal(const ReportStack *frame) {
- return frame != 0 && frame->file != 0
- && (internal_strstr(frame->file, "tsan_interceptors.cc") ||
- internal_strstr(frame->file, "sanitizer_common_interceptors.inc") ||
- internal_strstr(frame->file, "tsan_interface_"));
+ if (frame == 0)
+ return false;
+ const char *file = frame->info.file;
+ return file != 0 &&
+ (internal_strstr(file, "tsan_interceptors.cc") ||
+ internal_strstr(file, "sanitizer_common_interceptors.inc") ||
+ internal_strstr(file, "tsan_interface_"));
}
static bool RaceBetweenAtomicAndFree(ThreadState *thr) {
@@ -625,7 +604,9 @@ void ReportRace(ThreadState *thr) {
ThreadRegistryLock l0(ctx->thread_registry);
ReportType typ = ReportTypeRace;
- if (thr->is_vptr_access)
+ if (thr->is_vptr_access && freed)
+ typ = ReportTypeVptrUseAfterFree;
+ else if (thr->is_vptr_access)
typ = ReportTypeVptrRace;
else if (freed)
typ = ReportTypeUseAfterFree;
@@ -633,9 +614,9 @@ void ReportRace(ThreadState *thr) {
if (IsFiredSuppression(ctx, rep, addr))
return;
const uptr kMop = 2;
- StackTrace traces[kMop];
+ VarSizeStackTrace traces[kMop];
const uptr toppc = TraceTopPC(thr);
- traces[0].ObtainCurrent(thr, toppc);
+ ObtainCurrentStack(thr, toppc, &traces[0]);
if (IsFiredSuppression(ctx, rep, traces[0]))
return;
InternalScopedBuffer<MutexSet> mset2(1);
@@ -650,7 +631,7 @@ void ReportRace(ThreadState *thr) {
for (uptr i = 0; i < kMop; i++) {
Shadow s(thr->racy_state[i]);
- rep.AddMemoryAccess(addr, s, &traces[i],
+ rep.AddMemoryAccess(addr, s, traces[i],
i == 0 ? &thr->mset : mset2.data());
}
@@ -680,26 +661,33 @@ void ReportRace(ThreadState *thr) {
}
void PrintCurrentStack(ThreadState *thr, uptr pc) {
- StackTrace trace;
- trace.ObtainCurrent(thr, pc);
+ VarSizeStackTrace trace;
+ ObtainCurrentStack(thr, pc, &trace);
PrintStack(SymbolizeStack(trace));
}
-void PrintCurrentStackSlow() {
+void PrintCurrentStackSlow(uptr pc) {
#ifndef TSAN_GO
- __sanitizer::StackTrace *ptrace = new(internal_alloc(MBlockStackTrace,
- sizeof(__sanitizer::StackTrace))) __sanitizer::StackTrace;
- ptrace->Unwind(kStackTraceMax, __sanitizer::StackTrace::GetCurrentPc(), 0, 0,
- 0, 0, false);
+ BufferedStackTrace *ptrace =
+ new(internal_alloc(MBlockStackTrace, sizeof(BufferedStackTrace)))
+ BufferedStackTrace();
+ ptrace->Unwind(kStackTraceMax, pc, 0, 0, 0, 0, false);
for (uptr i = 0; i < ptrace->size / 2; i++) {
- uptr tmp = ptrace->trace[i];
- ptrace->trace[i] = ptrace->trace[ptrace->size - i - 1];
- ptrace->trace[ptrace->size - i - 1] = tmp;
+ uptr tmp = ptrace->trace_buffer[i];
+ ptrace->trace_buffer[i] = ptrace->trace_buffer[ptrace->size - i - 1];
+ ptrace->trace_buffer[ptrace->size - i - 1] = tmp;
}
- StackTrace trace;
- trace.Init(ptrace->trace, ptrace->size);
- PrintStack(SymbolizeStack(trace));
+ PrintStack(SymbolizeStack(*ptrace));
#endif
}
} // namespace __tsan
+
+using namespace __tsan;
+
+extern "C" {
+SANITIZER_INTERFACE_ATTRIBUTE
+void __sanitizer_print_stack_trace() {
+ PrintCurrentStackSlow(StackTrace::GetCurrentPc());
+}
+} // extern "C"
diff --git a/libsanitizer/tsan/tsan_stack_trace.cc b/libsanitizer/tsan/tsan_stack_trace.cc
index 45bd2517837..3734e0e4975 100644
--- a/libsanitizer/tsan/tsan_stack_trace.cc
+++ b/libsanitizer/tsan/tsan_stack_trace.cc
@@ -8,103 +8,37 @@
// This file is a part of ThreadSanitizer (TSan), a race detector.
//
//===----------------------------------------------------------------------===//
-//#include "sanitizer_common/sanitizer_placement_new.h"
#include "tsan_stack_trace.h"
#include "tsan_rtl.h"
#include "tsan_mman.h"
namespace __tsan {
-StackTrace::StackTrace()
- : n_()
- , s_()
- , c_() {
-}
-
-StackTrace::StackTrace(uptr *buf, uptr cnt)
- : n_()
- , s_(buf)
- , c_(cnt) {
- CHECK_NE(buf, 0);
- CHECK_NE(cnt, 0);
-}
-
-StackTrace::~StackTrace() {
- Reset();
-}
+VarSizeStackTrace::VarSizeStackTrace()
+ : StackTrace(nullptr, 0), trace_buffer(nullptr) {}
-void StackTrace::Reset() {
- if (s_ && !c_) {
- CHECK_NE(n_, 0);
- internal_free(s_);
- s_ = 0;
- }
- n_ = 0;
+VarSizeStackTrace::~VarSizeStackTrace() {
+ ResizeBuffer(0);
}
-void StackTrace::Init(const uptr *pcs, uptr cnt) {
- Reset();
- if (cnt == 0)
- return;
- if (c_) {
- CHECK_NE(s_, 0);
- CHECK_LE(cnt, c_);
- } else {
- s_ = (uptr*)internal_alloc(MBlockStackTrace, cnt * sizeof(s_[0]));
- }
- n_ = cnt;
- internal_memcpy(s_, pcs, cnt * sizeof(s_[0]));
-}
-
-void StackTrace::ObtainCurrent(ThreadState *thr, uptr toppc) {
- Reset();
- n_ = thr->shadow_stack_pos - thr->shadow_stack;
- if (n_ + !!toppc == 0)
- return;
- uptr start = 0;
- if (c_) {
- CHECK_NE(s_, 0);
- if (n_ + !!toppc > c_) {
- start = n_ - c_ + !!toppc;
- n_ = c_ - !!toppc;
- }
- } else {
- // Cap potentially huge stacks.
- if (n_ + !!toppc > kTraceStackSize) {
- start = n_ - kTraceStackSize + !!toppc;
- n_ = kTraceStackSize - !!toppc;
- }
- s_ = (uptr*)internal_alloc(MBlockStackTrace,
- (n_ + !!toppc) * sizeof(s_[0]));
- }
- for (uptr i = 0; i < n_; i++)
- s_[i] = thr->shadow_stack[start + i];
- if (toppc) {
- s_[n_] = toppc;
- n_++;
+void VarSizeStackTrace::ResizeBuffer(uptr new_size) {
+ if (trace_buffer) {
+ internal_free(trace_buffer);
}
-}
-
-void StackTrace::CopyFrom(const StackTrace& other) {
- Reset();
- Init(other.Begin(), other.Size());
-}
-
-bool StackTrace::IsEmpty() const {
- return n_ == 0;
-}
-
-uptr StackTrace::Size() const {
- return n_;
-}
-
-uptr StackTrace::Get(uptr i) const {
- CHECK_LT(i, n_);
- return s_[i];
-}
-
-const uptr *StackTrace::Begin() const {
- return s_;
+ trace_buffer =
+ (new_size > 0)
+ ? (uptr *)internal_alloc(MBlockStackTrace,
+ new_size * sizeof(trace_buffer[0]))
+ : nullptr;
+ trace = trace_buffer;
+ size = new_size;
+}
+
+void VarSizeStackTrace::Init(const uptr *pcs, uptr cnt, uptr extra_top_pc) {
+ ResizeBuffer(cnt + !!extra_top_pc);
+ internal_memcpy(trace_buffer, pcs, cnt * sizeof(trace_buffer[0]));
+ if (extra_top_pc)
+ trace_buffer[cnt] = extra_top_pc;
}
} // namespace __tsan
diff --git a/libsanitizer/tsan/tsan_stack_trace.h b/libsanitizer/tsan/tsan_stack_trace.h
index ce0cb8859d2..b097a9b2696 100644
--- a/libsanitizer/tsan/tsan_stack_trace.h
+++ b/libsanitizer/tsan/tsan_stack_trace.h
@@ -11,40 +11,25 @@
#ifndef TSAN_STACK_TRACE_H
#define TSAN_STACK_TRACE_H
-//#include "sanitizer_common/sanitizer_atomic.h"
-//#include "sanitizer_common/sanitizer_common.h"
-//#include "sanitizer_common/sanitizer_deadlock_detector_interface.h"
+#include "sanitizer_common/sanitizer_stacktrace.h"
#include "tsan_defs.h"
-//#include "tsan_clock.h"
-//#include "tsan_mutex.h"
-//#include "tsan_dense_alloc.h"
namespace __tsan {
-class StackTrace {
- public:
- StackTrace();
- // Initialized the object in "static mode",
- // in this mode it never calls malloc/free but uses the provided buffer.
- StackTrace(uptr *buf, uptr cnt);
- ~StackTrace();
- void Reset();
-
- void Init(const uptr *pcs, uptr cnt);
- void ObtainCurrent(ThreadState *thr, uptr toppc);
- bool IsEmpty() const;
- uptr Size() const;
- uptr Get(uptr i) const;
- const uptr *Begin() const;
- void CopyFrom(const StackTrace& other);
+// StackTrace which calls malloc/free to allocate the buffer for
+// addresses in stack traces.
+struct VarSizeStackTrace : public StackTrace {
+ uptr *trace_buffer; // Owned.
+
+ VarSizeStackTrace();
+ ~VarSizeStackTrace();
+ void Init(const uptr *pcs, uptr cnt, uptr extra_top_pc = 0);
private:
- uptr n_;
- uptr *s_;
- const uptr c_;
+ void ResizeBuffer(uptr new_size);
- StackTrace(const StackTrace&);
- void operator = (const StackTrace&);
+ VarSizeStackTrace(const VarSizeStackTrace &);
+ void operator=(const VarSizeStackTrace &);
};
} // namespace __tsan
diff --git a/libsanitizer/tsan/tsan_suppressions.cc b/libsanitizer/tsan/tsan_suppressions.cc
index 6b42d3a67b8..76460d90d92 100644
--- a/libsanitizer/tsan/tsan_suppressions.cc
+++ b/libsanitizer/tsan/tsan_suppressions.cc
@@ -58,6 +58,8 @@ SuppressionType conv(ReportType typ) {
return SuppressionRace;
else if (typ == ReportTypeUseAfterFree)
return SuppressionRace;
+ else if (typ == ReportTypeVptrUseAfterFree)
+ return SuppressionRace;
else if (typ == ReportTypeThreadLeak)
return SuppressionThread;
else if (typ == ReportTypeMutexDestroyLocked)
@@ -89,13 +91,14 @@ uptr IsSuppressed(ReportType typ, const ReportStack *stack, Suppression **sp) {
return 0;
Suppression *s;
for (const ReportStack *frame = stack; frame; frame = frame->next) {
- if (SuppressionContext::Get()->Match(frame->func, stype, &s) ||
- SuppressionContext::Get()->Match(frame->file, stype, &s) ||
- SuppressionContext::Get()->Match(frame->module, stype, &s)) {
+ const AddressInfo &info = frame->info;
+ if (SuppressionContext::Get()->Match(info.function, stype, &s) ||
+ SuppressionContext::Get()->Match(info.file, stype, &s) ||
+ SuppressionContext::Get()->Match(info.module, stype, &s)) {
DPrintf("ThreadSanitizer: matched suppression '%s'\n", s->templ);
s->hit_count++;
*sp = s;
- return frame->pc;
+ return info.address;
}
}
return 0;
@@ -109,13 +112,13 @@ uptr IsSuppressed(ReportType typ, const ReportLocation *loc, Suppression **sp) {
if (stype == SuppressionNone)
return 0;
Suppression *s;
- if (SuppressionContext::Get()->Match(loc->name, stype, &s) ||
- SuppressionContext::Get()->Match(loc->file, stype, &s) ||
- SuppressionContext::Get()->Match(loc->module, stype, &s)) {
+ const DataInfo &global = loc->global;
+ if (SuppressionContext::Get()->Match(global.name, stype, &s) ||
+ SuppressionContext::Get()->Match(global.module, stype, &s)) {
DPrintf("ThreadSanitizer: matched suppression '%s'\n", s->templ);
s->hit_count++;
*sp = s;
- return loc->addr;
+ return global.start;
}
return 0;
}
diff --git a/libsanitizer/tsan/tsan_symbolize.cc b/libsanitizer/tsan/tsan_symbolize.cc
index 49ae3dffa47..795f838991b 100644
--- a/libsanitizer/tsan/tsan_symbolize.cc
+++ b/libsanitizer/tsan/tsan_symbolize.cc
@@ -34,38 +34,6 @@ void ExitSymbolizer() {
thr->ignore_interceptors--;
}
-ReportStack *NewReportStackEntry(uptr addr) {
- ReportStack *ent = (ReportStack*)internal_alloc(MBlockReportStack,
- sizeof(ReportStack));
- internal_memset(ent, 0, sizeof(*ent));
- ent->pc = addr;
- return ent;
-}
-
-static ReportStack *NewReportStackEntry(const AddressInfo &info) {
- ReportStack *ent = NewReportStackEntry(info.address);
- ent->module = StripModuleName(info.module);
- ent->offset = info.module_offset;
- if (info.function)
- ent->func = internal_strdup(info.function);
- if (info.file)
- ent->file = internal_strdup(info.file);
- ent->line = info.line;
- ent->col = info.column;
- return ent;
-}
-
-
- ReportStack *next;
- char *module;
- uptr offset;
- uptr pc;
- char *func;
- char *file;
- int line;
- int col;
-
-
// Denotes fake PC values that come from JIT/JAVA/etc.
// For such PC values __tsan_symbolize_external() will be called.
const uptr kExternalPCBit = 1ULL << 60;
@@ -93,16 +61,14 @@ ReportStack *SymbolizeCode(uptr addr) {
static char func_buf[1024];
static char file_buf[1024];
int line, col;
+ ReportStack *ent = ReportStack::New(addr);
if (!__tsan_symbolize_external(addr, func_buf, sizeof(func_buf),
file_buf, sizeof(file_buf), &line, &col))
- return NewReportStackEntry(addr);
- ReportStack *ent = NewReportStackEntry(addr);
- ent->module = 0;
- ent->offset = 0;
- ent->func = internal_strdup(func_buf);
- ent->file = internal_strdup(file_buf);
- ent->line = line;
- ent->col = col;
+ return ent;
+ ent->info.function = internal_strdup(func_buf);
+ ent->info.file = internal_strdup(file_buf);
+ ent->info.line = line;
+ ent->info.column = col;
return ent;
}
static const uptr kMaxAddrFrames = 16;
@@ -112,13 +78,12 @@ ReportStack *SymbolizeCode(uptr addr) {
uptr addr_frames_num = Symbolizer::GetOrInit()->SymbolizePC(
addr, addr_frames.data(), kMaxAddrFrames);
if (addr_frames_num == 0)
- return NewReportStackEntry(addr);
+ return ReportStack::New(addr);
ReportStack *top = 0;
ReportStack *bottom = 0;
for (uptr i = 0; i < addr_frames_num; i++) {
- ReportStack *cur_entry = NewReportStackEntry(addr_frames[i]);
- CHECK(cur_entry);
- addr_frames[i].Clear();
+ ReportStack *cur_entry = ReportStack::New(addr);
+ cur_entry->info = addr_frames[i];
if (i == 0)
top = cur_entry;
else
@@ -132,16 +97,8 @@ ReportLocation *SymbolizeData(uptr addr) {
DataInfo info;
if (!Symbolizer::GetOrInit()->SymbolizeData(addr, &info))
return 0;
- ReportLocation *ent = (ReportLocation*)internal_alloc(MBlockReportStack,
- sizeof(ReportLocation));
- internal_memset(ent, 0, sizeof(*ent));
- ent->type = ReportLocationGlobal;
- ent->module = StripModuleName(info.module);
- ent->offset = info.module_offset;
- if (info.name)
- ent->name = internal_strdup(info.name);
- ent->addr = info.start;
- ent->size = info.size;
+ ReportLocation *ent = ReportLocation::New(ReportLocationGlobal);
+ ent->global = info;
return ent;
}
diff --git a/libsanitizer/tsan/tsan_trace.h b/libsanitizer/tsan/tsan_trace.h
index af140686f5d..8eceb634a53 100644
--- a/libsanitizer/tsan/tsan_trace.h
+++ b/libsanitizer/tsan/tsan_trace.h
@@ -40,21 +40,15 @@ enum EventType {
typedef u64 Event;
struct TraceHeader {
- StackTrace stack0; // Start stack for the trace.
- u64 epoch0; // Start epoch for the trace.
- MutexSet mset0;
-#ifndef TSAN_GO
- uptr stack0buf[kTraceStackSize];
-#endif
-
- TraceHeader()
#ifndef TSAN_GO
- : stack0(stack0buf, kTraceStackSize)
+ BufferedStackTrace stack0; // Start stack for the trace.
#else
- : stack0()
+ VarSizeStackTrace stack0;
#endif
- , epoch0() {
- }
+ u64 epoch0; // Start epoch for the trace.
+ MutexSet mset0;
+
+ TraceHeader() : stack0(), epoch0() {}
};
struct Trace {
diff --git a/libsanitizer/ubsan/Makefile.am b/libsanitizer/ubsan/Makefile.am
index e1aa7080a89..12d1ffac8f5 100644
--- a/libsanitizer/ubsan/Makefile.am
+++ b/libsanitizer/ubsan/Makefile.am
@@ -6,6 +6,7 @@ gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
DEFS = -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DPIC
AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros
AM_CXXFLAGS += $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
+AM_CXXFLAGS += -std=gnu++11
ACLOCAL_AMFLAGS = -I m4
toolexeclib_LTLIBRARIES = libubsan.la
diff --git a/libsanitizer/ubsan/Makefile.in b/libsanitizer/ubsan/Makefile.in
index 02902f23ab8..0bec083fa75 100644
--- a/libsanitizer/ubsan/Makefile.in
+++ b/libsanitizer/ubsan/Makefile.in
@@ -256,7 +256,8 @@ gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic \
-Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti \
-fomit-frame-pointer -funwind-tables -fvisibility=hidden \
- -Wno-variadic-macros $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
+ -Wno-variadic-macros $(LIBSTDCXX_RAW_CXX_CXXFLAGS) \
+ -std=gnu++11
ACLOCAL_AMFLAGS = -I m4
toolexeclib_LTLIBRARIES = libubsan.la
ubsan_files = \
diff --git a/libsanitizer/ubsan/ubsan_diag.cc b/libsanitizer/ubsan/ubsan_diag.cc
index 828127ab84d..028ac1a9b97 100644
--- a/libsanitizer/ubsan/ubsan_diag.cc
+++ b/libsanitizer/ubsan/ubsan_diag.cc
@@ -14,6 +14,7 @@
#include "ubsan_flags.h"
#include "sanitizer_common/sanitizer_report_decorator.h"
#include "sanitizer_common/sanitizer_stacktrace.h"
+#include "sanitizer_common/sanitizer_stacktrace_printer.h"
#include "sanitizer_common/sanitizer_symbolizer.h"
#include <stdio.h>
@@ -31,7 +32,7 @@ static void MaybePrintStackTrace(uptr pc, uptr bp) {
// under ASan).
if (StackTrace::WillUseFastUnwind(false))
return;
- StackTrace stack;
+ BufferedStackTrace stack;
stack.Unwind(kStackTraceMax, pc, bp, 0, 0, 0, false);
stack.Print();
}
@@ -44,12 +45,12 @@ static void MaybeReportErrorSummary(Location Loc) {
if (Loc.isSourceLocation()) {
SourceLocation SLoc = Loc.getSourceLocation();
if (!SLoc.isInvalid()) {
- ReportErrorSummary("runtime-error", SLoc.getFilename(), SLoc.getLine(),
- "");
+ ReportErrorSummary("undefined-behavior", SLoc.getFilename(),
+ SLoc.getLine(), "");
return;
}
}
- ReportErrorSummary("runtime-error");
+ ReportErrorSummary("undefined-behavior");
}
namespace {
@@ -127,14 +128,16 @@ static void renderLocation(Location Loc) {
if (SLoc.isInvalid())
LocBuffer.append("<unknown>");
else
- PrintSourceLocation(&LocBuffer, SLoc.getFilename(), SLoc.getLine(),
- SLoc.getColumn());
+ RenderSourceLocation(&LocBuffer, SLoc.getFilename(), SLoc.getLine(),
+ SLoc.getColumn(), common_flags()->strip_path_prefix);
break;
}
- case Location::LK_Module:
- PrintModuleAndOffset(&LocBuffer, Loc.getModuleLocation().getModuleName(),
- Loc.getModuleLocation().getOffset());
+ case Location::LK_Module: {
+ ModuleLocation MLoc = Loc.getModuleLocation();
+ RenderModuleLocation(&LocBuffer, MLoc.getModuleName(), MLoc.getOffset(),
+ common_flags()->strip_path_prefix);
break;
+ }
case Location::LK_Memory:
LocBuffer.append("%p", Loc.getMemoryLocation());
break;
diff --git a/libsanitizer/ubsan/ubsan_handlers.cc b/libsanitizer/ubsan/ubsan_handlers.cc
index bb9322f068f..770d3c28a4a 100644
--- a/libsanitizer/ubsan/ubsan_handlers.cc
+++ b/libsanitizer/ubsan/ubsan_handlers.cc
@@ -28,10 +28,10 @@ static bool ignoreReport(SourceLocation SLoc, ReportOptions Opts) {
}
namespace __ubsan {
- const char *TypeCheckKinds[] = {
+const char *TypeCheckKinds[] = {
"load of", "store to", "reference binding to", "member access within",
- "member call on", "constructor call on", "downcast of", "downcast of"
- };
+ "member call on", "constructor call on", "downcast of", "downcast of",
+ "upcast of", "cast to virtual base of"};
}
static void handleTypeMismatchImpl(TypeMismatchData *Data, ValueHandle Pointer,
diff --git a/libsanitizer/ubsan/ubsan_type_hash.cc b/libsanitizer/ubsan/ubsan_type_hash.cc
index d01009426db..8758f6c84c5 100644
--- a/libsanitizer/ubsan/ubsan_type_hash.cc
+++ b/libsanitizer/ubsan/ubsan_type_hash.cc
@@ -113,7 +113,8 @@ __ubsan::__ubsan_vptr_type_cache[__ubsan::VptrTypeCacheSize];
/// \brief Determine whether \p Derived has a \p Base base class subobject at
/// offset \p Offset.
-static bool isDerivedFromAtOffset(const abi::__class_type_info *Derived,
+static bool isDerivedFromAtOffset(sptr Object,
+ const abi::__class_type_info *Derived,
const abi::__class_type_info *Base,
sptr Offset) {
if (Derived->__type_name == Base->__type_name)
@@ -121,7 +122,7 @@ static bool isDerivedFromAtOffset(const abi::__class_type_info *Derived,
if (const abi::__si_class_type_info *SI =
dynamic_cast<const abi::__si_class_type_info*>(Derived))
- return isDerivedFromAtOffset(SI->__base_type, Base, Offset);
+ return isDerivedFromAtOffset(Object, SI->__base_type, Base, Offset);
const abi::__vmi_class_type_info *VTI =
dynamic_cast<const abi::__vmi_class_type_info*>(Derived);
@@ -136,13 +137,13 @@ static bool isDerivedFromAtOffset(const abi::__class_type_info *Derived,
sptr OffsetHere = VTI->base_info[base].__offset_flags >>
abi::__base_class_type_info::__offset_shift;
if (VTI->base_info[base].__offset_flags &
- abi::__base_class_type_info::__virtual_mask)
- // For now, just punt on virtual bases and say 'yes'.
- // FIXME: OffsetHere is the offset in the vtable of the virtual base
- // offset. Read the vbase offset out of the vtable and use it.
- return true;
- if (isDerivedFromAtOffset(VTI->base_info[base].__base_type,
- Base, Offset - OffsetHere))
+ abi::__base_class_type_info::__virtual_mask) {
+ sptr VTable = *reinterpret_cast<const sptr *>(Object);
+ OffsetHere = *reinterpret_cast<const sptr *>(VTable + OffsetHere);
+ }
+ if (isDerivedFromAtOffset(Object + OffsetHere,
+ VTI->base_info[base].__base_type, Base,
+ Offset - OffsetHere))
return true;
}
@@ -151,14 +152,15 @@ static bool isDerivedFromAtOffset(const abi::__class_type_info *Derived,
/// \brief Find the derived-most dynamic base class of \p Derived at offset
/// \p Offset.
-static const abi::__class_type_info *findBaseAtOffset(
- const abi::__class_type_info *Derived, sptr Offset) {
+static const abi::__class_type_info *
+findBaseAtOffset(sptr Object, const abi::__class_type_info *Derived,
+ sptr Offset) {
if (!Offset)
return Derived;
if (const abi::__si_class_type_info *SI =
dynamic_cast<const abi::__si_class_type_info*>(Derived))
- return findBaseAtOffset(SI->__base_type, Offset);
+ return findBaseAtOffset(Object, SI->__base_type, Offset);
const abi::__vmi_class_type_info *VTI =
dynamic_cast<const abi::__vmi_class_type_info*>(Derived);
@@ -170,12 +172,13 @@ static const abi::__class_type_info *findBaseAtOffset(
sptr OffsetHere = VTI->base_info[base].__offset_flags >>
abi::__base_class_type_info::__offset_shift;
if (VTI->base_info[base].__offset_flags &
- abi::__base_class_type_info::__virtual_mask)
- // FIXME: Can't handle virtual bases yet.
- continue;
- if (const abi::__class_type_info *Base =
- findBaseAtOffset(VTI->base_info[base].__base_type,
- Offset - OffsetHere))
+ abi::__base_class_type_info::__virtual_mask) {
+ sptr VTable = *reinterpret_cast<const sptr *>(Object);
+ OffsetHere = *reinterpret_cast<const sptr *>(VTable + OffsetHere);
+ }
+ if (const abi::__class_type_info *Base = findBaseAtOffset(
+ Object + OffsetHere, VTI->base_info[base].__base_type,
+ Offset - OffsetHere))
return Base;
}
@@ -227,7 +230,8 @@ bool __ubsan::checkDynamicType(void *Object, void *Type, HashValue Hash) {
return false;
abi::__class_type_info *Base = (abi::__class_type_info*)Type;
- if (!isDerivedFromAtOffset(Derived, Base, -Vtable->Offset))
+ if (!isDerivedFromAtOffset(reinterpret_cast<sptr>(Object), Derived, Base,
+ -Vtable->Offset))
return false;
// Success. Cache this result.
@@ -241,8 +245,9 @@ __ubsan::DynamicTypeInfo __ubsan::getDynamicTypeInfo(void *Object) {
if (!Vtable)
return DynamicTypeInfo(0, 0, 0);
const abi::__class_type_info *ObjectType = findBaseAtOffset(
- static_cast<const abi::__class_type_info*>(Vtable->TypeInfo),
- -Vtable->Offset);
+ reinterpret_cast<sptr>(Object),
+ static_cast<const abi::__class_type_info *>(Vtable->TypeInfo),
+ -Vtable->Offset);
return DynamicTypeInfo(Vtable->TypeInfo->__type_name, -Vtable->Offset,
ObjectType ? ObjectType->__type_name : "<unknown>");
}
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 8960ef744cc..c6f32e423d5 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,59 @@
+2014-11-14 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ * src/c++98/mt_allocator.cc: Fix assumption that sizeof(void *) is
+ equal to sizeof(size_t). The m32c breaks this assumption.
+
+2014-11-14 Jonathan Wakely <jwakely@redhat.com>
+
+ * config/abi/pre/gnu.ver: Add new exports.
+ * include/bits/ios_base.h (ios_base::failure): New definition using
+ abi_tag.
+ (io_errc, make_error_code, make_error_category, iostream_category):
+ Define.
+ * include/std/system_error (system_error): Add char* constructors.
+ * src/c++11/Makefile.am: Add new file.
+ * src/c++11/Makefile.in: Regenerate.
+ * src/c++11/cxx11-ios_failure.cc: New file.
+ * src/c++98/ios_failure.cc: Compile old definition without abi_tag.
+ * testsuite/27_io/ios_base/failure/cxx11.cc: New.
+ * testsuite/27_io/ios_base/failure/what-1.cc: Allow string returned by
+ ios_base::failure::what() to contain additional data.
+ * testsuite/27_io/ios_base/failure/what-2.cc: Likewise..
+ * testsuite/27_io/ios_base/failure/what-3.cc: Likewise..
+ * testsuite/27_io/ios_base/failure/what-big.cc: Likewise..
+
+2014-11-13 Daniel Kruegler <daniel.kruegler@gmail.com>
+
+ * include/bits/regex.h: Support embedded zeros in sub_match
+ comparisons (DR 2217)
+ * testsuite/28_regex/sub_match/embedded_zeros_cmp.cc:
+ Add test cases for embedded zeros
+
+2014-11-13 Tim Shen <timshen@google.com>
+
+ PR libstdc++/63775
+ * include/bits/regex_compiler.h (_Compiler<>::_M_expression_term,
+ _BracketMatcher<>::_M_make_range): Throw regex_erorr on invalid range
+ like [z-a]. Change _M_expression_term interface.
+ * include/bits/regex_compiler.tcc (
+ _Compiler<>::_M_insert_bracket_matcher,
+ _Compiler<>::_M_expression_term): Rewrite bracket expression parsing.
+ * testsuite/28_regex/algorithms/regex_match/cstring_bracket_01.cc:
+ Add testcases and move file out of extended.
+
+2014-11-12 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/57250
+ * config/abi/pre/gnu.ver: Export new symbols.
+ * include/Makefile.am: Add new header.
+ * include/Makefile.in: Regenerate.
+ * include/bits/shared_ptr_atomic.h: Define atomic access functions.
+ * include/std/memory: Include new header.
+ * src/c++11/shared_ptr.cc (_Sp_locker): Define and use mutex pool.
+ * testsuite/20_util/shared_ptr/atomic/1.cc: New.
+ * testsuite/20_util/shared_ptr/atomic/2.cc: New.
+ * testsuite/20_util/shared_ptr/atomic/3.cc: New.
+
2014-11-12 Jonathan Wakely <jwakely@redhat.com>
* include/bits/shared_ptr.h (weak_ptr): Add move constructor and
diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
index 4c6d994197f..78f3e77a1de 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -1473,9 +1473,24 @@ GLIBCXX_3.4.21 {
# std::basic_ios::operator bool() const
_ZNKSt9basic_iosI[cw]St11char_traitsI[cw]EEcvbEv;
+ # C++11 version of std::ios_base::failure
+ _ZNKSt8ios_base7failureB5cxx114whatEv;
+ _ZNSt8ios_base7failureB5cxx11C[12]ERKSs;
+ _ZNSt8ios_base7failureB5cxx11C[12]EPKcRKSt10error_code;
+ _ZNSt8ios_base7failureB5cxx11C[12]ERKSsB5cxx11;
+ _ZNSt8ios_base7failureB5cxx11C[12]ERKSsB5cxx11RKSt10error_code;
+ _ZNSt8ios_base7failureB5cxx11D[012]Ev;
+ _ZTINSt8ios_base7failureB5cxx11E;
+ _ZTSNSt8ios_base7failureB5cxx11E;
+ _ZTVNSt8ios_base7failureB5cxx11E;
+ _ZSt17iostream_categoryv;
+
# std::ctype_base::blank
_ZNSt10ctype_base5blankE;
+ # std::_Sp_locker::*
+ _ZNSt10_Sp_locker[CD]*;
+
} GLIBCXX_3.4.20;
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 5fa243b96f4..e6edc732779 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -143,6 +143,7 @@ bits_headers = \
${bits_srcdir}/stream_iterator.h \
${bits_srcdir}/streambuf_iterator.h \
${bits_srcdir}/shared_ptr.h \
+ ${bits_srcdir}/shared_ptr_atomic.h \
${bits_srcdir}/shared_ptr_base.h \
${bits_srcdir}/slice_array.h \
${bits_srcdir}/sstream.tcc \
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index 4ae4e41f3ac..2ade448de98 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -410,6 +410,7 @@ bits_headers = \
${bits_srcdir}/stream_iterator.h \
${bits_srcdir}/streambuf_iterator.h \
${bits_srcdir}/shared_ptr.h \
+ ${bits_srcdir}/shared_ptr_atomic.h \
${bits_srcdir}/shared_ptr_base.h \
${bits_srcdir}/slice_array.h \
${bits_srcdir}/sstream.tcc \
diff --git a/libstdc++-v3/include/bits/ios_base.h b/libstdc++-v3/include/bits/ios_base.h
index 5e33b812fe3..8e600598fe2 100644
--- a/libstdc++-v3/include/bits/ios_base.h
+++ b/libstdc++-v3/include/bits/ios_base.h
@@ -40,6 +40,12 @@
#include <bits/localefwd.h>
#include <bits/locale_classes.h>
+#if __cplusplus < 201103L
+# include <stdexcept>
+#else
+# include <system_error>
+#endif
+
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -186,6 +192,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_S_ios_seekdir_end = 1L << 16
};
+#if __cplusplus >= 201103L
+ /// I/O error code
+ enum class io_errc { stream = 1 };
+
+ template <> struct is_error_code_enum<io_errc> : public true_type { };
+
+ const error_category& iostream_category() noexcept;
+
+ inline error_code
+ make_error_code(io_errc e) noexcept
+ { return error_code(static_cast<int>(e), iostream_category()); }
+
+ inline error_condition
+ make_error_condition(io_errc e) noexcept
+ { return error_condition(static_cast<int>(e), iostream_category()); }
+#endif
+
// 27.4.2 Class ios_base
/**
* @brief The base of the I/O class hierarchy.
@@ -198,6 +221,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
class ios_base
{
+#if _GLIBCXX_USE_CXX11_ABI
+#if __cplusplus < 201103L
+ // Type that is layout-compatible with std::system_error
+ struct system_error : std::runtime_error
+ {
+ // Type that is layout-compatible with std::error_code
+ struct error_code
+ {
+ error_code() { }
+ private:
+ int _M_value;
+ const void* _M_cat;
+ } _M_code;
+ };
+#endif
+#endif
public:
/**
@@ -206,6 +245,28 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*
* 27.4.2.1.1 Class ios_base::failure
*/
+#if _GLIBCXX_USE_CXX11_ABI
+ class _GLIBCXX_ABI_TAG_CXX11 failure : public system_error
+ {
+ public:
+ explicit
+ failure(const string& __str);
+
+#if __cplusplus >= 201103L
+ explicit
+ failure(const string&, const error_code&);
+
+ explicit
+ failure(const char*, const error_code& = io_errc::stream);
+#endif
+
+ virtual
+ ~failure() throw();
+
+ virtual const char*
+ what() const throw();
+ };
+#else
class failure : public exception
{
public:
@@ -225,6 +286,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
private:
string _M_msg;
};
+#endif
// 27.4.2.1.2 Type ios_base::fmtflags
/**
diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h
index 30189e3645f..6ff9a82bded 100644
--- a/libstdc++-v3/include/bits/regex.h
+++ b/libstdc++-v3/include/bits/regex.h
@@ -1006,7 +1006,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline bool
operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
const sub_match<_Bi_iter>& __rhs)
- { return __rhs.compare(__lhs.c_str()) == 0; }
+ {
+ typedef typename sub_match<_Bi_iter>::string_type string_type;
+ return __rhs.compare(string_type(__lhs.data(), __lhs.size())) == 0;
+ }
/**
* @brief Tests the inequivalence of a string and a regular expression
@@ -1031,7 +1034,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline bool
operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
const sub_match<_Bi_iter>& __rhs)
- { return __rhs.compare(__lhs.c_str()) > 0; }
+ {
+ typedef typename sub_match<_Bi_iter>::string_type string_type;
+ return __rhs.compare(string_type(__lhs.data(), __lhs.size())) > 0;
+ }
/**
* @brief Tests the ordering of a string and a regular expression submatch.
@@ -1080,7 +1086,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline bool
operator==(const sub_match<_Bi_iter>& __lhs,
const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs)
- { return __lhs.compare(__rhs.c_str()) == 0; }
+ {
+ typedef typename sub_match<_Bi_iter>::string_type string_type;
+ return __lhs.compare(string_type(__rhs.data(), __rhs.size())) == 0;
+ }
/**
* @brief Tests the inequivalence of a regular expression submatch and a
@@ -1105,7 +1114,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline bool
operator<(const sub_match<_Bi_iter>& __lhs,
const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs)
- { return __lhs.compare(__rhs.c_str()) < 0; }
+ {
+ typedef typename sub_match<_Bi_iter>::string_type string_type;
+ return __lhs.compare(string_type(__rhs.data(), __rhs.size())) < 0;
+ }
/**
* @brief Tests the ordering of a regular expression submatch and a string.
diff --git a/libstdc++-v3/include/bits/regex_compiler.h b/libstdc++-v3/include/bits/regex_compiler.h
index 1bbc09dd9dc..d8880cc4794 100644
--- a/libstdc++-v3/include/bits/regex_compiler.h
+++ b/libstdc++-v3/include/bits/regex_compiler.h
@@ -118,7 +118,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<bool __icase, bool __collate>
void
- _M_expression_term(_BracketMatcher<_TraitsT, __icase, __collate>&
+ _M_expression_term(pair<bool, _CharT>& __last_char,
+ _BracketMatcher<_TraitsT, __icase, __collate>&
__matcher);
int
@@ -390,6 +391,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
void
_M_make_range(_CharT __l, _CharT __r)
{
+ if (__l > __r)
+ __throw_regex_error(regex_constants::error_range);
_M_range_set.push_back(make_pair(_M_translator._M_transform(__l),
_M_translator._M_transform(__r)));
#ifdef _GLIBCXX_DEBUG
diff --git a/libstdc++-v3/include/bits/regex_compiler.tcc b/libstdc++-v3/include/bits/regex_compiler.tcc
index 349d92a1200..f9598843751 100644
--- a/libstdc++-v3/include/bits/regex_compiler.tcc
+++ b/libstdc++-v3/include/bits/regex_compiler.tcc
@@ -415,8 +415,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_insert_bracket_matcher(bool __neg)
{
_BracketMatcher<_TraitsT, __icase, __collate> __matcher(__neg, _M_traits);
+ pair<bool, _CharT> __last_char; // Optional<_CharT>
+ __last_char.first = false;
+ if (!(_M_flags & regex_constants::ECMAScript))
+ if (_M_try_char())
+ {
+ __matcher._M_add_char(_M_value[0]);
+ __last_char.first = true;
+ __last_char.second = _M_value[0];
+ }
while (!_M_match_token(_ScannerT::_S_token_bracket_end))
- _M_expression_term(__matcher);
+ _M_expression_term(__last_char, __matcher);
__matcher._M_ready();
_M_stack.push(_StateSeqT(
*_M_nfa,
@@ -427,7 +436,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<bool __icase, bool __collate>
void
_Compiler<_TraitsT>::
- _M_expression_term(_BracketMatcher<_TraitsT, __icase, __collate>& __matcher)
+ _M_expression_term(pair<bool, _CharT>& __last_char,
+ _BracketMatcher<_TraitsT, __icase, __collate>& __matcher)
{
if (_M_match_token(_ScannerT::_S_token_collsymbol))
__matcher._M_add_collating_element(_M_value);
@@ -435,27 +445,50 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__matcher._M_add_equivalence_class(_M_value);
else if (_M_match_token(_ScannerT::_S_token_char_class_name))
__matcher._M_add_character_class(_M_value, false);
- else if (_M_try_char()) // [a
+ // POSIX doesn't permit '-' as a start-range char (say [a-z--0]),
+ // except when the '-' is the first character in the bracket expression
+ // ([--0]). ECMAScript treats all '-' after a range as a normal character.
+ // Also see above, where _M_expression_term gets called.
+ //
+ // As a result, POSIX rejects [-----], but ECMAScript doesn't.
+ // Boost (1.57.0) always uses POSIX style even in its ECMAScript syntax.
+ // Clang (3.5) always uses ECMAScript style even in its POSIX syntax.
+ //
+ // It turns out that no one reads BNFs ;)
+ else if (_M_try_char())
{
- auto __ch = _M_value[0];
- if (_M_try_char())
+ if (!__last_char.first)
+ {
+ if (_M_value[0] == '-'
+ && !(_M_flags & regex_constants::ECMAScript))
+ __throw_regex_error(regex_constants::error_range);
+ __matcher._M_add_char(_M_value[0]);
+ __last_char.first = true;
+ __last_char.second = _M_value[0];
+ }
+ else
{
- if (_M_value[0] == '-') // [a-
+ if (_M_value[0] == '-')
{
- if (_M_try_char()) // [a-z]
+ if (_M_try_char())
{
- __matcher._M_make_range(__ch, _M_value[0]);
- return;
+ __matcher._M_make_range(__last_char.second , _M_value[0]);
+ __last_char.first = false;
+ }
+ else
+ {
+ if (_M_scanner._M_get_token()
+ != _ScannerT::_S_token_bracket_end)
+ __throw_regex_error(regex_constants::error_range);
+ __matcher._M_add_char(_M_value[0]);
}
- // If the dash is the last character in the bracket
- // expression, it is not special.
- if (_M_scanner._M_get_token()
- != _ScannerT::_S_token_bracket_end)
- __throw_regex_error(regex_constants::error_range);
}
- __matcher._M_add_char(_M_value[0]);
+ else
+ {
+ __matcher._M_add_char(_M_value[0]);
+ __last_char.second = _M_value[0];
+ }
}
- __matcher._M_add_char(__ch);
}
else if (_M_match_token(_ScannerT::_S_token_quoted_class))
__matcher._M_add_character_class(_M_value,
diff --git a/libstdc++-v3/include/bits/shared_ptr_atomic.h b/libstdc++-v3/include/bits/shared_ptr_atomic.h
new file mode 100644
index 00000000000..79e35ec3b2d
--- /dev/null
+++ b/libstdc++-v3/include/bits/shared_ptr_atomic.h
@@ -0,0 +1,330 @@
+// shared_ptr atomic access -*- C++ -*-
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library 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 library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file bits/shared_ptr_atomic.h
+ * This is an internal header file, included by other library headers.
+ * Do not attempt to use it directly. @headername{memory}
+ */
+
+#ifndef _SHARED_PTR_ATOMIC_H
+#define _SHARED_PTR_ATOMIC_H 1
+
+#include <bits/atomic_base.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ /**
+ * @addtogroup pointer_abstractions
+ * @{
+ */
+
+ struct _Sp_locker
+ {
+ _Sp_locker(const _Sp_locker&) = delete;
+ _Sp_locker& operator=(const _Sp_locker&) = delete;
+
+#ifdef __GTHREADS
+ explicit
+ _Sp_locker(const void*) noexcept;
+ _Sp_locker(const void*, const void*) noexcept;
+ ~_Sp_locker();
+
+ private:
+ unsigned char _M_key1;
+ unsigned char _M_key2;
+#else
+ explicit _Sp_locker(const void*, const void* = nullptr) { }
+#endif
+ };
+
+ /**
+ * @brief Report whether shared_ptr atomic operations are lock-free.
+ * @param __p A non-null pointer to a shared_ptr object.
+ * @return True if atomic access to @c *__p is lock-free, false otherwise.
+ * @{
+ */
+ template<typename _Tp, _Lock_policy _Lp>
+ inline bool
+ atomic_is_lock_free(const __shared_ptr<_Tp, _Lp>* __p)
+ {
+#ifdef __GTHREADS
+ return __gthread_active_p() == 0;
+#else
+ return true;
+#endif
+ }
+
+ template<typename _Tp>
+ inline bool
+ atomic_is_lock_free(const shared_ptr<_Tp>* __p)
+ { return std::atomic_is_lock_free<_Tp, __default_lock_policy>(__p); }
+
+ // @}
+
+ /**
+ * @brief Atomic load for shared_ptr objects.
+ * @param __p A non-null pointer to a shared_ptr object.
+ * @return @c *__p
+ *
+ * The memory order shall not be @c memory_order_release or
+ * @c memory_order_acq_rel.
+ * @{
+ */
+ template<typename _Tp>
+ inline shared_ptr<_Tp>
+ atomic_load_explicit(const shared_ptr<_Tp>* __p, memory_order)
+ {
+ _Sp_locker __lock{__p};
+ return *__p;
+ }
+
+ template<typename _Tp>
+ inline shared_ptr<_Tp>
+ atomic_load(const shared_ptr<_Tp>* __p)
+ { return std::atomic_load_explicit(__p, memory_order_seq_cst); }
+
+ template<typename _Tp, _Lock_policy _Lp>
+ inline __shared_ptr<_Tp, _Lp>
+ atomic_load_explicit(const __shared_ptr<_Tp, _Lp>* __p, memory_order)
+ {
+ _Sp_locker __lock{__p};
+ return *__p;
+ }
+
+ template<typename _Tp, _Lock_policy _Lp>
+ inline __shared_ptr<_Tp, _Lp>
+ atomic_load(const __shared_ptr<_Tp, _Lp>* __p)
+ { return std::atomic_load_explicit(__p, memory_order_seq_cst); }
+ // @}
+
+ /**
+ * @brief Atomic store for shared_ptr objects.
+ * @param __p A non-null pointer to a shared_ptr object.
+ * @param __r The value to store.
+ *
+ * The memory order shall not be @c memory_order_acquire or
+ * @c memory_order_acq_rel.
+ * @{
+ */
+ template<typename _Tp>
+ inline void
+ atomic_store_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r,
+ memory_order)
+ {
+ _Sp_locker __lock{__p};
+ __p->swap(__r); // use swap so that **__p not destroyed while lock held
+ }
+
+ template<typename _Tp>
+ inline void
+ atomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r)
+ { std::atomic_store_explicit(__p, std::move(__r), memory_order_seq_cst); }
+
+ template<typename _Tp, _Lock_policy _Lp>
+ inline void
+ atomic_store_explicit(__shared_ptr<_Tp, _Lp>* __p,
+ __shared_ptr<_Tp, _Lp> __r,
+ memory_order)
+ {
+ _Sp_locker __lock{__p};
+ __p->swap(__r); // use swap so that **__p not destroyed while lock held
+ }
+
+ template<typename _Tp, _Lock_policy _Lp>
+ inline void
+ atomic_store(__shared_ptr<_Tp, _Lp>* __p, __shared_ptr<_Tp, _Lp> __r)
+ { std::atomic_store_explicit(__p, std::move(__r), memory_order_seq_cst); }
+ // @}
+
+ /**
+ * @brief Atomic exchange for shared_ptr objects.
+ * @param __p A non-null pointer to a shared_ptr object.
+ * @param __r New value to store in @c *__p.
+ * @return The original value of @c *__p
+ * @{
+ */
+ template<typename _Tp>
+ inline shared_ptr<_Tp>
+ atomic_exchange_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r,
+ memory_order)
+ {
+ _Sp_locker __lock{__p};
+ __p->swap(__r);
+ return __r;
+ }
+
+ template<typename _Tp>
+ inline shared_ptr<_Tp>
+ atomic_exchange(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r)
+ {
+ return std::atomic_exchange_explicit(__p, std::move(__r),
+ memory_order_seq_cst);
+ }
+
+ template<typename _Tp, _Lock_policy _Lp>
+ inline __shared_ptr<_Tp, _Lp>
+ atomic_exchange_explicit(__shared_ptr<_Tp, _Lp>* __p,
+ __shared_ptr<_Tp, _Lp> __r,
+ memory_order)
+ {
+ _Sp_locker __lock{__p};
+ __p->swap(__r);
+ return __r;
+ }
+
+ template<typename _Tp, _Lock_policy _Lp>
+ inline __shared_ptr<_Tp, _Lp>
+ atomic_exchange(__shared_ptr<_Tp, _Lp>* __p, __shared_ptr<_Tp, _Lp> __r)
+ {
+ return std::atomic_exchange_explicit(__p, std::move(__r),
+ memory_order_seq_cst);
+ }
+ // @}
+
+ /**
+ * @brief Atomic compare-and-swap for shared_ptr objects.
+ * @param __p A non-null pointer to a shared_ptr object.
+ * @param __v A non-null pointer to a shared_ptr object.
+ * @param __w A non-null pointer to a shared_ptr object.
+ * @return True if @c *__p was equivalent to @c *__v, false otherwise.
+ *
+ * The memory order for failure shall not be @c memory_order_release or
+ * @c memory_order_acq_rel, or stronger than the memory order for success.
+ * @{
+ */
+ template<typename _Tp>
+ bool
+ atomic_compare_exchange_strong_explicit(shared_ptr<_Tp>* __p,
+ shared_ptr<_Tp>* __v,
+ shared_ptr<_Tp> __w,
+ memory_order,
+ memory_order)
+ {
+ shared_ptr<_Tp> __x; // goes out of scope after __lock
+ _Sp_locker __lock{__p, __v};
+ owner_less<shared_ptr<_Tp>> __less;
+ if (*__p == *__v && !__less(*__p, *__v) && !__less(*__v, *__p))
+ {
+ __x = std::move(*__p);
+ *__p = std::move(__w);
+ return true;
+ }
+ __x = std::move(*__v);
+ *__v = *__p;
+ return false;
+ }
+
+ template<typename _Tp>
+ inline bool
+ atomic_compare_exchange_strong(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v,
+ shared_ptr<_Tp> __w)
+ {
+ return std::atomic_compare_exchange_strong_explicit(__p, __v,
+ std::move(__w), memory_order_seq_cst, memory_order_seq_cst);
+ }
+
+ template<typename _Tp>
+ inline bool
+ atomic_compare_exchange_weak_explicit(shared_ptr<_Tp>* __p,
+ shared_ptr<_Tp>* __v,
+ shared_ptr<_Tp> __w,
+ memory_order __success,
+ memory_order __failure)
+ {
+ return std::atomic_compare_exchange_strong_explicit(__p, __v,
+ std::move(__w), __success, __failure);
+ }
+
+ template<typename _Tp>
+ inline bool
+ atomic_compare_exchange_weak(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v,
+ shared_ptr<_Tp> __w)
+ {
+ return std::atomic_compare_exchange_weak_explicit(__p, __v,
+ std::move(__w), memory_order_seq_cst, memory_order_seq_cst);
+ }
+
+ template<typename _Tp, _Lock_policy _Lp>
+ bool
+ atomic_compare_exchange_strong_explicit(__shared_ptr<_Tp, _Lp>* __p,
+ __shared_ptr<_Tp, _Lp>* __v,
+ __shared_ptr<_Tp, _Lp> __w,
+ memory_order,
+ memory_order)
+ {
+ __shared_ptr<_Tp, _Lp> __x; // goes out of scope after __lock
+ _Sp_locker __lock{__p, __v};
+ owner_less<__shared_ptr<_Tp, _Lp>> __less;
+ if (*__p == *__v && !__less(*__p, *__v) && !__less(*__v, *__p))
+ {
+ __x = std::move(*__p);
+ *__p = std::move(__w);
+ return true;
+ }
+ __x = std::move(*__v);
+ *__v = *__p;
+ return false;
+ }
+
+ template<typename _Tp, _Lock_policy _Lp>
+ inline bool
+ atomic_compare_exchange_strong(__shared_ptr<_Tp, _Lp>* __p,
+ __shared_ptr<_Tp, _Lp>* __v,
+ __shared_ptr<_Tp, _Lp> __w)
+ {
+ return std::atomic_compare_exchange_strong_explicit(__p, __v,
+ std::move(__w), memory_order_seq_cst, memory_order_seq_cst);
+ }
+
+ template<typename _Tp, _Lock_policy _Lp>
+ inline bool
+ atomic_compare_exchange_weak_explicit(__shared_ptr<_Tp, _Lp>* __p,
+ __shared_ptr<_Tp, _Lp>* __v,
+ __shared_ptr<_Tp, _Lp> __w,
+ memory_order __success,
+ memory_order __failure)
+ {
+ return std::atomic_compare_exchange_strong_explicit(__p, __v,
+ std::move(__w), __success, __failure);
+ }
+
+ template<typename _Tp, _Lock_policy _Lp>
+ inline bool
+ atomic_compare_exchange_weak(__shared_ptr<_Tp, _Lp>* __p,
+ __shared_ptr<_Tp, _Lp>* __v,
+ __shared_ptr<_Tp, _Lp> __w)
+ {
+ return std::atomic_compare_exchange_weak_explicit(__p, __v,
+ std::move(__w), memory_order_seq_cst, memory_order_seq_cst);
+ }
+ // @}
+
+ // @} group pointer_abstractions
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif // _SHARED_PTR_ATOMIC_H
diff --git a/libstdc++-v3/include/std/memory b/libstdc++-v3/include/std/memory
index b5792ad78b7..3d1c8a9d2e3 100644
--- a/libstdc++-v3/include/std/memory
+++ b/libstdc++-v3/include/std/memory
@@ -80,6 +80,7 @@
# include <debug/debug.h>
# include <bits/unique_ptr.h>
# include <bits/shared_ptr.h>
+# include <bits/shared_ptr_atomic.h>
# if _GLIBCXX_USE_DEPRECATED
# include <backward/auto_ptr.h>
# endif
diff --git a/libstdc++-v3/include/std/system_error b/libstdc++-v3/include/std/system_error
index 4ec83d77c4e..ed17f554bca 100644
--- a/libstdc++-v3/include/std/system_error
+++ b/libstdc++-v3/include/std/system_error
@@ -321,16 +321,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
system_error(error_code __ec, const string& __what)
: runtime_error(__what + ": " + __ec.message()), _M_code(__ec) { }
- /*
- * TODO: Add const char* ctors to all exceptions.
- *
- * system_error(error_code __ec, const char* __what)
- * : runtime_error(__what + (": " + __ec.message())), _M_code(__ec) { }
- *
- * system_error(int __v, const error_category& __ecat, const char* __what)
- * : runtime_error(__what + (": " + __ec.message())),
- * _M_code(error_code(__v, __ecat)) { }
- */
+ system_error(error_code __ec, const char* __what)
+ : runtime_error(__what + (": " + __ec.message())), _M_code(__ec) { }
+
+ system_error(int __v, const error_category& __ecat, const char* __what)
+ : system_error(error_code(__v, __ecat), __what) { }
system_error(int __v, const error_category& __ecat)
: runtime_error(error_code(__v, __ecat).message()),
diff --git a/libstdc++-v3/src/c++11/Makefile.am b/libstdc++-v3/src/c++11/Makefile.am
index c8507cec8df..71306db4b00 100644
--- a/libstdc++-v3/src/c++11/Makefile.am
+++ b/libstdc++-v3/src/c++11/Makefile.am
@@ -39,6 +39,13 @@ ctype_configure_char.cc: ${glibcxx_srcdir}/$(OS_INC_SRCDIR)/ctype_configure_char
ctype_members.cc: ${glibcxx_srcdir}/$(CCTYPE_CC)
$(LN_S) ${glibcxx_srcdir}/$(CCTYPE_CC) . || true
+if ENABLE_CXX11_ABI
+cxx11_abi_sources = \
+ cxx11-ios_failure.cc
+else
+cxx11_abi_sources =
+endif
+
sources = \
chrono.cc \
condition_variable.cc \
@@ -59,6 +66,7 @@ sources = \
snprintf_lite.cc \
system_error.cc \
thread.cc \
+ ${cxx11_abi_sources} \
${host_sources}
if ENABLE_EXTERN_TEMPLATE
diff --git a/libstdc++-v3/src/c++11/Makefile.in b/libstdc++-v3/src/c++11/Makefile.in
index fd3e7801d85..dd9e110f768 100644
--- a/libstdc++-v3/src/c++11/Makefile.in
+++ b/libstdc++-v3/src/c++11/Makefile.in
@@ -67,19 +67,20 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libc__11convenience_la_LIBADD =
-am__objects_1 = ctype_configure_char.lo ctype_members.lo
-am__objects_2 = chrono.lo condition_variable.lo ctype.lo debug.lo \
+@ENABLE_CXX11_ABI_TRUE@am__objects_1 = cxx11-ios_failure.lo
+am__objects_2 = ctype_configure_char.lo ctype_members.lo
+am__objects_3 = chrono.lo condition_variable.lo ctype.lo debug.lo \
functexcept.lo functional.lo future.lo hash_c++0x.lo \
hashtable_c++0x.lo ios.lo limits.lo mutex.lo placeholders.lo \
random.lo regex.lo shared_ptr.lo snprintf_lite.lo \
- system_error.lo thread.lo $(am__objects_1)
-@ENABLE_EXTERN_TEMPLATE_TRUE@am__objects_3 = ext11-inst.lo \
+ system_error.lo thread.lo $(am__objects_1) $(am__objects_2)
+@ENABLE_EXTERN_TEMPLATE_TRUE@am__objects_4 = ext11-inst.lo \
@ENABLE_EXTERN_TEMPLATE_TRUE@ fstream-inst.lo ios-inst.lo \
@ENABLE_EXTERN_TEMPLATE_TRUE@ iostream-inst.lo istream-inst.lo \
@ENABLE_EXTERN_TEMPLATE_TRUE@ ostream-inst.lo sstream-inst.lo \
@ENABLE_EXTERN_TEMPLATE_TRUE@ streambuf-inst.lo string-inst.lo \
@ENABLE_EXTERN_TEMPLATE_TRUE@ wstring-inst.lo
-am_libc__11convenience_la_OBJECTS = $(am__objects_2) $(am__objects_3)
+am_libc__11convenience_la_OBJECTS = $(am__objects_3) $(am__objects_4)
libc__11convenience_la_OBJECTS = $(am_libc__11convenience_la_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp =
@@ -322,6 +323,10 @@ host_sources = \
ctype_configure_char.cc \
ctype_members.cc
+@ENABLE_CXX11_ABI_FALSE@cxx11_abi_sources =
+@ENABLE_CXX11_ABI_TRUE@cxx11_abi_sources = \
+@ENABLE_CXX11_ABI_TRUE@ cxx11-ios_failure.cc
+
sources = \
chrono.cc \
condition_variable.cc \
@@ -342,6 +347,7 @@ sources = \
snprintf_lite.cc \
system_error.cc \
thread.cc \
+ ${cxx11_abi_sources} \
${host_sources}
# XTEMPLATE_FLAGS =
diff --git a/libstdc++-v3/src/c++11/cxx11-ios_failure.cc b/libstdc++-v3/src/c++11/cxx11-ios_failure.cc
new file mode 100644
index 00000000000..143d70e5e93
--- /dev/null
+++ b/libstdc++-v3/src/c++11/cxx11-ios_failure.cc
@@ -0,0 +1,89 @@
+// Iostreams base classes -*- C++ -*-
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library 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 library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882:2011: 27.5.3.1.1 Class ios_base::failure
+//
+
+#include <ios>
+
+namespace
+{
+ struct io_error_category : std::error_category
+ {
+ virtual const char*
+ name() const noexcept
+ { return "iostream"; }
+
+ virtual std::string message(int __ec) const
+ {
+ std::string __msg;
+ switch (std::io_errc(__ec))
+ {
+ case std::io_errc::stream:
+ __msg = "iostream error";
+ break;
+ default:
+ __msg = "Unknown error";
+ break;
+ }
+ return __msg;
+ }
+ };
+
+ const io_error_category&
+ __io_category_instance() noexcept
+ {
+ static const io_error_category __ec{};
+ return __ec;
+ }
+
+} // namespace
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ const error_category&
+ iostream_category() noexcept
+ { return __io_category_instance(); }
+
+ ios_base::failure::failure(const string& __str)
+ : system_error(io_errc::stream, __str) { }
+
+ ios_base::failure::failure(const string& __str, const error_code& __ec)
+ : system_error(__ec, __str) { }
+
+ ios_base::failure::failure(const char* __str, const error_code& __ec)
+ : system_error(__ec, __str) { }
+
+ ios_base::failure::~failure()
+ { }
+
+ const char*
+ ios_base::failure::what() const throw()
+ { return runtime_error::what(); }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/libstdc++-v3/src/c++11/shared_ptr.cc b/libstdc++-v3/src/c++11/shared_ptr.cc
index 53b3452f093..924753258ff 100644
--- a/libstdc++-v3/src/c++11/shared_ptr.cc
+++ b/libstdc++-v3/src/c++11/shared_ptr.cc
@@ -34,5 +34,63 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
bad_weak_ptr::what() const noexcept
{ return "bad_weak_ptr"; }
+#ifdef __GTHREADS
+ namespace
+ {
+ const unsigned char mask = 0xf;
+ const unsigned char invalid = mask + 1;
+
+ inline unsigned char key(const void* addr)
+ { return _Hash_impl::hash(addr) & mask; }
+
+ /* Returns different instances of __mutex depending on the passed address
+ * in order to limit contention.
+ */
+ __gnu_cxx::__mutex&
+ get_mutex(unsigned char i)
+ {
+ static __gnu_cxx::__mutex m[mask + 1];
+ return m[i];
+ }
+ }
+
+ _Sp_locker::_Sp_locker(const void* p)
+ {
+ if (__gthread_active_p())
+ {
+ _M_key1 = _M_key2 = key(p);
+ get_mutex(_M_key1).lock();
+ }
+ else
+ _M_key1 = _M_key2 = invalid;
+ }
+
+ _Sp_locker::_Sp_locker(const void* p1, const void* p2)
+ {
+ if (__gthread_active_p())
+ {
+ _M_key1 = key(p1);
+ _M_key2 = key(p2);
+ if (_M_key2 < _M_key1)
+ get_mutex(_M_key2).lock();
+ get_mutex(_M_key1).lock();
+ if (_M_key2 > _M_key1)
+ get_mutex(_M_key2).lock();
+ }
+ else
+ _M_key1 = _M_key2 = invalid;
+ }
+
+ _Sp_locker::~_Sp_locker()
+ {
+ if (_M_key1 != invalid)
+ {
+ get_mutex(_M_key1).unlock();
+ if (_M_key2 != _M_key1)
+ get_mutex(_M_key2).unlock();
+ }
+ }
+#endif
+
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
diff --git a/libstdc++-v3/src/c++98/ios_failure.cc b/libstdc++-v3/src/c++98/ios_failure.cc
index 9d32e51c957..0f4517800ce 100644
--- a/libstdc++-v3/src/c++98/ios_failure.cc
+++ b/libstdc++-v3/src/c++98/ios_failure.cc
@@ -23,9 +23,10 @@
// <http://www.gnu.org/licenses/>.
//
-// ISO C++ 14882: 27.4.2.1.1 Class ios_base::failure
+// ISO C++ 14882:1998: 27.4.2.1.1 Class ios_base::failure
//
+#define _GLIBCXX_USE_CXX11_ABI 0
#include <ios>
namespace std _GLIBCXX_VISIBILITY(default)
diff --git a/libstdc++-v3/src/c++98/mt_allocator.cc b/libstdc++-v3/src/c++98/mt_allocator.cc
index 38e17df9f2b..51b260563b7 100644
--- a/libstdc++-v3/src/c++98/mt_allocator.cc
+++ b/libstdc++-v3/src/c++98/mt_allocator.cc
@@ -31,6 +31,11 @@
#include <ext/mt_allocator.h>
#include <cstring>
+// The include file is needed for uintptr_t. If this file does not compile,
+// check to make sure the target has <stdint.h> and that it provides
+// uintptr_t.
+#include <stdint.h>
+
namespace
{
#ifdef __GTHREADS
@@ -74,7 +79,7 @@ namespace
__freelist& freelist = get_freelist();
{
__gnu_cxx::__scoped_lock sentry(get_freelist_mutex());
- size_t _M_id = reinterpret_cast<size_t>(__id);
+ uintptr_t _M_id = reinterpret_cast<uintptr_t>(__id);
typedef __gnu_cxx::__pool<true>::_Thread_record _Thread_record;
_Thread_record* __tr = &freelist._M_thread_freelist_array[_M_id - 1];
@@ -627,7 +632,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
__freelist& freelist = get_freelist();
void* v = __gthread_getspecific(freelist._M_key);
- size_t _M_id = (size_t)v;
+ uintptr_t _M_id = (uintptr_t)v;
if (_M_id == 0)
{
{
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/atomic/1.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/atomic/1.cc
new file mode 100644
index 00000000000..37ab333f287
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/atomic/1.cc
@@ -0,0 +1,40 @@
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library 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 library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++11" }
+// { dg-require-gthreads "" }
+
+#include <memory>
+
+int main()
+{
+ using test_type = std::shared_ptr<int>;
+ bool test __attribute__ ((unused)) = false;
+ constexpr auto mo = std::memory_order_seq_cst;
+ const test_type p;
+ test = std::atomic_is_lock_free(&p);
+ test_type p2 = std::atomic_load(&p);
+ test_type p3 = std::atomic_load_explicit(&p, mo);
+ std::atomic_store(&p2, p);
+ std::atomic_store_explicit(&p2, p, mo);
+ test_type p4 = std::atomic_exchange(&p2, p);
+ p4 = std::atomic_exchange_explicit(&p2, p, mo);
+ test = std::atomic_compare_exchange_weak(&p2, &p3, p);
+ test = std::atomic_compare_exchange_strong(&p2, &p3, p);
+ test = std::atomic_compare_exchange_weak_explicit(&p2, &p3, p, mo, mo);
+ test = std::atomic_compare_exchange_strong_explicit(&p2, &p3, p, mo, mo);
+}
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/atomic/2.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/atomic/2.cc
new file mode 100644
index 00000000000..846a6633784
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/atomic/2.cc
@@ -0,0 +1,40 @@
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library 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 library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++11" }
+// { dg-require-gthreads "" }
+
+#include <memory>
+
+int main()
+{
+ using test_type = std::__shared_ptr<int, std::_S_single>;
+ bool test __attribute__ ((unused)) = false;
+ constexpr auto mo = std::memory_order_seq_cst;
+ const test_type p;
+ test = std::atomic_is_lock_free(&p);
+ test_type p2 = std::atomic_load(&p);
+ test_type p3 = std::atomic_load_explicit(&p, mo);
+ std::atomic_store(&p2, p);
+ std::atomic_store_explicit(&p2, p, mo);
+ test_type p4 = std::atomic_exchange(&p2, p);
+ p4 = std::atomic_exchange_explicit(&p2, p, mo);
+ test = std::atomic_compare_exchange_weak(&p2, &p3, p);
+ test = std::atomic_compare_exchange_strong(&p2, &p3, p);
+ test = std::atomic_compare_exchange_weak_explicit(&p2, &p3, p, mo, mo);
+ test = std::atomic_compare_exchange_strong_explicit(&p2, &p3, p, mo, mo);
+}
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/atomic/3.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/atomic/3.cc
new file mode 100644
index 00000000000..f9648062bd8
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/atomic/3.cc
@@ -0,0 +1,53 @@
+// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } }
+// { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } }
+// { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library 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 library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <thread>
+#include <memory>
+#include <testsuite_hooks.h>
+
+struct leaddock
+{
+ ~leaddock();
+};
+
+std::shared_ptr<leaddock> global;
+
+leaddock::~leaddock()
+{
+ // If this destructor is called "inside" an atomic operation on global it
+ // will deadlock, so this checks that the atomic_store is done atomically.
+ auto copy = std::atomic_load(&global);
+ VERIFY( !copy );
+}
+
+void f()
+{
+ std::atomic_store(&global, std::make_shared<leaddock>());
+ std::atomic_store(&global, {});
+}
+
+int main()
+{
+ std::thread{ f }.join();
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/failure/cxx11.cc b/libstdc++-v3/testsuite/27_io/ios_base/failure/cxx11.cc
new file mode 100644
index 00000000000..a3276e1c5bd
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/failure/cxx11.cc
@@ -0,0 +1,52 @@
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library 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 library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++11" }
+
+#include <ios>
+#include <testsuite_hooks.h>
+
+using test_type = std::ios_base::failure;
+
+static_assert( std::is_base_of<std::system_error, test_type>::value, "base" );
+
+void
+test01()
+{
+ test_type e("io error");
+ VERIFY(std::string(e.what()).find("io error") != std::string::npos);
+ e = test_type("", make_error_code(std::io_errc::stream));
+}
+
+struct E : test_type
+{
+ E(const char* s) : test_type(s, make_error_code(std::io_errc::stream)) { }
+};
+
+void
+test02()
+{
+ E e("io error");
+ VERIFY(std::string(e.what()).find("io error") != std::string::npos);
+}
+
+int
+main()
+{
+ test01();
+ test02();
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/failure/what-1.cc b/libstdc++-v3/testsuite/27_io/ios_base/failure/what-1.cc
index 07be43bfddb..a50c798b14c 100644
--- a/libstdc++-v3/testsuite/27_io/ios_base/failure/what-1.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_base/failure/what-1.cc
@@ -37,8 +37,13 @@ void test01()
// 2
std::ios_base::failure obj2(s);
+#if _GLIBCXX_USE_CXX11_ABI
+ VERIFY( std::strstr(obj1.what(), s.data()) != NULL );
+ VERIFY( std::strstr(obj2.what(), s.data()) != NULL );
+#else
VERIFY( std::strcmp(obj1.what(), s.data()) == 0 );
VERIFY( std::strcmp(obj2.what(), s.data()) == 0 );
+#endif
}
void test02()
@@ -47,7 +52,11 @@ void test02()
std::string s("lack of sunlight error");
std::range_error x(s);
+#if _GLIBCXX_USE_CXX11_ABI
+ VERIFY( std::strstr(x.what(), s.data()) != NULL );
+#else
VERIFY( std::strcmp(x.what(), s.data()) == 0 );
+#endif
}
int main(void)
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/failure/what-2.cc b/libstdc++-v3/testsuite/27_io/ios_base/failure/what-2.cc
index 334c8e1fcad..e16ef7c64d9 100644
--- a/libstdc++-v3/testsuite/27_io/ios_base/failure/what-2.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_base/failure/what-2.cc
@@ -37,7 +37,13 @@ void test03()
try
{ throw fuzzy_logic(); }
catch(const fuzzy_logic& obj)
- { VERIFY( std::strcmp("whoa", obj.what()) == 0 ); }
+ {
+#if _GLIBCXX_USE_CXX11_ABI
+ VERIFY( std::strstr(obj.what(), "whoa") != NULL );
+#else
+ VERIFY( std::strcmp("whoa", obj.what()) == 0 );
+#endif
+ }
catch(...)
{ VERIFY( false ); }
}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/failure/what-3.cc b/libstdc++-v3/testsuite/27_io/ios_base/failure/what-3.cc
index b9af939df82..abbbcca7826 100644
--- a/libstdc++-v3/testsuite/27_io/ios_base/failure/what-3.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_base/failure/what-3.cc
@@ -52,7 +52,11 @@ void test04()
obj1 = obj2;
}
allocate_on_stack();
+#if _GLIBCXX_USE_CXX11_ABI
+ VERIFY( std::strstr(obj1.what(), strlit1) != NULL );
+#else
VERIFY( std::strcmp(strlit1, obj1.what()) == 0 );
+#endif
// block 02
{
@@ -61,7 +65,11 @@ void test04()
obj1 = obj3;
}
allocate_on_stack();
+#if _GLIBCXX_USE_CXX11_ABI
+ VERIFY( std::strstr(obj1.what(), strlit2) != NULL );
+#else
VERIFY( std::strcmp(strlit2, obj1.what()) == 0 );
+#endif
}
int main(void)
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/failure/what-big.cc b/libstdc++-v3/testsuite/27_io/ios_base/failure/what-big.cc
index a2bd37c972c..99ee17d6839 100644
--- a/libstdc++-v3/testsuite/27_io/ios_base/failure/what-big.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_base/failure/what-big.cc
@@ -30,7 +30,11 @@ void test01()
bool test __attribute__((unused)) = true;
const std::string xxx(10000, 'x');
test_type t(xxx);
+#if _GLIBCXX_USE_CXX11_ABI
+ VERIFY( std::strstr(t.what(), xxx.c_str()) != NULL );
+#else
VERIFY( std::strcmp(t.what(), xxx.c_str()) == 0 );
+#endif
}
int main(void)
diff --git a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/extended/cstring_bracket_01.cc b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/cstring_bracket_01.cc
index ca2a5f556fc..e5cffc72a2a 100644
--- a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/extended/cstring_bracket_01.cc
+++ b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/cstring_bracket_01.cc
@@ -67,9 +67,60 @@ test01()
}
}
+void
+test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ try
+ {
+ std::regex re("[-----]", std::regex::extended);
+ VERIFY(false);
+ }
+ catch (const std::regex_error& e)
+ {
+ VERIFY(e.code() == std::regex_constants::error_range);
+ }
+ std::regex re("[-----]", std::regex::ECMAScript);
+}
+
+void
+test03()
+{
+ bool test __attribute__((unused)) = true;
+
+ try
+ {
+ std::regex re("[z-a]", std::regex::extended);
+ VERIFY(false);
+ }
+ catch (const std::regex_error& e)
+ {
+ VERIFY(e.code() == std::regex_constants::error_range);
+ }
+}
+
+void
+test04()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::regex re("[-0-9a-z]");
+ VERIFY(regex_match_debug("-", re));
+ VERIFY(regex_match_debug("1", re));
+ VERIFY(regex_match_debug("w", re));
+ re.assign("[-0-9a-z]", regex_constants::basic);
+ VERIFY(regex_match_debug("-", re));
+ VERIFY(regex_match_debug("1", re));
+ VERIFY(regex_match_debug("w", re));
+}
+
int
main()
{
test01();
+ test02();
+ test03();
+ test04();
return 0;
}
diff --git a/libstdc++-v3/testsuite/28_regex/sub_match/embedded_zeros_cmp.cc b/libstdc++-v3/testsuite/28_regex/sub_match/embedded_zeros_cmp.cc
new file mode 100644
index 00000000000..0908f124c6e
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/sub_match/embedded_zeros_cmp.cc
@@ -0,0 +1,55 @@
+// { dg-options "-std=gnu++11" }
+
+//
+// 2014-11-13 Daniel Kruegler <daniel.kruegler@gmail.com>
+//
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library 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 library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.9.2 [re.submatch.op] sub_match members, [DR 2217]
+
+#include <regex>
+#include <string>
+#include <testsuite_hooks.h>
+
+int main()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef char value_type;
+ typedef std::basic_string<value_type> string_type;
+ typedef std::sub_match<value_type*> sub_match_type;
+ const string_type test_data1("abc\0d", 4);
+ value_type test_data2[] = {'a', 'b', 'c'};
+ const string_type test_data3("abc");
+
+ sub_match_type sm;
+ sm.first = std::begin(test_data2);
+ sm.second = std::end(test_data2);
+ sm.matched = true;
+
+ VERIFY( test_data1 != sm );
+ VERIFY( sm != test_data1 );
+ VERIFY( sm < test_data1 );
+ VERIFY( !(test_data1 < sm) );
+ VERIFY( test_data1 > sm );
+
+ VERIFY( test_data3 == sm );
+ VERIFY( sm == test_data3 );
+ VERIFY( !(sm < test_data3) );
+ VERIFY( !(test_data3 < sm) );
+}
diff --git a/lto-plugin/ChangeLog b/lto-plugin/ChangeLog
index 0bb13540db0..69af7814e6f 100644
--- a/lto-plugin/ChangeLog
+++ b/lto-plugin/ChangeLog
@@ -1,3 +1,27 @@
+2014-11-13 Ilya Verbin <ilya.verbin@intel.com>
+ Bernd Schmidt <bernds@codesourcery.com>
+ Andrey Turetskiy <andrey.turetskiy@intel.com>
+ Michael Zolotukhin <michael.v.zolotukhin@intel.com>
+
+ * lto-plugin.c (OFFLOAD_SECTION, OFFLOAD_SECTION_LEN): Define.
+ (struct plugin_objfile): Add new field "offload".
+ (process_offload_section): New static function.
+ (claim_file_handler): Claim file if it contains offload sections.
+
+2014-11-13 Bernd Schmidt <bernds@codesourcery.com>
+ Thomas Schwinge <thomas@codesourcery.com>
+ Ilya Verbin <ilya.verbin@intel.com>
+ Andrey Turetskiy <andrey.turetskiy@intel.com>
+
+ * Makefile.am (libexecsubdir): Tweak for the possibility of being
+ configured for offload compiler.
+ (accel_dir_suffix, real_target_noncanonical): New variables substituted
+ by configure.
+ * Makefile.in: Regenerate.
+ * configure: Regenerate.
+ * configure.ac (accel_dir_suffix, real_target_noncanonical): Compute new
+ variables.
+
2014-11-11 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR target/63610
diff --git a/lto-plugin/Makefile.am b/lto-plugin/Makefile.am
index 93ea6498c55..c637ecb5743 100644
--- a/lto-plugin/Makefile.am
+++ b/lto-plugin/Makefile.am
@@ -5,7 +5,7 @@ AUTOMAKE_OPTIONS = no-dependencies
gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
target_noncanonical := @target_noncanonical@
-libexecsubdir := $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version)
+libexecsubdir := $(libexecdir)/gcc/$(real_target_noncanonical)/$(gcc_version)$(accel_dir_suffix)
AM_CPPFLAGS = -I$(top_srcdir)/../include $(DEFS)
AM_CFLAGS = @ac_lto_plugin_warn_cflags@
diff --git a/lto-plugin/Makefile.in b/lto-plugin/Makefile.in
index b15d90197dc..4bd943bdb01 100644
--- a/lto-plugin/Makefile.in
+++ b/lto-plugin/Makefile.in
@@ -167,6 +167,7 @@ ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
ac_lto_plugin_ldflags = @ac_lto_plugin_ldflags@
ac_lto_plugin_warn_cflags = @ac_lto_plugin_warn_cflags@
+accel_dir_suffix = @accel_dir_suffix@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@@ -209,6 +210,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+real_target_noncanonical = @real_target_noncanonical@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
@@ -227,7 +229,7 @@ with_libiberty = @with_libiberty@
ACLOCAL_AMFLAGS = -I .. -I ../config
AUTOMAKE_OPTIONS = no-dependencies
gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
-libexecsubdir := $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version)
+libexecsubdir := $(libexecdir)/gcc/$(real_target_noncanonical)/$(gcc_version)$(accel_dir_suffix)
AM_CPPFLAGS = -I$(top_srcdir)/../include $(DEFS)
AM_CFLAGS = @ac_lto_plugin_warn_cflags@
AM_LDFLAGS = @ac_lto_plugin_ldflags@
diff --git a/lto-plugin/configure b/lto-plugin/configure
index 5f3dd222020..9d1b09440d7 100755
--- a/lto-plugin/configure
+++ b/lto-plugin/configure
@@ -622,6 +622,8 @@ EGREP
GREP
SED
LIBTOOL
+real_target_noncanonical
+accel_dir_suffix
gcc_build_dir
ac_lto_plugin_ldflags
ac_lto_plugin_warn_cflags
@@ -4135,6 +4137,16 @@ else
fi
+# Used for constructing correct paths for offload compilers.
+accel_dir_suffix=
+real_target_noncanonical=${target_noncanonical}
+if test x"$enable_as_accelerator_for" != x; then
+ accel_dir_suffix=/accel/${target_noncanonical}
+ real_target_noncanonical=${enable_as_accelerator_for}
+fi
+
+
+
case `pwd` in
*\ * | *\ *)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
@@ -10607,7 +10619,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10610 "configure"
+#line 10622 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10713,7 +10725,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10716 "configure"
+#line 10728 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/lto-plugin/configure.ac b/lto-plugin/configure.ac
index c3ae93e12a7..db5b6cd64c8 100644
--- a/lto-plugin/configure.ac
+++ b/lto-plugin/configure.ac
@@ -34,6 +34,16 @@ else
fi
AC_SUBST(gcc_build_dir)
+# Used for constructing correct paths for offload compilers.
+accel_dir_suffix=
+real_target_noncanonical=${target_noncanonical}
+if test x"$enable_as_accelerator_for" != x; then
+ accel_dir_suffix=/accel/${target_noncanonical}
+ real_target_noncanonical=${enable_as_accelerator_for}
+fi
+AC_SUBST(accel_dir_suffix)
+AC_SUBST(real_target_noncanonical)
+
AM_PROG_LIBTOOL
ACX_LT_HOST_FLAGS
AC_SUBST(target_noncanonical)
diff --git a/lto-plugin/lto-plugin.c b/lto-plugin/lto-plugin.c
index 910e23cd609..fb6555daf91 100644
--- a/lto-plugin/lto-plugin.c
+++ b/lto-plugin/lto-plugin.c
@@ -86,6 +86,8 @@ along with this program; see the file COPYING3. If not see
#define LTO_SECTION_PREFIX ".gnu.lto_.symtab"
#define LTO_SECTION_PREFIX_LEN (sizeof (LTO_SECTION_PREFIX) - 1)
+#define OFFLOAD_SECTION ".gnu.offload_lto_.opts"
+#define OFFLOAD_SECTION_LEN (sizeof (OFFLOAD_SECTION) - 1)
/* 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
@@ -111,6 +113,7 @@ struct plugin_symtab
struct plugin_objfile
{
int found;
+ int offload;
simple_object_read *objfile;
struct plugin_symtab *out;
const struct ld_plugin_input_file *file;
@@ -862,6 +865,21 @@ err:
return 0;
}
+/* Find an offload section of an object file. */
+
+static int
+process_offload_section (void *data, const char *name, off_t offset, off_t len)
+{
+ if (!strncmp (name, OFFLOAD_SECTION, OFFLOAD_SECTION_LEN))
+ {
+ struct plugin_objfile *obj = (struct plugin_objfile *) data;
+ obj->offload = 1;
+ return 0;
+ }
+
+ return 1;
+}
+
/* Callback used by gold to check if the plugin will claim FILE. Writes
the result in CLAIMED. */
@@ -899,6 +917,7 @@ claim_file_handler (const struct ld_plugin_input_file *file, int *claimed)
*claimed = 0;
obj.file = file;
obj.found = 0;
+ obj.offload = 0;
obj.out = &lto_file.symtab;
errmsg = NULL;
obj.objfile = simple_object_start_read (file->fd, file->offset, LTO_SEGMENT_NAME,
@@ -920,7 +939,11 @@ claim_file_handler (const struct ld_plugin_input_file *file, int *claimed)
goto err;
}
- if (obj.found == 0)
+ if (obj.objfile)
+ simple_object_find_sections (obj.objfile, process_offload_section,
+ &obj, &err);
+
+ if (obj.found == 0 && obj.offload == 0)
goto err;
if (obj.found > 1)